more stuff

This commit is contained in:
Roman Trapeznikov 2022-02-22 20:14:25 +03:00
parent 1672dec60d
commit 80756a1444
No known key found for this signature in database
GPG Key ID: 89BED52F1E290F8D
58 changed files with 589 additions and 689 deletions

View File

@ -1 +1 @@
93799056966445196696254000169758935495 251300217209184493283326875275347381659

View File

@ -79,7 +79,7 @@ class CollideModel:
Category: **Asset Classes** Category: **Asset Classes**
Use ba.getcollidemodel to instantiate one. Use ba.getcollidemodel() to instantiate one.
""" """
pass pass
@ -89,7 +89,7 @@ class Context:
Category: **General Utility Classes** Category: **General Utility Classes**
Many operations such as ba.newnode or ba.gettexture operate Many operations such as ba.newnode() or ba.gettexture() operate
implicitly on the current context. Each ba.Activity has its own implicitly on the current context. Each ba.Activity has its own
Context and objects within that activity (nodes, media, etc) can only Context and objects within that activity (nodes, media, etc) can only
interact with other objects from that context. interact with other objects from that context.
@ -104,7 +104,7 @@ class Context:
When instantiating a ba.Context instance, a single `'source'` argument When instantiating a ba.Context instance, a single `'source'` argument
is passed, which can be one of the following strings/objects: is passed, which can be one of the following strings/objects:
`'empty'`: ###### `'empty'`
> Gives an empty context; it can be handy to run code here to ensure > Gives an empty context; it can be handy to run code here to ensure
it does no loading of media, creation of nodes, etc. it does no loading of media, creation of nodes, etc.
@ -199,7 +199,7 @@ class Data:
Category: **Asset Classes** Category: **Asset Classes**
Use ba.getdata to instantiate one. Use ba.getdata() to instantiate one.
""" """
def getvalue(self) -> Any: def getvalue(self) -> Any:
@ -309,21 +309,21 @@ class InputDevice:
class Material: class Material:
"""An entity applied to game objects to modify collision behavior. """An entity applied to game objects to modify collision behavior.
Category: Gameplay Classes Category: **Gameplay Classes**
A material can affect physical characteristics, generate sounds, A material can affect physical characteristics, generate sounds,
or trigger callback functions when collisions occur. or trigger callback functions when collisions occur.
Materials are applied to ``'parts'``, which are groups of one or more Materials are applied to 'parts', which are groups of one or more
rigid bodies created as part of a ba.Node. Nodes can have any number rigid bodies created as part of a ba.Node. Nodes can have any number
of parts, each with its own set of materials. Generally materials are of parts, each with its own set of materials. Generally materials are
specified as array attributes on the Node. The ``'spaz'`` node, for specified as array attributes on the Node. The `spaz` node, for
example, has various attributes such as ``'materials'``, example, has various attributes such as `materials`,
``'roller_materials'``, and ``'punch_materials'``, which correspond `roller_materials`, and `punch_materials`, which correspond
to the various parts it creates. to the various parts it creates.
Use ba.Material to instantiate a blank material, and then use its Use ba.Material to instantiate a blank material, and then use its
ba.Material.add_actions method to define what the material does. ba.Material.add_actions() method to define what the material does.
""" """
def __init__(self, label: str = None): def __init__(self, label: str = None):
@ -399,7 +399,7 @@ class Material:
`'at_connect'` or `'at_disconnect'`, and `message_obj` is the message `'at_connect'` or `'at_disconnect'`, and `message_obj` is the message
object to send. object to send.
This has the same effect as calling the node's This has the same effect as calling the node's
ba.Node.handlemessage method. ba.Node.handlemessage() method.
###### `('modify_part_collision', attr, value)` ###### `('modify_part_collision', attr, value)`
> Changes some > Changes some
@ -420,6 +420,7 @@ class Material:
how springy the physical response is), `'damping'` (float how springy the physical response is), `'damping'` (float
value, how damped the physical response is), `'bounce'` (float value, how damped the physical response is), `'bounce'` (float
value; how bouncy the physical response is). value; how bouncy the physical response is).
###### `('modify_node_collision', attr, value)` ###### `('modify_node_collision', attr, value)`
> Similar to > Similar to
`modify_part_collision`, but operates at a node-level. `modify_part_collision`, but operates at a node-level.
@ -466,7 +467,6 @@ class Material:
**Example 2:** send a ba.DieMessage to anything we touch, but cause **Example 2:** send a ba.DieMessage to anything we touch, but cause
no physical response. This should cause any ba.Actor to drop dead: no physical response. This should cause any ba.Actor to drop dead:
```python
>>> m = ba.Material() >>> m = ba.Material()
... m.add_actions( ... m.add_actions(
... actions=(('modify_part_collision', 'physical', False), ... actions=(('modify_part_collision', 'physical', False),
@ -474,7 +474,6 @@ class Material:
... ba.DieMessage()))) ... ba.DieMessage())))
**Example 3:** play some sounds when we're contacting the ground: **Example 3:** play some sounds when we're contacting the ground:
```python
>>> m = ba.Material() >>> m = ba.Material()
... m.add_actions( ... m.add_actions(
... conditions=('they_have_material', ... conditions=('they_have_material',
@ -499,7 +498,7 @@ class Model:
class Node: class Node:
"""Reference to a Node; the low level building block of the game. """Reference to a Node; the low level building block of the game.
Category: Gameplay Classes Category: **Gameplay Classes**
At its core, a game is nothing more than a scene of Nodes At its core, a game is nothing more than a scene of Nodes
with attributes getting interconnected or set over time. with attributes getting interconnected or set over time.
@ -508,8 +507,8 @@ class Node:
to a game node; *not* the node itself. This means a Node's to a game node; *not* the node itself. This means a Node's
lifecycle is completely independent of how many Python references lifecycle is completely independent of how many Python references
to it exist. To explicitly add a new node to the game, use to it exist. To explicitly add a new node to the game, use
ba.newnode, and to explicitly delete one, use ba.Node.delete. ba.newnode(), and to explicitly delete one, use ba.Node.delete().
ba.Node.exists can be used to determine if a Node still points to ba.Node.exists() can be used to determine if a Node still points to
a live node in the game. a live node in the game.
You can use ba.Node(None) to instantiate an invalid You can use ba.Node(None) to instantiate an invalid
@ -741,7 +740,7 @@ class SessionPlayer:
Be aware that, like ba.Nodes, ba.SessionPlayer objects are 'weak' Be aware that, like ba.Nodes, ba.SessionPlayer objects are 'weak'
references under-the-hood; a player can leave the game at references under-the-hood; a player can leave the game at
any point. For this reason, you should make judicious use of the any point. For this reason, you should make judicious use of the
ba.SessionPlayer.exists method (or boolean operator) to ensure ba.SessionPlayer.exists() method (or boolean operator) to ensure
that a SessionPlayer is still present if retaining references to one that a SessionPlayer is still present if retaining references to one
for any length of time. for any length of time.
""" """
@ -858,7 +857,7 @@ class Sound:
Category: **Asset Classes** Category: **Asset Classes**
Use ba.getsound to instantiate one. Use ba.getsound() to instantiate one.
""" """
pass pass
@ -1044,7 +1043,7 @@ class Widget:
This class represents a weak reference to a widget object This class represents a weak reference to a widget object
in the internal C++ layer. Currently, functions such as in the internal C++ layer. Currently, functions such as
ba.buttonwidget must be used to instantiate or edit these. ba.buttonwidget() must be used to instantiate or edit these.
""" """
def activate(self) -> None: def activate(self) -> None:
@ -1319,7 +1318,7 @@ def clipboard_get_text() -> str:
Category: **General Utility Functions** Category: **General Utility Functions**
Ensure that ba.clipboard_has_text returns True before calling Ensure that ba.clipboard_has_text() returns True before calling
this function. this function.
""" """
return str() return str()
@ -1352,7 +1351,7 @@ def clipboard_set_text(value: str) -> None:
Category: **General Utility Functions** Category: **General Utility Functions**
Ensure that ba.clipboard_available returns True before adding Ensure that ba.clipboard_available() returns True before adding
buttons/etc. that make use of this functionality. buttons/etc. that make use of this functionality.
""" """
return None return None
@ -3145,7 +3144,7 @@ def timer(time: float,
require the ability to do so, use the ba.Timer class instead. require the ability to do so, use the ba.Timer class instead.
##### Arguments ##### Arguments
###### time (float): ###### time (float)
> Length of time (in seconds by default) that the timer will wait > Length of time (in seconds by default) that the timer will wait
before firing. Note that the actual delay experienced may vary before firing. Note that the actual delay experienced may vary
depending on the timetype. (see below) depending on the timetype. (see below)

View File

@ -18,7 +18,7 @@ if TYPE_CHECKING:
class AccountSubsystem: class AccountSubsystem:
"""Subsystem for account handling in the app. """Subsystem for account handling in the app.
Category: App Classes Category: **App Classes**
Access the single shared instance of this class at 'ba.app.plugins'. Access the single shared instance of this class at 'ba.app.plugins'.
""" """

View File

@ -65,7 +65,7 @@ ACH_LEVEL_NAMES = {
class AchievementSubsystem: class AchievementSubsystem:
"""Subsystem for achievement handling. """Subsystem for achievement handling.
Category: App Classes Category: **App Classes**
Access the single shared instance of this class at 'ba.app.ach'. Access the single shared instance of this class at 'ba.app.ach'.
""" """
@ -436,7 +436,7 @@ def _display_next_achievement() -> None:
class Achievement: class Achievement:
"""Represents attributes and state for an individual achievement. """Represents attributes and state for an individual achievement.
Category: App Classes Category: **App Classes**
""" """
def __init__(self, def __init__(self,

View File

@ -362,7 +362,7 @@ class Activity(DependencyComponent, Generic[PlayerType, TeamType]):
def on_transition_out(self) -> None: def on_transition_out(self) -> None:
"""Called when your activity begins transitioning out. """Called when your activity begins transitioning out.
Note that this may happen at any time even if ba.Activity.end has Note that this may happen at any time even if ba.Activity.end() has
not been called. not been called.
""" """
@ -379,11 +379,12 @@ class Activity(DependencyComponent, Generic[PlayerType, TeamType]):
return UNHANDLED return UNHANDLED
def has_transitioned_in(self) -> bool: def has_transitioned_in(self) -> bool:
"""Return whether ba.Activity.on_transition_in has been called.""" """Return whether ba.Activity.on_transition_in()
has been called."""
return self._has_transitioned_in return self._has_transitioned_in
def has_begun(self) -> bool: def has_begun(self) -> bool:
"""Return whether ba.Activity.on_begin has been called.""" """Return whether ba.Activity.on_begin() has been called."""
return self._has_begun return self._has_begun
def has_ended(self) -> bool: def has_ended(self) -> bool:
@ -391,7 +392,7 @@ class Activity(DependencyComponent, Generic[PlayerType, TeamType]):
return self._has_ended return self._has_ended
def is_transitioning_out(self) -> bool: def is_transitioning_out(self) -> bool:
"""Return whether ba.Activity.on_transition_out has been called.""" """Return whether ba.Activity.on_transition_out() has been called."""
return self._transitioning_out return self._transitioning_out
def transition_in(self, prev_globals: Optional[ba.Node]) -> None: def transition_in(self, prev_globals: Optional[ba.Node]) -> None:

View File

@ -21,7 +21,7 @@ TA = TypeVar('TA', bound='Actor')
class Actor: class Actor:
"""High level logical entities in a ba.Activity. """High level logical entities in a ba.Activity.
Category: Gameplay Classes Category: **Gameplay Classes**
Actors act as controllers, combining some number of ba.Nodes, Actors act as controllers, combining some number of ba.Nodes,
ba.Textures, ba.Sounds, etc. into a high-level cohesive unit. ba.Textures, ba.Sounds, etc. into a high-level cohesive unit.
@ -33,18 +33,16 @@ class Actor:
(killing off or transitioning out their nodes) when the last Python (killing off or transitioning out their nodes) when the last Python
reference to them disappears, so you can use logic such as: reference to them disappears, so you can use logic such as:
Example: ##### Example
```python >>> # Create a flag Actor in our game activity:
>>> # Create a flag Actor in our game activity: ... from bastd.actor.flag import Flag
... from bastd.actor.flag import Flag ... self.flag = Flag(position=(0, 10, 0))
... self.flag = Flag(position=(0, 10, 0)) ...
... ... # Later, destroy the flag.
... # Later, destroy the flag. ... # (provided nothing else is holding a reference to it)
... # (provided nothing else is holding a reference to it) ... # We could also just assign a new flag to this value.
... # We could also just assign a new flag to this value. ... # Either way, the old flag disappears.
... # Either way, the old flag disappears. ... self.flag = None
... self.flag = None
```
This is in contrast to the behavior of the more low level ba.Nodes, This is in contrast to the behavior of the more low level ba.Nodes,
which are always explicitly created and destroyed and don't care which are always explicitly created and destroyed and don't care
@ -54,20 +52,18 @@ class Actor:
if you want an Actor to stick around until explicitly killed if you want an Actor to stick around until explicitly killed
regardless of references. regardless of references.
Another key feature of ba.Actor is its ba.Actor.handlemessage method, which Another key feature of ba.Actor is its ba.Actor.handlemessage() method, which
takes a single arbitrary object as an argument. This provides a safe way takes a single arbitrary object as an argument. This provides a safe way
to communicate between ba.Actor, ba.Activity, ba.Session, and any other to communicate between ba.Actor, ba.Activity, ba.Session, and any other
class providing a handlemessage() method. The most universally handled class providing a handlemessage() method. The most universally handled
message type for Actors is the ba.DieMessage. message type for Actors is the ba.DieMessage.
Another way to kill the flag from the example above: Another way to kill the flag from the example above:
We can safely call this on any type with a 'handlemessage' method We can safely call this on any type with a 'handlemessage' method
(though its not guaranteed to always have a meaningful effect). (though its not guaranteed to always have a meaningful effect).
In this case the Actor instance will still be around, but its exists() In this case the Actor instance will still be around, but its
and is_alive() methods will both return False. ba.Actor.exists() and ba.Actor.is_alive() methods will both return False.
```python
>>> self.flag.handlemessage(ba.DieMessage()) >>> self.flag.handlemessage(ba.DieMessage())
```
""" """
def __init__(self) -> None: def __init__(self) -> None:

View File

@ -15,7 +15,7 @@ if TYPE_CHECKING:
class AdsSubsystem: class AdsSubsystem:
"""Subsystem for ads functionality in the app. """Subsystem for ads functionality in the app.
Category: App Classes Category: **App Classes**
Access the single shared instance of this class at 'ba.app.ads'. Access the single shared instance of this class at 'ba.app.ads'.
""" """

View File

@ -27,7 +27,7 @@ if TYPE_CHECKING:
class App: class App:
"""A class for high level app functionality and state. """A class for high level app functionality and state.
Category: App Classes Category: **App Classes**
Use ba.app to access the single shared instance of this class. Use ba.app to access the single shared instance of this class.

View File

@ -14,7 +14,7 @@ if TYPE_CHECKING:
class AppConfig(dict): class AppConfig(dict):
"""A special dict that holds the game's persistent configuration values. """A special dict that holds the game's persistent configuration values.
Category: App Classes Category: **App Classes**
It also provides methods for fetching values with app-defined fallback It also provides methods for fetching values with app-defined fallback
defaults, applying contained values to the game, and committing the defaults, applying contained values to the game, and committing the
@ -155,7 +155,7 @@ def read_config() -> tuple[AppConfig, bool]:
def commit_app_config(force: bool = False) -> None: def commit_app_config(force: bool = False) -> None:
"""Commit the config to persistent storage. """Commit the config to persistent storage.
Category: General Utility Functions Category: **General Utility Functions**
(internal) (internal)
""" """

View File

@ -25,7 +25,7 @@ def getcampaign(name: str) -> ba.Campaign:
class Campaign: class Campaign:
"""Represents a unique set or series of ba.Level-s. """Represents a unique set or series of ba.Level-s.
Category: App Classes Category: **App Classes**
""" """
def __init__(self, name: str, sequential: bool = True): def __init__(self, name: str, sequential: bool = True):

View File

@ -16,7 +16,7 @@ if TYPE_CHECKING:
class Collision: class Collision:
"""A class providing info about occurring collisions. """A class providing info about occurring collisions.
Category: Gameplay Classes Category: **Gameplay Classes**
""" """
@property @property
@ -67,6 +67,6 @@ _collision = Collision()
def getcollision() -> Collision: def getcollision() -> Collision:
"""Return the in-progress collision. """Return the in-progress collision.
Category: Gameplay Functions Category: **Gameplay Functions**
""" """
return _collision return _collision

View File

@ -21,7 +21,7 @@ TeamType = TypeVar('TeamType', bound='ba.Team')
class CoopGameActivity(GameActivity[PlayerType, TeamType]): class CoopGameActivity(GameActivity[PlayerType, TeamType]):
"""Base class for cooperative-mode games. """Base class for cooperative-mode games.
Category: Gameplay Classes Category: **Gameplay Classes**
""" """
# We can assume our session is a CoopSession. # We can assume our session is a CoopSession.

View File

@ -19,25 +19,23 @@ TEAM_NAMES = ['Good Guys']
class CoopSession(Session): class CoopSession(Session):
"""A ba.Session which runs cooperative-mode games. """A ba.Session which runs cooperative-mode games.
Category: Gameplay Classes Category: **Gameplay Classes**
These generally consist of 1-4 players against These generally consist of 1-4 players against
the computer and include functionality such as the computer and include functionality such as
high score lists. high score lists.
Attributes:
campaign
The ba.Campaign instance this Session represents, or None if
there is no associated Campaign.
""" """
use_teams = True use_teams = True
use_team_colors = False use_team_colors = False
allow_mid_activity_joins = False allow_mid_activity_joins = False
# Note: even though these are instance vars, we annotate them at the # Note: even though these are instance vars, we annotate them at the
# class level so that docs generation can access their types. # class level so that docs generation can access their types.
campaign: Optional[ba.Campaign] campaign: Optional[ba.Campaign]
"""The ba.Campaign instance this Session represents, or None if
there is no associated Campaign."""
def __init__(self) -> None: def __init__(self) -> None:
"""Instantiate a co-op mode session.""" """Instantiate a co-op mode session."""

View File

@ -19,7 +19,7 @@ T = TypeVar('T', bound='DependencyComponent')
class Dependency(Generic[T]): class Dependency(Generic[T]):
"""A dependency on a DependencyComponent (with an optional config). """A dependency on a DependencyComponent (with an optional config).
Category: Dependency Classes Category: **Dependency Classes**
This class is used to request and access functionality provided This class is used to request and access functionality provided
by other DependencyComponent classes from a DependencyComponent class. by other DependencyComponent classes from a DependencyComponent class.
@ -87,7 +87,7 @@ class Dependency(Generic[T]):
class DependencyComponent: class DependencyComponent:
"""Base class for all classes that can act as or use dependencies. """Base class for all classes that can act as or use dependencies.
category: Dependency Classes Category: **Dependency Classes**
""" """
_dep_entry: weakref.ref[DependencyEntry] _dep_entry: weakref.ref[DependencyEntry]
@ -165,7 +165,7 @@ class DependencyEntry:
class DependencySet(Generic[T]): class DependencySet(Generic[T]):
"""Set of resolved dependencies and their associated data. """Set of resolved dependencies and their associated data.
Category: Dependency Classes Category: **Dependency Classes**
To use DependencyComponents, a set must be created, resolved, and then To use DependencyComponents, a set must be created, resolved, and then
loaded. The DependencyComponents are only valid while the set remains loaded. The DependencyComponents are only valid while the set remains
@ -291,7 +291,7 @@ class DependencySet(Generic[T]):
class AssetPackage(DependencyComponent): class AssetPackage(DependencyComponent):
"""ba.DependencyComponent representing a bundled package of game assets. """ba.DependencyComponent representing a bundled package of game assets.
Category: Asset Classes Category: **Asset Classes**
""" """
def __init__(self) -> None: def __init__(self) -> None:

View File

@ -15,7 +15,7 @@ if TYPE_CHECKING:
class DualTeamSession(MultiTeamSession): class DualTeamSession(MultiTeamSession):
"""ba.Session type for teams mode games. """ba.Session type for teams mode games.
Category: Gameplay Classes Category: **Gameplay Classes**
""" """
# Base class overrides: # Base class overrides:

View File

@ -16,7 +16,7 @@ if TYPE_CHECKING:
class DependencyError(Exception): class DependencyError(Exception):
"""Exception raised when one or more ba.Dependency items are missing. """Exception raised when one or more ba.Dependency items are missing.
category: Exception Classes Category: **Exception Classes**
(this will generally be missing assets). (this will generally be missing assets).
""" """
@ -34,7 +34,7 @@ class DependencyError(Exception):
class ContextError(Exception): class ContextError(Exception):
"""Exception raised when a call is made in an invalid context. """Exception raised when a call is made in an invalid context.
category: Exception Classes Category: **Exception Classes**
Examples of this include calling UI functions within an Activity context Examples of this include calling UI functions within an Activity context
or calling scene manipulation functions outside of a game context. or calling scene manipulation functions outside of a game context.
@ -44,91 +44,91 @@ class ContextError(Exception):
class NotFoundError(Exception): class NotFoundError(Exception):
"""Exception raised when a referenced object does not exist. """Exception raised when a referenced object does not exist.
category: Exception Classes Category: **Exception Classes**
""" """
class PlayerNotFoundError(NotFoundError): class PlayerNotFoundError(NotFoundError):
"""Exception raised when an expected ba.Player does not exist. """Exception raised when an expected ba.Player does not exist.
category: Exception Classes Category: **Exception Classes**
""" """
class SessionPlayerNotFoundError(NotFoundError): class SessionPlayerNotFoundError(NotFoundError):
"""Exception raised when an expected ba.SessionPlayer does not exist. """Exception raised when an expected ba.SessionPlayer does not exist.
category: Exception Classes Category: **Exception Classes**
""" """
class TeamNotFoundError(NotFoundError): class TeamNotFoundError(NotFoundError):
"""Exception raised when an expected ba.Team does not exist. """Exception raised when an expected ba.Team does not exist.
category: Exception Classes Category: **Exception Classes**
""" """
class DelegateNotFoundError(NotFoundError): class DelegateNotFoundError(NotFoundError):
"""Exception raised when an expected delegate object does not exist. """Exception raised when an expected delegate object does not exist.
category: Exception Classes Category: **Exception Classes**
""" """
class SessionTeamNotFoundError(NotFoundError): class SessionTeamNotFoundError(NotFoundError):
"""Exception raised when an expected ba.SessionTeam does not exist. """Exception raised when an expected ba.SessionTeam does not exist.
category: Exception Classes Category: **Exception Classes**
""" """
class NodeNotFoundError(NotFoundError): class NodeNotFoundError(NotFoundError):
"""Exception raised when an expected ba.Node does not exist. """Exception raised when an expected ba.Node does not exist.
category: Exception Classes Category: **Exception Classes**
""" """
class ActorNotFoundError(NotFoundError): class ActorNotFoundError(NotFoundError):
"""Exception raised when an expected ba.Actor does not exist. """Exception raised when an expected ba.Actor does not exist.
category: Exception Classes Category: **Exception Classes**
""" """
class ActivityNotFoundError(NotFoundError): class ActivityNotFoundError(NotFoundError):
"""Exception raised when an expected ba.Activity does not exist. """Exception raised when an expected ba.Activity does not exist.
category: Exception Classes Category: **Exception Classes**
""" """
class SessionNotFoundError(NotFoundError): class SessionNotFoundError(NotFoundError):
"""Exception raised when an expected ba.Session does not exist. """Exception raised when an expected ba.Session does not exist.
category: Exception Classes Category: **Exception Classes**
""" """
class InputDeviceNotFoundError(NotFoundError): class InputDeviceNotFoundError(NotFoundError):
"""Exception raised when an expected ba.InputDevice does not exist. """Exception raised when an expected ba.InputDevice does not exist.
category: Exception Classes Category: **Exception Classes**
""" """
class WidgetNotFoundError(NotFoundError): class WidgetNotFoundError(NotFoundError):
"""Exception raised when an expected ba.Widget does not exist. """Exception raised when an expected ba.Widget does not exist.
category: Exception Classes Category: **Exception Classes**
""" """
def print_exception(*args: Any, **keywds: Any) -> None: def print_exception(*args: Any, **keywds: Any) -> None:
"""Print info about an exception along with pertinent context state. """Print info about an exception along with pertinent context state.
category: General Utility Functions Category: **General Utility Functions**
Prints all arguments provided along with various info about the Prints all arguments provided along with various info about the
current context and the outstanding exception. current context and the outstanding exception.
@ -168,7 +168,7 @@ def print_exception(*args: Any, **keywds: Any) -> None:
def print_error(err_str: str, once: bool = False) -> None: def print_error(err_str: str, once: bool = False) -> None:
"""Print info about an error along with pertinent context state. """Print info about an error along with pertinent context state.
category: General Utility Functions Category: **General Utility Functions**
Prints all positional arguments provided along with various info about the Prints all positional arguments provided along with various info about the
current context. current context.

View File

@ -16,7 +16,7 @@ if TYPE_CHECKING:
class FreeForAllSession(MultiTeamSession): class FreeForAllSession(MultiTeamSession):
"""ba.Session type for free-for-all mode games. """ba.Session type for free-for-all mode games.
Category: Gameplay Classes Category: **Gameplay Classes**
""" """
use_teams = False use_teams = False
use_team_colors = False use_team_colors = False

View File

@ -31,7 +31,7 @@ TeamType = TypeVar('TeamType', bound='ba.Team')
class GameActivity(Activity[PlayerType, TeamType]): class GameActivity(Activity[PlayerType, TeamType]):
"""Common base class for all game ba.Activities. """Common base class for all game ba.Activities.
category: Gameplay Classes Category: **Gameplay Classes**
""" """
# pylint: disable=too-many-public-methods # pylint: disable=too-many-public-methods

View File

@ -27,10 +27,10 @@ class GameResults:
""" """
Results for a completed game. Results for a completed game.
Category: Gameplay Classes Category: **Gameplay Classes**
Upon completion, a game should fill one of these out and pass it to its Upon completion, a game should fill one of these out and pass it to its
ba.Activity.end() call. ba.Activity.end call.
""" """
def __init__(self) -> None: def __init__(self) -> None:

View File

@ -29,7 +29,7 @@ TROPHY_CHARS = {
class GameTip: class GameTip:
"""Defines a tip presentable to the user at the start of a game. """Defines a tip presentable to the user at the start of a game.
Category: Gameplay Classes Category: **Gameplay Classes**
""" """
text: str text: str
icon: Optional[ba.Texture] = None icon: Optional[ba.Texture] = None
@ -53,7 +53,7 @@ def animate(node: ba.Node,
suppress_format_warning: bool = False) -> ba.Node: suppress_format_warning: bool = False) -> ba.Node:
"""Animate values on a target ba.Node. """Animate values on a target ba.Node.
Category: Gameplay Functions Category: **Gameplay Functions**
Creates an 'animcurve' node with the provided values and time as an input, Creates an 'animcurve' node with the provided values and time as an input,
connect it to the provided attribute, and set it to die with the target. connect it to the provided attribute, and set it to die with the target.
@ -127,9 +127,9 @@ def animate_array(node: ba.Node,
suppress_format_warning: bool = False) -> None: suppress_format_warning: bool = False) -> None:
"""Animate an array of values on a target ba.Node. """Animate an array of values on a target ba.Node.
Category: Gameplay Functions Category: **Gameplay Functions**
Like ba.animate(), but operates on array attributes. Like ba.animate, but operates on array attributes.
""" """
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
combine = _ba.newnode('combine', owner=node, attrs={'size': size}) combine = _ba.newnode('combine', owner=node, attrs={'size': size})
@ -198,7 +198,7 @@ def show_damage_count(damage: str, position: Sequence[float],
direction: Sequence[float]) -> None: direction: Sequence[float]) -> None:
"""Pop up a damage count at a position in space. """Pop up a damage count at a position in space.
Category: Gameplay Functions Category: **Gameplay Functions**
""" """
lifespan = 1.0 lifespan = 1.0
app = _ba.app app = _ba.app
@ -253,7 +253,7 @@ def timestring(timeval: float,
suppress_format_warning: bool = False) -> ba.Lstr: suppress_format_warning: bool = False) -> ba.Lstr:
"""Generate a ba.Lstr for displaying a time value. """Generate a ba.Lstr for displaying a time value.
Category: General Utility Functions Category: **General Utility Functions**
Given a time value, returns a ba.Lstr with: Given a time value, returns a ba.Lstr with:
(hours if > 0 ) : minutes : seconds : (centiseconds if centi=True). (hours if > 0 ) : minutes : seconds : (centiseconds if centi=True).
@ -321,7 +321,7 @@ def timestring(timeval: float,
def cameraflash(duration: float = 999.0) -> None: def cameraflash(duration: float = 999.0) -> None:
"""Create a strobing camera flash effect. """Create a strobing camera flash effect.
Category: Gameplay Functions Category: **Gameplay Functions**
(as seen when a team wins a game) (as seen when a team wins a game)
Duration is in seconds. Duration is in seconds.

View File

@ -24,7 +24,7 @@ if TYPE_CHECKING:
class Existable(Protocol): class Existable(Protocol):
"""A Protocol for objects supporting an exists() method. """A Protocol for objects supporting an exists() method.
Category: Protocols Category: **Protocols**
""" """
def exists(self) -> bool: def exists(self) -> bool:
@ -39,7 +39,7 @@ T = TypeVar('T')
def existing(obj: Optional[ExistableType]) -> Optional[ExistableType]: def existing(obj: Optional[ExistableType]) -> Optional[ExistableType]:
"""Convert invalid references to None for any ba.Existable object. """Convert invalid references to None for any ba.Existable object.
Category: Gameplay Functions Category: **Gameplay Functions**
To best support type checking, it is important that invalid references To best support type checking, it is important that invalid references
not be passed around and instead get converted to values of None. not be passed around and instead get converted to values of None.
@ -59,7 +59,7 @@ def existing(obj: Optional[ExistableType]) -> Optional[ExistableType]:
def getclass(name: str, subclassof: type[T]) -> type[T]: def getclass(name: str, subclassof: type[T]) -> type[T]:
"""Given a full class name such as foo.bar.MyClass, return the class. """Given a full class name such as foo.bar.MyClass, return the class.
Category: General Utility Functions Category: **General Utility Functions**
The class will be checked to make sure it is a subclass of the provided The class will be checked to make sure it is a subclass of the provided
'subclassof' class, and a TypeError will be raised if not. 'subclassof' class, and a TypeError will be raised if not.
@ -140,7 +140,7 @@ def get_type_name(cls: type) -> str:
class _WeakCall: class _WeakCall:
"""Wrap a callable and arguments into a single callable object. """Wrap a callable and arguments into a single callable object.
Category: General Utility Classes Category: **General Utility Classes**
When passed a bound method as the callable, the instance portion When passed a bound method as the callable, the instance portion
of it is weak-referenced, meaning the underlying instance is of it is weak-referenced, meaning the underlying instance is
@ -150,40 +150,34 @@ class _WeakCall:
Think of this as a handy way to tell an object to do something Think of this as a handy way to tell an object to do something
at some point in the future if it happens to still exist. at some point in the future if it happens to still exist.
Examples: ##### Examples
EXAMPLE A: this code will create a FooClass instance and call its **EXAMPLE A:** this code will create a FooClass instance and call its
bar() method 5 seconds later; it will be kept alive even though bar() method 5 seconds later; it will be kept alive even though
we overwrite its variable with None because the bound method we overwrite its variable with None because the bound method
we pass as a timer callback (foo.bar) strong-references it we pass as a timer callback (foo.bar) strong-references it
```python >>> foo = FooClass()
>>> foo = FooClass() ... ba.timer(5.0, foo.bar)
... ba.timer(5.0, foo.bar) ... foo = None
... foo = None
```
EXAMPLE B: this code will *not* keep our object alive; it will die **EXAMPLE B:** This code will *not* keep our object alive; it will die
when we overwrite it with None and the timer will be a no-op when it when we overwrite it with None and the timer will be a no-op when it
fires fires
```python >>> foo = FooClass()
>>> foo = FooClass() ... ba.timer(5.0, ba.WeakCall(foo.bar))
... ba.timer(5.0, ba.WeakCall(foo.bar)) ... foo = None
... foo = None
```
EXAMPLE C: Wrap a method call with some positional and keyword args: **EXAMPLE C:** Wrap a method call with some positional and keyword args:
```python >>> myweakcall = ba.WeakCall(self.dostuff, argval1,
>>> myweakcall = ba.WeakCall(self.dostuff, argval1, ... namedarg=argval2)
... namedarg=argval2) ... # Now we have a single callable to run that whole mess.
... # Now we have a single callable to run that whole mess. ... # The same as calling myobj.dostuff(argval1, namedarg=argval2)
... # The same as calling myobj.dostuff(argval1, namedarg=argval2) ... # (provided my_obj still exists; this will do nothing
... # (provided my_obj still exists; this will do nothing ... # otherwise).
... # otherwise). ... myweakcall()
... myweakcall()
```
Note: additional args and keywords you provide to the WeakCall() Note: additional args and keywords you provide to the WeakCall()
constructor are stored as regular strong-references; you'll need constructor are stored as regular strong-references; you'll need
to wrap them in weakrefs manually if desired. to wrap them in weakrefs manually if desired.
""" """
def __init__(self, *args: Any, **keywds: Any) -> None: def __init__(self, *args: Any, **keywds: Any) -> None:
@ -219,7 +213,7 @@ class _WeakCall:
class _Call: class _Call:
"""Wraps a callable and arguments into a single callable object. """Wraps a callable and arguments into a single callable object.
Category: General Utility Classes Category: **General Utility Classes**
The callable is strong-referenced so it won't die until this The callable is strong-referenced so it won't die until this
object does. object does.
@ -236,14 +230,12 @@ class _Call:
Pass a callable as the first arg, followed by any number of Pass a callable as the first arg, followed by any number of
arguments or keywords. arguments or keywords.
Example: ##### Example
Wrap a method call with 1 positional and 1 keyword arg: Wrap a method call with 1 positional and 1 keyword arg:
```python >>> mycall = ba.Call(myobj.dostuff, argval, namedarg=argval2)
>>> mycall = ba.Call(myobj.dostuff, argval, namedarg=argval2) ... # Now we have a single callable to run that whole mess.
... # Now we have a single callable to run that whole mess. ... # ..the same as calling myobj.dostuff(argval, namedarg=argval2)
... # ..the same as calling myobj.dostuff(argval, namedarg=argval2) ... mycall()
... mycall()
```
""" """
self._call = args[0] self._call = args[0]
self._args = args[1:] self._args = args[1:]
@ -292,7 +284,7 @@ class WeakMethod:
def verify_object_death(obj: object) -> None: def verify_object_death(obj: object) -> None:
"""Warn if an object does not get freed within a short period. """Warn if an object does not get freed within a short period.
Category: General Utility Functions Category: **General Utility Functions**
This can be handy to detect and prevent memory/resource leaks. This can be handy to detect and prevent memory/resource leaks.
""" """
@ -313,7 +305,7 @@ def verify_object_death(obj: object) -> None:
def print_active_refs(obj: Any) -> None: def print_active_refs(obj: Any) -> None:
"""Print info about things referencing a given object. """Print info about things referencing a given object.
Category: General Utility Functions Category: **General Utility Functions**
Useful for tracking down cyclical references and causes for zombie objects. Useful for tracking down cyclical references and causes for zombie objects.
""" """
@ -370,7 +362,7 @@ def _verify_object_death(wref: weakref.ref) -> None:
def storagename(suffix: str = None) -> str: def storagename(suffix: str = None) -> str:
"""Generate a unique name for storing class data in shared places. """Generate a unique name for storing class data in shared places.
Category: General Utility Functions Category: **General Utility Functions**
This consists of a leading underscore, the module path at the This consists of a leading underscore, the module path at the
call site with dots replaced by underscores, the containing class's call site with dots replaced by underscores, the containing class's
@ -380,19 +372,17 @@ def storagename(suffix: str = None) -> str:
Note that this will function even if called in the class definition. Note that this will function even if called in the class definition.
Examples: ##### Examples
Generate a unique name for storage purposes: Generate a unique name for storage purposes:
```python >>> class MyThingie:
>>> class MyThingie: ... # This will give something like
... # This will give something like ... # '_mymodule_submodule_mythingie_data'.
... # '_mymodule_submodule_mythingie_data'. ... _STORENAME = ba.storagename('data')
... _STORENAME = ba.storagename('data') ...
... ... # Use that name to store some data in the Activity we were
... # Use that name to store some data in the Activity we were ... # passed.
... # passed. ... def __init__(self, activity):
... def __init__(self, activity): ... activity.customdata[self._STORENAME] = {}
... activity.customdata[self._STORENAME] = {}
```
""" """
frame = inspect.currentframe() frame = inspect.currentframe()
if frame is None: if frame is None:

View File

@ -13,7 +13,7 @@ if TYPE_CHECKING:
class Keyboard: class Keyboard:
"""Chars definitions for on-screen keyboard. """Chars definitions for on-screen keyboard.
Category: App Classes Category: **App Classes**
Keyboards are discoverable by the meta-tag system Keyboards are discoverable by the meta-tag system
and the user can select which one they want to use. and the user can select which one they want to use.

View File

@ -17,7 +17,7 @@ if TYPE_CHECKING:
class LanguageSubsystem: class LanguageSubsystem:
"""Wraps up language related app functionality. """Wraps up language related app functionality.
Category: App Classes Category: **App Classes**
To use this class, access the single instance of it at 'ba.app.lang'. To use this class, access the single instance of it at 'ba.app.lang'.
""" """
@ -367,7 +367,7 @@ class LanguageSubsystem:
class Lstr: class Lstr:
"""Used to define strings in a language-independent way. """Used to define strings in a language-independent way.
category: General Utility Classes Category: **General Utility Classes**
These should be used whenever possible in place of hard-coded strings These should be used whenever possible in place of hard-coded strings
so that in-game or UI elements show up correctly on all clients in their so that in-game or UI elements show up correctly on all clients in their
@ -376,36 +376,28 @@ class Lstr:
To see available resource keys, look at any of the bs_language_*.py files To see available resource keys, look at any of the bs_language_*.py files
in the game or the translations pages at bombsquadgame.com/translate. in the game or the translations pages at bombsquadgame.com/translate.
Examples: ##### Examples
EXAMPLE 1: specify a string from a resource path EXAMPLE 1: specify a string from a resource path
```python >>> mynode.text = ba.Lstr(resource='audioSettingsWindow.titleText')
>>> mynode.text = ba.Lstr(resource='audioSettingsWindow.titleText')
```
EXAMPLE 2: specify a translated string via a category and english EXAMPLE 2: specify a translated string via a category and english
value; if a translated value is available, it will be used; otherwise value; if a translated value is available, it will be used; otherwise
the english value will be. To see available translation categories, the english value will be. To see available translation categories,
look under the 'translations' resource section. look under the 'translations' resource section.
```python >>> mynode.text = ba.Lstr(translate=('gameDescriptions',
>>> mynode.text = ba.Lstr(translate=('gameDescriptions', ... 'Defeat all enemies'))
... 'Defeat all enemies'))
```
EXAMPLE 3: specify a raw value and some substitutions. Substitutions EXAMPLE 3: specify a raw value and some substitutions. Substitutions
can be used with resource and translate modes as well. can be used with resource and translate modes as well.
```python >>> mynode.text = ba.Lstr(value='${A} / ${B}',
>>> mynode.text = ba.Lstr(value='${A} / ${B}', ... subs=[('${A}', str(score)), ('${B}', str(total))])
... subs=[('${A}', str(score)), ('${B}', str(total))])
```
EXAMPLE 4: ba.Lstr's can be nested. This example would display the EXAMPLE 4: ba.Lstr's can be nested. This example would display the
resource at res_a but replace ${NAME} with the value of the resource at res_a but replace ${NAME} with the value of the
resource at res_b resource at res_b
```python >>> mytextnode.text = ba.Lstr(
>>> mytextnode.text = ba.Lstr( ... resource='res_a',
... resource='res_a', ... subs=[('${NAME}', ba.Lstr(resource='res_b'))])
... subs=[('${NAME}', ba.Lstr(resource='res_b'))])
```
""" """
# pylint: disable=dangerous-default-value # pylint: disable=dangerous-default-value

View File

@ -17,7 +17,7 @@ if TYPE_CHECKING:
class Level: class Level:
"""An entry in a ba.Campaign consisting of a name, game type, and settings. """An entry in a ba.Campaign consisting of a name, game type, and settings.
category: Gameplay Classes Category: **Gameplay Classes**
""" """
def __init__(self, def __init__(self,

View File

@ -18,7 +18,7 @@ if TYPE_CHECKING:
def preload_map_preview_media() -> None: def preload_map_preview_media() -> None:
"""Preload media needed for map preview UIs. """Preload media needed for map preview UIs.
Category: Asset Functions Category: **Asset Functions**
""" """
_ba.getmodel('level_select_button_opaque') _ba.getmodel('level_select_button_opaque')
_ba.getmodel('level_select_button_transparent') _ba.getmodel('level_select_button_transparent')
@ -31,7 +31,7 @@ def preload_map_preview_media() -> None:
def get_filtered_map_name(name: str) -> str: def get_filtered_map_name(name: str) -> str:
"""Filter a map name to account for name changes, etc. """Filter a map name to account for name changes, etc.
Category: Asset Functions Category: **Asset Functions**
This can be used to support old playlists, etc. This can be used to support old playlists, etc.
""" """
@ -46,7 +46,7 @@ def get_filtered_map_name(name: str) -> str:
def get_map_display_string(name: str) -> ba.Lstr: def get_map_display_string(name: str) -> ba.Lstr:
"""Return a ba.Lstr for displaying a given map\'s name. """Return a ba.Lstr for displaying a given map\'s name.
Category: Asset Functions Category: **Asset Functions**
""" """
from ba import _language from ba import _language
return _language.Lstr(translate=('mapsNames', name)) return _language.Lstr(translate=('mapsNames', name))
@ -55,7 +55,7 @@ def get_map_display_string(name: str) -> ba.Lstr:
def getmaps(playtype: str) -> list[str]: def getmaps(playtype: str) -> list[str]:
"""Return a list of ba.Map types supporting a playtype str. """Return a list of ba.Map types supporting a playtype str.
Category: Asset Functions Category: **Asset Functions**
Maps supporting a given playtype must provide a particular set of Maps supporting a given playtype must provide a particular set of
features and lend themselves to a certain style of play. features and lend themselves to a certain style of play.
@ -104,7 +104,7 @@ def getmaps(playtype: str) -> list[str]:
def get_unowned_maps() -> list[str]: def get_unowned_maps() -> list[str]:
"""Return the list of local maps not owned by the current account. """Return the list of local maps not owned by the current account.
Category: Asset Functions Category: **Asset Functions**
""" """
from ba import _store from ba import _store
unowned_maps: set[str] = set() unowned_maps: set[str] = set()
@ -120,7 +120,7 @@ def get_unowned_maps() -> list[str]:
def get_map_class(name: str) -> type[ba.Map]: def get_map_class(name: str) -> type[ba.Map]:
"""Return a map type given a name. """Return a map type given a name.
Category: Asset Functions Category: **Asset Functions**
""" """
name = get_filtered_map_name(name) name = get_filtered_map_name(name)
try: try:
@ -133,7 +133,7 @@ def get_map_class(name: str) -> type[ba.Map]:
class Map(Actor): class Map(Actor):
"""A game map. """A game map.
Category: Gameplay Classes Category: **Gameplay Classes**
Consists of a collection of terrain nodes, metadata, and other Consists of a collection of terrain nodes, metadata, and other
functionality comprising a game map. functionality comprising a game map.

View File

@ -50,24 +50,19 @@ class DeathType(Enum):
class DieMessage: class DieMessage:
"""A message telling an object to die. """A message telling an object to die.
Category: Message Classes Category: **Message Classes**
Most ba.Actor-s respond to this. Most ba.Actor-s respond to this.
Attributes:
immediate
If this is set to True, the actor should disappear immediately.
This is for 'removing' stuff from the game more so than 'killing'
it. If False, the actor should die a 'normal' death and can take
its time with lingering corpses, sound effects, etc.
how
The particular reason for death.
""" """
immediate: bool = False immediate: bool = False
"""If this is set to True, the actor should disappear immediately.
This is for 'removing' stuff from the game more so than 'killing'
it. If False, the actor should die a 'normal' death and can take
its time with lingering corpses, sound effects, etc."""
how: DeathType = DeathType.GENERIC how: DeathType = DeathType.GENERIC
"""The particular reason for death."""
PlayerType = TypeVar('PlayerType', bound='ba.Player') PlayerType = TypeVar('PlayerType', bound='ba.Player')
@ -76,19 +71,15 @@ PlayerType = TypeVar('PlayerType', bound='ba.Player')
class PlayerDiedMessage: class PlayerDiedMessage:
"""A message saying a ba.Player has died. """A message saying a ba.Player has died.
category: Message Classes Category: **Message Classes**
Attributes:
killed
If True, the player was killed;
If False, they left the game or the round ended.
how
The particular type of death.
""" """
killed: bool killed: bool
"""If True, the player was killed;
If False, they left the game or the round ended."""
how: ba.DeathType how: ba.DeathType
"""The particular type of death."""
def __init__(self, player: ba.Player, was_killed: bool, def __init__(self, player: ba.Player, was_killed: bool,
killerplayer: Optional[ba.Player], how: ba.DeathType): killerplayer: Optional[ba.Player], how: ba.DeathType):
@ -132,41 +123,34 @@ class PlayerDiedMessage:
class StandMessage: class StandMessage:
"""A message telling an object to move to a position in space. """A message telling an object to move to a position in space.
Category: Message Classes Category: **Message Classes**
Used when teleporting players to home base, etc. Used when teleporting players to home base, etc.
Attributes:
position
Where to move to.
angle
The angle to face (in degrees)
""" """
position: Sequence[float] = (0.0, 0.0, 0.0) position: Sequence[float] = (0.0, 0.0, 0.0)
"""Where to move to."""
angle: float = 0.0 angle: float = 0.0
"""The angle to face (in degrees)"""
@dataclass @dataclass
class PickUpMessage: class PickUpMessage:
"""Tells an object that it has picked something up. """Tells an object that it has picked something up.
Category: Message Classes Category: **Message Classes**
Attributes:
node
The ba.Node that is getting picked up.
""" """
node: ba.Node node: ba.Node
"""The ba.Node that is getting picked up."""
@dataclass @dataclass
class DropMessage: class DropMessage:
"""Tells an object that it has dropped what it was holding. """Tells an object that it has dropped what it was holding.
Category: Message Classes Category: **Message Classes**
""" """
@ -174,35 +158,29 @@ class DropMessage:
class PickedUpMessage: class PickedUpMessage:
"""Tells an object that it has been picked up by something. """Tells an object that it has been picked up by something.
Category: Message Classes Category: **Message Classes**
Attributes:
node
The ba.Node doing the picking up.
""" """
node: ba.Node node: ba.Node
"""The ba.Node doing the picking up."""
@dataclass @dataclass
class DroppedMessage: class DroppedMessage:
"""Tells an object that it has been dropped. """Tells an object that it has been dropped.
Category: Message Classes Category: **Message Classes**
Attributes:
node
The ba.Node doing the dropping.
""" """
node: ba.Node node: ba.Node
"""The ba.Node doing the dropping."""
@dataclass @dataclass
class ShouldShatterMessage: class ShouldShatterMessage:
"""Tells an object that it should shatter. """Tells an object that it should shatter.
Category: Message Classes Category: **Message Classes**
""" """
@ -210,21 +188,18 @@ class ShouldShatterMessage:
class ImpactDamageMessage: class ImpactDamageMessage:
"""Tells an object that it has been jarred violently. """Tells an object that it has been jarred violently.
Category: Message Classes Category: **Message Classes**
Attributes:
intensity
The intensity of the impact.
""" """
intensity: float intensity: float
"""The intensity of the impact."""
@dataclass @dataclass
class FreezeMessage: class FreezeMessage:
"""Tells an object to become frozen. """Tells an object to become frozen.
Category: Message Classes Category: **Message Classes**
As seen in the effects of an ice ba.Bomb. As seen in the effects of an ice ba.Bomb.
""" """
@ -234,7 +209,7 @@ class FreezeMessage:
class ThawMessage: class ThawMessage:
"""Tells an object to stop being frozen. """Tells an object to stop being frozen.
Category: Message Classes Category: **Message Classes**
""" """
@ -242,20 +217,17 @@ class ThawMessage:
class CelebrateMessage: class CelebrateMessage:
"""Tells an object to celebrate. """Tells an object to celebrate.
Category: Message Classes Category: **Message Classes**
Attributes:
duration
Amount of time to celebrate in seconds.
""" """
duration: float = 10.0 duration: float = 10.0
"""Amount of time to celebrate in seconds."""
class HitMessage: class HitMessage:
"""Tells an object it has been hit in some way. """Tells an object it has been hit in some way.
Category: Message Classes Category: **Message Classes**
This is used by punches, explosions, etc to convey This is used by punches, explosions, etc to convey
their effect to a target. their effect to a target.

View File

@ -37,7 +37,7 @@ class ScanResults:
class MetadataSubsystem: class MetadataSubsystem:
"""Subsystem for working with script metadata in the app. """Subsystem for working with script metadata in the app.
Category: App Classes Category: **App Classes**
Access the single shared instance of this class at 'ba.app.meta'. Access the single shared instance of this class at 'ba.app.meta'.
""" """

View File

@ -22,7 +22,7 @@ DEFAULT_TEAM_NAMES = ('Blue', 'Red')
class MultiTeamSession(Session): class MultiTeamSession(Session):
"""Common base class for ba.DualTeamSession and ba.FreeForAllSession. """Common base class for ba.DualTeamSession and ba.FreeForAllSession.
Category: Gameplay Classes Category: **Gameplay Classes**
Free-for-all-mode is essentially just teams-mode with each ba.Player having Free-for-all-mode is essentially just teams-mode with each ba.Player having
their own ba.Team, so there is much overlap in functionality. their own ba.Team, so there is much overlap in functionality.

View File

@ -18,7 +18,7 @@ if TYPE_CHECKING:
class MusicType(Enum): class MusicType(Enum):
"""Types of music available to play in-game. """Types of music available to play in-game.
Category: Enums Category: **Enums**
These do not correspond to specific pieces of music, but rather to These do not correspond to specific pieces of music, but rather to
'situations'. The actual music played for each type can be overridden 'situations'. The actual music played for each type can be overridden
@ -51,7 +51,7 @@ class MusicType(Enum):
class MusicPlayMode(Enum): class MusicPlayMode(Enum):
"""Influences behavior when playing music. """Influences behavior when playing music.
Category: Enums Category: **Enums**
""" """
REGULAR = 'regular' REGULAR = 'regular'
TEST = 'test' TEST = 'test'
@ -61,7 +61,7 @@ class MusicPlayMode(Enum):
class AssetSoundtrackEntry: class AssetSoundtrackEntry:
"""A music entry using an internal asset. """A music entry using an internal asset.
Category: App Classes Category: **App Classes**
""" """
assetname: str assetname: str
volume: float = 1.0 volume: float = 1.0
@ -120,7 +120,7 @@ ASSET_SOUNDTRACK_ENTRIES: dict[MusicType, AssetSoundtrackEntry] = {
class MusicSubsystem: class MusicSubsystem:
"""Subsystem for music playback in the app. """Subsystem for music playback in the app.
Category: App Classes Category: **App Classes**
Access the single shared instance of this class at 'ba.app.music'. Access the single shared instance of this class at 'ba.app.music'.
""" """
@ -385,7 +385,7 @@ class MusicSubsystem:
class MusicPlayer: class MusicPlayer:
"""Wrangles soundtrack music playback. """Wrangles soundtrack music playback.
Category: App Classes Category: **App Classes**
Music can be played either through the game itself Music can be played either through the game itself
or via a platform-specific external player. or via a platform-specific external player.
@ -474,7 +474,7 @@ def setmusic(musictype: Optional[ba.MusicType],
continuous: bool = False) -> None: continuous: bool = False) -> None:
"""Set the app to play (or stop playing) a certain type of music. """Set the app to play (or stop playing) a certain type of music.
category: Gameplay Functions category: **Gameplay Functions**
This function will handle loading and playing sound assets as necessary, This function will handle loading and playing sound assets as necessary,
and also supports custom user soundtracks on specific platforms so the and also supports custom user soundtracks on specific platforms so the

View File

@ -17,7 +17,7 @@ if TYPE_CHECKING:
class NodeActor(Actor): class NodeActor(Actor):
"""A simple ba.Actor type that wraps a single ba.Node. """A simple ba.Actor type that wraps a single ba.Node.
Category: Gameplay Classes Category: **Gameplay Classes**
This Actor will delete its Node when told to die, and it's This Actor will delete its Node when told to die, and it's
exists() call will return whether the Node still exists or not. exists() call will return whether the Node still exists or not.

View File

@ -16,7 +16,7 @@ if TYPE_CHECKING:
class PluginSubsystem: class PluginSubsystem:
"""Subsystem for plugin handling in the app. """Subsystem for plugin handling in the app.
Category: App Classes Category: **App Classes**
Access the single shared instance of this class at 'ba.app.plugins'. Access the single shared instance of this class at 'ba.app.plugins'.
""" """
@ -96,7 +96,7 @@ class PluginSubsystem:
class PotentialPlugin: class PotentialPlugin:
"""Represents a ba.Plugin which can potentially be loaded. """Represents a ba.Plugin which can potentially be loaded.
Category: App Classes Category: **App Classes**
These generally represent plugins which were detected by the These generally represent plugins which were detected by the
meta-tag scan. However they may also represent plugins which meta-tag scan. However they may also represent plugins which
@ -111,7 +111,7 @@ class PotentialPlugin:
class Plugin: class Plugin:
"""A plugin to alter app behavior in some way. """A plugin to alter app behavior in some way.
Category: App Classes Category: **App Classes**
Plugins are discoverable by the meta-tag system Plugins are discoverable by the meta-tag system
and the user can select which ones they want to activate. and the user can select which ones they want to activate.

View File

@ -16,31 +16,27 @@ if TYPE_CHECKING:
class PowerupMessage: class PowerupMessage:
"""A message telling an object to accept a powerup. """A message telling an object to accept a powerup.
Category: Message Classes Category: **Message Classes**
This message is normally received by touching a ba.PowerupBox. This message is normally received by touching a ba.PowerupBox.
Attributes:
poweruptype
The type of powerup to be granted (a string).
See ba.Powerup.poweruptype for available type values.
sourcenode
The node the powerup game from, or None otherwise.
If a powerup is accepted, a ba.PowerupAcceptMessage should be sent
back to the sourcenode to inform it of the fact. This will generally
cause the powerup box to make a sound and disappear or whatnot.
""" """
poweruptype: str poweruptype: str
"""The type of powerup to be granted (a string).
See ba.Powerup.poweruptype for available type values."""
sourcenode: Optional[ba.Node] = None sourcenode: Optional[ba.Node] = None
"""The node the powerup game from, or None otherwise.
If a powerup is accepted, a ba.PowerupAcceptMessage should be sent
back to the sourcenode to inform it of the fact. This will generally
cause the powerup box to make a sound and disappear or whatnot."""
@dataclass @dataclass
class PowerupAcceptMessage: class PowerupAcceptMessage:
"""A message informing a ba.Powerup that it was accepted. """A message informing a ba.Powerup that it was accepted.
Category: Message Classes Category: **Message Classes**
This is generally sent in response to a ba.PowerupMessage This is generally sent in response to a ba.PowerupMessage
to inform the box (or whoever granted it) that it can go away. to inform the box (or whoever granted it) that it can go away.

View File

@ -16,7 +16,7 @@ if TYPE_CHECKING:
class ScoreType(Enum): class ScoreType(Enum):
"""Type of scores. """Type of scores.
Category: Enums Category: **Enums**
""" """
SECONDS = 's' SECONDS = 's'
MILLISECONDS = 'ms' MILLISECONDS = 'ms'
@ -27,7 +27,7 @@ class ScoreType(Enum):
class ScoreConfig: class ScoreConfig:
"""Settings for how a game handles scores. """Settings for how a game handles scores.
Category: Gameplay Classes Category: **Gameplay Classes**
""" """
label: str = 'Score' label: str = 'Score'

View File

@ -77,7 +77,7 @@ def _cmd(command_data: bytes) -> None:
class ServerController: class ServerController:
"""Overall controller for the app in server mode. """Overall controller for the app in server mode.
Category: App Classes Category: **App Classes**
""" """
def __init__(self, config: ServerConfig) -> None: def __init__(self, config: ServerConfig) -> None:

View File

@ -19,7 +19,7 @@ if TYPE_CHECKING:
class Session: class Session:
"""Defines a high level series of ba.Activity-es with a common purpose. """Defines a high level series of ba.Activity-es with a common purpose.
Category: Gameplay Classes Category: **Gameplay Classes**
Examples of sessions are ba.FreeForAllSession, ba.DualTeamSession, and Examples of sessions are ba.FreeForAllSession, ba.DualTeamSession, and
ba.CoopSession. ba.CoopSession.

View File

@ -21,7 +21,7 @@ if TYPE_CHECKING:
class PlayerScoredMessage: class PlayerScoredMessage:
"""Informs something that a ba.Player scored. """Informs something that a ba.Player scored.
Category: Message Classes Category: **Message Classes**
""" """
score: int score: int
@ -31,7 +31,7 @@ class PlayerScoredMessage:
class PlayerRecord: class PlayerRecord:
"""Stats for an individual player in a ba.Stats object. """Stats for an individual player in a ba.Stats object.
Category: Gameplay Classes Category: **Gameplay Classes**
This does not necessarily correspond to a ba.Player that is This does not necessarily correspond to a ba.Player that is
still present (stats may be retained for players that leave still present (stats may be retained for players that leave
@ -229,7 +229,7 @@ class PlayerRecord:
class Stats: class Stats:
"""Manages scores and statistics for a ba.Session. """Manages scores and statistics for a ba.Session.
Category: Gameplay Classes Category: **Gameplay Classes**
""" """
def __init__(self) -> None: def __init__(self) -> None:

View File

@ -17,39 +17,32 @@ if TYPE_CHECKING:
class SessionTeam: class SessionTeam:
"""A team of one or more ba.SessionPlayers. """A team of one or more ba.SessionPlayers.
Category: Gameplay Classes Category: **Gameplay Classes**
Note that a SessionPlayer *always* has a SessionTeam; Note that a SessionPlayer *always* has a SessionTeam;
in some cases, such as free-for-all ba.Sessions, in some cases, such as free-for-all ba.Sessions,
each SessionTeam consists of just one SessionPlayer. each SessionTeam consists of just one SessionPlayer.
Attributes:
name
The team's name.
id
The unique numeric id of the team.
color
The team's color.
players
The list of ba.SessionPlayers on the team.
customdata
A dict for use by the current ba.Session for
storing data associated with this team.
Unlike customdata, this persists for the duration
of the session.
""" """
# Annotate our attr types at the class level so they're introspectable. # Annotate our attr types at the class level so they're introspectable.
name: Union[ba.Lstr, str] name: Union[ba.Lstr, str]
"""The team's name."""
color: tuple[float, ...] # FIXME: can't we make this fixed len? color: tuple[float, ...] # FIXME: can't we make this fixed len?
"""The team's color."""
players: list[ba.SessionPlayer] players: list[ba.SessionPlayer]
"""The list of ba.SessionPlayer-s on the team."""
customdata: dict customdata: dict
"""A dict for use by the current ba.Session for
storing data associated with this team.
Unlike customdata, this persists for the duration
of the session."""
id: int id: int
"""The unique numeric id of the team."""
def __init__(self, def __init__(self,
team_id: int = 0, team_id: int = 0,
@ -79,7 +72,7 @@ PlayerType = TypeVar('PlayerType', bound='ba.Player')
class Team(Generic[PlayerType]): class Team(Generic[PlayerType]):
"""A team in a specific ba.Activity. """A team in a specific ba.Activity.
Category: Gameplay Classes Category: **Gameplay Classes**
These correspond to ba.SessionTeam objects, but are created per activity These correspond to ba.SessionTeam objects, but are created per activity
so that the activity can use its own custom team subclass. so that the activity can use its own custom team subclass.
@ -197,7 +190,7 @@ class Team(Generic[PlayerType]):
class EmptyTeam(Team['ba.EmptyPlayer']): class EmptyTeam(Team['ba.EmptyPlayer']):
"""An empty player for use by Activities that don't need to define one. """An empty player for use by Activities that don't need to define one.
Category: Gameplay Classes Category: **Gameplay Classes**
ba.Player and ba.Team are 'Generic' types, and so passing those top level ba.Player and ba.Team are 'Generic' types, and so passing those top level
classes as type arguments when defining a ba.Activity reduces type safety. classes as type arguments when defining a ba.Activity reduces type safety.

View File

@ -24,7 +24,7 @@ TeamType = TypeVar('TeamType', bound='ba.Team')
class TeamGameActivity(GameActivity[PlayerType, TeamType]): class TeamGameActivity(GameActivity[PlayerType, TeamType]):
"""Base class for teams and free-for-all mode games. """Base class for teams and free-for-all mode games.
Category: Gameplay Classes Category: **Gameplay Classes**
(Free-for-all is essentially just a special case where every (Free-for-all is essentially just a special case where every
ba.Player has their own ba.Team) ba.Player has their own ba.Team)

View File

@ -18,7 +18,7 @@ if TYPE_CHECKING:
class UISubsystem: class UISubsystem:
"""Consolidated UI functionality for the app. """Consolidated UI functionality for the app.
Category: App Classes Category: **App Classes**
To use this class, access the single instance of it at 'ba.app.ui'. To use this class, access the single instance of it at 'ba.app.ui'.
""" """

View File

@ -22,112 +22,110 @@ PlayerType = TypeVar('PlayerType', bound='ba.Player')
class BombFactory: class BombFactory:
"""Wraps up media and other resources used by ba.Bombs. """Wraps up media and other resources used by ba.Bombs.
category: Gameplay Classes Category: **Gameplay Classes**
A single instance of this is shared between all bombs A single instance of this is shared between all bombs
and can be retrieved via bastd.actor.bomb.get_factory(). and can be retrieved via bastd.actor.bomb.get_factory().
Attributes:
bomb_model: ba.Model
The ba.Model of a standard or ice bomb.
sticky_bomb_model: ba.Model
The ba.Model of a sticky-bomb.
impact_bomb_model: ba.Model
The ba.Model of an impact-bomb.
land_mine_model: ba.Model
The ba.Model of a land-mine.
tnt_model: ba.Model
The ba.Model of a tnt box.
regular_tex: ba.Texture
The ba.Texture for regular bombs.
ice_tex: ba.Texture
The ba.Texture for ice bombs.
sticky_tex: ba.Texture
The ba.Texture for sticky bombs.
impact_tex: ba.Texture
The ba.Texture for impact bombs.
impact_lit_tex: ba.Texture
The ba.Texture for impact bombs with lights lit.
land_mine_tex: ba.Texture
The ba.Texture for land-mines.
land_mine_lit_tex: ba.Texture
The ba.Texture for land-mines with the light lit.
tnt_tex: ba.Texture
The ba.Texture for tnt boxes.
hiss_sound: ba.Sound
The ba.Sound for the hiss sound an ice bomb makes.
debris_fall_sound: ba.Sound
The ba.Sound for random falling debris after an explosion.
wood_debris_fall_sound: ba.Sound
A ba.Sound for random wood debris falling after an explosion.
explode_sounds: Sequence[ba.Sound]
A tuple of ba.Sound-s for explosions.
freeze_sound: ba.Sound
A ba.Sound of an ice bomb freezing something.
fuse_sound: ba.Sound
A ba.Sound of a burning fuse.
activate_sound: ba.Sound
A ba.Sound for an activating impact bomb.
warn_sound: ba.Sound
A ba.Sound for an impact bomb about to explode due to time-out.
bomb_material: ba.Material
A ba.Material applied to all bombs.
normal_sound_material: ba.Material
A ba.Material that generates standard bomb noises on impacts, etc.
sticky_material: ba.Material
A ba.Material that makes 'splat' sounds and makes collisions softer.
land_mine_no_explode_material: ba.Material
A ba.Material that keeps land-mines from blowing up.
Applied to land-mines when they are created to allow land-mines to
touch without exploding.
land_mine_blast_material: ba.Material
A ba.Material applied to activated land-mines that causes them to
explode on impact.
impact_blast_material: ba.Material
A ba.Material applied to activated impact-bombs that causes them to
explode on impact.
blast_material: ba.Material
A ba.Material applied to bomb blast geometry which triggers impact
events with what it touches.
dink_sounds: Sequence[ba.Sound]
A tuple of ba.Sound-s for when bombs hit the ground.
sticky_impact_sound: ba.Sound
The ba.Sound for a squish made by a sticky bomb hitting something.
roll_sound: ba.Sound
ba.Sound for a rolling bomb.
""" """
bomb_model: ba.Model
"""The ba.Model of a standard or ice bomb."""
sticky_bomb_model: ba.Model
"""The ba.Model of a sticky-bomb."""
impact_bomb_model: ba.Model
"""The ba.Model of an impact-bomb."""
land_mine_model: ba.Model
"""The ba.Model of a land-mine."""
tnt_model: ba.Model
"""The ba.Model of a tnt box."""
regular_tex: ba.Texture
"""The ba.Texture for regular bombs."""
ice_tex: ba.Texture
"""The ba.Texture for ice bombs."""
sticky_tex: ba.Texture
"""The ba.Texture for sticky bombs."""
impact_tex: ba.Texture
"""The ba.Texture for impact bombs."""
impact_lit_tex: ba.Texture
"""The ba.Texture for impact bombs with lights lit."""
land_mine_tex: ba.Texture
"""The ba.Texture for land-mines."""
land_mine_lit_tex: ba.Texture
"""The ba.Texture for land-mines with the light lit."""
tnt_tex: ba.Texture
"""The ba.Texture for tnt boxes."""
hiss_sound: ba.Sound
"""The ba.Sound for the hiss sound an ice bomb makes."""
debris_fall_sound: ba.Sound
"""The ba.Sound for random falling debris after an explosion."""
wood_debris_fall_sound: ba.Sound
"""A ba.Sound for random wood debris falling after an explosion."""
explode_sounds: Sequence[ba.Sound]
"""A tuple of ba.Sound-s for explosions."""
freeze_sound: ba.Sound
"""A ba.Sound of an ice bomb freezing something."""
fuse_sound: ba.Sound
"""A ba.Sound of a burning fuse."""
activate_sound: ba.Sound
"""A ba.Sound for an activating impact bomb."""
warn_sound: ba.Sound
"""A ba.Sound for an impact bomb about to explode due to time-out."""
bomb_material: ba.Material
"""A ba.Material applied to all bombs."""
normal_sound_material: ba.Material
"""A ba.Material that generates standard bomb noises on impacts, etc."""
sticky_material: ba.Material
"""A ba.Material that makes 'splat' sounds and makes collisions softer."""
land_mine_no_explode_material: ba.Material
"""A ba.Material that keeps land-mines from blowing up.
Applied to land-mines when they are created to allow land-mines to
touch without exploding."""
land_mine_blast_material: ba.Material
"""A ba.Material applied to activated land-mines that causes them to
explode on impact."""
impact_blast_material: ba.Material
"""A ba.Material applied to activated impact-bombs that causes them to
explode on impact."""
blast_material: ba.Material
"""A ba.Material applied to bomb blast geometry which triggers impact
events with what it touches."""
dink_sounds: Sequence[ba.Sound]
"""A tuple of ba.Sound-s for when bombs hit the ground."""
sticky_impact_sound: ba.Sound
"""The ba.Sound for a squish made by a sticky bomb hitting something."""
roll_sound: ba.Sound
"""ba.Sound for a rolling bomb."""
_STORENAME = ba.storagename() _STORENAME = ba.storagename()
@classmethod @classmethod

View File

@ -15,38 +15,36 @@ if TYPE_CHECKING:
class FlagFactory: class FlagFactory:
"""Wraps up media and other resources used by ba.Flags. """Wraps up media and other resources used by `Flag`s.
category: Gameplay Classes Category: **Gameplay Classes**
A single instance of this is shared between all flags A single instance of this is shared between all flags
and can be retrieved via bastd.actor.flag.get_factory(). and can be retrieved via FlagFactory.get().
Attributes:
flagmaterial: ba.Material
The ba.Material applied to all ba.Flags.
impact_sound: ba.Sound
The ba.Sound used when a ba.Flag hits the ground.
skid_sound: ba.Sound
The ba.Sound used when a ba.Flag skids along the ground.
no_hit_material: ba.Material
A ba.Material that prevents contact with most objects;
applied to 'non-touchable' flags.
flag_texture: ba.Texture
The ba.Texture for flags.
""" """
flagmaterial: ba.Material
"""The ba.Material applied to all `Flag`s."""
impact_sound: ba.Sound
"""The ba.Sound used when a `Flag` hits the ground."""
skid_sound: ba.Sound
"""The ba.Sound used when a `Flag` skids along the ground."""
no_hit_material: ba.Material
"""A ba.Material that prevents contact with most objects;
applied to 'non-touchable' flags."""
flag_texture: ba.Texture
"""The ba.Texture for flags."""
_STORENAME = ba.storagename() _STORENAME = ba.storagename()
def __init__(self) -> None: def __init__(self) -> None:
"""Instantiate a FlagFactory. """Instantiate a `FlagFactory`.
You shouldn't need to do this; call bastd.actor.flag.get_factory() to You shouldn't need to do this; call FlagFactory.get() to
get a shared instance. get a shared instance.
""" """
shared = SharedObjects.get() shared = SharedObjects.get()
@ -109,7 +107,7 @@ class FlagFactory:
@classmethod @classmethod
def get(cls) -> FlagFactory: def get(cls) -> FlagFactory:
"""Get/create a shared FlagFactory instance.""" """Get/create a shared `FlagFactory` instance."""
activity = ba.getactivity() activity = ba.getactivity()
factory = activity.customdata.get(cls._STORENAME) factory = activity.customdata.get(cls._STORENAME)
if factory is None: if factory is None:
@ -121,58 +119,47 @@ class FlagFactory:
@dataclass @dataclass
class FlagPickedUpMessage: class FlagPickedUpMessage:
"""A message saying a ba.Flag has been picked up. """A message saying a `Flag` has been picked up.
category: Message Classes Category: **Message Classes**
"""
Attributes:
flag
The ba.Flag that has been picked up.
node
The ba.Node doing the picking up.
"""
flag: Flag flag: Flag
"""The `Flag` that has been picked up."""
node: ba.Node node: ba.Node
"""The ba.Node doing the picking up."""
@dataclass @dataclass
class FlagDiedMessage: class FlagDiedMessage:
"""A message saying a ba.Flag has died. """A message saying a `Flag` has died.
category: Message Classes Category: **Message Classes**
Attributes:
flag
The ba.Flag that died.
""" """
flag: Flag flag: Flag
"""The `Flag` that died."""
@dataclass @dataclass
class FlagDroppedMessage: class FlagDroppedMessage:
"""A message saying a ba.Flag has been dropped. """A message saying a `Flag` has been dropped.
category: Message Classes Category: **Message Classes**
Attributes:
flag
The ba.Flag that was dropped.
node
The ba.Node that was holding it.
""" """
flag: Flag flag: Flag
"""The `Flag` that was dropped."""
node: ba.Node node: ba.Node
"""The ba.Node that was holding it."""
class Flag(ba.Actor): class Flag(ba.Actor):
"""A flag; used in games such as capture-the-flag or king-of-the-hill. """A flag; used in games such as capture-the-flag or king-of-the-hill.
category: Gameplay Classes Category: **Gameplay Classes**
Can be stationary or carry-able by players. Can be stationary or carry-able by players.
""" """
@ -189,7 +176,7 @@ class Flag(ba.Actor):
useful for things like king-of-the-hill where players should useful for things like king-of-the-hill where players should
not be moving the flag around. not be moving the flag around.
'materials can be a list of extra ba.Material-s to apply to the flag. 'materials can be a list of extra `ba.Material`s to apply to the flag.
If 'dropped_timeout' is provided (in seconds), the flag will die If 'dropped_timeout' is provided (in seconds), the flag will die
after remaining untouched for that long once it has been moved after remaining untouched for that long once it has been moved
@ -262,8 +249,8 @@ class Flag(ba.Actor):
if not self._has_moved: if not self._has_moved:
nodepos = self.node.position nodepos = self.node.position
if (max( if (max(
abs(nodepos[i] - self._initial_position[i]) abs(nodepos[i] - self._initial_position[i])
for i in list(range(3))) > 1.0): for i in list(range(3))) > 1.0):
self._has_moved = True self._has_moved = True
if self._held_count > 0 or not self._has_moved: if self._held_count > 0 or not self._has_moved:

View File

@ -17,31 +17,29 @@ TeamType = TypeVar('TeamType', bound=ba.Team)
class PlayerSpazHurtMessage: class PlayerSpazHurtMessage:
"""A message saying a ba.PlayerSpaz was hurt. """A message saying a PlayerSpaz was hurt.
category: Message Classes Category: **Message Classes**
Attributes:
spaz: ba.PlayerSpaz
The ba.PlayerSpaz that was hurt
""" """
spaz: PlayerSpaz
"""The PlayerSpaz that was hurt"""
def __init__(self, spaz: PlayerSpaz): def __init__(self, spaz: PlayerSpaz):
"""Instantiate with the given ba.Spaz value.""" """Instantiate with the given ba.Spaz value."""
self.spaz = spaz self.spaz = spaz
class PlayerSpaz(Spaz): class PlayerSpaz(Spaz):
"""A ba.Spaz subclass meant to be controlled by a ba.Player. """A Spaz subclass meant to be controlled by a ba.Player.
category: Gameplay Classes Category: **Gameplay Classes**
When a PlayerSpaz dies, it delivers a ba.PlayerDiedMessage When a PlayerSpaz dies, it delivers a ba.PlayerDiedMessage
to the current ba.Activity. (unless the death was the result of the to the current ba.Activity. (unless the death was the result of the
player leaving the game, in which case no message is sent) player leaving the game, in which case no message is sent)
When a PlayerSpaz is hurt, it delivers a ba.PlayerSpazHurtMessage When a PlayerSpaz is hurt, it delivers a PlayerSpazHurtMessage
to the current ba.Activity. to the current ba.Activity.
""" """

View File

@ -23,69 +23,67 @@ class _TouchedMessage:
class PowerupBoxFactory: class PowerupBoxFactory:
"""A collection of media and other resources used by ba.Powerups. """A collection of media and other resources used by ba.Powerups.
category: Gameplay Classes Category: **Gameplay Classes**
A single instance of this is shared between all powerups A single instance of this is shared between all powerups
and can be retrieved via ba.Powerup.get_factory(). and can be retrieved via ba.Powerup.get_factory().
Attributes:
model: ba.Model
The ba.Model of the powerup box.
model_simple: ba.Model
A simpler ba.Model of the powerup box, for use in shadows, etc.
tex_bomb: ba.Texture
Triple-bomb powerup ba.Texture.
tex_punch: ba.Texture
Punch powerup ba.Texture.
tex_ice_bombs: ba.Texture
Ice bomb powerup ba.Texture.
tex_sticky_bombs: ba.Texture
Sticky bomb powerup ba.Texture.
tex_shield: ba.Texture
Shield powerup ba.Texture.
tex_impact_bombs: ba.Texture
Impact-bomb powerup ba.Texture.
tex_health: ba.Texture
Health powerup ba.Texture.
tex_land_mines: ba.Texture
Land-mine powerup ba.Texture.
tex_curse: ba.Texture
Curse powerup ba.Texture.
health_powerup_sound: ba.Sound
ba.Sound played when a health powerup is accepted.
powerup_sound: ba.Sound
ba.Sound played when a powerup is accepted.
powerdown_sound: ba.Sound
ba.Sound that can be used when powerups wear off.
powerup_material: ba.Material
ba.Material applied to powerup boxes.
powerup_accept_material: ba.Material
Powerups will send a ba.PowerupMessage to anything they touch
that has this ba.Material applied.
""" """
model: ba.Model
"""The ba.Model of the powerup box."""
model_simple: ba.Model
"""A simpler ba.Model of the powerup box, for use in shadows, etc."""
tex_bomb: ba.Texture
"""Triple-bomb powerup ba.Texture."""
tex_punch: ba.Texture
"""Punch powerup ba.Texture."""
tex_ice_bombs: ba.Texture
"""Ice bomb powerup ba.Texture."""
tex_sticky_bombs: ba.Texture
"""Sticky bomb powerup ba.Texture."""
tex_shield: ba.Texture
"""Shield powerup ba.Texture."""
tex_impact_bombs: ba.Texture
"""Impact-bomb powerup ba.Texture."""
tex_health: ba.Texture
"""Health powerup ba.Texture."""
tex_land_mines: ba.Texture
"""Land-mine powerup ba.Texture."""
tex_curse: ba.Texture
"""Curse powerup ba.Texture."""
health_powerup_sound: ba.Sound
"""ba.Sound played when a health powerup is accepted."""
powerup_sound: ba.Sound
"""ba.Sound played when a powerup is accepted."""
powerdown_sound: ba.Sound
"""ba.Sound that can be used when powerups wear off."""
powerup_material: ba.Material
"""ba.Material applied to powerup boxes."""
powerup_accept_material: ba.Material
"""Powerups will send a ba.PowerupMessage to anything they touch
that has this ba.Material applied."""
_STORENAME = ba.storagename() _STORENAME = ba.storagename()
def __init__(self) -> None: def __init__(self) -> None:
"""Instantiate a PowerupBoxFactory. """Instantiate a PowerupBoxFactory.
You shouldn't need to do this; call ba.Powerup.get_factory() You shouldn't need to do this; call Powerup.get_factory()
to get a shared instance. to get a shared instance.
""" """
from ba.internal import get_default_powerup_distribution from ba.internal import get_default_powerup_distribution
@ -191,18 +189,16 @@ class PowerupBox(ba.Actor):
This will deliver a ba.PowerupMessage to anything that touches it This will deliver a ba.PowerupMessage to anything that touches it
which has the ba.PowerupBoxFactory.powerup_accept_material applied. which has the ba.PowerupBoxFactory.powerup_accept_material applied.
Attributes:
poweruptype: str
The string powerup type. This can be 'triple_bombs', 'punch',
'ice_bombs', 'impact_bombs', 'land_mines', 'sticky_bombs', 'shield',
'health', or 'curse'.
node: ba.Node
The 'prop' ba.Node representing this box.
""" """
poweruptype: str
"""The string powerup type. This can be 'triple_bombs', 'punch',
'ice_bombs', 'impact_bombs', 'land_mines', 'sticky_bombs', 'shield',
'health', or 'curse'."""
node: ba.Node
"""The 'prop' ba.Node representing this box."""
def __init__(self, def __init__(self,
position: Sequence[float] = (0.0, 1.0, 0.0), position: Sequence[float] = (0.0, 1.0, 0.0),
poweruptype: str = 'triple_bombs', poweruptype: str = 'triple_bombs',

View File

@ -16,29 +16,27 @@ if TYPE_CHECKING:
class Spawner: class Spawner:
"""Utility for delayed spawning of objects. """Utility for delayed spawning of objects.
category: Gameplay Classes Category: **Gameplay Classes**
Creates a light flash and sends a ba.Spawner.SpawnMessage Creates a light flash and sends a Spawner.SpawnMessage
to the current activity after a delay. to the current activity after a delay.
""" """
class SpawnMessage: class SpawnMessage:
"""Spawn message sent by a ba.Spawner after its delay has passed. """Spawn message sent by a Spawner after its delay has passed.
category: Message Classes Category: **Message Classes**
Attributes:
spawner
The ba.Spawner we came from.
data
The data object passed by the user.
pt
The spawn position.
""" """
spawner: Spawner
"""The ba.Spawner we came from."""
data: Any
"""The data object passed by the user."""
pt: Sequence[float]
"""The spawn position."""
def __init__( def __init__(
self, self,
spawner: Spawner, spawner: Spawner,

View File

@ -42,23 +42,21 @@ class Spaz(ba.Actor):
""" """
Base class for various Spazzes. Base class for various Spazzes.
category: Gameplay Classes Category: **Gameplay Classes**
A Spaz is the standard little humanoid character in the game. A Spaz is the standard little humanoid character in the game.
It can be controlled by a player or by AI, and can have It can be controlled by a player or by AI, and can have
various different appearances. The name 'Spaz' is not to be various different appearances. The name 'Spaz' is not to be
confused with the 'Spaz' character in the game, which is just confused with the 'Spaz' character in the game, which is just
one of the skins available for instances of this class. one of the skins available for instances of this class.
Attributes:
node: ba.Node
The 'spaz' ba.Node.
""" """
# pylint: disable=too-many-public-methods # pylint: disable=too-many-public-methods
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
node: ba.Node
"""The 'spaz' ba.Node."""
points_mult = 1 points_mult = 1
curse_time: Optional[float] = 5.0 curse_time: Optional[float] = 5.0
default_bomb_count = 1 default_bomb_count = 1

View File

@ -27,17 +27,15 @@ PRO_BOT_HIGHLIGHT = (0.6, 0.1, 0.05)
class SpazBotPunchedMessage: class SpazBotPunchedMessage:
"""A message saying a ba.SpazBot got punched. """A message saying a ba.SpazBot got punched.
category: Message Classes Category: **Message Classes**
Attributes:
spazbot: ba.SpazBot
The ba.SpazBot that got punched.
damage: int
How much damage was done to the ba.SpazBot.
""" """
spazbot: SpazBot
"""The ba.SpazBot that got punched."""
damage: int
"""How much damage was done to the SpazBot."""
def __init__(self, spazbot: SpazBot, damage: int): def __init__(self, spazbot: SpazBot, damage: int):
"""Instantiate a message with the given values.""" """Instantiate a message with the given values."""
self.spazbot = spazbot self.spazbot = spazbot
@ -47,20 +45,18 @@ class SpazBotPunchedMessage:
class SpazBotDiedMessage: class SpazBotDiedMessage:
"""A message saying a ba.SpazBot has died. """A message saying a ba.SpazBot has died.
category: Message Classes Category: **Message Classes**
Attributes:
spazbot: ba.SpazBot
The ba.SpazBot that was killed.
killerplayer: ba.Player
The ba.Player that killed it (or None).
how: ba.DeathType
The particular type of death.
""" """
spazbot: SpazBot
"""The SpazBot that was killed."""
killerplayer: ba.Player
"""The ba.Player that killed it (or None)."""
how: ba.DeathType
"""The particular type of death."""
def __init__(self, spazbot: SpazBot, killerplayer: Optional[ba.Player], def __init__(self, spazbot: SpazBot, killerplayer: Optional[ba.Player],
how: ba.DeathType): how: ba.DeathType):
"""Instantiate with given values.""" """Instantiate with given values."""
@ -72,7 +68,7 @@ class SpazBotDiedMessage:
class SpazBot(Spaz): class SpazBot(Spaz):
"""A really dumb AI version of ba.Spaz. """A really dumb AI version of ba.Spaz.
category: Bot Classes Category: **Bot Classes**
Add these to a ba.BotSet to use them. Add these to a ba.BotSet to use them.

View File

@ -11,72 +11,70 @@ from bastd.gameutils import SharedObjects
import _ba import _ba
if TYPE_CHECKING: if TYPE_CHECKING:
from typing import Any from typing import Any, Sequence
class SpazFactory: class SpazFactory:
"""Wraps up media and other resources used by ba.Spaz instances. """Wraps up media and other resources used by ba.Spaz instances.
Category: Gameplay Classes Category: **Gameplay Classes**
Generally one of these is created per ba.Activity and shared Generally one of these is created per ba.Activity and shared
between all spaz instances. Use ba.Spaz.get_factory() to return between all spaz instances. Use ba.Spaz.get_factory() to return
the shared factory for the current activity. the shared factory for the current activity.
Attributes:
impact_sounds_medium: Sequence[ba.Sound]
A tuple of ba.Sound-s for when a ba.Spaz hits something kinda hard.
impact_sounds_hard: Sequence[ba.Sound]
A tuple of ba.Sound-s for when a ba.Spaz hits something really hard.
impact_sounds_harder: Sequence[ba.Sound]
A tuple of ba.Sound-s for when a ba.Spaz hits something really
really hard.
single_player_death_sound: ba.Sound
The sound that plays for an 'important' spaz death such as in
co-op games.
punch_sound: ba.Sound
A standard punch ba.Sound.
punch_sound_strong: Sequence[ba.Sound]
A tuple of stronger sounding punch ba.Sounds.
punch_sound_stronger: ba.Sound
A really really strong sounding punch ba.Sound.
swish_sound: ba.Sound
A punch swish ba.Sound.
block_sound: ba.Sound
A ba.Sound for when an attack is blocked by invincibility.
shatter_sound: ba.Sound
A ba.Sound for when a frozen ba.Spaz shatters.
splatter_sound: ba.Sound
A ba.Sound for when a ba.Spaz blows up via curse.
spaz_material: ba.Material
A ba.Material applied to all of parts of a ba.Spaz.
roller_material: ba.Material
A ba.Material applied to the invisible roller ball body that
a ba.Spaz uses for locomotion.
punch_material: ba.Material
A ba.Material applied to the 'fist' of a ba.Spaz.
pickup_material: ba.Material
A ba.Material applied to the 'grabber' body of a ba.Spaz.
curse_material: ba.Material
A ba.Material applied to a cursed ba.Spaz that triggers an explosion.
""" """
impact_sounds_medium: Sequence[ba.Sound]
"""A tuple of ba.Sound-s for when a ba.Spaz hits something kinda hard."""
impact_sounds_hard: Sequence[ba.Sound]
"""A tuple of ba.Sound-s for when a ba.Spaz hits something really hard."""
impact_sounds_harder: Sequence[ba.Sound]
"""A tuple of ba.Sound-s for when a ba.Spaz hits something really
really hard."""
single_player_death_sound: ba.Sound
"""The sound that plays for an 'important' spaz death such as in
co-op games."""
punch_sound: ba.Sound
"""A standard punch ba.Sound."""
punch_sound_strong: Sequence[ba.Sound]
"""A tuple of stronger sounding punch ba.Sounds."""
punch_sound_stronger: ba.Sound
"""A really really strong sounding punch ba.Sound."""
swish_sound: ba.Sound
"""A punch swish ba.Sound."""
block_sound: ba.Sound
"""A ba.Sound for when an attack is blocked by invincibility."""
shatter_sound: ba.Sound
"""A ba.Sound for when a frozen ba.Spaz shatters."""
splatter_sound: ba.Sound
"""A ba.Sound for when a ba.Spaz blows up via curse."""
spaz_material: ba.Material
"""A ba.Material applied to all of parts of a ba.Spaz."""
roller_material: ba.Material
"""A ba.Material applied to the invisible roller ball body that
a ba.Spaz uses for locomotion."""
punch_material: ba.Material
"""A ba.Material applied to the 'fist' of a ba.Spaz."""
pickup_material: ba.Material
"""A ba.Material applied to the 'grabber' body of a ba.Spaz."""
curse_material: ba.Material
"""A ba.Material applied to a cursed ba.Spaz that triggers an explosion."""
_STORENAME = ba.storagename() _STORENAME = ba.storagename()
def _preload(self, character: str) -> None: def _preload(self, character: str) -> None:

View File

@ -17,13 +17,11 @@ class ConfigCheckBox:
It will automatically save and apply the config when its It will automatically save and apply the config when its
value changes. value changes.
Attributes:
widget
The underlying ba.Widget instance.
""" """
widget: ba.Widget
"""The underlying ba.Widget instance."""
def __init__(self, def __init__(self,
parent: ba.Widget, parent: ba.Widget,
configkey: str, configkey: str,
@ -65,22 +63,20 @@ class ConfigNumberEdit:
It will automatically save and apply the config when its It will automatically save and apply the config when its
value changes. value changes.
Attributes:
nametext
The text widget displaying the name.
valuetext
The text widget displaying the current value.
minusbutton
The button widget used to reduce the value.
plusbutton
The button widget used to increase the value.
""" """
nametext: ba.Widget
"""The text widget displaying the name."""
valuetext: ba.Widget
"""The text widget displaying the current value."""
minusbutton: ba.Widget
"""The button widget used to reduce the value."""
plusbutton: ba.Widget
"""The button widget used to increase the value."""
def __init__(self, def __init__(self,
parent: ba.Widget, parent: ba.Widget,
configkey: str, configkey: str,

View File

@ -27,7 +27,7 @@ void PythonClassCollideModel::SetupType(PyTypeObject* obj) {
"\n" "\n"
"Category: **Asset Classes**\n" "Category: **Asset Classes**\n"
"\n" "\n"
"Use ba.getcollidemodel to instantiate one."; "Use ba.getcollidemodel() to instantiate one.";
obj->tp_repr = (reprfunc)tp_repr; obj->tp_repr = (reprfunc)tp_repr;
obj->tp_new = tp_new; obj->tp_new = tp_new;
obj->tp_dealloc = (destructor)tp_dealloc; obj->tp_dealloc = (destructor)tp_dealloc;

View File

@ -21,7 +21,7 @@ void PythonClassContext::SetupType(PyTypeObject* obj) {
"\n" "\n"
"Category: **General Utility Classes**\n" "Category: **General Utility Classes**\n"
"\n" "\n"
"Many operations such as ba.newnode or ba.gettexture operate\n" "Many operations such as ba.newnode() or ba.gettexture() operate\n"
"implicitly on the current context. Each ba.Activity has its own\n" "implicitly on the current context. Each ba.Activity has its own\n"
"Context and objects within that activity (nodes, media, etc) can only\n" "Context and objects within that activity (nodes, media, etc) can only\n"
"interact with other objects from that context.\n" "interact with other objects from that context.\n"
@ -36,7 +36,7 @@ void PythonClassContext::SetupType(PyTypeObject* obj) {
"When instantiating a ba.Context instance, a single `'source'` " "When instantiating a ba.Context instance, a single `'source'` "
"argument\n" "argument\n"
"is passed, which can be one of the following strings/objects:\n\n" "is passed, which can be one of the following strings/objects:\n\n"
"`'empty'`:\n" "###### `'empty'`\n"
"> Gives an empty context; it can be handy to run code here to ensure\n" "> Gives an empty context; it can be handy to run code here to ensure\n"
"it does no loading of media, creation of nodes, etc.\n" "it does no loading of media, creation of nodes, etc.\n"
"\n" "\n"

View File

@ -26,7 +26,7 @@ void PythonClassData::SetupType(PyTypeObject* obj) {
"\n" "\n"
"Category: **Asset Classes**\n" "Category: **Asset Classes**\n"
"\n" "\n"
"Use ba.getdata to instantiate one."; "Use ba.getdata() to instantiate one.";
obj->tp_repr = (reprfunc)tp_repr; obj->tp_repr = (reprfunc)tp_repr;
obj->tp_new = tp_new; obj->tp_new = tp_new;
obj->tp_dealloc = (destructor)tp_dealloc; obj->tp_dealloc = (destructor)tp_dealloc;

View File

@ -51,21 +51,21 @@ void PythonClassMaterial::SetupType(PyTypeObject* obj) {
"\n" "\n"
"An entity applied to game objects to modify collision behavior.\n" "An entity applied to game objects to modify collision behavior.\n"
"\n" "\n"
"Category: Gameplay Classes\n" "Category: **Gameplay Classes**\n"
"\n" "\n"
"A material can affect physical characteristics, generate sounds,\n" "A material can affect physical characteristics, generate sounds,\n"
"or trigger callback functions when collisions occur.\n" "or trigger callback functions when collisions occur.\n"
"\n" "\n"
"Materials are applied to ``'parts'``, which are groups of one or more\n" "Materials are applied to 'parts', which are groups of one or more\n"
"rigid bodies created as part of a ba.Node. Nodes can have any number\n" "rigid bodies created as part of a ba.Node. Nodes can have any number\n"
"of parts, each with its own set of materials. Generally materials are\n" "of parts, each with its own set of materials. Generally materials are\n"
"specified as array attributes on the Node. The ``'spaz'`` node, for\n" "specified as array attributes on the Node. The `spaz` node, for\n"
"example, has various attributes such as ``'materials'``,\n" "example, has various attributes such as `materials`,\n"
"``'roller_materials'``, and ``'punch_materials'``, which correspond\n" "`roller_materials`, and `punch_materials`, which correspond\n"
"to the various parts it creates.\n" "to the various parts it creates.\n"
"\n" "\n"
"Use ba.Material to instantiate a blank material, and then use its\n" "Use ba.Material to instantiate a blank material, and then use its\n"
"ba.Material.add_actions method to define what the material does.\n" "ba.Material.add_actions() method to define what the material does.\n"
"\n" "\n"
"Attributes:\n" "Attributes:\n"
"\n" "\n"
@ -342,7 +342,7 @@ PyMethodDef PythonClassMaterial::tp_methods[] = {
"`'at_connect'` or `'at_disconnect'`, and `message_obj` is the message\n" "`'at_connect'` or `'at_disconnect'`, and `message_obj` is the message\n"
"object to send.\n" "object to send.\n"
"This has the same effect as calling the node's\n" "This has the same effect as calling the node's\n"
"ba.Node.handlemessage method.\n" "ba.Node.handlemessage() method.\n"
"\n" "\n"
"###### `('modify_part_collision', attr, value)`\n" "###### `('modify_part_collision', attr, value)`\n"
"> Changes some\n" "> Changes some\n"
@ -362,7 +362,7 @@ PyMethodDef PythonClassMaterial::tp_methods[] = {
"overrides for this collision), `'stiffness'` (float value,\n" "overrides for this collision), `'stiffness'` (float value,\n"
"how springy the physical response is), `'damping'` (float\n" "how springy the physical response is), `'damping'` (float\n"
"value, how damped the physical response is), `'bounce'` (float\n" "value, how damped the physical response is), `'bounce'` (float\n"
"value; how bouncy the physical response is)." "value; how bouncy the physical response is).\n"
"\n" "\n"
"###### `('modify_node_collision', attr, value)`\n" "###### `('modify_node_collision', attr, value)`\n"
"> Similar to\n" "> Similar to\n"
@ -410,7 +410,6 @@ PyMethodDef PythonClassMaterial::tp_methods[] = {
"\n" "\n"
"**Example 2:** send a ba.DieMessage to anything we touch, but cause\n" "**Example 2:** send a ba.DieMessage to anything we touch, but cause\n"
"no physical response. This should cause any ba.Actor to drop dead:\n" "no physical response. This should cause any ba.Actor to drop dead:\n"
"```python\n"
">>> m = ba.Material()\n" ">>> m = ba.Material()\n"
"... m.add_actions(\n" "... m.add_actions(\n"
"... actions=(('modify_part_collision', 'physical', False),\n" "... actions=(('modify_part_collision', 'physical', False),\n"
@ -418,7 +417,6 @@ PyMethodDef PythonClassMaterial::tp_methods[] = {
"... ba.DieMessage())))\n" "... ba.DieMessage())))\n"
"\n" "\n"
"**Example 3:** play some sounds when we're contacting the ground:\n" "**Example 3:** play some sounds when we're contacting the ground:\n"
"```python\n"
">>> m = ba.Material()\n" ">>> m = ba.Material()\n"
"... m.add_actions(\n" "... m.add_actions(\n"
"... conditions=('they_have_material',\n" "... conditions=('they_have_material',\n"

View File

@ -25,7 +25,7 @@ void PythonClassNode::SetupType(PyTypeObject* obj) {
obj->tp_doc = obj->tp_doc =
"Reference to a Node; the low level building block of the game.\n" "Reference to a Node; the low level building block of the game.\n"
"\n" "\n"
"Category: Gameplay Classes\n" "Category: **Gameplay Classes**\n"
"\n" "\n"
"At its core, a game is nothing more than a scene of Nodes\n" "At its core, a game is nothing more than a scene of Nodes\n"
"with attributes getting interconnected or set over time.\n" "with attributes getting interconnected or set over time.\n"
@ -34,8 +34,8 @@ void PythonClassNode::SetupType(PyTypeObject* obj) {
"to a game node; *not* the node itself. This means a Node's\n" "to a game node; *not* the node itself. This means a Node's\n"
"lifecycle is completely independent of how many Python references\n" "lifecycle is completely independent of how many Python references\n"
"to it exist. To explicitly add a new node to the game, use\n" "to it exist. To explicitly add a new node to the game, use\n"
"ba.newnode, and to explicitly delete one, use ba.Node.delete.\n" "ba.newnode(), and to explicitly delete one, use ba.Node.delete().\n"
"ba.Node.exists can be used to determine if a Node still points to\n" "ba.Node.exists() can be used to determine if a Node still points to\n"
"a live node in the game.\n" "a live node in the game.\n"
"\n" "\n"
"You can use ba.Node(None) to instantiate an invalid\n" "You can use ba.Node(None) to instantiate an invalid\n"

View File

@ -53,7 +53,7 @@ void PythonClassSessionPlayer::SetupType(PyTypeObject* obj) {
"Be aware that, like ba.Nodes, ba.SessionPlayer objects are 'weak'\n" "Be aware that, like ba.Nodes, ba.SessionPlayer objects are 'weak'\n"
"references under-the-hood; a player can leave the game at\n" "references under-the-hood; a player can leave the game at\n"
" any point. For this reason, you should make judicious use of the\n" " any point. For this reason, you should make judicious use of the\n"
"ba.SessionPlayer.exists method (or boolean operator) to ensure\n" "ba.SessionPlayer.exists() method (or boolean operator) to ensure\n"
"that a SessionPlayer is still present if retaining references to one\n" "that a SessionPlayer is still present if retaining references to one\n"
"for any length of time.\n" "for any length of time.\n"
"\n" "\n"

View File

@ -26,7 +26,7 @@ void PythonClassSound::SetupType(PyTypeObject* obj) {
"\n" "\n"
"Category: **Asset Classes**\n" "Category: **Asset Classes**\n"
"\n" "\n"
"Use ba.getsound to instantiate one."; "Use ba.getsound() to instantiate one.";
obj->tp_repr = (reprfunc)tp_repr; obj->tp_repr = (reprfunc)tp_repr;
obj->tp_new = tp_new; obj->tp_new = tp_new;
obj->tp_dealloc = (destructor)tp_dealloc; obj->tp_dealloc = (destructor)tp_dealloc;

View File

@ -26,7 +26,7 @@ void PythonClassWidget::SetupType(PyTypeObject* obj) {
"\n" "\n"
"This class represents a weak reference to a widget object\n" "This class represents a weak reference to a widget object\n"
"in the internal C++ layer. Currently, functions such as\n" "in the internal C++ layer. Currently, functions such as\n"
"ba.buttonwidget must be used to instantiate or edit these."; "ba.buttonwidget() must be used to instantiate or edit these.";
obj->tp_new = tp_new; obj->tp_new = tp_new;
obj->tp_dealloc = (destructor)tp_dealloc; obj->tp_dealloc = (destructor)tp_dealloc;
obj->tp_repr = (reprfunc)tp_repr; obj->tp_repr = (reprfunc)tp_repr;

View File

@ -1034,7 +1034,7 @@ auto PythonMethodsApp::GetMethods() -> std::vector<PyMethodDef> {
" require the ability to do so, use the ba.Timer class instead.\n" " require the ability to do so, use the ba.Timer class instead.\n"
"\n" "\n"
"##### Arguments\n" "##### Arguments\n"
"###### time (float):\n" "###### time (float)\n"
"> Length of time (in seconds by default) that the timer will wait\n" "> Length of time (in seconds by default) that the timer will wait\n"
"before firing. Note that the actual delay experienced may vary\n " "before firing. Note that the actual delay experienced may vary\n "
"depending on the timetype. (see below)\n" "depending on the timetype. (see below)\n"

View File

@ -812,7 +812,7 @@ auto PythonMethodsSystem::GetMethods() -> std::vector<PyMethodDef> {
"\n" "\n"
"Category: **General Utility Functions**\n" "Category: **General Utility Functions**\n"
"\n" "\n"
"Ensure that ba.clipboard_available returns True before adding\n" "Ensure that ba.clipboard_available() returns True before adding\n"
" buttons/etc. that make use of this functionality."}, " buttons/etc. that make use of this functionality."},
{"clipboard_get_text", (PyCFunction)PyClipboardGetText, METH_NOARGS, {"clipboard_get_text", (PyCFunction)PyClipboardGetText, METH_NOARGS,
"clipboard_get_text() -> str\n" "clipboard_get_text() -> str\n"
@ -821,7 +821,7 @@ auto PythonMethodsSystem::GetMethods() -> std::vector<PyMethodDef> {
"\n" "\n"
"Category: **General Utility Functions**\n" "Category: **General Utility Functions**\n"
"\n" "\n"
"Ensure that ba.clipboard_has_text returns True before calling\n" "Ensure that ba.clipboard_has_text() returns True before calling\n"
" this function."}, " this function."},
{"printobjects", (PyCFunction)PyPrintObjects, {"printobjects", (PyCFunction)PyPrintObjects,
METH_VARARGS | METH_KEYWORDS, METH_VARARGS | METH_KEYWORDS,