Sim Utilities

Sim Interaction Utils

class BBSimInteractionUtils

Bases: object

Utilities for manipulating interactions of Sims.

classmethod get_queued_interactions_gen(sim_info, include_interaction_callback=None)

Retrieve all interactions that a Sim currently has queued.

Parameters:
  • sim_info (SimInfo) – An instance of a Sim

  • include_interaction_callback (Callable[[Interaction], bool], optional) – If the result of this callback is True, the Interaction will be included in the results. If set to None, All interactions will be included. Default is None.

Returns:

An iterator of all queued Interactions that pass the include callback filter.

Return type:

Iterator[Interaction]

classmethod get_running_interactions_gen(sim_info, include_interaction_callback=None)

Retrieve all interactions that a Sim is currently running.

Parameters:
  • sim_info (SimInfo) – An instance of a Sim

  • include_interaction_callback (Callable[[Interaction], bool], optional) – If the result of this callback is True, the Interaction will be included in the results. If set to None, all interactions will be included. Default is None.

Returns:

An iterator of all running Interactions that pass the include callback filter.

Return type:

Iterator[Interaction]

Sim Buff Utils

class BBSimBuffUtils

Bases: object

Utilities for managing Buffs on Sims.

classmethod add_buff(sim_info, buff, reason)

Add a Buff to a Sim.

Parameters:
  • sim_info (SimInfo) – The info of a Sim.

  • buff (int or Buff) – The Buff to add.

  • reason (int) – The reason the Buff is added. (This will appear under the Buff header when hovering over it in-game.)

Returns:

The result of adding or failing to add the buff. True, if successful. False, if not.

Return type:

BBRunResult

classmethod can_add_buff(sim_info, buff)

Determine if a Buff can be added to the Sim.

Parameters:
  • sim_info (SimInfo) – The info of a Sim.

  • buff (int or Buff) – The Buff to check.

Returns:

True, if the Buff can be added to the Sim. False, if not.

Return type:

BBRunResult

classmethod has_buff(sim_info, buff)

Check if a Sim has a buff or not.

Parameters:
  • sim_info (SimInfo) – The info of a Sim.

  • buff (int or Trait) – The buff to check for.

Returns:

True, if the Sim has the buff. False, if not.

Return type:

bool

classmethod remove_buff(sim_info, buff)

Remove a buff from a Sim.

Parameters:
  • sim_info (SimInfo) – The info of a Sim.

  • buff (int or Buff) – The Buff to remove.

Returns:

True, if the Buff was successfully removed. False, if not.

Return type:

BBRunResult

Sim Situation Utils

class BBSimSituationUtils

Bases: object

Utilities for manipulating the situations of Sims.

classmethod get_situation_job(sim_info, situation)

Get the current Situation Job a Sim is assigned to in a Situation.

Parameters:
  • sim_info (SimInfo) – The info of a Sim.

  • situation (Situation) – A situation.

Returns:

The Situation Job the Sim is assigned to in the Situation or None if the Sim is not running the Situation.

Return type:

SituationJob or None

classmethod get_situation_role(sim_info, situation)

Get the current Situation Role a Sim is assigned to in a Situation.

Parameters:
  • sim_info (SimInfo) – The info of a Sim.

  • situation (Situation) – A situation.

Returns:

The Situation Role the Sim is assigned to in the Situation or None if the Sim is not running the Situation.

Return type:

RoleState or None

classmethod get_situations(sim_info)

Get all situations a Sim is in.

Parameters:

sim_info (SimInfo) – The info of a Sim.

Returns:

An iterator of Situations.

Return type:

Iterator[Situation]

Sim Spawn Utils

class BBSimSpawnUtils

Bases: object

Utilities for spawning and despawning Sims.

classmethod create_sim_info(species, gender=None, age=None, source='testing')

Create a new Sim.

Parameters:
  • species (SpeciesExtended) – The species of the Sim.

  • gender (Gender, optional) – The gender of the Sim. Default is MALE.

  • age (Age, optional) – The age of the Sim. Default is ADULT.

  • source (str, optional) – The source of creation. Default is “testing”.

Returns:

The newly created Sim or None if an error occurs.

Return type:

SimInfo or None

classmethod spawn_sim(sim_info)

Spawn a Sim.

Parameters:

sim_info (SimInfo) – The info of a Sim.

Returns:

True, if successful. False, if not.

Sim Statistic Utils

Sim Trait Utils

class BBSimTraitUtils

Bases: object

Utilities for managing Traits on Sims.

classmethod add_trait(sim_info, trait)

Add a Trait to a Sim.

Parameters:
  • sim_info (SimInfo) – The info of a Sim.

  • trait (int or Trait) – The Trait to add.

Returns:

The result of adding or failing to add the trait. True, if successful. False, if not.

Return type:

BBRunResult

classmethod can_add_trait(sim_info, trait)

Determine if a Trait can be added to the Sim.

Parameters:
  • sim_info (SimInfo) – The info of a Sim.

  • trait (int or Trait) – The Trait to check.

Returns:

True, if the Trait can be added to the Sim. False, if not.

Return type:

BBRunResult

classmethod get_traits(sim_info)

Get traits on a Sim.

Parameters:

sim_info (SimInfo) – The info of a Sim.

Returns:

A list of Traits.

Return type:

List[Trait]

classmethod has_trait(sim_info, trait)

Check if a Sim has a trait or not.

Parameters:
  • sim_info (SimInfo) – The info of a Sim.

  • trait (int or Trait) – The trait to check for.

Returns:

True, if the Sim has the trait. False, if not.

Return type:

bool

classmethod remove_trait(sim_info, trait)

Remove a trait from a Sim.

Parameters:
  • sim_info (SimInfo) – The info of a Sim.

  • trait (int or Trait) – The Trait to remove.

Returns:

True, if the Trait was successfully removed. False, if not.

Return type:

BBRunResult

Sim Utils

class BBSimUtils

Bases: object

Utilities for manipulating Sims.

classmethod get_active_sim_info()

Get the Info of the Active Sim.

Returns:

The Info of the Active Sim or None, if not found.

Return type:

SimInfo or None

classmethod get_all_sim_info_gen()

Get all Sim Infos

Returns:

An iterable of SimInfo

Return type:

Iterable[SimInfo]

classmethod get_sim_info_manager()

Retrieve the manager that manages Sims.

Returns:

The manager that manages Sims.

Return type:

SimInfoManager

classmethod to_sim_id(sim_identifier)

Convert a Sim identifier to a Sim ID.

Parameters:

sim_identifier (Union[int, Sim, SimInfo, SimInfoBaseWrapper]) – The identifier or instance of a Sim.

Returns:

The decimal identifier for the Sim instance or 0 if a problem occurs.

Return type:

int

classmethod to_sim_info(sim_identifier)

Convert a Sim identifier to SimInfo.

Parameters:

sim_identifier (Union[int, Sim, SimInfo, SimInfoBaseWrapper]) – The identifier or instance of a Sim to use.

Returns:

The SimInfo of the specified Sim instance or None, if SimInfo is not found.

Return type:

Union[SimInfo, SimInfoBaseWrapper, None]

classmethod to_sim_instance(sim_identifier, allow_hidden_flags=HiddenReasonFlag.NONE)

Convert a Sim identifier to a Sim Instance.

Parameters:
  • sim_identifier (Union[int, Sim, SimInfo]) – The identifier or instance of a Sim.

  • allow_hidden_flags (HiddenReasonFlag, optional) – Flags to indicate the types of hidden Sims to consider as being instanced. Default is ALL_HIDDEN_REASONS

Returns:

The instance of the specified Sim or None if no instance was found.

Return type:

Union[Sim, None]