Effects

Visual Effects

class CommonVisualEffect(mod_identity, source, effect_name, joint_bone_name='b__Root__', target_actor_id=0, target_joint_bone_name=None, **kwargs)

Bases: HasLog

A visual effect that will play while attached to an object or Sim.

Parameters:
  • mod_identity (CommonModIdentity) – The identity of the mod that owns this visual effect.

  • source (Union[GameObject, Sim]) – An instance of an object or Sim. They will be the source of the effect.

  • effect_name (str) – The name of the effect to play.

  • joint_bone_name (str, optional) – The name of the joint to play the effect attached to. Default is the root bone ‘b__Root__’.

  • target_actor_id (int, optional) – The id of the target actor. Default will be the id of the target.

  • target_joint_bone_name (str, optional) – The name of the joint to play the effect attached to on the target. Default is the value of joint_bone_name.

property log_identifier

A string identifier for the log used by instances of the class.

Note

This is the message identifier that will appear when logging messages.

Returns:

The identifier of the log

Return type:

str

property mod_identity

The identity of the mod that owns this property

Warning

Override this property with the CommonModIdentity of your mod.

This is a MUST override to allow for proper Exception Handling and Logging!

Returns:

An instance of CommonModIdentity

Return type:

CommonModIdentity

Raises:

NotImplementedError – Thrown when the property is not implemented.

start(time_span=None, on_end=None)

Start the effect.

Parameters:
  • time_span (TimeSpan, optional) – A span of time indicating how long to run the effect for. Default is however long the vfx itself runs.

  • on_end (Callable[['CommonVisualEffect'], None], optional) – A callback invoked when the effect ends. This is only used when sim_minutes_until_end is specified. Default is None.

Returns:

True, if the effect was started successfully. False, if not.

Return type:

bool

start_run_once(time_span=None, on_end=None)

Start the effect and have it run only once.

Parameters:
  • time_span (TimeSpan, optional) – A span of time indicating how long to run the effect for. Default is however long the vfx itself runs.

  • on_end (Callable[['CommonVisualEffect'], None], optional) – A callback invoked when the effect ends. This is only used when sim_minutes_until_end is specified. Default is None.

Returns:

True, if the effect was started successfully. False, if not.

Return type:

bool

stop()

Stop the effect.

Returns:

True, if the effect was stopped successfully. False, if not.

Return type:

bool

stop_immediate()

Kill the effect.

Returns:

True, if the effect was stopped successfully. False, if not.

Return type:

bool