Class: MockActionBase
Mock of the X-Ray engine GOAP action base class.
Extends
Implements
action_base
Accessors
__name
Get Signature
get __name(): string;Returns
string
Implementation of
action_base.__nameInherited from
__name
Get Signature
get static __name(): string;Returns
string
Inherited from
Constructors
Constructor
new MockActionBase(object: game_object, name?: string): MockActionBase;Parameters
| Parameter | Type |
|---|---|
object | game_object |
name? | string |
Returns
MockActionBase
Overrides
Methods
add_effect()
add_effect(property: MockWorldProperty): void;Add action effect. Describes what target world state is expected to be if action is completed.
Parameters
| Parameter | Type | Description |
|---|---|---|
property | MockWorldProperty | World state property describing a pair of evaluator ID and value. |
Returns
void
Remarks
Do not mutate effects while the owner planner is updating; the engine asserts on graph changes during solving.
Implementation of
action_base.add_effectadd_precondition()
add_precondition(property: MockWorldProperty): void;Add action execution precondition. When building logics graph, action will be considered blocked by some preconditions.
Parameters
| Parameter | Type | Description |
|---|---|---|
property | MockWorldProperty | World state property describing a pair of evaluator ID and value. |
Returns
void
Remarks
Do not mutate preconditions while the owner planner is updating; the engine asserts on graph changes during solving.
Implementation of
action_base.add_preconditionexecute()
execute(): void;Lifecycle method. Execution tick of the action, called from object logics update cycle when current action is active.
Returns
void
Remarks
Called by the owning planner after initialize. Direct calls bypass planner state.
Implementation of
action_base.executefinalize()
finalize(): void;Lifecycle method called once on action execution stop. Means that action is finished / preconditions are not met anymore.
Returns
void
Remarks
Called by the owning planner. Direct calls are only useful when driving an action manually in tests or tools.
Implementation of
action_base.finalizegetEffect()
getEffect(id: number): MockWorldProperty | null;Parameters
| Parameter | Type |
|---|---|
id | number |
Returns
MockWorldProperty | null
getPrecondition()
getPrecondition(id: number): MockWorldProperty | null;Parameters
| Parameter | Type |
|---|---|
id | number |
Returns
MockWorldProperty | null
initialize()
initialize(): void;Lifecycle method called once on action execution start. Means that lifecycle of the action begun.
Returns
void
Remarks
Called by the owning planner. Direct calls are only useful when driving an action manually in tests or tools.
Implementation of
action_base.initializeremove_effect()
remove_effect(id: number): void;Remove action effect. Action will be not considered as property changing for id anymore.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | number | World state property id. |
Returns
void
Remarks
Do not mutate effects while the owner planner is updating; the engine asserts on graph changes during solving.
Implementation of
action_base.remove_effectremove_precondition()
remove_precondition(id: number): void;Remove precondition for action. When building logics graph, action will not be considered blocked by evaluator id states.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | number | World state property id. |
Returns
void
Remarks
Do not mutate preconditions while the owner planner is updating; the engine asserts on graph changes during solving.
Implementation of
action_base.remove_preconditionset_weight()
set_weight(weight: number): void;Set weight of current action execution.
Parameters
| Parameter | Type | Description |
|---|---|---|
weight | number | Weight value to express how prioritized action is. |
Returns
void
Implementation of
action_base.set_weightsetup()
setup(object: game_object): void;Handle setup of the action and binding to a specific object.
Parameters
| Parameter | Type | Description |
|---|---|---|
object | game_object | Target client object to work with. |
Returns
void
Remarks
Called by the planner when the action is registered. Call it manually only for standalone action tests.
Implementation of
action_base.setupshow()
show(prefix?: string): void;Debug method. With mixed / debug build allows investigation of evaluators and actions matches. Helps to debug custom actions and actions pre-conditions with state printing in log files.
Note: Available only in mixed / debug engine builds, not for direct usage from lua.
Parameters
| Parameter | Type | Description |
|---|---|---|
prefix? | string | String prefix to display current action state in logs. |
Returns
void
Implementation of
action_base.showcreate()
static create(object: game_object, name?: string): MockActionBase;Parameters
| Parameter | Type |
|---|---|
object | game_object |
name? | string |
Returns
MockActionBase
Overrides
mock()
static mock(object: game_object, name?: string): action_base;Parameters
| Parameter | Type |
|---|---|
object | game_object |
name? | string |
Returns
action_base
Overrides
Properties
effects
effects: MockWorldProperty[] = [];name
name: string;object
object: game_object;Game object that is handled by current action instance.
Implementation of
action_base.objectpreconditions
preconditions: MockWorldProperty[] = [];storage
storage: property_storage;Container reference with state of action preconditions.
Implementation of
action_base.storage