PerformableAction Class
A performable action implementation. Handles the resolution of a source object performing an action on a target object. Performable action logic is attached to and primarily related to the source. Methods on this object should only be called by the {{#crossLink "PerformableActionInterface"}}
If any of the functions on this object should always return true
or false
it can be set to a Boolean
value that will be used
instead of the value returned by calling the function.
Item Index
Methods
afterPerformActionSuccess
-
target
-
[settings]
Optional function called after action is resolved successfully.
Parameters:
-
target
Object- The target to perform the action on.
-
[settings]
Object optional- Settings for the action.
Returns:
Array of valid targets.
afterPerformActionSuccess
-
target
-
[settings]
Optional function called after action is resolved un-successfully.
Parameters:
-
target
Object- The target to perform the action on.
-
[settings]
Object optional- Settings for the action.
Returns:
Array of valid targets.
canPerformAction
-
settings
Checks if the entity with this PerformableAction
can currently perform the action.
Instead of a function this.canPerformAction
can be set to a boolean value if the check should always be true or false.
If this functions should always return true
or false
it can be set to a Boolean
value that will be used
instead of the value returned by calling the function.
Parameters:
-
settings
Object- The settings for the action.
Returns:
canPerformActionOnTarget
-
target
-
settings
Checks if the entity with this PerformableAction
can currently perform the action on given target.
If this functions should always return true
or false
it can be set to a Boolean
value that will be used
instead of the value returned by calling the function.
Parameters:
-
target
Object- The target to perform the action on.
-
settings
Object- The settings for the action.
Returns:
getTargetsForAction
-
[settings]
Returns a list of valid targets to perform this action on.
Parameters:
-
[settings]
Object optional- Settings for the action.
Returns:
Array of valid targets.
performAction
-
target
-
settings
Performs this PerformableAction
from source on target using settings.
If this functions should always return true
or false
it can be set to a Boolean
value that will be used
instead of the value returned by calling the function.
Parameters:
-
target
Object- The target to perform the action on.
-
settings
Object- The settings for the action.