Object Utilities

Object Spawn Utils

class BBObjectSpawnUtils

Bases: object

Utilities for creating and spawning Game Objects.

classmethod create_object(object_definition, on_init=None, on_added=None, item_location=ItemLocation.ON_LOT, **kwargs)

Create a Game Object from an Object Definition.

Parameters:
  • object_definition (int) – The Object Definition to create the Game Object from.

  • on_init (Callable[[GameObject], None], optional) – Occurs when the object is initialized. Default is None.

  • on_added (Callable[[GameObject], None], optional) – Occurs when the object is added to the Object Manager for the specified item_location. Default is nothing.

  • item_location (ItemLocation, optional) – The location to spawn the object at. Default is ON_LOT.

Returns:

The created Game Object.

Return type:

GameObject

classmethod spawn_object_at_location(object_definition, location, on_init=None, on_added=None, **kwargs)

Create and Spawn an Object at a Location.

Parameters:
  • object_definition (int) – The Object Definition to create the Game Object from.

  • location (Location) – The location to place the Game Object once it is spawned.

  • on_init (Callable[[GameObject], None], optional) – Occurs when the object is initialized. Default is None.

  • on_added (Callable[[GameObject], None], optional) – Occurs when the object is added to the Object Manager for the specified item_location. Default is nothing.

Returns:

The spawned object or None if an issue occurs.

Return type:

BBRunResult[GameObject]

Object State Utils