Skip to content

Class: MockAlifeCreatureActor

Class based server object mock.

Extends

Implements

  • cse_alife_creature_actor

Accessors

__name

Get Signature

ts
get __name(): string;
Returns

string

Implementation of

ts
cse_alife_creature_actor.__name

Inherited from

MockServerAlifeCreatureAbstract.__name


__name

Get Signature

ts
get static __name(): string;
Returns

string

Inherited from

MockServerAlifeCreatureAbstract.__name

Constructors

Constructor

ts
new MockAlifeCreatureActor(config?: IMockAlifeObjectConfig): MockAlifeCreatureActor;

Parameters

ParameterType
configIMockAlifeObjectConfig

Returns

MockAlifeCreatureActor

Overrides

MockServerAlifeCreatureAbstract.constructor

Methods

asMock()

ts
asMock(): cse_alife_creature_actor;

Returns

cse_alife_creature_actor


can_save()

ts
can_save(): boolean;

Returns

boolean

Whether this object should be saved.

Implementation of

ts
cse_alife_creature_actor.can_save

Inherited from

MockServerAlifeCreatureAbstract.can_save


can_switch_offline()

Call Signature

ts
can_switch_offline(): boolean;
Returns

boolean

Whether this object may switch offline.

Implementation of
ts
cse_alife_creature_actor.can_switch_offline
Inherited from

MockServerAlifeCreatureAbstract.can_switch_offline

Call Signature

ts
can_switch_offline(value: boolean): void;

Allow or block switching offline.

Parameters
ParameterTypeDescription
valuebooleanWhether offline switching is allowed.
Returns

void

Remarks

Sets the object's switch-offline flag; it does not switch the object immediately.

Implementation of
ts
cse_alife_creature_actor.can_switch_offline
Inherited from

MockServerAlifeCreatureAbstract.can_switch_offline


can_switch_online()

Call Signature

ts
can_switch_online(): boolean;
Returns

boolean

Whether this object may switch online.

Implementation of
ts
cse_alife_creature_actor.can_switch_online
Inherited from

MockServerAlifeCreatureAbstract.can_switch_online

Call Signature

ts
can_switch_online(value: boolean): void;

Allow or block switching online.

Parameters
ParameterTypeDescription
valuebooleanWhether online switching is allowed.
Returns

void

Remarks

Sets the object's switch-online flag; it does not switch the object immediately.

Implementation of
ts
cse_alife_creature_actor.can_switch_online
Inherited from

MockServerAlifeCreatureAbstract.can_switch_online


clsid()

ts
clsid(): TXR_class_id;

Returns

TXR_class_id

Engine class id.

Implementation of

ts
cse_alife_creature_actor.clsid

Inherited from

MockServerAlifeCreatureAbstract.clsid


current_level_travel_speed()

Call Signature

ts
current_level_travel_speed(): number;
Returns

number

Travel speed used inside the current level.

Implementation of
ts
cse_alife_creature_actor.current_level_travel_speed
Inherited from

MockServerAlifeCreatureAbstract.current_level_travel_speed

Call Signature

ts
current_level_travel_speed(value: number): void;

Set travel speed used inside the current level.

Parameters
ParameterTypeDescription
valuenumberNew travel speed.
Returns

void

Implementation of
ts
cse_alife_creature_actor.current_level_travel_speed
Inherited from

MockServerAlifeCreatureAbstract.current_level_travel_speed


FillProps()

ts
FillProps(_pref: string, _items: prop_item_vec): void;

Fill editor property rows for this object.

Parameters

ParameterType
_prefstring
_itemsprop_item_vec

Returns

void

Implementation of

ts
cse_alife_creature_actor.FillProps

Inherited from

MockServerAlifeCreatureAbstract.FillProps


init()

ts
init(): cse_alife_object;

Initialize the ALife object and return its abstract base.

Returns

cse_alife_object

Initialized abstract entity.

Implementation of

ts
cse_alife_creature_actor.init

Inherited from

MockServerAlifeCreatureAbstract.init


interactive()

ts
interactive(): boolean;

Returns

boolean

Whether the object is interactive.

Implementation of

ts
cse_alife_creature_actor.interactive

Inherited from

MockServerAlifeCreatureAbstract.interactive


keep_saved_data_anyway()

ts
keep_saved_data_anyway(): boolean;

Returns

boolean

Implementation of

ts
cse_alife_creature_actor.keep_saved_data_anyway

Inherited from

MockServerAlifeCreatureAbstract.keep_saved_data_anyway


kill()

ts
kill(): void;

Kill the server-side creature.

Returns

void

Remarks

Intended for creature server objects managed by ALife.

Implementation of

ts
cse_alife_creature_actor.kill

Inherited from

MockServerAlifeCreatureAbstract.kill


move_offline()

Call Signature

ts
move_offline(): boolean;
Returns

boolean

Whether the object should move while offline.

Implementation of
ts
cse_alife_creature_actor.move_offline
Inherited from

MockServerAlifeCreatureAbstract.move_offline

Call Signature

ts
move_offline(value: boolean): void;

Set whether the object should move while offline.

Parameters
ParameterTypeDescription
valuebooleanWhether offline movement is enabled.
Returns

void

Implementation of
ts
cse_alife_creature_actor.move_offline
Inherited from

MockServerAlifeCreatureAbstract.move_offline


name()

ts
name<T>(): T;

Type Parameters

Type Parameter
T extends string

Returns

T

Runtime object name.

Implementation of

ts
cse_alife_creature_actor.name

Inherited from

MockServerAlifeCreatureAbstract.name


on_before_register()

ts
on_before_register(): void;

Returns

void

Implementation of

ts
cse_alife_creature_actor.on_before_register

Inherited from

MockServerAlifeCreatureAbstract.on_before_register


on_death()

ts
on_death(): void;

Notify the server object that this creature died.

Returns

void

Remarks

Marks server-side health as dead and records death time. It is not a general damage method.

Implementation of

ts
cse_alife_creature_actor.on_death

Overrides

MockServerAlifeCreatureAbstract.on_death


on_register()

ts
on_register(): void;

Returns

void

Implementation of

ts
cse_alife_creature_actor.on_register

Inherited from

MockServerAlifeCreatureAbstract.on_register


on_spawn()

ts
on_spawn(): void;

Returns

void

Implementation of

ts
cse_alife_creature_actor.on_spawn

Inherited from

MockServerAlifeCreatureAbstract.on_spawn


on_unregister()

ts
on_unregister(): void;

Returns

void

Implementation of

ts
cse_alife_creature_actor.on_unregister

Inherited from

MockServerAlifeCreatureAbstract.on_unregister


section_name()

ts
section_name<T>(): T;

Type Parameters

Type Parameter
T extends string

Returns

T

Spawn section name.

Implementation of

ts
cse_alife_creature_actor.section_name

Inherited from

MockServerAlifeCreatureAbstract.section_name


set_yaw()

ts
set_yaw(yaw: number): void;

Set object yaw.

Parameters

ParameterTypeDescription
yawnumberYaw angle.

Returns

void

Implementation of

ts
cse_alife_creature_actor.set_yaw

Inherited from

MockServerAlifeCreatureAbstract.set_yaw


STATE_Read()

ts
STATE_Read(packet: net_packet, size: number): void;

Read a state packet into this object.

Parameters

ParameterTypeDescription
packetnet_packetSource network packet.
sizenumberSerialized state size.

Returns

void

Remarks

Use only with packets written for the same server object class and state format.

Implementation of

ts
cse_alife_creature_actor.STATE_Read

Inherited from

MockServerAlifeCreatureAbstract.STATE_Read


STATE_Write()

ts
STATE_Write(packet: net_packet): void;

Write a state packet from this object.

Parameters

ParameterTypeDescription
packetnet_packetTarget network packet.

Returns

void

Implementation of

ts
cse_alife_creature_actor.STATE_Write

Inherited from

MockServerAlifeCreatureAbstract.STATE_Write


switch_offline()

ts
switch_offline(): void;

Mark the server object offline.

Returns

void

Source

src/xrGame/alife_dynamic_object.cpp, CSE_ALifeDynamicObject::switch_offline.

Remarks

Requires the object to be online. The base implementation marks it offline, removes it from the online ALife set, and clears client data unless keep_saved_data_anyway() returns true.

Implementation of

ts
cse_alife_creature_actor.switch_offline

Inherited from

MockServerAlifeCreatureAbstract.switch_offline


switch_online()

ts
switch_online(): void;

Mark the server object online.

Returns

void

Source

src/xrGame/alife_dynamic_object.cpp, CSE_ALifeDynamicObject::switch_online.

Remarks

Requires the object to be offline. The base implementation marks it online and adds it to the online ALife set. Use the simulator switch manager for normal distance-based switching.

Implementation of

ts
cse_alife_creature_actor.switch_online

Inherited from

MockServerAlifeCreatureAbstract.switch_online


travel_speed()

Call Signature

ts
travel_speed(): number;
Returns

number

Travel speed used for graph movement.

Implementation of
ts
cse_alife_creature_actor.travel_speed
Inherited from

MockServerAlifeCreatureAbstract.travel_speed

Call Signature

ts
travel_speed(value: number): void;

Set travel speed used for graph movement.

Parameters
ParameterTypeDescription
valuenumberNew travel speed.
Returns

void

Implementation of
ts
cse_alife_creature_actor.travel_speed
Inherited from

MockServerAlifeCreatureAbstract.travel_speed


update()

ts
update(): void;

Declared on the prototype rather than as an own jest.fn() field.

Returns

void

Remarks

Server objects override update and call super.update(). An own instance field is installed by this constructor before the subclass body runs, so it would shadow the subclass override entirely and leave super.update undefined. Spy on it with jest.spyOn(object, "update") when call assertions are needed.

Implementation of

ts
cse_alife_creature_actor.update

Inherited from

MockServerAlifeCreatureAbstract.update


UPDATE_Read()

ts
UPDATE_Read(packet: net_packet): void;

Read an update packet into this object.

Parameters

ParameterTypeDescription
packetnet_packetSource network packet.

Returns

void

Remarks

Use only with packets written for the same server object class and update format.

Implementation of

ts
cse_alife_creature_actor.UPDATE_Read

Inherited from

MockServerAlifeCreatureAbstract.UPDATE_Read


UPDATE_Write()

ts
UPDATE_Write(packet: net_packet): void;

Write an update packet from this object.

Parameters

ParameterTypeDescription
packetnet_packetTarget network packet.

Returns

void

Implementation of

ts
cse_alife_creature_actor.UPDATE_Write

Inherited from

MockServerAlifeCreatureAbstract.UPDATE_Write


use_ai_locations()

ts
use_ai_locations(value: boolean): void;

Enable or disable AI location graph use.

Parameters

ParameterTypeDescription
valuebooleanWhether AI locations should be used.

Returns

void

Implementation of

ts
cse_alife_creature_actor.use_ai_locations

Inherited from

MockServerAlifeCreatureAbstract.use_ai_locations


used_ai_locations()

ts
used_ai_locations(): boolean;

Returns

boolean

Whether the object uses AI location graph data.

Implementation of

ts
cse_alife_creature_actor.used_ai_locations

Inherited from

MockServerAlifeCreatureAbstract.used_ai_locations


visible_for_map()

Call Signature

ts
visible_for_map(): boolean;
Returns

boolean

Whether the object is visible on the map.

Implementation of
ts
cse_alife_creature_actor.visible_for_map
Inherited from

MockServerAlifeCreatureAbstract.visible_for_map

Call Signature

ts
visible_for_map(value: boolean): void;

Set whether the object is visible on the map.

Parameters
ParameterTypeDescription
valuebooleanWhether the object should be shown on the map.
Returns

void

Implementation of
ts
cse_alife_creature_actor.visible_for_map
Inherited from

MockServerAlifeCreatureAbstract.visible_for_map


create()

ts
static create(config?: IMockAlifeObjectConfig): MockAlifeCreatureActor;

Parameters

ParameterType
configIMockAlifeObjectConfig

Returns

MockAlifeCreatureActor

Overrides

MockServerAlifeCreatureAbstract.create


mock()

ts
static mock(config?: IMockAlifeObjectConfig): cse_alife_creature_actor;

Parameters

ParameterType
configIMockAlifeObjectConfig

Returns

cse_alife_creature_actor

Overrides

MockServerAlifeCreatureAbstract.mock


mockWithClassId()

ts
static mockWithClassId(classId: number): cse_alife_object;

Parameters

ParameterType
classIdnumber

Returns

cse_alife_object

Inherited from

MockServerAlifeCreatureAbstract.mockWithClassId


toMock()

ts
static toMock(object: cse_alife_object): MockAlifeObject;

Parameters

ParameterType
objectcse_alife_object

Returns

MockAlifeObject

Inherited from

MockServerAlifeCreatureAbstract.toMock

Properties

aiBrain

ts
aiBrain: CALifeMonsterBrain;

Inherited from

MockServerAlifeCreatureAbstract.aiBrain


alive

ts
alive: Mock<() => boolean>;

Implementation of

ts
cse_alife_creature_actor.alive

Inherited from

MockServerAlifeCreatureAbstract.alive


angle

ts
angle: vector;

Server-side orientation angles.

Implementation of

ts
cse_alife_creature_actor.angle

Inherited from

MockServerAlifeCreatureAbstract.angle


brain

ts
brain: Mock<() => CALifeMonsterBrain>;

Throws

If this creature type has no ALife monster brain.

Returns

ALife brain that drives offline monster behavior.

Implementation of

ts
cse_alife_creature_actor.brain

Inherited from

MockServerAlifeCreatureAbstract.brain


canSave

ts
canSave: boolean;

Inherited from

MockServerAlifeCreatureAbstract.canSave


canSwitchOffline

ts
canSwitchOffline: boolean;

Inherited from

MockServerAlifeCreatureAbstract.canSwitchOffline


canSwitchOnline

ts
canSwitchOnline: boolean;

Inherited from

MockServerAlifeCreatureAbstract.canSwitchOnline


character_icon

ts
character_icon: Mock<() => string>;

Resolve and return the actor character icon name.

Returns

Icon name.

Implementation of

ts
cse_alife_creature_actor.character_icon

character_name

ts
character_name: Mock<() => string>;

Returns

Localized actor character name.

Implementation of

ts
cse_alife_creature_actor.character_name

classId

ts
classId: TXR_class_id;

Inherited from

MockServerAlifeCreatureAbstract.classId


clear_smart_terrain

ts
clear_smart_terrain: Mock<UnknownFunction>;

Implementation of

ts
cse_alife_creature_actor.clear_smart_terrain

Inherited from

MockServerAlifeCreatureAbstract.clear_smart_terrain


community

ts
community: <T>() => T;

Type Parameters

Type ParameterDefault type
T extends stringstring

Returns

T

Implementation of

ts
cse_alife_creature_actor.community

Inherited from

MockServerAlifeCreatureAbstract.community


force_set_goodwill

ts
force_set_goodwill: Mock<UnknownFunction>;

Set goodwill from this creature toward another object.

Remarks

npc_id must resolve to an ALife object that can store personal goodwill.

Param

goodwill

New goodwill value.

Param

npc_id

Target object id.

Implementation of

ts
cse_alife_creature_actor.force_set_goodwill

Overrides

MockServerAlifeCreatureAbstract.force_set_goodwill


g_group

ts
g_group: Mock<() => number>;

Returns

Game group id.

Implementation of

ts
cse_alife_creature_actor.g_group

Inherited from

MockServerAlifeCreatureAbstract.g_group


g_squad

ts
g_squad: Mock<() => number>;

Returns

Game squad id.

Implementation of

ts
cse_alife_creature_actor.g_squad

Inherited from

MockServerAlifeCreatureAbstract.g_squad


g_team

ts
g_team: Mock<() => number>;

Returns

Game team id.

Implementation of

ts
cse_alife_creature_actor.g_team

Inherited from

MockServerAlifeCreatureAbstract.g_team


group

ts
group: number;

Game group id.

Implementation of

ts
cse_alife_creature_actor.group

Inherited from

MockServerAlifeCreatureAbstract.group


group_id

ts
group_id: number;

Object squad id, maximal u16 (65535) if no squad assigned.

Implementation of

ts
cse_alife_creature_actor.group_id

Inherited from

MockServerAlifeCreatureAbstract.group_id


has_detector

ts
has_detector: Mock<() => boolean>;

Returns

Whether the creature has a detector.

Implementation of

ts
cse_alife_creature_actor.has_detector

Inherited from

MockServerAlifeCreatureAbstract.has_detector


health

ts
health: Mock<() => number>;

Returns

Current creature health.

Implementation of

ts
cse_alife_creature_actor.health

Inherited from

MockServerAlifeCreatureAbstract.health


id

ts
id: number;

Server object id.

Implementation of

ts
cse_alife_creature_actor.id

Inherited from

MockServerAlifeCreatureAbstract.id


isInteractive

ts
isInteractive: boolean;

Inherited from

MockServerAlifeCreatureAbstract.isInteractive


isVisibleForMap

ts
isVisibleForMap: boolean;

Inherited from

MockServerAlifeCreatureAbstract.isVisibleForMap


m_game_vertex_id

ts
m_game_vertex_id: number;

Game graph vertex used by ALife simulation.

Implementation of

ts
cse_alife_creature_actor.m_game_vertex_id

Inherited from

MockServerAlifeCreatureAbstract.m_game_vertex_id


m_level_vertex_id

ts
m_level_vertex_id: number;

Level graph vertex used by ALife simulation.

Implementation of

ts
cse_alife_creature_actor.m_level_vertex_id

Inherited from

MockServerAlifeCreatureAbstract.m_level_vertex_id


m_smart_terrain_id

ts
m_smart_terrain_id: number;

Assigned smart terrain id, or 65535 when none is assigned.

Implementation of

ts
cse_alife_creature_actor.m_smart_terrain_id

Inherited from

MockServerAlifeCreatureAbstract.m_smart_terrain_id


m_story_id

ts
m_story_id: number;

Always numeric value. Returns maximal u32 (4294967295) value if object has no story id.

Implementation of

ts
cse_alife_creature_actor.m_story_id

Inherited from

MockServerAlifeCreatureAbstract.m_story_id


o_torso

ts
o_torso: Mock<() => rotation>;

Returns

Torso rotation state.

Implementation of

ts
cse_alife_creature_actor.o_torso

Inherited from

MockServerAlifeCreatureAbstract.o_torso


objectAlive

ts
objectAlive: boolean;

Inherited from

MockServerAlifeCreatureAbstract.objectAlive


objectCharacterIcon

ts
objectCharacterIcon: string = "ui_inGame2_actor";

objectCharacterName

ts
objectCharacterName: string = "actor";

objectCommunity

ts
objectCommunity: string;

Inherited from

MockServerAlifeCreatureAbstract.objectCommunity


objectCurrentLevelTravelSpeed

ts
objectCurrentLevelTravelSpeed: number;

Inherited from

MockServerAlifeCreatureAbstract.objectCurrentLevelTravelSpeed


objectHasDetector

ts
objectHasDetector: boolean;

Inherited from

MockServerAlifeCreatureAbstract.objectHasDetector


objectHealth

ts
objectHealth: number;

Inherited from

MockServerAlifeCreatureAbstract.objectHealth


objectName

ts
objectName: string;

Inherited from

MockServerAlifeCreatureAbstract.objectName


objectProfileName

ts
objectProfileName: string = "actor";

objectRank

ts
objectRank: number;

Inherited from

MockServerAlifeCreatureAbstract.objectRank


objectReputation

ts
objectReputation: number = 0;

objectTravelSpeed

ts
objectTravelSpeed: number;

Inherited from

MockServerAlifeCreatureAbstract.objectTravelSpeed


online

ts
online: boolean;

Whether server object has client representation and is in online mode.

Implementation of

ts
cse_alife_creature_actor.online

Inherited from

MockServerAlifeCreatureAbstract.online


parent_id

ts
parent_id: number;

Parent server object id, or 65535 when there is no parent.

Implementation of

ts
cse_alife_creature_actor.parent_id

Inherited from

MockServerAlifeCreatureAbstract.parent_id


position

ts
position: vector;

Server-side world position.

Implementation of

ts
cse_alife_creature_actor.position

Inherited from

MockServerAlifeCreatureAbstract.position


profile_name

ts
profile_name: Mock<() => string>;

Returns

Actor character profile section name.

Implementation of

ts
cse_alife_creature_actor.profile_name

rank

ts
rank: Mock<() => number>;

Returns

Creature rank.

Implementation of

ts
cse_alife_creature_actor.rank

Overrides

MockServerAlifeCreatureAbstract.rank


reputation

ts
reputation: Mock<() => number>;

Returns

Actor reputation value.

Implementation of

ts
cse_alife_creature_actor.reputation

script_version

ts
script_version: number;

Script data version stored with this object.

Implementation of

ts
cse_alife_creature_actor.script_version

Inherited from

MockServerAlifeCreatureAbstract.script_version


section

ts
section: string;

Inherited from

MockServerAlifeCreatureAbstract.section


set_character_name

ts
set_character_name: Mock<(name: string) => void>;

Set localized actor character name.

Param

name

Character name.

Implementation of

ts
cse_alife_creature_actor.set_character_name

set_profile_name

ts
set_profile_name: Mock<(name: string) => void>;

Set actor character profile section name.

Param

name

Profile section name.

Implementation of

ts
cse_alife_creature_actor.set_profile_name

set_rank

ts
set_rank: Mock<(rank: number) => void>;

Set actor rank.

Param

rank

New rank value.

Implementation of

ts
cse_alife_creature_actor.set_rank

shouldMoveOffline

ts
shouldMoveOffline: boolean;

Inherited from

MockServerAlifeCreatureAbstract.shouldMoveOffline


smart_terrain_id

ts
smart_terrain_id: Mock<() => number>;

Returns

Assigned smart terrain id, or 65535 when none is assigned.

Implementation of

ts
cse_alife_creature_actor.smart_terrain_id

Inherited from

MockServerAlifeCreatureAbstract.smart_terrain_id


smart_terrain_task_activate

ts
smart_terrain_task_activate: Mock<UnknownFunction>;

Works for CSE_ALifeMonsterAbstract, marks smart terrain as reached and switches logic to terrain task.

Remarks

Only meaningful for monsters assigned to a smart terrain task.

Implementation of

ts
cse_alife_creature_actor.smart_terrain_task_activate

Inherited from

MockServerAlifeCreatureAbstract.smart_terrain_task_activate


smart_terrain_task_deactivate

ts
smart_terrain_task_deactivate: Mock<UnknownFunction>;

Mark the current smart terrain task as not reached.

Implementation of

ts
cse_alife_creature_actor.smart_terrain_task_deactivate

Inherited from

MockServerAlifeCreatureAbstract.smart_terrain_task_deactivate


spawn_ini

ts
spawn_ini: Mock<() => ini_file | null>;

Returns

Spawn ini attached to this object, if any.

Implementation of

ts
cse_alife_creature_actor.spawn_ini

Inherited from

MockServerAlifeCreatureAbstract.spawn_ini


spawnIni

ts
spawnIni: ini_file | null;

Inherited from

MockServerAlifeCreatureAbstract.spawnIni


squad

ts
squad: number;

Squad identifier that links squad and parent smart terrain.

Implementation of

ts
cse_alife_creature_actor.squad

Inherited from

MockServerAlifeCreatureAbstract.squad


team

ts
team: number;

Team (community) of the object. Defined in game_relations.ltx -> [game_relations] -> [communities].

Example: 8 is monster, 9 is stalker, 0 is actor, 4 is freedom.

Implementation of

ts
cse_alife_creature_actor.team

Inherited from

MockServerAlifeCreatureAbstract.team


torso

ts
torso: rotation;

Inherited from

MockServerAlifeCreatureAbstract.torso


usesAiLocations

ts
usesAiLocations: boolean;

Inherited from

MockServerAlifeCreatureAbstract.usesAiLocations