PerformableActionInterface Class
Surface API to handle PerformableAction implementations. This allows a source object and target object to have separate action resolution logic without directly referencing eachother. See also ResolvableActionInterface, ResolvableAction
Item Index
Methods
canPerformAction
-
action
-
[settings]
Checks if source can perform an action with given settings. (source is this
)
Functionality separated to avoid checking multiple targets when source cannot perform action regardless of target.
Parameters:
-
action
String- The action to check.
-
[settings]
Object optional- Settings for the action.
Returns:
true
if the action can be performed.
canPerformActionOnTarget
-
action
-
target
-
[settings]
Checks if source can perform an action on target with given settings.
Parameters:
-
action
String- The action to check.
-
target
Object- The target object to check against.
-
[settings]
Object optional- Settings for the action.
-
[skipCanPerformAction]
Object optional- If true skips checking that
this.canPerformAction(action, settings) == true
- If true skips checking that
Returns:
true
if the action can be performed on target.
getTargetsForAction
-
action
-
[settings]
Returns a list of valid targets to perform an action on.
Parameters:
-
action
String- The action to get targets for.
-
[settings]
Object optional- Settings for the action.
Returns:
Array of valid targets.
performAction
-
action
-
target
-
[settings]
Performs an action on target with given settings.
Parameters:
-
action
String- The action to perform.
-
target
Object- The target object to perform the action on.
-
[settings]
Object optional- Settings for the action.
-
[skipCanPerformAction]
Object optional- If true skips checking that
this.canPerformAction(action, settings) == true
- If true skips checking that
-
[skipCanPerformActionOnTarget]
Object optional- If true skips checking that
this.skipCanPerformActionOnTarget(action, target, settings) == true
- If true skips checking that
Returns:
true
if the action has been successfully completed.
setPerformableAction
-
action
-
implementation
Sets a performable action implementation on object.
Parameters:
-
action
String- The action name.
-
implementation
PerformableAction- Object to set as the action implementation.
or a string to lookup an implementation
RL.PerformableActions[implementation]
.
- Object to set as the action implementation.
or a string to lookup an implementation