Interaction Registration

Interaction Registry

class BBInteractionRegistry(*args, **kwargs)

Bases: object

A registry for putting interactions onto Sims, Objects, Terrain, and other places.

classmethod register()

Make the registry know about your handler.

Usage: @BBInteractionRegistry.register() class BBExampleSimHandler(BBSimInteractionHandler):

Returns:

A callable that creates an instance.

Return type:

Callable[[Type[BBInteractionHandler]], BBInteractionHandler]

register_interaction_handler(interaction_handler)

Manually register a handler for interactions.

Parameters:

interaction_handler (BBInteractionHandler) – The handler being registered.

Interaction Handler

class BBInteractionHandler

Bases: object

A handler for registering interactions on script objects.

property interaction_guids

A collection of interaction GUIDs to register.

property registration_location

The location for which interactions will be registered.

should_register(script_object)

Determine if the interactions should be registered to the specified script object.

Parameters:

script_object (ScriptObject) – The object to check.

Returns:

True, if the interactions should register to the object. False, if not.

Return type:

bool

Interaction Location

class BBInteractionLocation

Bases: BBInt

Different locations for which interactions exist.

Object Interaction Handler

class BBObjectInteractionHandler

Bases: BBInteractionHandler

A handler for registering interactions on Game Objects that are not Sims.

@BBInteractionRegistry.register()
class _ExampleObjectInteractionRegistration(BBObjectInteractionHandler):

    @property
    def interaction_guids(self) -> Tuple[int]:
        return (
            12345,
        )

    def should_register(self, game_object: GameObject) -> bool:
        super_result = super().should_register(game_object)
        if not super_result:
            return super_result
        # If matches specific id.
        return game_object.id == 5678
property interaction_guids

A collection of interaction GUIDs to register.

property registration_location

The location for which interactions will be registered.

should_register(script_object)

Determine if the interactions should be registered to the specified script object.

Parameters:

script_object (ScriptObject) – The object to check.

Returns:

True, if the interactions should register to the object. False, if not.

Return type:

bool

Sim Interaction Handler

class BBSimInteractionHandler

Bases: BBInteractionHandler

A handler for registering interactions on Sims.

@BBInteractionRegistry.register()
class _ExampleSimInteractionRegistration(BBSimInteractionHandler):

    @property
    def interaction_guids(self) -> Tuple[int]:
        return (
            12345,
        )

    def should_register(self, sim: Sim) -> bool:
        super_result = super().should_register(sim)
        if not super_result:
            return super_result
        # Only register these interactions to Young Adult Sims.
        return sim.age == Age.YOUNGADULT
property interaction_guids

A collection of interaction GUIDs to register.

property registration_location

The location for which interactions will be registered.

should_register(script_object)

Determine if the interactions should be registered to the specified script object.

Parameters:

script_object (ScriptObject) – The object to check.

Returns:

True, if the interactions should register to the object. False, if not.

Return type:

bool

Terrain Interaction Handler

class BBTerrainInteractionHandler

Bases: BBInteractionHandler

A handler for registering interactions on the Terrain (Does not include Oceans).

@BBInteractionRegistry.register()
class _ExampleTerrainInteractionRegistration(BBTerrainInteractionHandler):

    @property
    def interaction_guids(self) -> Tuple[int]:
        return (
            12345,
        )
property interaction_guids

A collection of interaction GUIDs to register.

property registration_location

The location for which interactions will be registered.

should_register(script_object)

Determine if the interactions should be registered to the specified script object.

Parameters:

script_object (ScriptObject) – The object to check.

Returns:

True, if the interactions should register to the object. False, if not.

Return type:

bool

Ocean Interaction Handler

class BBOceanInteractionHandler

Bases: BBInteractionHandler

A handler for registering interactions on the Ocean and Pools.

@BBInteractionRegistry.register()
class _ExampleOceanInteractionRegistration(BBOceanInteractionHandler):

    @property
    def interaction_guids(self) -> Tuple[int]:
        return (
            12345,
        )
property interaction_guids

A collection of interaction GUIDs to register.

property registration_location

The location for which interactions will be registered.

should_register(script_object)

Determine if the interactions should be registered to the specified script object.

Parameters:

script_object (ScriptObject) – The object to check.

Returns:

True, if the interactions should register to the object. False, if not.

Return type:

bool

Phone Interaction Handler

class BBPhoneInteractionHandler

Bases: BBInteractionHandler

A handler for registering interactions on the Phone.

@BBInteractionRegistry.register()
class _ExamplePhoneInteractionRegistration(BBPhoneInteractionHandler):

    @property
    def interaction_guids(self) -> Tuple[int]:
        return (
            12345,
        )
property interaction_guids

A collection of interaction GUIDs to register.

property registration_location

The location for which interactions will be registered.

should_register(script_object)

Determine if the interactions should be registered to the specified script object.

Parameters:

script_object (ScriptObject) – The object to check.

Returns:

True, if the interactions should register to the object. False, if not.

Return type:

bool

Relationship Panel Interaction Handler

class BBRelationshipPanelInteractionHandler

Bases: BBInteractionHandler

A handler for registering interactions on the Relationship Panel.

@BBInteractionRegistry.register()
class _ExampleRelationshipPanelInteractionRegistration(BBRelationshipPanelInteractionHandler):

    @property
    def interaction_guids(self) -> Tuple[int]:
        return (
            12345,
        )
property interaction_guids

A collection of interaction GUIDs to register.

property registration_location

The location for which interactions will be registered.

should_register(script_object)

Determine if the interactions should be registered to the specified script object.

Parameters:

script_object (ScriptObject) – The object to check.

Returns:

True, if the interactions should register to the object. False, if not.

Return type:

bool