From 3d8121c744c3fe4893802e0dca95e9fd2d1fe78f Mon Sep 17 00:00:00 2001 From: Ayush Saini <36878972+imayushsaini@users.noreply.github.com> Date: Sat, 12 Apr 2025 20:03:10 +0530 Subject: [PATCH 1/2] updated dummy modules --- dist/dummymodules/_babase.py | 1106 +++++++++++++++++----------- dist/dummymodules/_baclassic.py | 122 +++ dist/dummymodules/_baplus.py | 92 ++- dist/dummymodules/_bascenev1.py | 982 ++++++++++++------------ dist/dummymodules/_batemplatefs.py | 4 + dist/dummymodules/_bauiv1.py | 183 +++-- 6 files changed, 1507 insertions(+), 982 deletions(-) diff --git a/dist/dummymodules/_babase.py b/dist/dummymodules/_babase.py index 02b15bc..958c04b 100644 --- a/dist/dummymodules/_babase.py +++ b/dist/dummymodules/_babase.py @@ -27,6 +27,8 @@ NOTE: This file was autogenerated by batools.dummymodule; do not edit by hand. # pylint: disable=redefined-outer-name # pylint: disable=invalid-name # pylint: disable=no-value-for-parameter +# pylint: disable=unused-import +# pylint: disable=too-many-positional-arguments from __future__ import annotations @@ -52,41 +54,42 @@ def _uninferrable() -> Any: class AppTimer: """Timers are used to run code at later points in time. - Category: **General Utility Classes** - This class encapsulates a timer based on app-time. The underlying timer will be destroyed when this object is no longer referenced. If you do not want to worry about keeping a reference to - your timer around, use the babase.apptimer() function instead to get a - one-off timer. + your timer around, use the :meth:`~babase.apptimer()` function instead + to get a one-off timer. - ##### Arguments - ###### time - > Length of time in seconds that the timer will wait before firing. + Args: - ###### call - > A callable Python object. Remember that the timer will retain a - strong reference to the callable for as long as it exists, so you - may want to look into concepts such as babase.WeakCall if that is not - desired. + time: + Length of time in seconds that the timer will wait before firing. - ###### repeat - > If True, the timer will fire repeatedly, with each successive - firing having the same delay as the first. + call: + A callable Python object. Remember that the timer will retain a + strong reference to the callable for as long as it exists, so you + may want to look into concepts such as :class:`~babase.WeakCall` + if that is not desired. - ##### Example + repeat: + If True, the timer will fire repeatedly, with each successive + firing having the same delay as the first. - Use a Timer object to print repeatedly for a few seconds: - ... def say_it(): - ... babase.screenmessage('BADGER!') - ... def stop_saying_it(): - ... global g_timer - ... g_timer = None - ... babase.screenmessage('MUSHROOM MUSHROOM!') - ... # Create our timer; it will run as long as we have the self.t ref. - ... g_timer = babase.AppTimer(0.3, say_it, repeat=True) - ... # Now fire off a one-shot timer to kill it. - ... babase.apptimer(3.89, stop_saying_it) + Example: Use a timer object to print repeatedly for a few seconds:: + + def say_it(): + babase.screenmessage('BADGER!') + + def stop_saying_it(): + global g_timer + g_timer = None + babase.screenmessage('MUSHROOM MUSHROOM!') + + # Create our timer; it will run as long as we keep its ref alive. + g_timer = babase.AppTimer(0.3, say_it, repeat=True) + + # Now fire off a one-shot timer to kill the ref. + babase.apptimer(3.89, stop_saying_it) """ def __init__( @@ -98,42 +101,41 @@ class AppTimer: class ContextCall: """A context-preserving callable. - Category: **General Utility Classes** - - A ContextCall wraps a callable object along with a reference - to the current context (see babase.ContextRef); it handles restoring - the context when run and automatically clears itself if the context - it belongs to dies. + This wraps a callable object along with a reference to the current + context (see :class:`~babase.ContextRef`); it handles restoring the + context when run and automatically clears itself if the context it + belongs to dies. Generally you should not need to use this directly; all standard Ballistica callbacks involved with timers, materials, UI functions, etc. handle this under-the-hood so you don't have to worry about it. The only time it may be necessary is if you are implementing your own callbacks, such as a worker thread that does some action and then - runs some game code when done. By wrapping said callback in one of + runs some engine code when done. By wrapping said callback in one of these, you can ensure that you will not inadvertently be keeping the current activity alive or running code in a torn-down (expired) - context_ref. + :class:`~babase.ContextRef`. - You can also use babase.WeakCall for similar functionality, but - ContextCall has the added bonus that it will not run during context_ref - shutdown, whereas babase.WeakCall simply looks at whether the target - object instance still exists. + You can also use :class:`~babase.WeakCall` for similar functionality, + but ContextCall has the added bonus that it will not run during + :class:`~babase.ContextRef` shutdown, whereas + :class:`~babase.WeakCall` simply looks at whether the target object + instance still exists. - ##### Examples - **Example A:** code like this can inadvertently prevent our activity + **Example A:** Code like this can inadvertently prevent our activity (self) from ending until the operation completes, since the bound method we're passing (self.dosomething) contains a strong-reference - to self). - >>> start_some_long_action(callback_when_done=self.dosomething) + to self):: - **Example B:** in this case our activity (self) can still die + start_some_long_action(callback_when_done=self.dosomething) + + **Example B:** In this case our activity (self) can still die properly; the callback will clear itself when the activity starts shutting down, becoming a harmless no-op and releasing the reference - to our activity. + to our activity:: - >>> start_long_action( - ... callback_when_done=babase.ContextCall(self.mycallback)) + start_long_action( + callback_when_done=babase.ContextCall(self.mycallback)) """ def __init__(self, call: Callable) -> None: @@ -145,17 +147,16 @@ class ContextCall: class ContextRef: - """Store or use a ballistica context. + """Store or use a Ballistica context. - Category: **General Utility Classes** - - Many operations such as bascenev1.newnode() or bascenev1.gettexture() - operate implicitly on a current 'context'. A context is some sort of - state that functionality can implicitly use. Context determines, for - example, which scene nodes or textures get added to without having to - specify it explicitly in the newnode()/gettexture() call. Contexts can - also affect object lifecycles; for example a babase.ContextCall will - become a no-op when the context it was created in is destroyed. + Many operations such as :meth:`bascenev1.newnode()` or + :meth:`bascenev1.gettexture()` operate implicitly on a current + 'context'. A context is some sort of state that functionality can + implicitly use. Context determines, for example, which scene new nodes + or textures get added to without having to specify that explicitly in + the newnode()/gettexture() call. Contexts can also affect object + lifecycles; for example a :class:`~babase.ContextCall` will instantly + become a no-op and release any references it is holding when the context it belongs to is destroyed. In general, if you are a modder, you should not need to worry about contexts; mod code should mostly be getting run in the correct @@ -164,23 +165,34 @@ class ContextRef: however, where you need to deal directly with contexts, and that is where this class comes in. - Creating a babase.ContextRef() will capture a reference to the current + Creating a context-ref will capture a reference to the current context. Other modules may provide ways to access their contexts; for - example a bascenev1.Activity instance has a 'context' attribute. You - can also use babase.ContextRef.empty() to create a reference to *no* - context. Some code such as UI calls may expect this and may complain - if you try to use them within a context. + example a :class:`bascenev1.Activity` instance has a + :attr:`~bascenev1.Activity.context` attribute. You can also use + the :meth:`~babase.ContextRef.empty()` classmethod to create a + reference to *no* context. Some code such as UI calls may expect + to be run with no context set and may complain if you try to use + them within a context. - ##### Usage - ContextRefs are generally used with the Python 'with' statement, which + Usage + ===== + + Context-refs are generally used with the Python ``with`` statement, which sets the context they point to as current on entry and resets it to the previous value on exit. - ##### Example - Explicitly create a few UI bits with no context set. - (UI stuff may complain if called within a context): - >>> with bui.ContextRef.empty(): - ... my_container = bui.containerwidget() + Example: Explicitly clear context while working with UI code from + gameplay (UI stuff may complain if called within a context):: + + import bauiv1 as bui + + def _callback_called_from_gameplay(): + + # We are probably called with a game context as current, but + # this makes UI stuff unhappy. So we clear the context while + # doing our thing. + with bui.ContextRef.empty(): + my_container = bui.containerwidget() """ def __init__( @@ -198,67 +210,74 @@ class ContextRef: @classmethod def empty(cls) -> ContextRef: - """Return a ContextRef pointing to no context. + """Return a context-ref pointing to no context. This is useful when code should be run free of a context. For example, UI code generally insists on being run this way. Otherwise, callbacks set on the UI could inadvertently stop working due to a game activity ending, which would be unintuitive behavior. """ + # This is a dummy stub; the actual implementation is native code. return ContextRef() def is_empty(self) -> bool: """Whether the context was created as empty.""" + # This is a dummy stub; the actual implementation is native code. return bool() def is_expired(self) -> bool: - """Whether the context has expired.""" + """Whether the context has expired. + + Returns False for refs created as empty. + """ + # This is a dummy stub; the actual implementation is native code. return bool() class DisplayTimer: """Timers are used to run code at later points in time. - Category: **General Utility Classes** - This class encapsulates a timer based on display-time. The underlying timer will be destroyed when this object is no longer referenced. If you do not want to worry about keeping a reference to - your timer around, use the babase.displaytimer() function instead to get a - one-off timer. + your timer around, use the :meth:`~babase.displaytimer()` function + instead to get a one-off timer. Display-time is a time value intended to be used for animation and other visual purposes. It will generally increment by a consistent amount each frame. It will pass at an overall similar rate to AppTime, but trades accuracy for smoothness. - ##### Arguments - ###### time - > Length of time in seconds that the timer will wait before firing. + Args: - ###### call - > A callable Python object. Remember that the timer will retain a - strong reference to the callable for as long as it exists, so you - may want to look into concepts such as babase.WeakCall if that is not - desired. + time: + Length of time in seconds that the timer will wait before firing. - ###### repeat - > If True, the timer will fire repeatedly, with each successive - firing having the same delay as the first. + call: + A callable Python object. Remember that the timer will retain a + strong reference to the callable for as long as it exists, so you + may want to look into concepts such as :class:`~babase.WeakCall` + if that is not desired. - ##### Example + repeat: + If True, the timer will fire repeatedly, with each successive + firing having the same delay as the first. - Use a Timer object to print repeatedly for a few seconds: - ... def say_it(): - ... babase.screenmessage('BADGER!') - ... def stop_saying_it(): - ... global g_timer - ... g_timer = None - ... babase.screenmessage('MUSHROOM MUSHROOM!') - ... # Create our timer; it will run as long as we have the self.t ref. - ... g_timer = babase.DisplayTimer(0.3, say_it, repeat=True) - ... # Now fire off a one-shot timer to kill it. - ... babase.displaytimer(3.89, stop_saying_it) + Example: Use a Timer object to print repeatedly for a few seconds:: + + def say_it(): + babase.screenmessage('BADGER!') + + def stop_saying_it(): + global g_timer + g_timer = None + babase.screenmessage('MUSHROOM MUSHROOM!') + + # Create our timer; it will run as long as we keep its ref alive. + g_timer = babase.DisplayTimer(0.3, say_it, repeat=True) + + # Now fire off a one-shot timer to kill the ref. + babase.displaytimer(3.89, stop_saying_it) """ def __init__( @@ -269,7 +288,8 @@ class DisplayTimer: class Env: """Unchanging values for the current running app instance. - Access the single shared instance of this class at `babase.app.env`. + Access the single shared instance of this class through the + :attr:`~babase.App.env` attr on the :class:`~babase.App` class. """ android: bool @@ -279,11 +299,11 @@ class Env: """The app's api version. Only Python modules and packages associated with the current API - version number will be detected by the game (see the ba_meta tag). - This value will change whenever substantial backward-incompatible - changes are introduced to Ballistica APIs. When that happens, - modules/packages should be updated accordingly and set to target - the newer API version number.""" + version number will be detected by the game (see the + :class:`babase.MetadataSubsystem`). This value will change whenever + substantial backward-incompatible changes are introduced to + Ballistica APIs. When that happens, modules/packages should be updated + accordingly and set to target the newer API version number.""" arcade: bool """Whether the app is targeting an arcade-centric experience.""" @@ -383,23 +403,24 @@ class SimpleSound: """A simple sound wrapper for internal use. Do not use for gameplay code as it will only play locally. + + :meta private: """ def play(self) -> None: """Play the sound locally.""" + # This is a dummy stub; the actual implementation is native code. return None class Vec3(Sequence[float]): """A vector of 3 floats. - Category: **General Utility Classes** - These can be created the following ways (checked in this order): - - with no args, all values are set to 0 - - with a single numeric arg, all values are set to that value - - with a single three-member sequence arg, sequence values are copied - - otherwise assumes individual x/y/z args (positional or keywords) + - With no args, all values are set to 0. + - With a single numeric arg, all values are set to that value. + - With a three-member sequence arg, sequence values are copied. + - Otherwise assumes individual x/y/z args (positional or keywords). """ x: float @@ -485,69 +506,79 @@ class Vec3(Sequence[float]): def cross(self, other: Vec3) -> Vec3: """Returns the cross product of this vector and another.""" + # This is a dummy stub; the actual implementation is native code. return Vec3() def dot(self, other: Vec3) -> float: """Returns the dot product of this vector and another.""" + # This is a dummy stub; the actual implementation is native code. return float() def length(self) -> float: """Returns the length of the vector.""" + # This is a dummy stub; the actual implementation is native code. return float() def normalized(self) -> Vec3: """Returns a normalized version of the vector.""" + # This is a dummy stub; the actual implementation is native code. return Vec3() def add_clean_frame_callback(call: Callable) -> None: - """(internal) + """Run code once the next non-progress-bar frame draws. - Provide an object to be called once the next non-progress-bar-frame has - been rendered. Useful for queueing things to load in the background - without elongating any current progress-bar-load. + Useful for queueing things to load in the background without elongating + any current progress-bar-load. + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return None -def android_get_external_files_dir() -> str: - """(internal) +def allows_ticket_sales() -> bool: + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. + return bool() - Returns the android external storage path, or None if there is none on - this device + +def android_get_external_files_dir() -> str: + """Return the android external storage path, or None if there is none. + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return str() def app_instance_uuid() -> str: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return str() def app_is_active() -> bool: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return bool() def appname() -> str: - """(internal)""" + """Return current app name (all lowercase).""" + # This is a dummy stub; the actual implementation is native code. return str() def appnameupper() -> str: - """(internal) - - Return whether this build of the game can display full unicode such as - Emoji, Asian languages, etc. - """ + """Return current app name with capitalized characters.""" + # This is a dummy stub; the actual implementation is native code. return str() def apptime() -> babase.AppTime: """Return the current app-time in seconds. - Category: **General Utility Functions** - App-time is a monotonic time value; it starts at 0.0 when the app launches and will never jump by large amounts or go backwards, even if the system time changes. Its progression will pause when the app is in @@ -557,6 +588,7 @@ def apptime() -> babase.AppTime: unique type in the type-checker's eyes to help prevent it from being accidentally used with time functionality expecting other time types. """ + # This is a dummy stub; the actual implementation is native code. import babase # pylint: disable=cyclic-import return babase.AppTime(0.0) @@ -565,131 +597,137 @@ def apptime() -> babase.AppTime: def apptimer(time: float, call: Callable[[], Any]) -> None: """Schedule a callable object to run based on app-time. - Category: **General Utility Functions** - This function creates a one-off timer which cannot be canceled or modified once created. If you require the ability to do so, or need a repeating timer, use the babase.AppTimer class instead. - ##### Arguments - ###### time (float) - > Length of time in seconds that the timer will wait before firing. + Args: + time: Length of time in seconds that the timer will wait before + firing. - ###### call (Callable[[], Any]) - > A callable Python object. Note that the timer will retain a - strong reference to the callable for as long as the timer exists, so you - may want to look into concepts such as babase.WeakCall if that is not - desired. + call: A callable Python object. Note that the timer will retain a + strong reference to the callable for as long as the timer + exists, so you may want to look into concepts such as + :class:`~babase.WeakCall` if that is not desired. - ##### Examples - Print some stuff through time: - >>> babase.screenmessage('hello from now!') - >>> babase.apptimer(1.0, babase.Call(babase.screenmessage, - 'hello from the future!')) - >>> babase.apptimer(2.0, babase.Call(babase.screenmessage, - ... 'hello from the future 2!')) + Example: Print some stuff through time:: + + import babase + + babase.screenmessage('hello from now!') + babase.apptimer(1.0, babase.Call(babase.screenmessage, + 'hello from the future!')) + babase.apptimer(2.0, babase.Call(babase.screenmessage, + 'hello from the future 2!')) """ + # This is a dummy stub; the actual implementation is native code. return None def asset_loads_allowed() -> bool: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return bool() def audio_shutdown_begin() -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def audio_shutdown_is_complete() -> bool: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return bool() -def can_display_full_unicode() -> bool: - """(internal)""" +def can_display_chars(text: str) -> bool: + """Is this build able to display all chars in the provided string? + + See also: :meth:`~babase.supports_unicode_display()`. + """ + # This is a dummy stub; the actual implementation is native code. return bool() def charstr(char_id: babase.SpecialChar) -> str: - """Get a unicode string representing a special character. - - Category: **General Utility Functions** + """Return a unicode string representing a special character. Note that these utilize the private-use block of unicode characters (U+E000-U+F8FF) and are specific to the game; exporting or rendering them elsewhere will be meaningless. - See babase.SpecialChar for the list of available characters. + See :class:`~babase.SpecialChar` for the list of available characters. """ + # This is a dummy stub; the actual implementation is native code. return str() def clipboard_get_text() -> str: """Return text currently on the system clipboard. - Category: **General Utility Functions** - - Ensure that babase.clipboard_has_text() returns True before calling - this function. + Ensure that :meth:`~babase.clipboard_has_text()` returns True before + calling this function. """ + # This is a dummy stub; the actual implementation is native code. return str() def clipboard_has_text() -> bool: """Return whether there is currently text on the clipboard. - Category: **General Utility Functions** - This will return False if no system clipboard is available; no need - to call babase.clipboard_is_supported() separately. + to call :meth:`~babase.clipboard_is_supported()` separately. """ + # This is a dummy stub; the actual implementation is native code. return bool() def clipboard_is_supported() -> bool: """Return whether this platform supports clipboard operations at all. - Category: **General Utility Functions** - If this returns False, UIs should not show 'copy to clipboard' buttons, etc. """ + # This is a dummy stub; the actual implementation is native code. return bool() def clipboard_set_text(value: str) -> None: """Copy a string to the system clipboard. - Category: **General Utility Functions** - - Ensure that babase.clipboard_is_supported() returns True before adding - buttons/etc. that make use of this functionality. + Ensure that :meth:`~babase.clipboard_is_supported()` returns True before + adding buttons/etc. that make use of this functionality. """ + # This is a dummy stub; the actual implementation is native code. return None def commit_config(config: str) -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def complete_shutdown() -> None: """Complete the shutdown process, triggering the app to exit.""" + # This is a dummy stub; the actual implementation is native code. return None def contains_python_dist() -> bool: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return bool() def debug_print_py_err() -> None: - """(internal) + """Debugging func for tracking leaked Python errors in the C++ layer. - Debugging func for tracking leaked Python errors in the C++ layer. + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return None @@ -704,13 +742,16 @@ def dev_console_add_button( label_scale: float, corner_radius: float, style: str, + disabled: bool, ) -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def dev_console_add_python_terminal() -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None @@ -723,57 +764,54 @@ def dev_console_add_text( v_align: str, scale: float, ) -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def dev_console_base_scale() -> float: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return float() def dev_console_input_adapter_finish() -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def dev_console_request_refresh() -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def dev_console_tab_height() -> float: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return float() def dev_console_tab_width() -> float: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return float() -def disable_custom_tint() -> None: - """(internal) - - Disable custom tint overrride. - """ - return None - - def displaytime() -> babase.DisplayTime: """Return the current display-time in seconds. - Category: **General Utility Functions** - Display-time is a time value intended to be used for animation and other visual purposes. It will generally increment by a consistent amount each - frame. It will pass at an overall similar rate to AppTime, but trades + frame. It will pass at an overall similar rate to app-time, but trades accuracy for smoothness. Note that the value returned here is simply a float; it just has a unique type in the type-checker's eyes to help prevent it from being accidentally used with time functionality expecting other time types. """ + # This is a dummy stub; the actual implementation is native code. import babase # pylint: disable=cyclic-import return babase.DisplayTime(0.0) @@ -782,118 +820,140 @@ def displaytime() -> babase.DisplayTime: def displaytimer(time: float, call: Callable[[], Any]) -> None: """Schedule a callable object to run based on display-time. - Category: **General Utility Functions** - This function creates a one-off timer which cannot be canceled or modified once created. If you require the ability to do so, or need - a repeating timer, use the babase.DisplayTimer class instead. + a repeating timer, use the :class:`~babase.DisplayTimer` class instead. Display-time is a time value intended to be used for animation and other visual purposes. It will generally increment by a consistent amount each - frame. It will pass at an overall similar rate to AppTime, but trades + frame. It will pass at an overall similar rate to app-time, but trades accuracy for smoothness. - ##### Arguments - ###### time (float) - > Length of time in seconds that the timer will wait before firing. + Args: - ###### call (Callable[[], Any]) - > A callable Python object. Note that the timer will retain a - strong reference to the callable for as long as the timer exists, so you - may want to look into concepts such as babase.WeakCall if that is not - desired. + time: + Length of time in seconds that the timer will wait before firing. - ##### Examples - Print some stuff through time: - >>> babase.screenmessage('hello from now!') - >>> babase.displaytimer(1.0, babase.Call(babase.screenmessage, - ... 'hello from the future!')) - >>> babase.displaytimer(2.0, babase.Call(babase.screenmessage, - ... 'hello from the future 2!')) + call: + A callable Python object. Note that the timer will retain a + strong reference to the callable for as long as the timer exists, so + you may want to look into concepts such as :class:`~babase.WeakCall` + if that is not desired. + + Example: Print some stuff through time:: + + babase.screenmessage('hello from now!') + babase.displaytimer(1.0, babase.Call(babase.screenmessage, + 'hello from the future!')) + babase.displaytimer(2.0, babase.Call(babase.screenmessage, + 'hello from the future 2!')) """ + # This is a dummy stub; the actual implementation is native code. return None def do_apply_app_config() -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def do_once() -> bool: """Return whether this is the first time running a line of code. - Category: **General Utility Functions** - - This is used by 'print_once()' type calls to keep from overflowing + This is used by ``print_once()`` type calls to keep from overflowing logs. The call functions by registering the filename and line where The call is made from. Returns True if this location has not been registered already, and False if it has. - ##### Example - This print will only fire for the first loop iteration: - >>> for i in range(10): - ... if babase.do_once(): - ... print('HelloWorld once from loop!') + Example: This print will only fire for the first loop iteration:: + + for i in range(10): + if babase.do_once(): + print('HelloWorld once from loop!') """ + # This is a dummy stub; the actual implementation is native code. return bool() def ehv() -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None -def emit_log(name: str, level: str, message: str) -> None: - """(internal) +def emit_log(name: str, level: str, timestamp: float, message: str) -> None: + """Sends a log message to the in-app console/etc. - Sends a log message to the in-app console and any per-platform - log destinations (Android log, etc.). This generally is not called - directly and should instead be fed Python logging output. + This also includes any per-platform log destinations (Android log, + etc.). This generally is not called directly and should instead be + fed Python logging output. + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return None -def empty_app_mode_handle_intent_default() -> None: - """(internal)""" +def empty_app_mode_activate() -> None: + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None -def empty_app_mode_handle_intent_exec(command: str) -> None: - """(internal)""" +def empty_app_mode_deactivate() -> None: + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. + return None + + +def empty_app_mode_handle_app_intent_default() -> None: + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. + return None + + +def empty_app_mode_handle_app_intent_exec(command: str) -> None: + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def env() -> dict: - """(internal) + """Return a dict containing general env info. - Returns a dict containing general info about the operating environment - such as version, platform, etc. - This info is now exposed through babase.App; refer to those docs for - info on specific elements. + This has been superseded by :class:`~babase.Env` for most purposes. + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return dict() def evaluate_lstr(value: str) -> str: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return str() def exec_arg() -> str | None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return '' def fade_screen( to: int = 0, time: float = 0.25, endcall: Callable[[], None] | None = None ) -> None: - """(internal) + """Fade the screen in or out. Fade the local game screen in our out from black over a duration of - time. if "to" is 0, the screen will fade out to black. Otherwise it - will fade in from black. If endcall is provided, it will be run after a - completely faded frame is drawn. + time. if "to" is 0, the screen will fade out to black. Otherwise + it will fade in from black. If endcall is provided, it will be run after + a completely faded frame is drawn. + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return None @@ -901,484 +961,580 @@ def fatal_error(message: str) -> None: """Trigger a fatal error. Use this in situations where it is not possible for the engine to continue on in a useful way. This can sometimes help provide more clear information at the exact source of a problem - as compared to raising an Exception. In the vast majority of cases, - however, Exceptions should be preferred. + as compared to raising an :class:`Exception`. In the vast majority of + cases, however, exceptions should be preferred. """ + # This is a dummy stub; the actual implementation is native code. return None def fullscreen_control_available() -> bool: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return bool() def fullscreen_control_get() -> bool: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return bool() def fullscreen_control_key_shortcut() -> str | None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return '' def fullscreen_control_set(val: bool) -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def get_appconfig_builtin_keys() -> list[str]: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return ['blah', 'blah2'] def get_appconfig_default_value(key: str) -> Any: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return _uninferrable() -def get_camera_position() -> tuple[float, ...]: - """(internal) +def get_camera_position() -> tuple[float, float, float]: + """Return current camera position. WARNING: these camera controls will not apply to network clients and may behave unpredictably in other ways. Use them only for tinkering. + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return (0.0, 0.0, 0.0) -def get_camera_target() -> tuple[float, ...]: - """(internal) +def get_camera_target() -> tuple[float, float, float]: + """Return the current camera target point. WARNING: these camera controls will not apply to network clients and may behave unpredictably in other ways. Use them only for tinkering. + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return (0.0, 0.0, 0.0) def get_dev_console_input_text() -> str: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return str() def get_display_resolution() -> tuple[int, int] | None: - """(internal) + """Return currently selected display resolution for fullscreen display. - Return the currently selected display resolution for fullscreen - display. Returns None if resolutions cannot be directly set. + Returns None if resolutions cannot be directly set. + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return (0, 0) -def get_idle_time() -> int: - """(internal) +def get_draw_virtual_safe_area_bounds() -> bool: + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. + return bool() - Returns the amount of time since any game input has been received. + +def get_idle_time() -> int: + """Returns the amount of time since any game input has been received. + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return int() def get_immediate_return_code() -> int | None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return 0 +def get_initial_app_config() -> dict: + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. + return dict() + + def get_input_idle_time() -> float: - """Return seconds since any local input occurred (touch, keypress, etc.).""" + """Return seconds since any local input occurred (touch, keypress, etc.). + + :meta private: + """ + # This is a dummy stub; the actual implementation is native code. return float() def get_low_level_config_value(key: str, default_value: int) -> int: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return int() def get_max_graphics_quality() -> str: - """(internal) + """Return the max graphics-quality supported on the current hardware. - Return the max graphics-quality supported on the current hardware. + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return str() def get_replays_dir() -> str: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return str() def get_string_height(string: str, suppress_warning: bool = False) -> float: - """(internal) + """Given a string, returns its height with the standard small app font. - Given a string, returns its height using the standard small app - font. + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return float() def get_string_width(string: str, suppress_warning: bool = False) -> float: - """(internal) + """Given a string, returns its width in the standard small app font. - Given a string, returns its width using the standard small app - font. + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return float() def get_thread_name() -> str: - """(internal) + """Return the name of the current thread. - Returns the name of the current thread. This may vary depending on platform and should not be used in logic; only for debugging. + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. + return str() + + +def get_ui_scale() -> str: + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return str() def get_v1_cloud_log() -> str: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return str() def get_v1_cloud_log_file_path() -> str: - """(internal) + """Return the path to the app log file. - Return the path to the app log file. + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return str() -def get_volatile_data_directory() -> str: - """(internal) +def get_virtual_safe_area_size() -> tuple[float, float]: + """Return the size of the area on screen that will always be visible.""" + # This is a dummy stub; the actual implementation is native code. + return (0.0, 0.0) + + +def get_virtual_screen_size() -> tuple[float, float]: + """Return the current virtual size of the display.""" + # This is a dummy stub; the actual implementation is native code. + return (0.0, 0.0) + + +def get_volatile_data_directory() -> str: + """Return the path to the app volatile data directory. - Return the path to the app volatile data directory. This directory is for data generated by the app that does not need to be backed up and can be recreated if necessary. + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return str() def getapp() -> babase.App: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. import babase # pylint: disable=cyclic-import return babase.App() def getsimplesound(name: str) -> SimpleSound: - """(internal).""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return SimpleSound() def graphics_shutdown_begin() -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def graphics_shutdown_is_complete() -> bool: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return bool() def has_user_run_commands() -> bool: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return bool() def hastouchscreen() -> bool: - """(internal) + """Return whether a touchscreen is present on the current device. - Return whether a touchscreen is present on the current device. + :meta private: """ - return bool() - - -def have_chars(text: str) -> bool: - """(internal)""" + # This is a dummy stub; the actual implementation is native code. return bool() def have_permission(permission: babase.Permission) -> bool: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return bool() def in_logic_thread() -> bool: - """(internal) + """Return whether the current thread is the logic thread. - Returns whether or not the current thread is the logic thread. + The logic thread is where a large amount of app code runs, and + various functionality expects to only be used from there. """ + # This is a dummy stub; the actual implementation is native code. + return bool() + + +def in_main_menu() -> bool: + """Are we currently in a main-menu (as opposed to gameplay)? + + :meta private: + """ + # This is a dummy stub; the actual implementation is native code. return bool() def increment_analytics_count(name: str, increment: int = 1) -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def increment_analytics_count_raw_2( name: str, uses_increment: bool = True, increment: int = 1 ) -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def increment_analytics_counts_raw(name: str, increment: int = 1) -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def invoke_main_menu() -> None: """High level call to bring up the main menu if it is not present. - This is essentially the same as pressing the menu button on a controller. + This is essentially the same as pressing the menu button on a + controller. + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return None def is_log_full() -> bool: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return bool() def is_os_playing_music() -> bool: - """(internal) + """Return whether the OS is currently playing music of some sort. - Tells whether the OS is currently playing music of some sort. + Used to determine whether the app should avoid playing its own. - (Used to determine whether the app should avoid playing its own) + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return bool() def is_xcode_build() -> bool: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return bool() -def lifecyclelog(message: str) -> None: - """(internal)""" - return None - - def lock_all_input() -> None: - """(internal) + """Prevent all keyboard, mouse, and gamepad events from being processed. - Prevents all keyboard, mouse, and gamepad events from being processed. + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return None def login_adapter_back_end_active_change(login_type: str, active: bool) -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def login_adapter_get_sign_in_token(login_type: str, attempt_id: int) -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def mac_music_app_get_playlists() -> list[str]: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return ['blah', 'blah2'] def mac_music_app_get_volume() -> int: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return int() def mac_music_app_init() -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def mac_music_app_play_playlist(playlist: str) -> bool: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return bool() def mac_music_app_set_volume(volume: int) -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def mac_music_app_stop() -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def mark_log_sent() -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def music_player_play(files: Any) -> None: - """(internal) + """Start internal music file playback. - Starts internal music file playback (for internal use) + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return None def music_player_set_volume(volume: float) -> None: - """(internal) + """Set internal music player volume. - Sets internal music player volume (for internal use) + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return None def music_player_shutdown() -> None: - """(internal) + """Finalize internal music file playback. - Finalizes internal music file playback (for internal use) + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return None def music_player_stop() -> None: - """(internal) + """Stops internal music file playback. - Stops internal music file playback (for internal use) + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return None def native_review_request() -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def native_review_request_supported() -> bool: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return bool() def native_stack_trace() -> str | None: """Return a native stack trace as a string, or None if not available. - Category: **General Utility Functions** - Stack traces contain different data and formatting across platforms. Only use them for debugging. """ + # This is a dummy stub; the actual implementation is native code. return '' def on_app_running() -> None: - """(internal)""" - return None - - -def on_empty_app_mode_activate() -> None: - """(internal)""" - return None - - -def on_empty_app_mode_deactivate() -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def on_initial_app_mode_set() -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def open_dir_externally(path: str) -> None: - """(internal) + """Open the provided dir in the default external app. - Open the provided dir in the default external app. + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return None def open_file_externally(path: str) -> None: - """(internal) + """Open the provided file in the default external app. - Open the provided file in the default external app. + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return None def open_url(address: str, force_fallback: bool = False) -> None: """Open the provided URL. - Category: **General Utility Functions** - Attempts to open the provided url in a web-browser. If that is not - possible (or force_fallback is True), instead displays the url as + possible (or ``force_fallback`` is True), instead displays the url as a string and/or qrcode. """ + # This is a dummy stub; the actual implementation is native code. return None def overlay_web_browser_close() -> bool: """Close any open overlay web browser. - Category: **General Utility Functions** + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return bool() def overlay_web_browser_is_open() -> bool: """Return whether an overlay web browser is open currently. - Category: **General Utility Functions** + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return bool() def overlay_web_browser_is_supported() -> bool: """Return whether an overlay web browser is supported here. - Category: **General Utility Functions** - An overlay web browser is a small dialog that pops up over the top of the main engine window. It can be used for performing simple tasks such as sign-ins. + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return bool() def overlay_web_browser_open_url(address: str) -> None: - """Open the provided URL in an overlayw web browser. - - Category: **General Utility Functions** + """Open the provided URL in an overlay web browser. An overlay web browser is a small dialog that pops up over the top of the main engine window. It can be used for performing simple tasks such as sign-ins. + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return None def pre_env() -> dict: - """(internal) + """Return a dict containing general env info. - Returns a dict containing general info about the operating environment - such as version, platform, etc. - This info is now exposed through babase.App; refer to those docs for - info on specific elements. + This has been superseded by :class:`~babase.Env` for most purposes. + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return dict() def print_context() -> None: - """(internal) + """Prints info about the current context state; for debugging. - Prints info about the current context_ref state; for debugging. + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return None def print_load_info() -> None: - """(internal) + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. + return None - Category: **General Utility Functions** - """ + +def push_back_press() -> None: + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None @@ -1389,19 +1545,18 @@ def pushcall( other_thread_use_fg_context: bool = False, raw: bool = False, ) -> None: - """Push a call to the logic event-loop. - Category: **General Utility Functions** + """Push a call to the logic-thread's event loop. - This call expects to be used in the logic thread, and will automatically - save and restore the babase.Context to behave seamlessly. + This function expects to be called from the logic thread, and will automatically save and restore the context to behave seamlessly. - If you want to push a call from outside of the logic thread, - however, you can pass 'from_other_thread' as True. In this case - the call will always run in the UI context_ref on the logic thread - or whichever context_ref is in the foreground if - other_thread_use_fg_context is True. - Passing raw=True will disable thread checks and context_ref sets/restores. + To push a call from outside of the logic thread, pass + ``from_other_thread=True``. In that case the call will run with no + context set. To instead run in whichever context is currently active + on the logic thread, pass ``other_thread_use_fg_context=True``. + Passing ``raw=True`` will skip thread checks and context + saves/restores altogether. """ + # This is a dummy stub; the actual implementation is native code. return None @@ -1411,13 +1566,12 @@ def quit( ) -> None: """Quit the app. - Category: **General Utility Functions** - - If 'confirm' is True, a confirm dialog will be presented if conditions + If ``confirm`` is True, a confirm dialog will be presented if conditions allow; otherwise the quit will still be immediate. - See docs for babase.QuitType for explanations of the optional - 'quit_type' arg. + See docs for :class:`~babase.QuitType` for explanations of the optional + ``quit_type`` arg. """ + # This is a dummy stub; the actual implementation is native code. return None @@ -1425,25 +1579,30 @@ def reached_end_of_babase() -> None: """A simple user-agent-string that should be used in any web requests made on behalf of the engine. """ + # This is a dummy stub; the actual implementation is native code. return None def reload_media() -> None: - """(internal) + """Reload all currently loaded game media. - Reload all currently loaded game media; useful for - development/debugging. + Mainly for development/debugging. + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return None def request_permission(permission: babase.Permission) -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def resolve_appconfig_value(key: str) -> Any: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return _uninferrable() @@ -1453,6 +1612,7 @@ def run_app() -> None: Note that this only works on platforms/builds where ballistica manages its own event loop. """ + # This is a dummy stub; the actual implementation is native code. return None @@ -1461,11 +1621,10 @@ def safecolor( ) -> tuple[float, ...]: """Given a color tuple, return a color safe to display as text. - Category: **General Utility Functions** - Accepts tuples of length 3 or 4. This will slightly brighten very dark colors, etc. """ + # This is a dummy stub; the actual implementation is native code. return (0.0, 0.0, 0.0) @@ -1474,204 +1633,271 @@ def screenmessage( color: Sequence[float] | None = None, log: bool = False, ) -> None: - """Print a message to the local client's screen, in a given color. + """Print a message to the local client's screen in a given color. - Category: **General Utility Functions** - - Note that this version of the function is purely for local display. - To broadcast screen messages in network play, look for methods such as - broadcastmessage() provided by the scene-version packages. + Note that this function is purely for local display. To broadcast + screen-messages during gameplay, look for methods such as + :meth:`bascenev1.broadcastmessage()`. """ + # This is a dummy stub; the actual implementation is native code. return None def set_analytics_screen(screen: str) -> None: """Used for analytics to see where in the app players spend their time. - Category: **General Utility Functions** - Generally called when opening a new window or entering some UI. 'screen' should be a string description of an app location ('Main Menu', etc.) + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. + return None + + +def set_app_config(config: dict) -> None: + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def set_camera_manual(value: bool) -> None: - """(internal) + """Set camera manual mode on or off. WARNING: these camera controls will not apply to network clients and may behave unpredictably in other ways. Use them only for tinkering. + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return None def set_camera_position(x: float, y: float, z: float) -> None: - """(internal) + """Set camera position. WARNING: these camera controls will not apply to network clients and may behave unpredictably in other ways. Use them only for tinkering. + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return None def set_camera_target(x: float, y: float, z: float) -> None: - """(internal) + """Set the camera target. WARNING: these camera controls will not apply to network clients and may behave unpredictably in other ways. Use them only for tinkering. + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return None def set_dev_console_input_text(val: str) -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None -def set_global_tint(x: float, y: float, z: float) -> None: - """(internal) - - This will override any tint set by game in local or netplay - """ +def set_draw_virtual_safe_area_bounds(value: bool) -> None: + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def set_internal_language_keys( listobj: list[tuple[str, str]], random_names_list: list[tuple[str, str]] ) -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def set_low_level_config_value(key: str, value: int) -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def set_platform_misc_read_vals(mode: str) -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def set_thread_name(name: str) -> None: - """(internal) + """Set the name of the current thread (on platforms where available). - Sets the name of the current thread (on platforms where this is - available). EventLoop names are only for debugging and should - not be used in logic, as naming behavior can vary across platforms. + Thread names are only for debugging and should not be used in logic, + as naming behavior can vary across platforms. + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. + return None + + +def set_ui_account_state(signed_in: bool, name: str | None = None) -> None: + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def set_ui_input_device(input_device_id: int | None) -> None: - """(internal) + """Sets the input-device that currently owns the user interface. - Sets the input-device that currently owns the user interface. + :meta private: """ + # This is a dummy stub; the actual implementation is native code. + return None + + +def set_ui_scale(scale: str) -> None: + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def setup_sigint() -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def show_progress_bar() -> None: - """(internal) - - Category: **General Utility Functions** - """ + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def shutdown_suppress_begin() -> bool: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return bool() def shutdown_suppress_count() -> int: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return int() def shutdown_suppress_end() -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def submit_analytics_counts() -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def supports_max_fps() -> bool: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return bool() def supports_open_dir_externally() -> bool: - """(internal) + """Return whether current app/platform supports opening dirs externally. - Return whether the current app/platform supports opening dirs externally - (in the Mac Finder, Windows Explorer, etc.). + (Via the Mac Finder, Windows Explorer, etc.) + + :meta private: """ + # This is a dummy stub; the actual implementation is native code. + return bool() + + +def supports_unicode_display() -> bool: + """Return whether we can display all unicode characters in the gui.""" + # This is a dummy stub; the actual implementation is native code. return bool() def supports_vsync() -> bool: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return bool() def temp_testing() -> bool: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return bool() def unlock_all_input() -> None: - """(internal) + """Resume normal keyboard, mouse, and gamepad event processing. - Resumes normal keyboard, mouse, and gamepad event processing. + :meta private: """ + # This is a dummy stub; the actual implementation is native code. + return None + + +def update_internal_logger_levels() -> None: + """Update the native layer to re-cache Python logger levels. + + The native layer caches logger levels so it can efficiently + avoid making Python log calls for disabled logger levels. If any + logger levels are changed at runtime, call this method after to + instruct the native layer to regenerate its cache so the change + is properly reflected in logs originating from the native layer. + + :meta private: + """ + # This is a dummy stub; the actual implementation is native code. return None def user_agent_string() -> str: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return str() def user_ran_commands() -> None: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return None def using_game_center() -> bool: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return bool() def using_google_play_game_services() -> bool: - """(internal)""" + """:meta private:""" + # This is a dummy stub; the actual implementation is native code. return bool() def v1_cloud_log(message: str) -> None: - """(internal) + """Push messages to the old v1 cloud log. - Push messages to the old v1 cloud log. + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return None def workspaces_in_use() -> bool: - """(internal) + """Return whether workspace functionality was ever enabled this run. - Returns whether workspaces functionality has been enabled at - any point this run. + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return bool() diff --git a/dist/dummymodules/_baclassic.py b/dist/dummymodules/_baclassic.py index 36691ae..962e53b 100644 --- a/dist/dummymodules/_baclassic.py +++ b/dist/dummymodules/_baclassic.py @@ -27,6 +27,8 @@ NOTE: This file was autogenerated by batools.dummymodule; do not edit by hand. # pylint: disable=redefined-outer-name # pylint: disable=invalid-name # pylint: disable=no-value-for-parameter +# pylint: disable=unused-import +# pylint: disable=too-many-positional-arguments from __future__ import annotations @@ -45,10 +47,129 @@ def _uninferrable() -> Any: return _not_a_real_variable # type: ignore +def animate_root_ui_chest_unlock_time( + *, + chestid: str, + duration: float, + startvalue: float, + endvalue: float, +) -> None: + """Animate the unlock time on a chest.""" + # This is a dummy stub; the actual implementation is native code. + return None + + +def animate_root_ui_tickets( + *, + duration: float, + startvalue: int, + endvalue: int, +) -> None: + """Animate the displayed tickets value.""" + # This is a dummy stub; the actual implementation is native code. + return None + + +def animate_root_ui_tokens( + *, + duration: float, + startvalue: int, + endvalue: int, +) -> None: + """Animate the displayed tokens value.""" + # This is a dummy stub; the actual implementation is native code. + return None + + +def classic_app_mode_activate() -> None: + """(internal)""" + # This is a dummy stub; the actual implementation is native code. + return None + + +def classic_app_mode_deactivate() -> None: + """(internal)""" + # This is a dummy stub; the actual implementation is native code. + return None + + +def classic_app_mode_handle_app_intent_default() -> None: + """(internal)""" + # This is a dummy stub; the actual implementation is native code. + return None + + +def classic_app_mode_handle_app_intent_exec(command: str) -> None: + """(internal)""" + # This is a dummy stub; the actual implementation is native code. + return None + + +def get_account_display_state() -> Any: + """(internal)""" + # This is a dummy stub; the actual implementation is native code. + return _uninferrable() + + +def set_account_display_state(vals: dict) -> None: + """(internal)""" + # This is a dummy stub; the actual implementation is native code. + return None + + +def set_have_live_account_values(have: bool) -> None: + """Inform the native layer whether we are being fed with live account + values from the server. + """ + # This is a dummy stub; the actual implementation is native code. + return None + + +def set_root_ui_account_values( + *, + tickets: int, + tokens: int, + league_type: str, + league_number: int, + league_rank: int, + achievements_percent_text: str, + level_text: str, + xp_text: str, + inbox_count: int, + inbox_count_is_max: bool, + inbox_announce_text: str, + gold_pass: bool, + chest_0_appearance: str, + chest_1_appearance: str, + chest_2_appearance: str, + chest_3_appearance: str, + chest_0_create_time: float, + chest_1_create_time: float, + chest_2_create_time: float, + chest_3_create_time: float, + chest_0_unlock_time: float, + chest_1_unlock_time: float, + chest_2_unlock_time: float, + chest_3_unlock_time: float, + chest_0_unlock_tokens: int, + chest_1_unlock_tokens: int, + chest_2_unlock_tokens: int, + chest_3_unlock_tokens: int, + chest_0_ad_allow_time: float, + chest_1_ad_allow_time: float, + chest_2_ad_allow_time: float, + chest_3_ad_allow_time: float, +) -> None: + """Pass values to the native layer for use in the root UI or elsewhere.""" + # This is a dummy stub; the actual implementation is native code. + return None + + def set_stress_testing( testing: bool, player_count: int, attract_mode: bool ) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None @@ -56,4 +177,5 @@ def value_test( arg: str, change: float | None = None, absolute: float | None = None ) -> float: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return float() diff --git a/dist/dummymodules/_baplus.py b/dist/dummymodules/_baplus.py index 5910d49..e20c0e8 100644 --- a/dist/dummymodules/_baplus.py +++ b/dist/dummymodules/_baplus.py @@ -27,6 +27,8 @@ NOTE: This file was autogenerated by batools.dummymodule; do not edit by hand. # pylint: disable=redefined-outer-name # pylint: disable=invalid-name # pylint: disable=no-value-for-parameter +# pylint: disable=unused-import +# pylint: disable=too-many-positional-arguments from __future__ import annotations @@ -49,11 +51,13 @@ def add_v1_account_transaction( transaction: dict, callback: Callable | None = None ) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def can_show_ad() -> bool: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return bool() @@ -63,74 +67,88 @@ def game_service_has_leaderboard(game: str, config: str) -> bool: Given a game and config string, returns whether there is a leaderboard for it on the game service. """ + # This is a dummy stub; the actual implementation is native code. return bool() +def get_classic_news_show() -> str: + """(internal)""" + # This is a dummy stub; the actual implementation is native code. + return str() + + def get_master_server_address(source: int = -1, version: int = 1) -> str: """(internal) Return the address of the master server. """ - return str() - - -def get_news_show() -> str: - """(internal)""" + # This is a dummy stub; the actual implementation is native code. return str() def get_price(item: str) -> str | None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return '' -def get_purchased(item: str) -> bool: - """(internal)""" - return bool() - - -def get_purchases_state() -> int: - """(internal)""" - return int() - - def get_v1_account_display_string(full: bool = True) -> str: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return str() def get_v1_account_misc_read_val(name: str, default_value: Any) -> Any: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return _uninferrable() def get_v1_account_misc_read_val_2(name: str, default_value: Any) -> Any: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return _uninferrable() def get_v1_account_misc_val(name: str, default_value: Any) -> Any: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return _uninferrable() def get_v1_account_name() -> str: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return str() +def get_v1_account_product_purchased(item: str) -> bool: + """(internal)""" + # This is a dummy stub; the actual implementation is native code. + return bool() + + +def get_v1_account_product_purchases_state() -> int: + """(internal)""" + # This is a dummy stub; the actual implementation is native code. + return int() + + def get_v1_account_public_login_id() -> str | None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return '' def get_v1_account_state() -> str: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return str() def get_v1_account_state_num() -> int: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return int() @@ -139,84 +157,97 @@ def get_v1_account_ticket_count() -> int: Returns the number of tickets for the current account. """ + # This is a dummy stub; the actual implementation is native code. return int() def get_v1_account_type() -> str: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return str() def get_v2_fleet() -> str: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return str() def has_video_ads() -> bool: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return bool() def have_incentivized_ad() -> bool: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return bool() def have_outstanding_v1_account_transactions() -> bool: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return bool() def in_game_purchase(item: str, price: int) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def is_blessed() -> bool: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return bool() def mark_config_dirty() -> None: - """(internal) - - Category: General Utility Functions - """ + """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def on_app_loading() -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def power_ranking_query(callback: Callable, season: Any = None) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def purchase(item: str) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def report_achievement(achievement: str, pass_to_account: bool = True) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def reset_achievements() -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def restore_purchases() -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def run_v1_account_transactions() -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None @@ -224,6 +255,7 @@ def show_ad( purpose: str, on_completion_call: Callable[[], None] | None = None ) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None @@ -231,6 +263,7 @@ def show_ad_2( purpose: str, on_completion_call: Callable[[bool], None] | None = None ) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None @@ -240,22 +273,19 @@ def show_game_service_ui( game_version: str | None = None, ) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def sign_in_v1(account_type: str) -> None: - """(internal) - - Category: General Utility Functions - """ + """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def sign_out_v1(v2_embedded: bool = False) -> None: - """(internal) - - Category: General Utility Functions - """ + """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None @@ -278,11 +308,19 @@ def submit_score( to devote my time to improving the game instead of trying to make the score server more mischief-proof. """ + # This is a dummy stub; the actual implementation is native code. return None +def supports_purchases() -> bool: + """(internal)""" + # This is a dummy stub; the actual implementation is native code. + return bool() + + def tournament_query( callback: Callable[[dict | None], None], args: dict ) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None diff --git a/dist/dummymodules/_bascenev1.py b/dist/dummymodules/_bascenev1.py index 97166d6..faa68fc 100644 --- a/dist/dummymodules/_bascenev1.py +++ b/dist/dummymodules/_bascenev1.py @@ -27,6 +27,8 @@ NOTE: This file was autogenerated by batools.dummymodule; do not edit by hand. # pylint: disable=redefined-outer-name # pylint: disable=invalid-name # pylint: disable=no-value-for-parameter +# pylint: disable=unused-import +# pylint: disable=too-many-positional-arguments from __future__ import annotations @@ -48,30 +50,38 @@ def _uninferrable() -> Any: class ActivityData: - """(internal)""" + """Internal; holds native data for the activity. + + :meta private: + """ def context(self) -> bascenev1.ContextRef: """Return a context-ref pointing to the activity.""" + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.ContextRef() def exists(self) -> bool: - """Returns whether the ActivityData still exists. + """Returns whether the activity-data still exists. Most functionality will fail on a nonexistent instance. """ + # This is a dummy stub; the actual implementation is native code. return bool() def expire(self) -> None: """Expires the internal data for the activity""" + # This is a dummy stub; the actual implementation is native code. return None def make_foreground(self) -> None: """Sets this activity as the foreground one in its session.""" + # This is a dummy stub; the actual implementation is native code. return None def start(self) -> None: """Begins the activity running""" + # This is a dummy stub; the actual implementation is native code. return None @@ -79,43 +89,49 @@ class ActivityData: class BaseTimer: """Timers are used to run code at later points in time. - Category: **General Utility Classes** - This class encapsulates a base-time timer in the current scene context. The underlying timer will be destroyed when either this object is - no longer referenced or when its Context (Activity, etc.) dies. If you + no longer referenced or when its context (activity, etc.) dies. If you do not want to worry about keeping a reference to your timer around, - you should use the bascenev1.basetimer() function instead. + you should use the :meth:`bascenev1.basetimer()` function instead. - ###### time (float) - > Length of time in seconds that the timer will wait - before firing. + Args: - ###### call (Callable[[], Any]) - > A callable Python object. Remember that the timer will retain a - strong reference to the callable for as long as it exists, so you - may want to look into concepts such as babase.WeakCall if that is not - desired. + time: + Length of time in seconds that the timer will wait + before firing. - ###### repeat (bool) - > If True, the timer will fire repeatedly, with each successive - firing having the same delay as the first. + call: + A callable Python object. Remember that the timer will retain a + strong reference to the callable for as long as it exists, so you + may want to look into concepts such as :class:`~babase.WeakCall` + if that is not desired. - ##### Example + repeat: + If True, the timer will fire repeatedly, with each successive + firing having the same delay as the first. - Use a BaseTimer object to print repeatedly for a few seconds: - >>> import bascenev1 as bs - ... def say_it(): - ... bs.screenmessage('BADGER!') - ... def stop_saying_it(): - ... global g_timer - ... g_timer = None - ... bs.screenmessage('MUSHROOM MUSHROOM!') - ... # Create our timer; it will run as long as we have the self.t ref. - ... g_timer = bs.BaseTimer(0.3, say_it, repeat=True) - ... # Now fire off a one-shot timer to kill it. - ... bs.basetimer(3.89, stop_saying_it) + Example + ------- + + Use a base-timer object to print repeatedly for a few seconds:: + + import bascenev1 as bs + + def say_it(): + bs.screenmessage('BADGER!') + + def stop_saying_it(): + global g_timer + g_timer = None + bs.screenmessage('MUSHROOM MUSHROOM!') + + # Create our timer; it will run as long as we keep its ref alive. + g_timer = bs.BaseTimer(0.3, say_it, repeat=True) + + # Now fire off a one-shot timer to kill the ref. + bs.basetimer(3.89, stop_saying_it) """ def __init__( @@ -127,9 +143,7 @@ class BaseTimer: class CollisionMesh: """A reference to a collision-mesh. - Category: **Asset Classes** - - Use bascenev1.getcollisionmesh() to instantiate one. + Use :meth:`bascenev1.getcollisionmesh()` to instantiate one. """ pass @@ -138,9 +152,7 @@ class CollisionMesh: class Data: """A reference to a data object. - Category: **Asset Classes** - - Use bascenev1.getdata() to instantiate one. + Use :meth:`bascenev1.getdata()` to instantiate one. """ def getvalue(self) -> Any: @@ -152,14 +164,12 @@ class Data: so it can be beneficial to plan a short bit of time between when the data object is requested and when it's value is accessed. """ + # This is a dummy stub; the actual implementation is native code. return _uninferrable() class InputDevice: - """An input-device such as a gamepad, touchscreen, or keyboard. - - Category: **Gameplay Classes** - """ + """An input-device such as a gamepad, touchscreen, or keyboard.""" allows_configuring: bool """Whether the input-device can be configured in the app.""" @@ -216,12 +226,14 @@ class InputDevice: This applies both to local players and remote players. """ + # This is a dummy stub; the actual implementation is native code. return None def exists(self) -> bool: """Return whether the underlying device for this object is still present. """ + # This is a dummy stub; the actual implementation is native code. return bool() def get_axis_name(self, axis_id: int) -> str: @@ -229,6 +241,7 @@ class InputDevice: Can return an empty string if the value is not meaningful to humans. """ + # This is a dummy stub; the actual implementation is native code. return str() def get_button_name(self, button_id: int) -> babase.Lstr: @@ -236,6 +249,7 @@ class InputDevice: Can return an empty string if the value is not meaningful to humans. """ + # This is a dummy stub; the actual implementation is native code. import babase # pylint: disable=cyclic-import return babase.Lstr(value='') @@ -246,10 +260,12 @@ class InputDevice: Returns the default player name for this device. (used for the 'random' profile) """ + # This is a dummy stub; the actual implementation is native code. return str() def get_player_profiles(self) -> dict: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return dict() def get_v1_account_name(self, full: bool) -> str: @@ -257,6 +273,7 @@ class InputDevice: (can be used to get account names for remote players) """ + # This is a dummy stub; the actual implementation is native code. return str() def is_attached_to_player(self) -> bool: @@ -264,14 +281,13 @@ class InputDevice: This can mean either a local player or a remote player. """ + # This is a dummy stub; the actual implementation is native code. return bool() class Material: """An entity applied to game objects to modify collision behavior. - Category: **Gameplay Classes** - A material can affect physical characteristics, generate sounds, or trigger callback functions when collisions occur. @@ -284,8 +300,8 @@ class Material: to the various parts it creates. Use bascenev1.Material to instantiate a blank material, and then use - its babase.Material.add_actions() method to define what the material - does. + its :meth:`bascenev1.Material.add_actions()` method to define what the + material does. """ def __init__(self, label: str | None = None) -> None: @@ -299,161 +315,183 @@ class Material: ) -> None: """Add one or more actions to the material, optionally with conditions. - ##### Conditions - Conditions are provided as tuples which can be combined - to form boolean logic. A single condition might look like - `('condition_name', cond_arg)`, or a more complex nested one - might look like `(('some_condition', cond_arg), 'or', - ('another_condition', cond2_arg))`. + Conditions + ========== - `'and'`, `'or'`, and `'xor'` are available to chain - together 2 conditions, as seen above. + Conditions are provided as tuples which can be combined to form + boolean logic. A single condition might look like: - ##### Available Conditions - ###### `('they_have_material', material)` - > Does the part we're hitting have a given bascenev1.Material? + ``('condition_name', cond_arg)`` - ###### `('they_dont_have_material', material)` - > Does the part we're hitting not have a given bascenev1.Material? + Or a more complex nested one might look like: - ###### `('eval_colliding')` - > Is `'collide'` true at this point - in material evaluation? (see the `modify_part_collision` action) + ``(('condition1', cond_arg), 'or', ('condition2', cond2_arg))`` - ###### `('eval_not_colliding')` - > Is 'collide' false at this point - in material evaluation? (see the `modify_part_collision` action) + The strings ``'and'``, ``'or'``, and ``'xor'`` can chain together + two conditions, as seen above. - ###### `('we_are_younger_than', age)` - > Is our part younger than `age` (in milliseconds)? + Available Conditions + -------------------- + ``('they_have_material', material)`` + Does the part we're hitting have a given + :class:`bascenev1.Material`? - ###### `('we_are_older_than', age)` - > Is our part older than `age` (in milliseconds)? + ``('they_dont_have_material', material)`` + Does the part we're hitting not have a given + :class:`bascenev1.Material`? - ###### `('they_are_younger_than', age)` - > Is the part we're hitting younger than `age` (in milliseconds)? + ``('eval_colliding')`` + Is ``'collide'`` true at this point + in material evaluation? (see the ``modify_part_collision`` action) - ###### `('they_are_older_than', age)` - > Is the part we're hitting older than `age` (in milliseconds)? + ``('eval_not_colliding')`` + Is ``collide`` false at this point + in material evaluation? (see the ``modify_part_collision`` action) - ###### `('they_are_same_node_as_us')` - > Does the part we're hitting belong to the same bascenev1.Node as us? + ``('we_are_younger_than', age)`` + Is our part younger than ``age`` (in milliseconds)? - ###### `('they_are_different_node_than_us')` - > Does the part we're hitting belong to a different bascenev1.Node? + ``('we_are_older_than', age)`` + Is our part older than ``age`` (in milliseconds)? - ##### Actions - In a similar manner, actions are specified as tuples. - Multiple actions can be specified by providing a tuple - of tuples. + ``('they_are_younger_than', age)`` + Is the part we're hitting younger than ``age`` (in milliseconds)? - ##### Available Actions - ###### `('call', when, callable)` - > Calls the provided callable; - `when` can be either `'at_connect'` or `'at_disconnect'`. - `'at_connect'` means to fire - when the two parts first come in contact; `'at_disconnect'` - means to fire once they cease being in contact. + ``('they_are_older_than', age)`` + Is the part we're hitting older than ``age`` (in milliseconds)? - ###### `('message', who, when, message_obj)` - > Sends a message object; - `who` can be either `'our_node'` or `'their_node'`, `when` can be - `'at_connect'` or `'at_disconnect'`, and `message_obj` is the message - object to send. - This has the same effect as calling the node's - babase.Node.handlemessage() method. + ``('they_are_same_node_as_us')`` + Does the part we're hitting belong to the same + :class:`bascenev1.Node` + as us? - ###### `('modify_part_collision', attr, value)` - > Changes some - characteristic of the physical collision that will occur between - our part and their part. This change will remain in effect as - long as the two parts remain overlapping. This means if you have a - part with a material that turns `'collide'` off against parts - younger than 100ms, and it touches another part that is 50ms old, - it will continue to not collide with that part until they separate, - even if the 100ms threshold is passed. Options for attr/value are: - `'physical'` (boolean value; whether a *physical* response will - occur at all), `'friction'` (float value; how friction-y the - physical response will be), `'collide'` (boolean value; - whether *any* collision will occur at all, including non-physical - stuff like callbacks), `'use_node_collide'` - (boolean value; whether to honor modify_node_collision - overrides for this collision), `'stiffness'` (float value, - how springy the physical response is), `'damping'` (float - value, how damped the physical response is), `'bounce'` (float - value; how bouncy the physical response is). + ``('they_are_different_node_than_us')`` + Does the part we're hitting belong to a different + :class:`bascenev1.Node`? - ###### `('modify_node_collision', attr, value)` - > Similar to - `modify_part_collision`, but operates at a node-level. - collision attributes set here will remain in effect as long as - *anything* from our part's node and their part's node overlap. - A key use of this functionality is to prevent new nodes from - colliding with each other if they appear overlapped; - if `modify_part_collision` is used, only the individual - parts that were overlapping would avoid contact, but other parts - could still contact leaving the two nodes 'tangled up'. Using - `modify_node_collision` ensures that the nodes must completely - separate before they can start colliding. Currently the only attr - available here is `'collide'` (a boolean value). + Actions + ======= - ###### `('sound', sound, volume)` - > Plays a bascenev1.Sound when a collision - occurs, at a given volume, regardless of the collision speed/etc. + In a similar manner, actions are specified as tuples. Multiple + actions can be specified by providing a tuple of tuples. - ###### `('impact_sound', sound, targetImpulse, volume)` - > Plays a sound - when a collision occurs, based on the speed of impact. - Provide a bascenev1.Sound, a target-impulse, and a volume. + Available Actions + ----------------- - ###### `('skid_sound', sound, targetImpulse, volume)` - > Plays a sound - during a collision when parts are 'scraping' against each other. - Provide a bascenev1.Sound, a target-impulse, and a volume. + ``('call', when, callable)`` + Calls the provided callable; + ``when`` can be either ``'at_connect'`` or ``'at_disconnect'``. + ``'at_connect'`` means to fire when the two parts first come in + contact; ``'at_disconnect'`` means to fire once they cease being + in contact. - ###### `('roll_sound', sound, targetImpulse, volume)` - > Plays a sound - during a collision when parts are 'rolling' against each other. - Provide a bascenev1.Sound, a target-impulse, and a volume. + ``('message', who, when, message_obj)`` + Sends a message object; ``who`` can be either ``'our_node'`` or + ``'their_node'``, ``when`` can be ``'at_connect'`` or + ``'at_disconnect'``, and ``message_obj`` is the message object to + send. This has the same effect as calling the node's + :meth:`bascenev1.Node.handlemessage()` method. - ##### Examples - **Example 1:** create a material that lets us ignore + ``('modify_part_collision', attr, value)`` + Changes some characteristic of the physical collision that will + occur between our part and their part. This change will remain in + effect as long as the two parts remain overlapping. This means if + you have a part with a material that turns ``'collide'`` off + against parts younger than 100ms, and it touches another part that + is 50ms old, it will continue to not collide with that part until + they separate, even if the 100ms threshold is passed. Options for + attr/value are: + ``'physical'`` (boolean value; whether a *physical* response will + occur at all), ``'friction'`` (float value; how friction-y the + physical response will be), ``'collide'`` (boolean value; + whether *any* collision will occur at all, including non-physical + stuff like callbacks), ``'use_node_collide'`` + (boolean value; whether to honor modify_node_collision + overrides for this collision), ``'stiffness'`` (float value, + how springy the physical response is), ``'damping'`` (float + value, how damped the physical response is), ``'bounce'`` (float + value; how bouncy the physical response is). + + ``('modify_node_collision', attr, value)`` + Similar to ``modify_part_collision``, but operates at a + node-level. Collision attributes set here will remain in effect + as long as *anything* from our part's node and their part's node + overlap. A key use of this functionality is to prevent new nodes + from colliding with each other if they appear overlapped; + if ``modify_part_collision`` is used, only the individual + parts that were overlapping would avoid contact, but other parts + could still contact leaving the two nodes 'tangled up'. Using + ``modify_node_collision`` ensures that the nodes must completely + separate before they can start colliding. Currently the only attr + available here is ``'collide'`` (a boolean value). + + ``('sound', sound, volume)`` + Plays a :class:`bascenev1.Sound` when a collision occurs, at a + given volume, regardless of the collision speed/etc. + + ``('impact_sound', sound, target_impulse, volume)`` + Plays a sound when a collision occurs, based on the speed of + impact. Provide a :class:`bascenev1.Sound`, a target-impulse, + and a volume. + + ``('skid_sound', sound, target_impulse, volume)`` + Plays a sound during a collision when parts are 'scraping' + against each other. Provide a :class:`bascenev1.Sound`, + a target-impulse, and a volume. + + ``('roll_sound', sound, targetImpulse, volume)`` + Plays a sound during a collision when parts are 'rolling' + against each other. + Provide a :class:`bascenev1.Sound`, a target-impulse, and a + volume. + + Examples + ======== + + **Example 1:** Create a material that lets us ignore collisions against any nodes we touch in the first 100 ms of our existence; handy for preventing us from - exploding outward if we spawn on top of another object: - >>> m = bascenev1.Material() - ... m.add_actions( - ... conditions=(('we_are_younger_than', 100), - ... 'or', ('they_are_younger_than', 100)), - ... actions=('modify_node_collision', 'collide', False)) + exploding outward if we spawn on top of another object:: - **Example 2:** send a bascenev1.DieMessage to anything we touch, but - cause no physical response. This should cause any bascenev1.Actor to - drop dead: - >>> m = bascenev1.Material() - ... m.add_actions( - ... actions=(('modify_part_collision', 'physical', False), - ... ('message', 'their_node', 'at_connect', - ... bascenev1.DieMessage()))) + m = bascenev1.Material() + m.add_actions( + conditions=(('we_are_younger_than', 100), + 'or', ('they_are_younger_than', 100)), + actions=('modify_node_collision', 'collide', False)) - **Example 3:** play some sounds when we're contacting the ground: - >>> m = bascenev1.Material() - ... m.add_actions( - ... conditions=('they_have_material', shared.footing_material), - ... actions=( - ('impact_sound', bascenev1.getsound('metalHit'), 2, 5), - ('skid_sound', bascenev1.getsound('metalSkid'), 2, 5))) + **Example 2:** Send a :class:`bascenev1.DieMessage` to anything we + touch, but cause no physical response. This should cause any + :class:`bascenev1.Actor` to drop dead:: + + m = bascenev1.Material() + m.add_actions( + actions=( + ('modify_part_collision', 'physical', False), + ('message', 'their_node', 'at_connect', bascenev1.DieMessage()) + ) + ) + + **Example 3:** Play some sounds when we're contacting the + ground:: + + m = bascenev1.Material() + m.add_actions( + conditions=('they_have_material' shared.footing_material), + actions=( + ('impact_sound', bascenev1.getsound('metalHit'), 2, 5), + ('skid_sound', bascenev1.getsound('metalSkid'), 2, 5) + ) + ) """ + # This is a dummy stub; the actual implementation is native code. return None class Mesh: """A reference to a mesh. - Category: **Asset Classes** - Meshes are used for drawing. - Use bascenev1.getmesh() to instantiate one. + Use :meth:`bascenev1.getmesh()` to instantiate one. """ pass @@ -463,21 +501,19 @@ class Mesh: class Node: """Reference to a Node; the low level building block of a game. - Category: **Gameplay Classes** - At its core, a game is nothing more than a scene of Nodes with attributes getting interconnected or set over time. - A bascenev1.Node instance should be thought of as a weak-reference - to a game node; *not* the node itself. This means a Node's - lifecycle is completely independent of how many Python references - to it exist. To explicitly add a new node to the game, use - bascenev1.newnode(), and to explicitly delete one, - use bascenev1.Node.delete(). - babase.Node.exists() can be used to determine if a Node still points - to a live node in the game. + A :class:`bascenev1.Node` instance should be thought of as a + weak-reference to a game node; *not* the node itself. This means + a Node's lifecycle is completely independent of how many Python + references to it exist. To explicitly add a new node to the game, use + :meth:`bascenev1.newnode()`, and to explicitly delete one, use + :meth:`bascenev1.Node.delete()`. + :meth:`bascenev1.Node.exists()` can be used to determine if a Node + still points to a live node in the game. - You can use `ba.Node(None)` to instantiate an invalid + You can use ``bascenev1.Node(None)`` to instantiate an invalid Node reference (sometimes used as attr values/etc). """ @@ -544,32 +580,50 @@ class Node: bomb_pressed: bool = False fly_pressed: bool = False hold_position_pressed: bool = False + #: Available on spaz node. knockout: float = 0.0 invincible: bool = False stick_to_owner: bool = False damage: int = 0 + #: Available on spaz node. run: float = 0.0 + #: Available on spaz node. move_up_down: float = 0.0 + #: Available on spaz node. move_left_right: float = 0.0 curse_death_time: int = 0 boxing_gloves: bool = False hockey: bool = False use_fixed_vr_overlay: bool = False + #: Available on globals node. allow_kick_idle_players: bool = False music_continuous: bool = False music_count: int = 0 + #: Available on spaz node. hurt: float = 0.0 + #: On shield node. always_show_health_bar: bool = False + #: Available on spaz node. mini_billboard_1_texture: bascenev1.Texture | None = None + #: Available on spaz node. mini_billboard_1_start_time: int = 0 + #: Available on spaz node. mini_billboard_1_end_time: int = 0 + #: Available on spaz node. mini_billboard_2_texture: bascenev1.Texture | None = None + #: Available on spaz node. mini_billboard_2_start_time: int = 0 + #: Available on spaz node. mini_billboard_2_end_time: int = 0 + #: Available on spaz node. mini_billboard_3_texture: bascenev1.Texture | None = None + #: Available on spaz node. mini_billboard_3_start_time: int = 0 + #: Available on spaz node. mini_billboard_3_end_time: int = 0 + #: Available on spaz node. boxing_gloves_flashing: bool = False + #: Available on spaz node. dead: bool = False floor_reflection: bool = False debris_friction: float = 0.0 @@ -587,9 +641,13 @@ class Node: shadow_range: Sequence[float] = (0, 0, 0, 0) counter_text: str = '' counter_texture: bascenev1.Texture | None = None + #: Available on spaz node. shattered: int = 0 + #: Available on spaz node. billboard_texture: bascenev1.Texture | None = None + #: Available on spaz node. billboard_cross_out: bool = False + #: Available on spaz node. billboard_opacity: float = 0.0 slow_motion: bool = False music: str = '' @@ -608,10 +666,7 @@ class Node: """Add a callable object to be called upon this node's death. Note that these actions are run just after the node dies, not before. """ - return None - - def changerotation(self, x: int, y: int, z: int) -> None: - """added by smoothy""" + # This is a dummy stub; the actual implementation is native code. return None def connectattr(self, srcattr: str, dstnode: Node, dstattr: str) -> None: @@ -622,18 +677,20 @@ class Node: setting the target attribute to any value or connecting another node attribute to it. - ##### Example - Create a locator and attach a light to it: - >>> light = bascenev1.newnode('light') - ... loc = bascenev1.newnode('locator', attrs={'position': (0, 10, 0)}) - ... loc.connectattr('position', light, 'position') + Example: Create a locator and attach a light to it:: + + light = bascenev1.newnode('light') + loc = bascenev1.newnode('locator', attrs={'position': (0, 10, 0)}) + loc.connectattr('position', light, 'position') """ + # This is a dummy stub; the actual implementation is native code. return None def delete(self, ignore_missing: bool = True) -> None: """Delete the node. Ignores already-deleted nodes if `ignore_missing` - is True; otherwise a bascenev1.NodeNotFoundError is thrown. + is True; otherwise a :class:`babase.NodeNotFoundError` is thrown. """ + # This is a dummy stub; the actual implementation is native code. return None def exists(self) -> bool: @@ -645,6 +702,7 @@ class Node: functionality, so a statement such as "if mynode" will do the right thing both for Node objects and values of None. """ + # This is a dummy stub; the actual implementation is native code. return bool() # Show that ur return type varies based on "doraise" value: @@ -662,44 +720,50 @@ class Node: If the node has no delegate or it is not an instance of the passed type, then None will be returned. If 'doraise' is True, then an - babase.DelegateNotFoundError will be raised instead. + bascenev1.DelegateNotFoundError will be raised instead. """ return None def getname(self) -> str: """Return the name assigned to a Node; used mainly for debugging""" + # This is a dummy stub; the actual implementation is native code. return str() def getnodetype(self) -> str: - """Return the type of Node referenced by this object as a string. + """Return the internal type of node referenced by this object as a string. (Note this is different from the Python type which is always - bascenev1.Node) + :class:`bascenev1.Node`) """ + # This is a dummy stub; the actual implementation is native code. return str() def handlemessage(self, *args: Any) -> None: """General message handling; can be passed any message object. - All standard message objects are forwarded along to the - bascenev1.Node's delegate for handling (generally the bascenev1.Actor - that made the node). + All standard message objects are forwarded along to the node's + delegate for handling (generally the :class:`bascenev1.Actor` that + made the node). - bascenev1.Node-s are unique, however, in that they can be passed a - second form of message; 'node-messages'. These consist of a string - type-name as a first argument along with the args specific to that type - name as additional arguments. - Node-messages communicate directly with the low-level node layer - and are delivered simultaneously on all game clients, - acting as an alternative to setting node attributes. + Nodes also support a second form of message; 'node-messages'. + These consist of a string type-name as a first argument along with + the args specific to that type name as additional arguments. + Node-messages communicate directly with the low-level node + layer and are delivered simultaneously on all game clients, acting + as an alternative to setting node attributes. """ + # This is a dummy stub; the actual implementation is native code. return None class SessionData: - """(internal)""" + """Internal; holds native data for the session. + + :meta private: + """ def context(self) -> bascenev1.ContextRef: """Return a context-ref pointing to the session.""" + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.ContextRef() @@ -708,47 +772,48 @@ class SessionData: """Returns whether the SessionData still exists. Most functionality will fail on a nonexistent instance. """ + # This is a dummy stub; the actual implementation is native code. return bool() # noinspection PyShadowingBuiltins class SessionPlayer: - """A reference to a player in the bascenev1.Session. + """A reference to a player in a :class:`~bascenev1.Session`. - Category: **Gameplay Classes** - - These are created and managed internally and - provided to your bascenev1.Session/bascenev1.Activity instances. - Be aware that, like `ba.Node`s, bascenev1.SessionPlayer objects are - 'weak' references under-the-hood; a player can leave the game at - any point. For this reason, you should make judicious use of the - babase.SessionPlayer.exists() method (or boolean operator) to ensure - that a SessionPlayer is still present if retaining references to one - for any length of time. + These are created and managed internally and provided to your + :class:`~bascenev1.Session`/:class:`~bascenev1.Activity` + instances. Be aware that, like :class:`~bascenev1.Node` objects, + :class:`~bascenev1.SessionPlayer` objects are effectively 'weak' + references under-the-hood; a player can leave the game at any point. + For this reason, you should make judicious use of the + :meth:`bascenev1.SessionPlayer.exists()` method (or boolean operator) to + ensure that a :class:`SessionPlayer` is still present if retaining + references to one for any length of time. """ id: int - """The unique numeric ID of the Player. + """The unique numeric id of the player. Note that you can also use the boolean operator for this same - functionality, so a statement such as "if player" will do - the right thing both for Player objects and values of None.""" + functionality, so a statement such as ``if player:`` will do + the right thing both for :class:`~bascenev1.SessionPlayer` + objects as well as values of ``None``.""" in_game: bool - """This bool value will be True once the Player has completed + """This bool value will be True once the player has completed any lobby character/team selection.""" sessionteam: bascenev1.SessionTeam - """The bascenev1.SessionTeam this Player is on. If the - SessionPlayer is still in its lobby selecting a team/etc. - then a bascenev1.SessionTeamNotFoundError will be raised.""" + """The session-team this session-player is on. If the player is + still in its lobby selecting a team/etc. then a + :class:`~bascenev1.SessionTeamNotFoundError` will be raised.""" inputdevice: bascenev1.InputDevice """The input device associated with the player.""" color: Sequence[float] - """The base color for this Player. - In team games this will match the bascenev1.SessionTeam's + """The base color for this player. + In team games this will match the team's color.""" highlight: Sequence[float] @@ -773,44 +838,55 @@ class SessionPlayer: call: Callable, ) -> None: """Set the python callable to be run for one or more types of input.""" + # This is a dummy stub; the actual implementation is native code. return None def exists(self) -> bool: """Return whether the underlying player is still in the game.""" + # This is a dummy stub; the actual implementation is native code. return bool() def get_icon(self) -> dict[str, Any]: - """Returns the character's icon (images, colors, etc contained + """Return the character's icon (images, colors, etc contained in a dict. """ + # This is a dummy stub; the actual implementation is native code. return {'foo': 'bar'} def get_icon_info(self) -> dict[str, Any]: - """(internal)""" + """(internal) + + :meta private: + """ + # This is a dummy stub; the actual implementation is native code. return {'foo': 'bar'} def get_v1_account_id(self) -> str: - """Return the V1 Account ID this player is signed in under, if + """Return the V1 account id this player is signed in under, if there is one and it can be determined with relative certainty. Returns None otherwise. Note that this may require an active internet connection (especially for network-connected players) and may return None for a short while after a player initially joins (while verification occurs). """ + # This is a dummy stub; the actual implementation is native code. return str() def getname(self, full: bool = False, icon: bool = True) -> str: - """Returns the player's name. If icon is True, the long version of the + """Returns the player's name. If ``icon`` is True, the long version of the name may include an icon. """ + # This is a dummy stub; the actual implementation is native code. return str() def remove_from_game(self) -> None: """Removes the player from the game.""" + # This is a dummy stub; the actual implementation is native code. return None def resetinput(self) -> None: """Clears out the player's assigned input actions.""" + # This is a dummy stub; the actual implementation is native code. return None def set_icon_info( @@ -820,11 +896,19 @@ class SessionPlayer: tint_color: Sequence[float], tint2_color: Sequence[float], ) -> None: - """(internal)""" + """(internal) + + :meta private: + """ + # This is a dummy stub; the actual implementation is native code. return None def setactivity(self, activity: bascenev1.Activity | None) -> None: - """(internal)""" + """(internal) + + :meta private: + """ + # This is a dummy stub; the actual implementation is native code. return None def setdata( @@ -835,6 +919,7 @@ class SessionPlayer: highlight: Sequence[float], ) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def setname( @@ -844,19 +929,22 @@ class SessionPlayer: A number will automatically be appended if the name is not unique from other players. """ + # This is a dummy stub; the actual implementation is native code. return None def setnode(self, node: bascenev1.Node | None) -> None: - """(internal)""" + """(internal) + + :meta private: + """ + # This is a dummy stub; the actual implementation is native code. return None class Sound: """A reference to a sound. - Category: **Asset Classes** - - Use bascenev1.getsound() to instantiate one. + Use :meth:`bascenev1.getsound()` to instantiate one. """ def play( @@ -867,20 +955,17 @@ class Sound: ) -> None: """Play the sound a single time. - Category: **Gameplay Functions** - If position is not provided, the sound will be at a constant volume everywhere. Position should be a float tuple of size 3. """ + # This is a dummy stub; the actual implementation is native code. return None class Texture: """A reference to a texture. - Category: **Asset Classes** - - Use bascenev1.gettexture() to instantiate one. + Use :meth:`bascenev1.gettexture()` to instantiate one. """ pass @@ -890,8 +975,6 @@ class Texture: class Timer: """Timers are used to run code at later points in time. - Category: **General Utility Classes** - This class encapsulates a scene-time timer in the current bascenev1.Context. The underlying timer will be destroyed when either this object is no longer referenced or when its Context (Activity, @@ -903,35 +986,40 @@ class Timer: bascenev1.Session Contexts. This means that it may progress slower in slow-motion play modes, stop when the game is paused, etc. - ###### time - > Length of time (in seconds by default) that the timer will wait - before firing. Note that the actual delay experienced may vary - depending on the timetype. (see below) + Args: - ###### call - > A callable Python object. Note that the timer will retain a - strong reference to the callable for as long as it exists, so you - may want to look into concepts such as babase.WeakCall if that is not - desired. + time: + Length of time (in seconds by default) that the timer will wait + before firing. Note that the actual delay experienced may vary + depending on the timetype. (see below) - ###### repeat - > If True, the timer will fire repeatedly, with each successive - firing having the same delay as the first. + call: + A callable Python object. Note that the timer will retain a + strong reference to the callable for as long as it exists, so you + may want to look into concepts such as :class:`~babase.WeakCall` + if that is not desired. - ##### Example + repeat: + If True, the timer will fire repeatedly, with each successive + firing having the same delay as the first. - Use a Timer object to print repeatedly for a few seconds: - >>> import bascenev1 as bs - ... def say_it(): - ... bs.screenmessage('BADGER!') - ... def stop_saying_it(): - ... global g_timer - ... g_timer = None - ... bs.screenmessage('MUSHROOM MUSHROOM!') - ... # Create our timer; it will run as long as we have the self.t ref. - ... g_timer = bs.Timer(0.3, say_it, repeat=True) - ... # Now fire off a one-shot timer to kill it. - ... bs.timer(3.89, stop_saying_it) + Example: Use a Timer object to print repeatedly for a few seconds:: + + import bascenev1 as bs + + def say_it(): + bs.screenmessage('BADGER!') + + def stop_saying_it(): + global g_timer + g_timer = None + bs.screenmessage('MUSHROOM MUSHROOM!') + + # Create our timer; it will run as long as we hold its ref. + g_timer = bs.Timer(0.3, say_it, repeat=True) + + # Now fire off a one-shot timer to kill the ref. + bs.timer(3.89, stop_saying_it) """ def __init__( @@ -940,16 +1028,9 @@ class Timer: pass -def append_owner_ip(ip: str) -> None: - """(internal)""" - return None - - def basetime() -> bascenev1.BaseTime: """Return the base-time in seconds for the current scene-v1 context. - Category: **General Utility Functions** - Base-time is a time value that progresses at a constant rate for a scene, even when the scene is sped up, slowed down, or paused. It may, however, speed up or slow down due to replay speed adjustments or may slow down @@ -958,6 +1039,7 @@ def basetime() -> bascenev1.BaseTime: unique type in the type-checker's eyes to help prevent it from being accidentally used with time functionality expecting other time types. """ + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.BaseTime(0.0) @@ -970,39 +1052,40 @@ def basetimer( ) -> None: """Schedule a call to run at a later point in scene base-time. Base-time is a value that progresses at a constant rate for a scene, - even when the scene is sped up, slowed down, or paused. It may, - however, speed up or slow down due to replay speed adjustments or may - slow down if the cpu is overloaded. - - Category: **General Utility Functions** + even when the scene is sped up, slowed down, or paused. It may, + however, speed up or slow down due to replay speed adjustments or may + slow down if the cpu is overloaded. This function adds a timer to the current scene context. This timer cannot be canceled or modified once created. If you - require the ability to do so, use the bascenev1.BaseTimer class - instead. + require the ability to do so, use the bascenev1.BaseTimer class + instead. - ##### Arguments - ###### time (float) - > Length of time in seconds that the timer will wait before firing. + Args: + time: + Length of time in seconds that the timer will wait before firing. - ###### call (Callable[[], Any]) - > A callable Python object. Remember that the timer will retain a - strong reference to the callable for the duration of the timer, so you - may want to look into concepts such as babase.WeakCall if that is not - desired. + call: + A callable Python object. Remember that the timer will retain a + strong reference to the callable for the duration of the timer, so + you may want to look into concepts such as :class:`~babase.WeakCall` + if that is not desired. - ###### repeat (bool) - > If True, the timer will fire repeatedly, with each successive - firing having the same delay as the first. + repeat: + If True, the timer will fire repeatedly, with each successive + firing having the same delay as the first. - ##### Examples - Print some stuff through time: - >>> import bascenev1 as bs - >>> bs.screenmessage('hello from now!') - >>> bs.basetimer(1.0, bs.Call(bs.screenmessage, 'hello from the future!')) - >>> bs.basetimer(2.0, bs.Call(bs.screenmessage, - ... 'hello from the future 2!')) + Example: Print some stuff through time:: + + import bascenev1 as bs + + bs.screenmessage('hello from now!') + bs.basetimer(1.0, bs.Call(bs.screenmessage, + 'hello from the future!')) + bs.basetimer(2.0, bs.Call(bs.screenmessage, + 'hello from the future 2!')) """ + # This is a dummy stub; the actual implementation is native code. return None @@ -1017,8 +1100,6 @@ def broadcastmessage( ) -> None: """Broadcast a screen-message to clients in the current session. - Category: **General Utility Functions** - If 'top' is True, the message will go to the top message area. For 'top' messages, 'image' must be a dict containing 'texture' and 'tint_texture' textures and 'tint_color' and 'tint2_color' @@ -1030,18 +1111,18 @@ def broadcastmessage( game-stream and thus will not show up when viewing replays. Currently the 'clients' option only works for transient messages. """ + # This is a dummy stub; the actual implementation is native code. return None def camerashake(intensity: float = 1.0) -> None: """Shake the camera. - Category: **Gameplay Functions** - Note that some cameras and/or platforms (such as VR) may not display camera-shake, so do not rely on this always being visible to the player as a gameplay cue. """ + # This is a dummy stub; the actual implementation is native code. return None @@ -1051,6 +1132,7 @@ def capture_gamepad_input(call: Callable[[dict], None]) -> None: Add a callable to be called for subsequent gamepad events. The method is passed a dict containing info about the event. """ + # This is a dummy stub; the actual implementation is native code. return None @@ -1060,6 +1142,7 @@ def capture_keyboard_input(call: Callable[[dict], None]) -> None: Add a callable to be called for subsequent keyboard-game-pad events. The method is passed a dict containing info about the event. """ + # This is a dummy stub; the actual implementation is native code. return None @@ -1069,11 +1152,13 @@ def chatmessage( sender_override: str | None = None, ) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def client_info_query_response(token: str, response: Any) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None @@ -1081,24 +1166,19 @@ def connect_to_party( address: str, port: int | None = None, print_progress: bool = True ) -> None: """(internal)""" - return None - - -def disable_kickvote(id: str) -> None: - """(internal)id: pb-id who cant start a kick vote to anyone""" + # This is a dummy stub; the actual implementation is native code. return None def disconnect_client(client_id: int, ban_time: int = 300) -> bool: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return bool() def disconnect_from_host() -> None: - """(internal) - - Category: General Utility Functions - """ + """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None @@ -1114,67 +1194,48 @@ def emitfx( ) -> None: """Emit particles, smoke, etc. into the fx sim layer. - Category: **Gameplay Functions** - The fx sim layer is a secondary dynamics simulation that runs in the background and just looks pretty; it does not affect gameplay. Note that the actual amount emitted may vary depending on graphics settings, exiting element counts, or other factors. """ + # This is a dummy stub; the actual implementation is native code. return None def end_host_scanning() -> None: - """(internal) - - Category: General Utility Functions - """ + """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def get_chat_messages() -> list[str]: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return ['blah', 'blah2'] -def get_client_device_uuid(client_id: float) -> str: - """(internal)""" - return str() - - -def get_client_ip(client_id: float) -> str: - """(internal)""" - return str() - - -def get_client_ping(client_id: float) -> str: - """(internal)""" - return str() - - def get_client_public_device_uuid(client_id: int) -> str | None: """(internal) - Category: General Utility Functions - Return a public device UUID for a client. If the client does not exist or is running a version older than 1.6.10, returns None. Public device UUID uniquely identifies the device the client is using in a semi-permanent way. The UUID value will change periodically with updates to the game or operating system. """ + # This is a dummy stub; the actual implementation is native code. return '' def get_collision_info(*args: Any) -> Any: """Return collision related values - Category: **Gameplay Functions** - Returns a single collision value or tuple of values such as location, depth, nodes involved, etc. Only call this in the handler of a collision-triggered callback or message """ + # This is a dummy stub; the actual implementation is native code. return _uninferrable() @@ -1184,16 +1245,19 @@ def get_configurable_game_pads() -> list: Returns a list of the currently connected gamepads that can be configured. """ + # This is a dummy stub; the actual implementation is native code. return list() def get_connection_to_host_info() -> dict: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return dict() def get_connection_to_host_info_2() -> bascenev1.HostInfo | None: """Return info about the host we are currently connected to.""" + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.HostInfo('dummyname', -1, 'dummy_addr', -1) @@ -1205,6 +1269,7 @@ def get_foreground_host_activity() -> bascenev1.Activity | None: Returns the bascenev1.Activity currently in the foreground, or None if there is none. """ + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.Activity(settings={}) @@ -1216,6 +1281,7 @@ def get_foreground_host_session() -> bascenev1.Session | None: Return the bascenev1.Session currently being displayed, or None if there is none. """ + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.Session([]) @@ -1226,16 +1292,19 @@ def get_game_port() -> int: Return the port ballistica is hosting on. """ + # This is a dummy stub; the actual implementation is native code. return int() def get_game_roster() -> list[dict[str, Any]]: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return [{'foo': 'bar'}] def get_local_active_input_devices_count() -> int: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return int() @@ -1243,6 +1312,7 @@ def get_package_collision_mesh( package: bascenev1.AssetPackage, name: str ) -> bascenev1.CollisionMesh: """(internal)""" + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.CollisionMesh() @@ -1252,6 +1322,7 @@ def get_package_data( package: bascenev1.AssetPackage, name: str ) -> bascenev1.Data: """(internal).""" + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.Data() @@ -1261,6 +1332,7 @@ def get_package_mesh( package: bascenev1.AssetPackage, name: str ) -> bascenev1.Mesh: """(internal)""" + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.Mesh() @@ -1270,6 +1342,7 @@ def get_package_sound( package: bascenev1.AssetPackage, name: str ) -> bascenev1.Sound: """(internal).""" + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.Sound() @@ -1279,6 +1352,7 @@ def get_package_texture( package: bascenev1.AssetPackage, name: str ) -> bascenev1.Texture: """(internal)""" + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.Texture() @@ -1286,11 +1360,13 @@ def get_package_texture( def get_public_party_enabled() -> bool: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return bool() def get_public_party_max_size() -> int: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return int() @@ -1299,6 +1375,7 @@ def get_random_names() -> list: Returns the random names used by the game. """ + # This is a dummy stub; the actual implementation is native code. return list() @@ -1307,6 +1384,7 @@ def get_replay_speed_exponent() -> int: Returns current replay speed value. Actual displayed speed is pow(2,speed). """ + # This is a dummy stub; the actual implementation is native code. return int() @@ -1316,6 +1394,7 @@ def get_ui_input_device() -> bascenev1.InputDevice | None: Returns the input-device that currently owns the user interface, or None if there is none. """ + # This is a dummy stub; the actual implementation is native code. return InputDevice() @@ -1331,8 +1410,6 @@ def getactivity(doraise: Literal[False]) -> bascenev1.Activity | None: ... def getactivity(doraise: bool = True) -> bascenev1.Activity | None: """Return the current bascenev1.Activity instance. - Category: **Gameplay Functions** - Note that this is based on context_ref; thus code run in a timer generated in Activity 'foo' will properly return 'foo' here, even if another Activity has since been created or is transitioning in. @@ -1345,16 +1422,16 @@ def getactivity(doraise: bool = True) -> bascenev1.Activity | None: def getcollisionmesh(name: str) -> bascenev1.CollisionMesh: """Return a collision-mesh, loading it if necessary. - Category: **Asset Functions** - Collision-meshes are used in physics calculations for such things as terrain. Note that this function returns immediately even if the asset has yet - to be loaded. To avoid hitches, instantiate your asset objects in - advance of when you will be using them, allowing time for them to - load in the background if necessary. + to be loaded. Loading will happen in the background or on-demand. To + avoid hitches, try to instantiate asset objects a bit earlier than + they are actually needed, giving them time to load gracefully + in the background. """ + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.CollisionMesh() @@ -1363,13 +1440,13 @@ def getcollisionmesh(name: str) -> bascenev1.CollisionMesh: def getdata(name: str) -> bascenev1.Data: """Return a data, loading it if necessary. - Category: **Asset Functions** - Note that this function returns immediately even if the asset has yet - to be loaded. To avoid hitches, instantiate your asset objects in - advance of when you will be using them, allowing time for them to - load in the background if necessary. + to be loaded. Loading will happen in the background or on-demand. To + avoid hitches, try to instantiate asset objects a bit earlier than + they are actually needed, giving them time to load gracefully + in the background. """ + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.Data() @@ -1401,23 +1478,21 @@ def getinputdevice(name: str, unique_id: str, doraise: bool = True) -> Any: def getmesh(name: str) -> bascenev1.Mesh: """Return a mesh, loading it if necessary. - Category: **Asset Functions** - Note that this function returns immediately even if the asset has yet - to be loaded. To avoid hitches, instantiate your asset objects in - advance of when you will be using them, allowing time for them to - load in the background if necessary. + to be loaded. Loading will happen in the background or on-demand. To + avoid hitches, try to instantiate asset objects a bit earlier than + they are actually needed, giving them time to load gracefully + in the background. """ + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.Mesh() def getnodes() -> list: - """Return all nodes in the current bascenev1.Context. - - Category: **Gameplay Functions** - """ + """Return all nodes in the current scene context.""" + # This is a dummy stub; the actual implementation is native code. return list() @@ -1431,13 +1506,9 @@ def getsession(doraise: Literal[False]) -> bascenev1.Session | None: ... def getsession(doraise: bool = True) -> bascenev1.Session | None: - """Category: **Gameplay Functions** - - Returns the current bascenev1.Session instance. - Note that this is based on context_ref; thus code being run in the UI - context will return the UI context_ref here even if a game Session also - exists, etc. If there is no current Session, an Exception is raised, or - if doraise is False then None is returned instead. + """Return the session associated with the current context. If there is + none, a :class:`~bascenev1.SessionNotFoundError` is raised (unless + ``doraise`` is False, in which case ``None`` is returned instead). """ return None @@ -1445,13 +1516,13 @@ def getsession(doraise: bool = True) -> bascenev1.Session | None: def getsound(name: str) -> bascenev1.Sound: """Return a sound, loading it if necessary. - Category: **Asset Functions** - Note that this function returns immediately even if the asset has yet - to be loaded. To avoid hitches, instantiate your asset objects in - advance of when you will be using them, allowing time for them to - load in the background if necessary. + to be loaded. Loading will happen in the background or on-demand. To + avoid hitches, try to instantiate asset objects a bit earlier than + they are actually needed, giving them time to load gracefully + in the background. """ + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.Sound() @@ -1460,56 +1531,48 @@ def getsound(name: str) -> bascenev1.Sound: def gettexture(name: str) -> bascenev1.Texture: """Return a texture, loading it if necessary. - Category: **Asset Functions** - Note that this function returns immediately even if the asset has yet - to be loaded. To avoid hitches, instantiate your asset objects in - advance of when you will be using them, allowing time for them to - load in the background if necessary. + to be loaded. Loading will happen in the background or on-demand. To + avoid hitches, try to instantiate asset objects a bit earlier than + they are actually needed, giving them time to load gracefully + in the background. """ + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.Texture() -def handle_app_intent_default() -> None: - """(internal)""" - return None - - -def handle_app_intent_exec(command: str) -> None: - """(internal)""" - return None - - def have_connected_clients() -> bool: """(internal) - Category: General Utility Functions + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return bool() def have_touchscreen_input() -> bool: - """(internal) + """Internal; Return whether or not a touch-screen input is present. - Returns whether or not a touch-screen input is present + :meta private: """ + # This is a dummy stub; the actual implementation is native code. return bool() -def hide_player_device_id(type: bool) -> None: - """(internal)hide player device spec from roster to clients""" - return None - - def host_scan_cycle() -> list: - """(internal)""" + """(internal) + + :meta private: + """ + # This is a dummy stub; the actual implementation is native code. return list() def is_in_replay() -> bool: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return bool() @@ -1518,28 +1581,27 @@ def is_replay_paused() -> bool: Returns if Replay is paused or not. """ + # This is a dummy stub; the actual implementation is native code. return bool() def ls_input_devices() -> None: """Print debugging info about game objects. - Category: **General Utility Functions** - This call only functions in debug builds of the game. It prints various info about the current object count, etc. """ + # This is a dummy stub; the actual implementation is native code. return None def ls_objects() -> None: """Log debugging info about C++ level objects. - Category: **General Utility Functions** - This call only functions in debug builds of the game. It prints various info about the current object count, etc. """ + # This is a dummy stub; the actual implementation is native code. return None @@ -1547,11 +1609,13 @@ def new_host_session( sessiontype: type[bascenev1.Session], benchmark_type: str | None = None ) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def new_replay_session(file_name: str) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None @@ -1560,11 +1624,10 @@ def newactivity( ) -> bascenev1.Activity: """Instantiates a bascenev1.Activity given a type object. - Category: **General Utility Functions** - Activities require special setup and thus cannot be directly instantiated; you must go through this function. """ + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.Activity(settings={}) @@ -1580,8 +1643,6 @@ def newnode( ) -> bascenev1.Node: """Add a node of the given type to the game. - Category: **Gameplay Functions** - If a dict is provided for 'attributes', the node's initial attributes will be set based on them. @@ -1596,44 +1657,36 @@ def newnode( if 'owner' is provided, the node will be automatically killed when that object dies. 'owner' can be another node or a bascenev1.Actor """ + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.Node() -def on_app_mode_activate() -> None: - """(internal)""" - return None - - -def on_app_mode_deactivate() -> None: - """(internal)""" - return None - - def pause_replay() -> None: """(internal) Pauses replay. """ + # This is a dummy stub; the actual implementation is native code. return None def printnodes() -> None: - """Print various info about existing nodes; useful for debugging. - - Category: **Gameplay Functions** - """ + """Print various info about existing nodes; useful for debugging.""" + # This is a dummy stub; the actual implementation is native code. return None def protocol_version() -> int: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return int() def register_activity(activity: bascenev1.Activity) -> bascenev1.ActivityData: """(internal)""" + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.ActivityData() @@ -1641,6 +1694,7 @@ def register_activity(activity: bascenev1.Activity) -> bascenev1.ActivityData: def register_session(session: bascenev1.Session) -> bascenev1.SessionData: """(internal)""" + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.SessionData() @@ -1651,6 +1705,7 @@ def release_gamepad_input() -> None: Resumes normal gamepad event processing. """ + # This is a dummy stub; the actual implementation is native code. return None @@ -1659,11 +1714,13 @@ def release_keyboard_input() -> None: Resumes normal keyboard event processing. """ + # This is a dummy stub; the actual implementation is native code. return None def reset_random_player_names() -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None @@ -1672,6 +1729,7 @@ def resume_replay() -> None: Resumes replay. """ + # This is a dummy stub; the actual implementation is native code. return None @@ -1680,16 +1738,19 @@ def seek_replay(delta: float) -> None: Rewind or fast-forward replay. """ + # This is a dummy stub; the actual implementation is native code. return None def set_admins(admins: list[str]) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def set_authenticate_clients(enable: bool) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None @@ -1698,19 +1759,13 @@ def set_debug_speed_exponent(speed: int) -> None: Sets the debug speed scale for the game. Actual speed is pow(2,speed). """ + # This is a dummy stub; the actual implementation is native code. return None def set_enable_default_kick_voting(enable: bool) -> None: """(internal)""" - return None - - -def set_game_speed(speed: int) -> None: - """(internal) - - Sets the speed scale for the game. - """ + # This is a dummy stub; the actual implementation is native code. return None @@ -1718,61 +1773,66 @@ def set_internal_music( music: babase.SimpleSound | None, volume: float = 1.0, loop: bool = True ) -> None: """(internal).""" - return None - - -def set_kickvote_msg_type(name: str) -> None: - """(internal)set chat to show msg in chat""" + # This is a dummy stub; the actual implementation is native code. return None def set_map_bounds( - bounds: tuple[float, float, float, float, float, float] + bounds: tuple[float, float, float, float, float, float], ) -> None: """(internal) Set map bounds. Generally nodes that go outside of this box are killed. """ + # This is a dummy stub; the actual implementation is native code. return None def set_master_server_source(source: int) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def set_public_party_enabled(enabled: bool) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def set_public_party_max_size(max_size: int) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def set_public_party_name(name: str) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def set_public_party_public_address_ipv4(address: str | None) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def set_public_party_public_address_ipv6(address: str | None) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def set_public_party_queue_enabled(max_size: bool) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None def set_public_party_stats_url(url: str | None) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None @@ -1781,29 +1841,19 @@ def set_replay_speed_exponent(speed: int) -> None: Set replay speed. Actual displayed speed is pow(2, speed). """ - return None - - -def set_server_name(name: str) -> None: - """(internal)set the host name""" + # This is a dummy stub; the actual implementation is native code. return None def set_touchscreen_editing(editing: bool) -> None: """(internal)""" - return None - - -def set_transparent_kickvote(type: bool) -> None: - """(internal)True to show kick vote starter name""" + # This is a dummy stub; the actual implementation is native code. return None def time() -> bascenev1.Time: """Return the current scene time in seconds. - Category: **General Utility Functions** - Scene time maps to local simulation time in bascenev1.Activity or bascenev1.Session Contexts. This means that it may progress slower in slow-motion play modes, stop when the game is paused, etc. @@ -1812,6 +1862,7 @@ def time() -> bascenev1.Time: unique type in the type-checker's eyes to help prevent it from being accidentally used with time functionality expecting other time types. """ + # This is a dummy stub; the actual implementation is native code. import bascenev1 # pylint: disable=cyclic-import return bascenev1.Time(0.0) @@ -1821,37 +1872,40 @@ def time() -> bascenev1.Time: def timer(time: float, call: Callable[[], Any], repeat: bool = False) -> None: """Schedule a call to run at a later point in time. - Category: **General Utility Functions** + This function adds a scene-time timer to the current + :class:`bascenev1.ContextRef`. This timer cannot be canceled or modified + once created. If you require the ability to do so, use the + :class:`bascenev1.Timer` class instead. - This function adds a scene-time timer to the current babase.Context. - This timer cannot be canceled or modified once created. If you - require the ability to do so, use the babase.Timer class instead. + Scene time maps to local simulation time in :class:`bascenev1.Activity` + or :class:`bascenev1.Session` Contexts. This means that it may progress + slower in slow-motion play modes, stop when the game is paused, etc. - Scene time maps to local simulation time in bascenev1.Activity or - bascenev1.Session Contexts. This means that it may progress slower - in slow-motion play modes, stop when the game is paused, etc. + Args: - ##### Arguments - ###### time (float) - > Length of scene time in seconds that the timer will wait - before firing. + time: + Length of scene time in seconds that the timer will wait + before firing. - ###### call (Callable[[], Any]) - > A callable Python object. Note that the timer will retain a - strong reference to the callable for as long as it exists, so you - may want to look into concepts such as babase.WeakCall if that is not - desired. + call: + A callable Python object. Note that the timer will retain a + strong reference to the callable for as long as it exists, so you + may want to look into concepts such as :class:`bascenev1.WeakCall` + if that is not desired. - ###### repeat (bool) - > If True, the timer will fire repeatedly, with each successive - firing having the same delay as the first. + repeat: + If True, the timer will fire repeatedly, with each successive + firing having the same delay as the first. - ##### Examples - Print some stuff through time: - >>> import bascenev1 as bs - >>> bs.screenmessage('hello from now!') - >>> bs.timer(1.0, bs.Call(bs.screenmessage, 'hello from the future!')) - >>> bs.timer(2.0, bs.Call(bs.screenmessage, - ... 'hello from the future 2!')) + Examples + ======== + + Print some stuff through time:: + + import bascenev1 as bs + bs.screenmessage('hello from now!') + bs.timer(1.0, bs.Call(bs.screenmessage, 'hello from the future!')) + bs.timer(2.0, bs.Call(bs.screenmessage, 'hello from the future 2!')) """ + # This is a dummy stub; the actual implementation is native code. return None diff --git a/dist/dummymodules/_batemplatefs.py b/dist/dummymodules/_batemplatefs.py index 33adb83..1598a87 100644 --- a/dist/dummymodules/_batemplatefs.py +++ b/dist/dummymodules/_batemplatefs.py @@ -27,6 +27,8 @@ NOTE: This file was autogenerated by batools.dummymodule; do not edit by hand. # pylint: disable=redefined-outer-name # pylint: disable=invalid-name # pylint: disable=no-value-for-parameter +# pylint: disable=unused-import +# pylint: disable=too-many-positional-arguments from __future__ import annotations @@ -50,9 +52,11 @@ class Hello: def testmethod(self, val: int = 0) -> None: """Just testing.""" + # This is a dummy stub; the actual implementation is native code. return None def hello_again_world() -> None: """Another hello world print.""" + # This is a dummy stub; the actual implementation is native code. return None diff --git a/dist/dummymodules/_bauiv1.py b/dist/dummymodules/_bauiv1.py index 7ed50a3..8514e06 100644 --- a/dist/dummymodules/_bauiv1.py +++ b/dist/dummymodules/_bauiv1.py @@ -27,6 +27,8 @@ NOTE: This file was autogenerated by batools.dummymodule; do not edit by hand. # pylint: disable=redefined-outer-name # pylint: disable=invalid-name # pylint: disable=no-value-for-parameter +# pylint: disable=unused-import +# pylint: disable=too-many-positional-arguments from __future__ import annotations @@ -48,25 +50,27 @@ def _uninferrable() -> Any: class Mesh: - """Category: **User Interface Classes**""" + """Mesh asset for local user interface purposes.""" pass class Sound: - """Category: **User Interface Classes**""" + """Sound asset for local user interface purposes.""" - def play(self) -> None: + def play(self, volume: float = 1.0) -> None: """Play the sound locally.""" + # This is a dummy stub; the actual implementation is native code. return None def stop(self) -> None: """Stop the sound if it is playing.""" + # This is a dummy stub; the actual implementation is native code. return None class Texture: - """Category: **User Interface Classes**""" + """Texture asset for local user interface purposes.""" pass @@ -74,8 +78,6 @@ class Texture: class Widget: """Internal type for low level UI elements; buttons, windows, etc. - Category: **User Interface Classes** - This class represents a weak reference to a widget object in the internal C++ layer. Currently, functions such as bauiv1.buttonwidget() must be used to instantiate or edit these. @@ -94,16 +96,19 @@ class Widget: def activate(self) -> None: """Activates a widget; the same as if it had been clicked.""" + # This is a dummy stub; the actual implementation is native code. return None def add_delete_callback(self, call: Callable) -> None: """Add a call to be run immediately after this widget is destroyed.""" + # This is a dummy stub; the actual implementation is native code. return None def delete(self, ignore_missing: bool = True) -> None: """Delete the Widget. Ignores already-deleted Widgets if ignore_missing is True; otherwise an Exception is thrown. """ + # This is a dummy stub; the actual implementation is native code. return None def exists(self) -> bool: @@ -114,10 +119,12 @@ class Widget: functionality, so a statement such as "if mywidget" will do the right thing both for Widget objects and values of None. """ + # This is a dummy stub; the actual implementation is native code. return bool() def get_children(self) -> list[bauiv1.Widget]: """Returns any child Widgets of this Widget.""" + # This is a dummy stub; the actual implementation is native code. import bauiv1 return [bauiv1.Widget()] @@ -127,10 +134,12 @@ class Widget: of the screen. This can be useful for placing pop-up windows and other special cases. """ + # This is a dummy stub; the actual implementation is native code. return (0.0, 0.0) def get_selected_child(self) -> bauiv1.Widget | None: """Returns the selected child Widget or None if nothing is selected.""" + # This is a dummy stub; the actual implementation is native code. import bauiv1 return bauiv1.Widget() @@ -140,17 +149,15 @@ class Widget: is different from the Python bauiv1.Widget type, which is the same for all widgets. """ + # This is a dummy stub; the actual implementation is native code. return str() -def back_press() -> None: - """(internal)""" - return None - - def buttonwidget( + *, edit: bauiv1.Widget | None = None, parent: bauiv1.Widget | None = None, + id: str | None = None, size: Sequence[float] | None = None, position: Sequence[float] | None = None, on_activate_call: Callable | None = None, @@ -189,18 +196,18 @@ def buttonwidget( ) -> bauiv1.Widget: """Create or edit a button widget. - Category: **User Interface Functions** - Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise a new one is created and returned. Arguments that are not set to None are applied to the Widget. """ + # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget() def checkboxwidget( + *, edit: bauiv1.Widget | None = None, parent: bauiv1.Widget | None = None, size: Sequence[float] | None = None, @@ -219,18 +226,18 @@ def checkboxwidget( ) -> bauiv1.Widget: """Create or edit a check-box widget. - Category: **User Interface Functions** - Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise a new one is created and returned. Arguments that are not set to None are applied to the Widget. """ + # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget() def columnwidget( + *, edit: bauiv1.Widget | None = None, parent: bauiv1.Widget | None = None, size: Sequence[float] | None = None, @@ -247,24 +254,24 @@ def columnwidget( border: float | None = None, margin: float | None = None, claims_left_right: bool | None = None, - claims_tab: bool | None = None, ) -> bauiv1.Widget: """Create or edit a column widget. - Category: **User Interface Functions** - Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise a new one is created and returned. Arguments that are not set to None are applied to the Widget. """ + # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget() def containerwidget( + *, edit: bauiv1.Widget | None = None, parent: bauiv1.Widget | None = None, + id: str | None = None, size: Sequence[float] | None = None, position: Sequence[float] | None = None, background: bool | None = None, @@ -275,7 +282,6 @@ def containerwidget( root_selectable: bool | None = None, on_activate_call: Callable[[], None] | None = None, claims_left_right: bool | None = None, - claims_tab: bool | None = None, selection_loops: bool | None = None, selection_loops_to_parent: bool | None = None, scale: float | None = None, @@ -290,19 +296,33 @@ def containerwidget( always_highlight: bool | None = None, selectable: bool | None = None, scale_origin_stack_offset: Sequence[float] | None = None, - toolbar_visibility: str | None = None, + toolbar_visibility: ( + Literal[ + 'menu_minimal', + 'menu_minimal_no_back', + 'menu_full', + 'menu_full_no_back', + 'menu_store', + 'menu_store_no_back', + 'menu_in_game', + 'menu_tokens', + 'get_tokens', + 'no_menu_minimal', + 'inherit', + ] + | None + ) = None, on_select_call: Callable[[], None] | None = None, claim_outside_clicks: bool | None = None, claims_up_down: bool | None = None, ) -> bauiv1.Widget: """Create or edit a container widget. - Category: **User Interface Functions** - Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise a new one is created and returned. Arguments that are not set to None are applied to the Widget. """ + # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget() @@ -313,13 +333,36 @@ def get_qrcode_texture(url: str) -> bauiv1.Texture: The provided url must be 64 bytes or less. """ + # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Texture() -def get_special_widget(name: str) -> bauiv1.Widget: +def get_special_widget( + name: Literal[ + 'squad_button', + 'back_button', + 'account_button', + 'achievements_button', + 'settings_button', + 'inbox_button', + 'store_button', + 'get_tokens_button', + 'inventory_button', + 'tickets_meter', + 'tokens_meter', + 'trophy_meter', + 'level_meter', + 'overlay_stack', + 'chest_0_button', + 'chest_1_button', + 'chest_2_button', + 'chest_3_button', + ], +) -> bauiv1.Widget: """(internal)""" + # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget() @@ -327,6 +370,7 @@ def get_special_widget(name: str) -> bauiv1.Widget: def getmesh(name: str) -> bauiv1.Mesh: """Load a mesh for use solely in the local user interface.""" + # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Mesh() @@ -334,6 +378,7 @@ def getmesh(name: str) -> bauiv1.Mesh: def getsound(name: str) -> bauiv1.Sound: """Load a sound for use in the ui.""" + # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Sound() @@ -341,12 +386,14 @@ def getsound(name: str) -> bauiv1.Sound: def gettexture(name: str) -> bauiv1.Texture: """Load a texture for use in the ui.""" + # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Texture() def hscrollwidget( + *, edit: bauiv1.Widget | None = None, parent: bauiv1.Widget | None = None, size: Sequence[float] | None = None, @@ -362,22 +409,21 @@ def hscrollwidget( simple_culling_h: float | None = None, claims_left_right: bool | None = None, claims_up_down: bool | None = None, - claims_tab: bool | None = None, ) -> bauiv1.Widget: """Create or edit a horizontal scroll widget. - Category: **User Interface Functions** - Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise a new one is created and returned. Arguments that are not set to None are applied to the Widget. """ + # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget() def imagewidget( + *, edit: bauiv1.Widget | None = None, parent: bauiv1.Widget | None = None, size: Sequence[float] | None = None, @@ -396,15 +442,15 @@ def imagewidget( tilt_scale: float | None = None, mask_texture: bauiv1.Texture | None = None, radial_amount: float | None = None, + draw_controller_mult: float | None = None, ) -> bauiv1.Widget: """Create or edit an image widget. - Category: **User Interface Functions** - Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise a new one is created and returned. Arguments that are not set to None are applied to the Widget. """ + # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget() @@ -412,12 +458,35 @@ def imagewidget( def is_available() -> bool: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return bool() -def is_party_icon_visible() -> bool: +def on_ui_scale_change() -> None: """(internal)""" - return bool() + # This is a dummy stub; the actual implementation is native code. + return None + + +def root_ui_back_press() -> None: + """(internal)""" + # This is a dummy stub; the actual implementation is native code. + return None + + +def root_ui_pause_updates() -> None: + """Temporarily pause updates to the root ui for animation purposes. + Make sure that each call to this is matched by a call to + root_ui_resume_updates(). + """ + # This is a dummy stub; the actual implementation is native code. + return None + + +def root_ui_resume_updates() -> None: + """Resume paused updates to the root ui for animation purposes.""" + # This is a dummy stub; the actual implementation is native code. + return None def rowwidget( @@ -429,23 +498,22 @@ def rowwidget( selected_child: bauiv1.Widget | None = None, visible_child: bauiv1.Widget | None = None, claims_left_right: bool | None = None, - claims_tab: bool | None = None, selection_loops_to_parent: bool | None = None, ) -> bauiv1.Widget: """Create or edit a row widget. - Category: **User Interface Functions** - Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise a new one is created and returned. Arguments that are not set to None are applied to the Widget. """ + # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget() def scrollwidget( + *, edit: bauiv1.Widget | None = None, parent: bauiv1.Widget | None = None, size: Sequence[float] | None = None, @@ -455,6 +523,7 @@ def scrollwidget( capture_arrows: bool = False, on_select_call: Callable | None = None, center_small_content: bool | None = None, + center_small_content_horizontally: bool | None = None, color: Sequence[float] | None = None, highlight: bool | None = None, border_opacity: float | None = None, @@ -462,33 +531,49 @@ def scrollwidget( selection_loops_to_parent: bool | None = None, claims_left_right: bool | None = None, claims_up_down: bool | None = None, - claims_tab: bool | None = None, autoselect: bool | None = None, ) -> bauiv1.Widget: """Create or edit a scroll widget. - Category: **User Interface Functions** - Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise a new one is created and returned. Arguments that are not set to None are applied to the Widget. """ + # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget() -def set_party_icon_always_visible(value: bool) -> None: - """(internal)""" - return None - - def set_party_window_open(value: bool) -> None: """(internal)""" + # This is a dummy stub; the actual implementation is native code. return None +def spinnerwidget( + *, + edit: bauiv1.Widget | None = None, + parent: bauiv1.Widget | None = None, + size: float | None = None, + position: Sequence[float] | None = None, + style: Literal['bomb', 'simple'] | None = None, + visible: bool | None = None, +) -> bauiv1.Widget: + """Create or edit a spinner widget. + + Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise + a new one is created and returned. Arguments that are not set to None + are applied to the Widget. + """ + # This is a dummy stub; the actual implementation is native code. + import bauiv1 # pylint: disable=cyclic-import + + return bauiv1.Widget() + + def textwidget( + *, edit: bauiv1.Widget | None = None, parent: bauiv1.Widget | None = None, size: Sequence[float] | None = None, @@ -532,22 +617,16 @@ def textwidget( ) -> bauiv1.Widget: """Create or edit a text widget. - Category: **User Interface Functions** - Pass a valid existing bauiv1.Widget as 'edit' to modify it; otherwise a new one is created and returned. Arguments that are not set to None are applied to the Widget. """ + # This is a dummy stub; the actual implementation is native code. import bauiv1 # pylint: disable=cyclic-import return bauiv1.Widget() -def toolbar_test() -> bool: - """(internal)""" - return bool() - - def uibounds() -> tuple[float, float, float, float]: """(internal) @@ -556,11 +635,13 @@ def uibounds() -> tuple[float, float, float, float]: bauiv1.ContainerWidget's stack_offset value while guaranteeing that its center remains onscreen. """ + # This is a dummy stub; the actual implementation is native code. return (0.0, 0.0, 0.0, 0.0) def widget( - edit: bauiv1.Widget | None = None, + *, + edit: bauiv1.Widget, up_widget: bauiv1.Widget | None = None, down_widget: bauiv1.Widget | None = None, left_widget: bauiv1.Widget | None = None, @@ -569,12 +650,12 @@ def widget( show_buffer_bottom: float | None = None, show_buffer_left: float | None = None, show_buffer_right: float | None = None, + depth_range: tuple[float, float] | None = None, autoselect: bool | None = None, ) -> None: """Edit common attributes of any widget. - Category: **User Interface Functions** - Unlike other UI calls, this can only be used to edit, not to create. """ + # This is a dummy stub; the actual implementation is native code. return None From a2cf2bfcb6c864f28865e3d3807a68564fdd53b1 Mon Sep 17 00:00:00 2001 From: Ayush Saini <36878972+imayushsaini@users.noreply.github.com> Date: Sun, 13 Apr 2025 12:17:10 +0530 Subject: [PATCH 2/2] bug fixes, servermanager link in stats, toml to json config --- config.json | 44 +++++ config.toml | 175 ------------------ dist/ba_root/mods/custom_hooks.py | 14 +- dist/ba_root/mods/defaults/config.toml | 34 ++-- dist/ba_root/mods/features/afk_check.py | 2 +- dist/ba_root/mods/features/votingmachine.py | 7 +- .../ba_root/mods/plugins/bombsquad_service.py | 11 +- .../ba_root/mods/plugins/character_chooser.py | 7 +- 8 files changed, 88 insertions(+), 206 deletions(-) create mode 100644 config.json delete mode 100644 config.toml diff --git a/config.json b/config.json new file mode 100644 index 0000000..3c0dea9 --- /dev/null +++ b/config.json @@ -0,0 +1,44 @@ +{ + "party_name":"BombSquad Community Server", + "party_is_public":true, + "authenticate_clients":true, + "admins":[ + "pb-yOuRAccOuNtIdHErE", + "pb-aNdMayBeAnotherHeRE" + ], + "enable_default_kick_voting":true, + "port":43210, + "max_party_size":6, + "session_max_players_override":8, + "session_type":"ffa", + "playlist_code":12345, + "playlist_shuffle":true, + "auto_balance_teams":true, + "enable_telnet":false, + "teams_series_length":7, + "ffa_series_length":24, + "stats_url":"https://discord.gg/ucyaesh", + "clean_exit_minutes":60, + "unclean_exit_minutes":90, + "idle_exit_minutes":20, + "show_tutorial":false, + "team_names":[ + "ladoo", + "barfi" + ], + "team_colors":[ + [ + 0.8, + 0.0, + 0.6 + ], + [ + 0, + 1, + 0.8 + ] + ], + "enable_queue":true, + "protocol_version":35, + "player_rejoin_cooldown":10.0 +} \ No newline at end of file diff --git a/config.toml b/config.toml deleted file mode 100644 index ed5a203..0000000 --- a/config.toml +++ /dev/null @@ -1,175 +0,0 @@ -# To configure your server, create a config.toml file in the same directory -# as the ballisticakit_server script. The config_template.toml file can be -# copied or renamed as a convenient starting point. - -# Uncomment any of these values to override defaults. - -# Name of our server in the public parties list. -party_name = "BombSquad Community Server" - -# If true, your party will show up in the global public party list -# Otherwise it will still be joinable via LAN or connecting by IP -# address. -#party_is_public = true - -# If true, all connecting clients will be authenticated through the -# master server to screen for fake account info. Generally this -# should always be enabled unless you are hosting on a LAN with no -# internet connection. -#authenticate_clients = true - -# IDs of server admins. Server admins are not kickable through the -# default kick vote system and they are able to kick players without -# a vote. To get your account id, enter 'getaccountid' in -# settings->advanced->enter-code. -#admins = ["pb-yOuRAccOuNtIdHErE", "pb-aNdMayBeAnotherHeRE"] - -# Whether the default kick-voting system is enabled. -#enable_default_kick_voting = true - -# To be included in the public server list, your server MUST be -# accessible via an ipv4 address. By default, the master server will -# try to use the address your server contacts it from, but this may -# be an ipv6 address these days so you may need to provide an ipv4 -# address explicitly. -#public_ipv4_address = "123.123.123.123" - -# You can optionally provide an ipv6 address for your server for the -# public server list. Unlike ipv4, a server is not required to have -# an ipv6 address to appear in the list, but is still good to -# provide when available since more and more devices are using ipv6 -# these days. Your server's ipv6 address will be autodetected if -# your server uses ipv6 when communicating with the master server. You -# can pass an empty string here to explicitly disable the ipv6 -# address. -#public_ipv6_address = "123A::A123:23A1:A312:12A3:A213:2A13" - -# UDP port to host on. Change this to work around firewalls or run -# multiple servers on one machine. -# -# 43210 is the default and the only port that will show up in the -# LAN browser tab. -#port = 43210 - -# Max devices in the party. Note that this does *NOT* mean max -# players. Any device in the party can have more than one player on -# it if they have multiple controllers. Also, this number currently -# includes the server so generally make it 1 bigger than you need. -#max_party_size = 6 - -# Max players that can join a session. If present this will override -# the session's preferred max_players. if a value below 0 is given -# player limit will be removed. -#session_max_players_override = 8 - -# Options here are 'ffa' (free-for-all), 'teams' and 'coop' -# (cooperative) This value is ignored if you supply a playlist_code -# (see below). -#session_type = "ffa" - -# Playlist-code for teams or free-for-all mode sessions. To host -# your own custom playlists, use the 'share' functionality in the -# playlist editor in the regular version of the game. This will give -# you a numeric code you can enter here to host that playlist. -#playlist_code = 12345 - -# Alternately, you can embed playlist data here instead of using -# codes. Make sure to set session_type to the correct type for the -# data here. -#playlist_inline = [] - -# Whether to shuffle the playlist or play its games in designated -# order. -#playlist_shuffle = true - -# If true, keeps team sizes equal by disallowing joining the largest -# team (teams mode only). -#auto_balance_teams = true - -# The campaign used when in co-op session mode. Do -# print(ba.app.campaigns) to see available campaign names. -#coop_campaign = "Easy" - -# The level name within the campaign used in co-op session mode. For -# campaign name FOO, do print(ba.app.campaigns['FOO'].levels) to see -# available level names. -#coop_level = "Onslaught Training" - -# Whether to enable telnet access. -# -# IMPORTANT: This option is no longer available, as it was being -# used for exploits. Live access to the running server is still -# possible through the mgr.cmd() function in the server script. Run -# your server through tools such as 'screen' or 'tmux' and you can -# reconnect to it remotely over a secure ssh connection. -#enable_telnet = false - -# Series length in teams mode (7 == 'best-of-7' series; a team must -# get 4 wins) -#teams_series_length = 7 - -# Points to win in free-for-all mode (Points are awarded per game -# based on performance) -#ffa_series_length = 24 - -# If you have a custom stats webpage for your server, you can use -# this to provide a convenient in-game link to it in the -# server-browser alongside the server name. -# -# if ${ACCOUNT} is present in the string, it will be replaced by the -# currently-signed-in account's id. To fetch info about an account, -# your back-end server can use the following url: -# https://legacy.ballistica.net/accountquery?id=ACCOUNT_ID_HERE -stats_url = "https://discord.gg/ucyaesh" - -# If present, the server subprocess will attempt to gracefully exit -# after this amount of time. A graceful exit can occur at the end of -# a series or other opportune time. Server-managers set to -# auto-restart (the default) will then spin up a fresh subprocess. -# This mechanism can be useful to clear out any memory leaks or -# other accumulated bad state in the server subprocess. -#clean_exit_minutes = 60 - -# If present, the server subprocess will shut down immediately after -# this amount of time. This can be useful as a fallback for -# clean_exit_time. The server manager will then spin up a fresh -# server subprocess if auto-restart is enabled (the default). -#unclean_exit_minutes = 90 - -# If present, the server subprocess will shut down immediately if -# this amount of time passes with no activity from any players. The -# server manager will then spin up a fresh server subprocess if -# auto-restart is enabled (the default). -#idle_exit_minutes = 20 - -# Should the tutorial be shown at the beginning of games? -#show_tutorial = false - -# Team names (teams mode only). -team_names = ["ladoo", "barfi"] - -# Team colors (teams mode only). -team_colors = [[0.8, 0.0, 0.6], [0, 1, 0.8]] - -# Whether to enable the queue where players can line up before -# entering your server. Disabling this can be used as a workaround -# to deal with queue spamming attacks. -#enable_queue = true - -# Protocol version we host with. Currently the default is 33 which -# still allows older 1.4 game clients to connect. Explicitly setting -# to 35 no longer allows those clients but adds/fixes a few things -# such as making camera shake properly work in net games. -#protocol_version = 35 - -# How many seconds individual players from a given account must wait -# before rejoining the game. This can help suppress exploits -# involving leaving and rejoining or switching teams rapidly. -#player_rejoin_cooldown = 10.0 - -# Log levels for particular loggers, overriding the engine's -# defaults. Valid values are NOTSET, DEBUG, INFO, WARNING, ERROR, or -# CRITICAL. -#[log_levels] -#"ba.lifecycle" = "INFO" -#"ba.assets" = "INFO" \ No newline at end of file diff --git a/dist/ba_root/mods/custom_hooks.py b/dist/ba_root/mods/custom_hooks.py index 3461b58..622a332 100644 --- a/dist/ba_root/mods/custom_hooks.py +++ b/dist/ba_root/mods/custom_hooks.py @@ -381,7 +381,19 @@ def on_player_request(func) -> bool: Session.on_player_request = on_player_request(Session.on_player_request) -ServerController._access_check_response = servercontroller._access_check_response + +def on_access_check_response(self, data): + if data is not None: + addr = data['address'] + port = data['port'] + if settings["ballistica_web"]["enable"]: + bs.set_public_party_stats_url( + f'https://bombsquad-community.web.app/server-manager/?host={addr}&port={port}') + + servercontroller._access_check_response(self, data) + + +ServerController._access_check_response = on_access_check_response def wrap_player_spaz_init(original_class): diff --git a/dist/ba_root/mods/defaults/config.toml b/dist/ba_root/mods/defaults/config.toml index a64cdc3..d7efc42 100644 --- a/dist/ba_root/mods/defaults/config.toml +++ b/dist/ba_root/mods/defaults/config.toml @@ -10,13 +10,13 @@ party_name = "BombSquad Community Server" # If true, your party will show up in the global public party list # Otherwise it will still be joinable via LAN or connecting by IP # address. -#party_is_public = true +party_is_public = true # If true, all connecting clients will be authenticated through the # master server to screen for fake account info. Generally this # should always be enabled unless you are hosting on a LAN with no # internet connection. -#authenticate_clients = true +authenticate_clients = true # IDs of server admins. Server admins are not kickable through the default # kick vote system and they are able to kick players without a vote. To get @@ -24,7 +24,7 @@ party_name = "BombSquad Community Server" admins = ["pb-yOuRAccOuNtIdHErE", "pb-aNdMayBeAnotherHeRE"] # Whether the default kick-voting system is enabled. -#enable_default_kick_voting = true +enable_default_kick_voting = true # To be included in the public server list, your server MUST be # accessible via an ipv4 address. By default, the master server will @@ -48,23 +48,23 @@ admins = ["pb-yOuRAccOuNtIdHErE", "pb-aNdMayBeAnotherHeRE"] # # 43210 is the default and the only port that will show up in the # LAN browser tab. -#port = 43210 +port = 43210 # Max devices in the party. Note that this does *NOT* mean max # players. Any device in the party can have more than one player on # it if they have multiple controllers. Also, this number currently # includes the server so generally make it 1 bigger than you need. -#max_party_size = 6 +max_party_size = 6 # Max players that can join a session. If present this will override # the session's preferred max_players. if a value below 0 is given # player limit will be removed. -#session_max_players_override = 8 +session_max_players_override = 8 # Options here are 'ffa' (free-for-all), 'teams' and 'coop' # (cooperative) This value is ignored if you supply a playlist_code # (see below). -#session_type = "ffa" +session_type = "ffa" # Playlist-code for teams or free-for-all mode sessions. # To host your own custom playlists, use the 'share' functionality in the @@ -80,11 +80,11 @@ playlist_code = 12345 # Whether to shuffle the playlist or play its games in designated # order. -#playlist_shuffle = true +playlist_shuffle = true # If true, keeps team sizes equal by disallowing joining the largest # team (teams mode only). -#auto_balance_teams = true +auto_balance_teams = true # The campaign used when in co-op session mode. Do # print(ba.app.campaigns) to see available campaign names. @@ -102,7 +102,7 @@ playlist_code = 12345 # possible through the mgr.cmd() function in the server script. Run # your server through tools such as 'screen' or 'tmux' and you can # reconnect to it remotely over a secure ssh connection. -#enable_telnet = false +enable_telnet = false # Series length in teams mode (7 == 'best-of-7' series; a team must # get 4 wins) @@ -128,22 +128,22 @@ stats_url = "https://discord.gg/ucyaesh" # auto-restart (the default) will then spin up a fresh subprocess. # This mechanism can be useful to clear out any memory leaks or # other accumulated bad state in the server subprocess. -#clean_exit_minutes = 60 +clean_exit_minutes = 60 # If present, the server subprocess will shut down immediately after # this amount of time. This can be useful as a fallback for # clean_exit_time. The server manager will then spin up a fresh # server subprocess if auto-restart is enabled (the default). -#unclean_exit_minutes = 90 +unclean_exit_minutes = 90 # If present, the server subprocess will shut down immediately if # this amount of time passes with no activity from any players. The # server manager will then spin up a fresh server subprocess if # auto-restart is enabled (the default). -#idle_exit_minutes = 20 +idle_exit_minutes = 20 # Should the tutorial be shown at the beginning of games? -#show_tutorial = false +show_tutorial = false # Team names (teams mode only). team_names = ["ladoo", "barfi"] @@ -154,15 +154,15 @@ team_colors = [[0.8, 0.0, 0.6], [0, 1, 0.8]] # Whether to enable the queue where players can line up before # entering your server. Disabling this can be used as a workaround # to deal with queue spamming attacks. -#enable_queue = true +enable_queue = true # Protocol version we host with. Currently the default is 33 which # still allows older 1.4 game clients to connect. Explicitly setting # to 35 no longer allows those clients but adds/fixes a few things # such as making camera shake properly work in net games. -#protocol_version = 35 +protocol_version = 35 # How many seconds individual players from a given account must wait # before rejoining the game. This can help suppress exploits # involving leaving and rejoining or switching teams rapidly. -#player_rejoin_cooldown = 10.0 +player_rejoin_cooldown = 10.0 diff --git a/dist/ba_root/mods/features/afk_check.py b/dist/ba_root/mods/features/afk_check.py index 9a556f8..680eb72 100644 --- a/dist/ba_root/mods/features/afk_check.py +++ b/dist/ba_root/mods/features/afk_check.py @@ -15,7 +15,7 @@ cLastIdle = 0 class checkIdle(object): def start(self): - self.t1 = bs.timer(2, babase.Call(self.check), repeat=True) + self.t1 = bs.AppTimer(2, babase.Call(self.check), repeat=True) self.lobbies = {} def check(self): diff --git a/dist/ba_root/mods/features/votingmachine.py b/dist/ba_root/mods/features/votingmachine.py index 1c4e3c7..581a337 100644 --- a/dist/ba_root/mods/features/votingmachine.py +++ b/dist/ba_root/mods/features/votingmachine.py @@ -3,6 +3,7 @@ import time import _babase +import _bascenev1 import bascenev1 as bs @@ -81,11 +82,11 @@ def vote(pb_id, client_id, vote_type): except: pass elif vote_type == "nv": - _babase.chatmessage("/nv") + _bascenev1.chatmessage("/nv") elif vote_type == "dv": - _babase.chatmessage("/dv") + _bascenev1.chatmessage("/dv") elif vote_type == "sm": - _babase.chatmessage("/sm") + _bascenev1.chatmessage("/sm") def reset_votes(): diff --git a/dist/ba_root/mods/plugins/bombsquad_service.py b/dist/ba_root/mods/plugins/bombsquad_service.py index 8e8eaa5..816d197 100644 --- a/dist/ba_root/mods/plugins/bombsquad_service.py +++ b/dist/ba_root/mods/plugins/bombsquad_service.py @@ -16,6 +16,7 @@ from typing import Type import babase import bascenev1 as bs from tools import servercheck, logger, notification_manager +from tools.file_handle import OpenJson stats = {} leaderboard = {} @@ -29,7 +30,7 @@ class BsDataThread(object): global stats stats["name"] = _babase.app.classic.server._config.party_name stats["discord"] = get_server_settings( - )["ballistica_web"]["server_password"] + )["ballistica_web"]["discord_link"] stats["vapidKey"] = notification_manager.get_vapid_keys()["public_key"] self.refresh_stats_cache_timer = bs.AppTimer(8, babase.Call( @@ -117,7 +118,7 @@ class BsDataThread(object): return data -v = bs.AppTimer(5, babase.Call( +v = bs.AppTimer(8, babase.Call( BsDataThread)) @@ -273,10 +274,10 @@ def get_server_config(): def update_server_config(config): current_dir = os.getcwd() - file_path = os.path.join(current_dir, '..', 'config.yaml') + file_path = os.path.join(current_dir, '..', 'config.json') - with open(file_path, "w") as f: - f.write(yaml.dump(config)) + with OpenJson(file_path) as f: + f.dump(config, indent=4) def do_action(action, value): diff --git a/dist/ba_root/mods/plugins/character_chooser.py b/dist/ba_root/mods/plugins/character_chooser.py index 33955e1..c89cfbe 100644 --- a/dist/ba_root/mods/plugins/character_chooser.py +++ b/dist/ba_root/mods/plugins/character_chooser.py @@ -1,4 +1,4 @@ -# ba_meta require api 8 +# ba_meta require api 9 ''' Character Chooser by Mr.Smoothy @@ -36,7 +36,6 @@ from typing import TYPE_CHECKING import babase import bauiv1 as bui -from babase._error import print_error from babase._language import Lstr if TYPE_CHECKING: @@ -248,11 +247,11 @@ def handlemessage(self, msg: Any) -> Any: # If we've been removed from the lobby, ignore this stuff. if self._dead: - print_error('chooser got ChangeMessage after dying') + print('chooser got ChangeMessage after dying') return if not self._text_node: - print_error('got ChangeMessage after nodes died') + print('got ChangeMessage after nodes died') return if msg.what == 'characterchooser': self._click_sound.play()