Zone Events

Zone Load Start Event

class BBOnZoneLoadStartEvent(mod_identity, zone, is_first_load)

Bases: BBEvent

An event that occurs when a Zone starts loading.

Usage:

@BBEventHandlerRegistry.register(ModIdentity(), BBOnZoneLoadStartEvent) def _bbl_handle_on_zone_load_start(event: BBOnZoneLoadStartEvent):

Example usage:

from bluuberrylibrary.events.event_handling.bb_event_handler_registry import BBEventHandlerRegistry
from bluuberrylibrary.classes.bb_test_result import BBTestResult

@BBEventHandlerRegistry.register(ModIdentity(), BBOnZoneLoadStartEvent)
def _bbl_handle_on_zone_load_start(event: BBOnZoneLoadStartEvent):
    return BBTestResult.TRUE
Parameters:
  • mod_identity (BBModIdentity) – The identity of the mod that owns this event.

  • zone (Zone) – An instance of the Zone that was loaded.

  • is_first_load (bool) – True, indicates this is the first time the client has loaded into a zone. False, if the client has previously loaded into a zone.

property is_first_load

True, if this the first load of the game. False, if not.

property zone

The Zone that started loading.

Zone Load End Event

class BBOnZoneLoadEndEvent(mod_identity, zone, is_first_load)

Bases: BBEvent

An event that occurs when a Zone finishes loading.

Usage:

@BBEventHandlerRegistry.register(ModIdentity(), BBOnZoneLoadEndEvent) def _bbl_handle_on_zone_load_end(event: BBOnZoneLoadEndEvent):

Example usage:

from bluuberrylibrary.events.event_handling.bb_event_handler_registry import BBEventHandlerRegistry
from bluuberrylibrary.classes.bb_test_result import BBTestResult

@BBEventHandlerRegistry.register(ModIdentity(), BBOnZoneLoadEndEvent)
def _bbl_handle_on_zone_load_end(event: BBOnZoneLoadEndEvent):
    return BBTestResult.TRUE
Parameters:
  • mod_identity (BBModIdentity) – The identity of the mod that owns this event.

  • zone (Zone) – An instance of the Zone that was loaded.

  • household_id (int) – The id of the household that was loaded.

  • is_build_mode (bool) – True, indicates the client loaded into Build Mode. (No Sims are selected) False, indicates the client loaded into Live Mode.

  • is_first_load (bool) – True, indicates this is the first time the client has loaded into a zone. False, if the client has previously loaded into a zone.

property household_id

The id of the household being loaded.

property is_build_mode

True, if the client loaded into build mode. False, if the client loaded into Live mode.

property is_first_load

True, if this the first load of the game. False, if not.

property zone

The zone that finished loading.

Zone Unload Start Event

class BBOnZoneUnloadStartEvent(mod_identity, zone)

Bases: BBEvent

An event that occurs when a Zone starts unloading.

Usage:

@BBEventHandlerRegistry.register(ModIdentity(), BBOnZoneUnloadStartEvent) def _bbl_handle_on_zone_unload_start(event: BBOnZoneUnloadStartEvent):

Example usage:

from bluuberrylibrary.events.event_handling.bb_event_handler_registry import BBEventHandlerRegistry
from bluuberrylibrary.classes.bb_test_result import BBTestResult

@BBEventHandlerRegistry.register(ModIdentity(), BBOnZoneUnloadStartEvent)
def _bbl_handle_on_zone_unload_start(event: BBOnZoneUnloadStartEvent):
    return BBTestResult.TRUE
Parameters:
  • mod_identity (BBModIdentity) – The identity of the mod that owns this event.

  • zone (Zone) – An instance of the Zone that was loaded.

  • client (Client) – The client performing the action.

property client

The client performing the action.

property zone

The zone that finished loading.

Zone Event Dispatcher

class BBZoneEventDispatcher(*args, **kwargs)

Bases: BBEventDispatcher

Dispatches event related to Zones

property client_finished_first_load

True, if the client has finished loading for the very first time. False, if not.

property client_is_loading

True, if the client is currently loading (In a loading screen). False, if not.

on_zone_load_finished(zone, household_id, is_build_mode)

Dispatch an event when a zone finishes loading.

Parameters:
  • zone (Zone) – The zone that finished loading.

  • household_id (int) – The id of the household that finished loading.

  • is_build_mode (bool) – True, if the client loaded into Build Mode. False, if the client loaded into Live Mode.

Returns:

The result of dispatching the event. True, if successful. False, if not.

Return type:

BBRunResult

on_zone_load_started(zone)

Dispatch an event when a Zone starts loading.

Parameters:

zone (Zone) – The zone that started to load.

Returns:

The result of dispatching the event. True, if successful. False, if not.

Return type:

BBRunResult

on_zone_unload_started(zone, client)

Dispatch an event when a Zone starts unloading.

Parameters:
  • zone (Zone) – The zone that started to unload.

  • client (Client) – The client being unloaded.

Returns:

The result of dispatching the event. True, if successful. False, if not.

Return type:

BBRunResult