Skip to content

Class: MockActionPlanner ​

Mock of the X-Ray engine GOAP action planner.

Extends ​

Implements ​

  • action_planner

Accessors ​

__name ​

Get Signature ​

ts
get __name(): string;
Returns ​

string

Implementation of ​

ts
action_planner.__name

Inherited from ​

MockLuabindClass.__name


__name ​

Get Signature ​

ts
get static __name(): string;
Returns ​

string

Inherited from ​

MockLuabindClass.__name

Constructors ​

Constructor ​

ts
new MockActionPlanner(): MockActionPlanner;

Returns ​

MockActionPlanner

Inherited from ​

MockLuabindClass.constructor

Methods ​

actual() ​

ts
actual(): boolean;

Returns ​

boolean

Whether state of current planner is actual.

Implementation of ​

ts
action_planner.actual

asMock() ​

ts
asMock(): action_planner;

Returns ​

action_planner


clear() ​

ts
clear(): void;

Clear state of current action planner.

Returns ​

void

Implementation of ​

ts
action_planner.clear

current_action() ​

ts
current_action(): action_base;

Get currently active action being executed.

Returns ​

action_base

Current action instance reference.

Remarks ​

Requires the planner to be initialized, usually after a successful update.

Implementation of ​

ts
action_planner.current_action

current_action_id() ​

ts
current_action_id(): number;

Get currently active action identifier.

Returns ​

number

Unique identifier of current action.

Throws ​

If the planner is not initialized yet.

Implementation of ​

ts
action_planner.current_action_id

initialized() ​

ts
initialized(): boolean;

Returns ​

boolean

Whether object action planner is already initialized.

Implementation of ​

ts
action_planner.initialized

set_goal_world_state() ​

ts
set_goal_world_state(state: world_state): void;

Set target world state to try to reach with all the graph logics. All graphs will be built from current state to goal world state with the shortest possible path.

Parameters ​

ParameterTypeDescription
stateworld_stateTarget world state to reach with planner.

Returns ​

void

Implementation of ​

ts
action_planner.set_goal_world_state

setup() ​

ts
setup(object: game_object): void;

Setup planner for game object.

Parameters ​

ParameterTypeDescription
objectgame_objectClient game object to setup planner for.

Returns ​

void

Throws ​

If object is missing.

Implementation of ​

ts
action_planner.setup

update() ​

ts
update(): void;

Lifecycle method to handle generic game loop updates.

Returns ​

void

Throws ​

If the planner cannot build a non-empty action sequence to the target world state.

Implementation of ​

ts
action_planner.update

create() ​

ts
static create(): MockActionPlanner;

Returns ​

MockActionPlanner

Overrides ​

MockLuabindClass.create


mock() ​

ts
static mock(): action_planner;

Returns ​

action_planner

Overrides ​

MockLuabindClass.mock


mockDefault() ​

ts
static mockDefault(object: game_object | MockGameObject): action_planner;

Parameters ​

ParameterType
objectgame_object | MockGameObject

Returns ​

action_planner

Properties ​

action ​

ts
action: Mock<(id: number) => action_base>;

Get action instance by unique id.

Param ​

id

Unique identifier of the action to get.

Returns ​

Registered action instance.

Implementation of ​

ts
action_planner.action

actions ​

ts
actions: Record<number, action_base> = {};

add_action ​

ts
add_action: Mock<(id: number, actionBase: action_base) => void>;

Add generic action by id for planner execution.

Remarks ​

Do not add actions from evaluator/action callbacks running inside update; the engine asserts on planner graph changes during solving.

Param ​

id

Unique identifier of new action.

Param ​

action

Action implementation containing preconditions, logics, effects and other meta infos.

Implementation of ​

ts
action_planner.add_action

add_evaluator ​

ts
add_evaluator: Mock<(id: number, evaluator: property_evaluator) => void>;

Add evaluator instance for current action planner.

Remarks ​

Do not add evaluators from evaluator/action callbacks running inside update; the engine asserts on planner graph changes during solving.

Param ​

id

Unique identifier of the evaluator.

Param ​

evaluator

Instance of evaluator linked to the id.

Implementation of ​

ts
action_planner.add_evaluator

currentActionId ​

ts
currentActionId: number | null = null;

evaluator ​

ts
evaluator: Mock<(id: number) => property_evaluator>;

Get evaluator instance by id.

Param ​

id

Unique identifier of the evaluator to get.

Returns ​

Registered property evaluator.

Implementation of ​

ts
action_planner.evaluator

evaluators ​

ts
evaluators: Record<number, property_evaluator> = {};

goalWorldState ​

ts
goalWorldState: world_state | null = null;

isInitialized ​

ts
isInitialized: boolean = false;

object ​

ts
object: game_object;

Game object that is handled by current planner instance.

Implementation of ​

ts
action_planner.object

remove_action ​

ts
remove_action: Mock<(id: number) => void>;

Remove action by unique id.

Remarks ​

Do not remove actions from evaluator/action callbacks running inside update; the engine asserts on planner graph changes during solving.

Param ​

id

Unique identifier of the action to remove.

Implementation of ​

ts
action_planner.remove_action

remove_evaluator ​

ts
remove_evaluator: Mock<(id: number) => void>;

Remove evaluator instance from current action planner.

Remarks ​

Do not remove evaluators from evaluator/action callbacks running inside update; the engine asserts on planner graph changes during solving.

Param ​

id

Unique identifier of the evaluator for removal.

Implementation of ​

ts
action_planner.remove_evaluator

show ​

ts
show: Mock<UnknownFunction>;

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.

Param ​

prefix

String prefix to display current action state in logs.

Implementation of ​

ts
action_planner.show

storage ​

ts
storage: property_storage;

Container reference with state of planner preconditions.

Implementation of ​

ts
action_planner.storage