Zone Spin Event Types

Zone Early Load Event

class S4CLZoneEarlyLoadEvent(zone, game_loaded=False, game_loading=False)

Bases: sims4communitylib.events.event_handling.common_event.CommonEvent

An event that occurs when a Zone has loaded.

Note

This event occurs before the S4CLZoneLateLoadEvent

Example usage:
from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry
from sims4communitylib.modinfo import ModInfo

class ExampleEventListener:

    # In order to listen to an event, your function must match these criteria:
    # - The function is static (staticmethod).
    # - The first and only required argument has the name "event_data".
    # - The first and only required argument has the Type Hint for the event you are listening for.
    # - The argument passed to "handle_events" is the name of your Mod.
    @staticmethod
    @CommonEventRegistry.handle_events(ModInfo.get_identity().name)
    def handle_event(event_data: S4CLZoneEarlyLoadEvent):
        pass
Parameters:
  • zone (Zone) – The Zone that was loaded.
  • game_loaded (bool) – A value indicating if the game has been loaded.
  • game_loading (bool) – A value indicating if the game is currently loading.
game_loaded

Determine if the game has loaded.

Returns:True, if the game has loaded. False, if the game has not loaded.
Return type:bool
game_loading

Determine if the game is loading.

Returns:True, if the game is currently loading. False, if the game is not currently loading.
Return type:bool
zone

The Zone that was loaded.

Returns:The Zone that was loaded.
Return type:Zone

Zone Late Load Event

class S4CLZoneLateLoadEvent(zone, household_id, active_sim_id, game_loaded=False, game_loading=False)

Bases: sims4communitylib.events.event_handling.common_event.CommonEvent

An event that occurs when a Zone has finished spinning up.

Note

This event occurs after the S4CLZoneEarlyLoadEvent and before the S4CLZoneFinishedLoadEvent

Example usage:
from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry
from sims4communitylib.modinfo import ModInfo

class ExampleEventListener:

    # In order to listen to an event, your function must match these criteria:
    # - The function is static (staticmethod).
    # - The first and only required argument has the name "event_data".
    # - The first and only required argument has the Type Hint for the event you are listening for.
    # - The argument passed to "handle_events" is the name of your Mod.
    @staticmethod
    @CommonEventRegistry.handle_events(ModInfo.get_identity().name)
    def handle_event(event_data: S4CLZoneLateLoadEvent):
        pass
Parameters:
  • zone (Zone) – The Zone that has finished spinning up.
  • household_id (int) – The identifier of the Household that owns the Zone.
  • active_sim_id (int) – The identifier of the Active Sim.
  • game_loaded (bool) – A value indicating if the game has been loaded.
  • game_loading (bool) – A value indicating if the game is currently loading.
active_sim_id

The identifier of the Active Sim.

Returns:The identifier of the Active Sim.
Return type:int
game_loaded

Determine if the game has loaded.

Returns:True, if the game has loaded. False, if the game has not loaded.
Return type:bool
game_loading

Determine if the game is loading.

Returns:True, if the game is currently loading. False, if the game is not currently loading.
Return type:bool
household_id

The identifier of the Household that owns the Zone.

Returns:The identifier of the Household that owns the Zone.
Return type:int
zone

The Zone that has finished spinning up.

Returns:The Zone that has finished spinning up.
Return type:Zone

Zone Save Event

class S4CLZoneSaveEvent(zone, save_slot_data=None, game_loaded=False, game_loading=False)

Bases: sims4communitylib.events.event_handling.common_event.CommonEvent

An event that occurs upon a Zone being saved (Before it has been saved).

Note

This event can occur when the Player is saving the game, switching save files, or traveling to a new zone.

Warning

This event will also occur when the Player closes the game without saving.

Example usage:
from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry
from sims4communitylib.modinfo import ModInfo

class ExampleEventListener:

    # In order to listen to an event, your function must match these criteria:
    # - The function is static (staticmethod).
    # - The first and only required argument has the name "event_data".
    # - The first and only required argument has the Type Hint for the event you are listening for.
    # - The argument passed to "handle_events" is the name of your Mod.
    @staticmethod
    @CommonEventRegistry.handle_events(ModInfo.get_identity().name)
    def handle_event(event_data: S4CLZoneSaveEvent):
        pass
Parameters:
  • zone (Zone) – The Zone being saved.
  • save_slot_data (Any) – The data that will be saved.
  • game_loaded (bool) – A value indicating if the game has been loaded.
  • game_loading (bool) – A value indicating if the game is currently loading.
game_loaded

Determine if the game has loaded.

Returns:True, if the game has loaded. False, if the game has not loaded.
Return type:bool
game_loading

Determine if the game is loading.

Returns:True, if the game is currently loading. False, if the game is not currently loading.
Return type:bool
save_slot_data

The data that will be saved.

Returns:The data that will be saved.
Return type:Any
zone

The Zone being saved.

Returns:The Zone being saved.
Return type:Zone

Zone Teardown Event

class S4CLZoneTeardownEvent(zone, client, game_loaded=False, game_loading=False)

Bases: sims4communitylib.events.event_handling.common_event.CommonEvent

An event that occurs upon a Zone being saved (Before it has been torn down).

Note

This event can occur when the Player travels to another lot.

Warning

This event will also occur when the Player closes the game without saving.

Example usage:
from sims4communitylib.events.event_handling.common_event_registry import CommonEventRegistry
from sims4communitylib.modinfo import ModInfo

class ExampleEventListener:

    # In order to listen to an event, your function must match these criteria:
    # - The function is static (staticmethod).
    # - The first and only required argument has the name "event_data".
    # - The first and only required argument has the Type Hint for the event you are listening for.
    # - The argument passed to "handle_events" is the name of your Mod.
    @staticmethod
    @CommonEventRegistry.handle_events(ModInfo.get_identity().name)
    def handle_event(event_data: S4CLZoneTeardownEvent):
        pass
Parameters:
  • zone (Zone) – The Zone being torn down.
  • client (Client) – An instance of the Client.
  • game_loaded (bool) – A value indicating if the game has been loaded.
  • game_loading (bool) – A value indicating if the game is currently loading.
client

An instance of the Client.

Returns:An instance of the Client.
Return type:Client
game_loaded

Determine if the game has loaded.

Returns:True, if the game has loaded. False, if the game has not loaded.
Return type:bool
game_loading

Determine if the game is loading.

Returns:True, if the game is currently loading. False, if the game is not currently loading.
Return type:bool
zone

The Zone being torn down.

Returns:The Zone being torn down.
Return type:Zone