Class: MockAlifeItem
Mock alife item server object.
Extends
Extended by
MockAlifeItemAmmoMockAlifeItemArtefactMockAlifeItemDetectorMockAlifeItemExplosiveMockAlifeItemGrenadeMockAlifeItemHelmetMockAlifeItemOutfitMockAlifeItemPdaMockAlifeItemTorchMockAlifeItemWeapon
Implements
cse_alife_item
Accessors
__name
Get Signature
get __name(): string;Returns
string
Implementation of
cse_alife_item.__nameInherited from
MockAlifeDynamicObjectVisual.__name
__name
Get Signature
get static __name(): string;Returns
string
Inherited from
MockAlifeDynamicObjectVisual.__name
Constructors
Constructor
new MockAlifeItem(config?:
| string
| IMockAlifeObjectConfig): MockAlifeItem;Parameters
| Parameter | Type |
|---|---|
config | | string | IMockAlifeObjectConfig |
Returns
MockAlifeItem
Inherited from
MockAlifeDynamicObjectVisual.constructor
Methods
add_upgrade()
add_upgrade(section: string): void;Add an upgrade section to the item.
Parameters
| Parameter | Type | Description |
|---|---|---|
section | string | Upgrade section id. |
Returns
void
Remarks
Adding the same upgrade twice is a fatal engine error.
Implementation of
cse_alife_item.add_upgradebfUseful()
bfUseful(): boolean;Returns
boolean
Whether the ALife item is useful to AI.
Implementation of
cse_alife_item.bfUsefulcan_save()
can_save(): boolean;Returns
boolean
Whether this object should be saved.
Implementation of
cse_alife_item.can_saveInherited from
MockAlifeDynamicObjectVisual.can_save
can_switch_offline()
Call Signature
can_switch_offline(): boolean;Returns
boolean
Whether this object may switch offline.
Implementation of
cse_alife_item.can_switch_offlineInherited from
MockAlifeDynamicObjectVisual.can_switch_offline
Call Signature
can_switch_offline(value: boolean): void;Allow or block switching offline.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | boolean | Whether offline switching is allowed. |
Returns
void
Remarks
Sets the object's switch-offline flag; it does not switch the object immediately.
Implementation of
cse_alife_item.can_switch_offlineInherited from
MockAlifeDynamicObjectVisual.can_switch_offline
can_switch_online()
Call Signature
can_switch_online(): boolean;Returns
boolean
Whether this object may switch online.
Implementation of
cse_alife_item.can_switch_onlineInherited from
MockAlifeDynamicObjectVisual.can_switch_online
Call Signature
can_switch_online(value: boolean): void;Allow or block switching online.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | boolean | Whether online switching is allowed. |
Returns
void
Remarks
Sets the object's switch-online flag; it does not switch the object immediately.
Implementation of
cse_alife_item.can_switch_onlineInherited from
MockAlifeDynamicObjectVisual.can_switch_online
clsid()
clsid(): TXR_class_id;Returns
TXR_class_id
Engine class id.
Implementation of
cse_alife_item.clsidInherited from
MockAlifeDynamicObjectVisual.clsid
FillProps()
FillProps(_pref: string, _items: prop_item_vec): void;Fill editor property rows for this object.
Parameters
| Parameter | Type |
|---|---|
_pref | string |
_items | prop_item_vec |
Returns
void
Implementation of
cse_alife_item.FillPropsInherited from
MockAlifeDynamicObjectVisual.FillProps
has_upgrade()
has_upgrade(section: string): boolean;Check whether the item already has an upgrade section.
Parameters
| Parameter | Type | Description |
|---|---|---|
section | string | Upgrade section id. |
Returns
boolean
Whether the upgrade is installed.
Implementation of
cse_alife_item.has_upgradeinit()
init(): cse_alife_object;Initialize the ALife object and return its abstract base.
Returns
cse_alife_object
Initialized abstract entity.
Implementation of
cse_alife_item.initInherited from
MockAlifeDynamicObjectVisual.init
interactive()
interactive(): boolean;Returns
boolean
Whether the object is interactive.
Implementation of
cse_alife_item.interactiveInherited from
MockAlifeDynamicObjectVisual.interactive
keep_saved_data_anyway()
keep_saved_data_anyway(): boolean;Returns
boolean
Implementation of
cse_alife_item.keep_saved_data_anywayInherited from
MockAlifeDynamicObjectVisual.keep_saved_data_anyway
move_offline()
Call Signature
move_offline(): boolean;Returns
boolean
Whether the object should move while offline.
Implementation of
cse_alife_item.move_offlineInherited from
MockAlifeDynamicObjectVisual.move_offline
Call Signature
move_offline(value: boolean): void;Set whether the object should move while offline.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | boolean | Whether offline movement is enabled. |
Returns
void
Implementation of
cse_alife_item.move_offlineInherited from
MockAlifeDynamicObjectVisual.move_offline
name()
name<T>(): T;Type Parameters
| Type Parameter |
|---|
T extends string |
Returns
T
Runtime object name.
Implementation of
cse_alife_item.nameInherited from
MockAlifeDynamicObjectVisual.name
on_before_register()
on_before_register(): void;Returns
void
Implementation of
cse_alife_item.on_before_registerInherited from
MockAlifeDynamicObjectVisual.on_before_register
on_register()
on_register(): void;Returns
void
Implementation of
cse_alife_item.on_registerInherited from
MockAlifeDynamicObjectVisual.on_register
on_spawn()
on_spawn(): void;Returns
void
Implementation of
cse_alife_item.on_spawnInherited from
MockAlifeDynamicObjectVisual.on_spawn
on_unregister()
on_unregister(): void;Returns
void
Implementation of
cse_alife_item.on_unregisterInherited from
MockAlifeDynamicObjectVisual.on_unregister
section_name()
section_name<T>(): T;Type Parameters
| Type Parameter |
|---|
T extends string |
Returns
T
Spawn section name.
Implementation of
cse_alife_item.section_nameInherited from
MockAlifeDynamicObjectVisual.section_name
set_yaw()
set_yaw(yaw: number): void;Set object yaw.
Parameters
| Parameter | Type | Description |
|---|---|---|
yaw | number | Yaw angle. |
Returns
void
Implementation of
cse_alife_item.set_yawInherited from
MockAlifeDynamicObjectVisual.set_yaw
STATE_Read()
STATE_Read(packet: net_packet, size: number): void;Read a state packet into this object.
Parameters
| Parameter | Type | Description |
|---|---|---|
packet | net_packet | Source network packet. |
size | number | Serialized state size. |
Returns
void
Remarks
Use only with packets written for the same server object class and state format.
Implementation of
cse_alife_item.STATE_ReadInherited from
MockAlifeDynamicObjectVisual.STATE_Read
STATE_Write()
STATE_Write(packet: net_packet): void;Write a state packet from this object.
Parameters
| Parameter | Type | Description |
|---|---|---|
packet | net_packet | Target network packet. |
Returns
void
Implementation of
cse_alife_item.STATE_WriteInherited from
MockAlifeDynamicObjectVisual.STATE_Write
switch_offline()
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
cse_alife_item.switch_offlineInherited from
MockAlifeDynamicObjectVisual.switch_offline
switch_online()
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
cse_alife_item.switch_onlineInherited from
MockAlifeDynamicObjectVisual.switch_online
update()
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
cse_alife_item.updateInherited from
MockAlifeDynamicObjectVisual.update
UPDATE_Read()
UPDATE_Read(packet: net_packet): void;Read an update packet into this object.
Parameters
| Parameter | Type | Description |
|---|---|---|
packet | net_packet | Source network packet. |
Returns
void
Remarks
Use only with packets written for the same server object class and update format.
Implementation of
cse_alife_item.UPDATE_ReadInherited from
MockAlifeDynamicObjectVisual.UPDATE_Read
UPDATE_Write()
UPDATE_Write(packet: net_packet): void;Write an update packet from this object.
Parameters
| Parameter | Type | Description |
|---|---|---|
packet | net_packet | Target network packet. |
Returns
void
Implementation of
cse_alife_item.UPDATE_WriteInherited from
MockAlifeDynamicObjectVisual.UPDATE_Write
use_ai_locations()
use_ai_locations(value: boolean): void;Enable or disable AI location graph use.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | boolean | Whether AI locations should be used. |
Returns
void
Implementation of
cse_alife_item.use_ai_locationsInherited from
MockAlifeDynamicObjectVisual.use_ai_locations
used_ai_locations()
used_ai_locations(): boolean;Returns
boolean
Whether the object uses AI location graph data.
Implementation of
cse_alife_item.used_ai_locationsInherited from
MockAlifeDynamicObjectVisual.used_ai_locations
visible_for_map()
Call Signature
visible_for_map(): boolean;Returns
boolean
Whether the object is visible on the map.
Implementation of
cse_alife_item.visible_for_mapInherited from
MockAlifeDynamicObjectVisual.visible_for_map
Call Signature
visible_for_map(value: boolean): void;Set whether the object is visible on the map.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | boolean | Whether the object should be shown on the map. |
Returns
void
Implementation of
cse_alife_item.visible_for_mapInherited from
MockAlifeDynamicObjectVisual.visible_for_map
create()
static create(config?: IMockAlifeObjectConfig): MockAlifeItem;Parameters
| Parameter | Type |
|---|---|
config | IMockAlifeObjectConfig |
Returns
MockAlifeItem
Overrides
MockAlifeDynamicObjectVisual.create
mock()
static mock(config?: IMockAlifeObjectConfig): cse_alife_item;Parameters
| Parameter | Type |
|---|---|
config | IMockAlifeObjectConfig |
Returns
cse_alife_item
Overrides
MockAlifeDynamicObjectVisual.mock
mockWithClassId()
static mockWithClassId(classId: number): cse_alife_object;Parameters
| Parameter | Type |
|---|---|
classId | number |
Returns
cse_alife_object
Inherited from
MockAlifeDynamicObjectVisual.mockWithClassId
toMock()
static toMock(object: cse_alife_object): MockAlifeObject;Parameters
| Parameter | Type |
|---|---|
object | cse_alife_object |
Returns
Inherited from
MockAlifeDynamicObjectVisual.toMock
Properties
alive
alive: Mock<() => boolean>;Inherited from
MockAlifeDynamicObjectVisual.alive
angle
angle: vector;Server-side orientation angles.
Implementation of
cse_alife_item.angleInherited from
MockAlifeDynamicObjectVisual.angle
canSave
canSave: boolean;Inherited from
MockAlifeDynamicObjectVisual.canSave
canSwitchOffline
canSwitchOffline: boolean;Inherited from
MockAlifeDynamicObjectVisual.canSwitchOffline
canSwitchOnline
canSwitchOnline: boolean;Inherited from
MockAlifeDynamicObjectVisual.canSwitchOnline
classId
classId: TXR_class_id;Inherited from
MockAlifeDynamicObjectVisual.classId
clear_smart_terrain
clear_smart_terrain: Mock<UnknownFunction>;Inherited from
MockAlifeDynamicObjectVisual.clear_smart_terrain
community
community: <T>() => T;Type Parameters
| Type Parameter | Default type |
|---|---|
T extends string | string |
Returns
T
Inherited from
MockAlifeDynamicObjectVisual.community
id
id: number;Server object id.
Implementation of
cse_alife_item.idInherited from
MockAlifeDynamicObjectVisual.id
isInteractive
isInteractive: boolean;Inherited from
MockAlifeDynamicObjectVisual.isInteractive
isUsefulForNpc
isUsefulForNpc: boolean = false;isVisibleForMap
isVisibleForMap: boolean;Inherited from
MockAlifeDynamicObjectVisual.isVisibleForMap
m_game_vertex_id
m_game_vertex_id: number;Game graph vertex used by ALife simulation.
Implementation of
cse_alife_item.m_game_vertex_idInherited from
MockAlifeDynamicObjectVisual.m_game_vertex_id
m_level_vertex_id
m_level_vertex_id: number;Level graph vertex used by ALife simulation.
Implementation of
cse_alife_item.m_level_vertex_idInherited from
MockAlifeDynamicObjectVisual.m_level_vertex_id
m_story_id
m_story_id: number;Always numeric value. Returns maximal u32 (4294967295) value if object has no story id.
Implementation of
cse_alife_item.m_story_idInherited from
MockAlifeDynamicObjectVisual.m_story_id
objectAlive
objectAlive: boolean;Inherited from
MockAlifeDynamicObjectVisual.objectAlive
objectCommunity
objectCommunity: string;Inherited from
MockAlifeDynamicObjectVisual.objectCommunity
objectName
objectName: string;Inherited from
MockAlifeDynamicObjectVisual.objectName
objectUpgrades
objectUpgrades: Set<string>;online
online: boolean;Whether server object has client representation and is in online mode.
Implementation of
cse_alife_item.onlineInherited from
MockAlifeDynamicObjectVisual.online
parent_id
parent_id: number;Parent server object id, or 65535 when there is no parent.
Implementation of
cse_alife_item.parent_idInherited from
MockAlifeDynamicObjectVisual.parent_id
position
position: vector;Server-side world position.
Implementation of
cse_alife_item.positionInherited from
MockAlifeDynamicObjectVisual.position
script_version
script_version: number;Script data version stored with this object.
Implementation of
cse_alife_item.script_versionInherited from
MockAlifeDynamicObjectVisual.script_version
section
section: string;Inherited from
MockAlifeDynamicObjectVisual.section
shouldMoveOffline
shouldMoveOffline: boolean;Inherited from
MockAlifeDynamicObjectVisual.shouldMoveOffline
spawn_ini
spawn_ini: Mock<() => ini_file | null>;Returns
Spawn ini attached to this object, if any.
Implementation of
cse_alife_item.spawn_iniInherited from
MockAlifeDynamicObjectVisual.spawn_ini
spawnIni
spawnIni: ini_file | null;Inherited from
MockAlifeDynamicObjectVisual.spawnIni
usesAiLocations
usesAiLocations: boolean;