Conditionals¶
Conditional Action¶
-
class
CommonConditionalAction
¶ Bases:
sims4communitylib.logging.has_log.HasLog
An inheritable class that Performs an action when a condition is met.
Note
A common usage would be in a factory pattern with a collection of
CommonConditionalAction
objects.-
_apply
(*_, **__)¶ Apply the action.
Warning
The arguments must match the
try_apply()
arguments.Returns: True, if the action was applied. False, if not. Return type: bool
-
_should_apply
(*_, **__)¶ Determine if the action should apply based on the given arguments.
Warning
The arguments must match the
try_apply()
method.Returns: True, if the action should be applied. False, if not. Return type: bool
-
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.
-
try_apply
(*_, **__)¶ Attempt to apply the action.
Note
Override this method with any arguments you want to.
Returns: True, if the action was applied. False, if not. Return type: bool
-