Skip to content

Class: MockAlifeItemWeapon

Mock alife weapon item server object.

Extends

Extended by

Implements

  • cse_alife_item_weapon

Accessors

__name

Get Signature

ts
get __name(): string;
Returns

string

Implementation of

ts
cse_alife_item_weapon.__name

Inherited from

MockAlifeItem.__name


__name

Get Signature

ts
get static __name(): string;
Returns

string

Inherited from

MockAlifeItem.__name

Constructors

Constructor

ts
new MockAlifeItemWeapon(config?: 
  | string
  | IMockAlifeObjectConfig): MockAlifeItemWeapon;

Parameters

ParameterType
config| string | IMockAlifeObjectConfig

Returns

MockAlifeItemWeapon

Inherited from

MockAlifeItem.constructor

Methods

add_upgrade()

ts
add_upgrade(section: string): void;

Add an upgrade section to the item.

Parameters

ParameterTypeDescription
sectionstringUpgrade section id.

Returns

void

Remarks

Adding the same upgrade twice is a fatal engine error.

Implementation of

ts
cse_alife_item_weapon.add_upgrade

Inherited from

MockAlifeItem.add_upgrade


bfUseful()

ts
bfUseful(): boolean;

Returns

boolean

Whether the ALife item is useful to AI.

Implementation of

ts
cse_alife_item_weapon.bfUseful

Inherited from

MockAlifeItem.bfUseful


can_save()

ts
can_save(): boolean;

Returns

boolean

Whether this object should be saved.

Implementation of

ts
cse_alife_item_weapon.can_save

Inherited from

MockAlifeItem.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_item_weapon.can_switch_offline
Inherited from

MockAlifeItem.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_item_weapon.can_switch_offline
Inherited from

MockAlifeItem.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_item_weapon.can_switch_online
Inherited from

MockAlifeItem.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_item_weapon.can_switch_online
Inherited from

MockAlifeItem.can_switch_online


clone_addons()

ts
clone_addons(_weapon: cse_alife_item_weapon): void;

Copy addon flags from another weapon server object.

Parameters

ParameterType
_weaponcse_alife_item_weapon

Returns

void

Remarks

Copies addon state only. Ammo, condition, and installed upgrades are handled by other fields or helpers.

Implementation of

ts
cse_alife_item_weapon.clone_addons

clsid()

ts
clsid(): TXR_class_id;

Returns

TXR_class_id

Engine class id.

Implementation of

ts
cse_alife_item_weapon.clsid

Inherited from

MockAlifeItem.clsid


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_item_weapon.FillProps

Inherited from

MockAlifeItem.FillProps


get_ammo_elapsed()

ts
get_ammo_elapsed(): number;

Returns

number

Ammo currently loaded in the weapon.

Implementation of

ts
cse_alife_item_weapon.get_ammo_elapsed

get_ammo_magsize()

ts
get_ammo_magsize(): number;

Returns

number

Weapon magazine size from the weapon section.

Implementation of

ts
cse_alife_item_weapon.get_ammo_magsize

has_upgrade()

ts
has_upgrade(section: string): boolean;

Check whether the item already has an upgrade section.

Parameters

ParameterTypeDescription
sectionstringUpgrade section id.

Returns

boolean

Whether the upgrade is installed.

Implementation of

ts
cse_alife_item_weapon.has_upgrade

Inherited from

MockAlifeItem.has_upgrade


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_item_weapon.init

Inherited from

MockAlifeItem.init


interactive()

ts
interactive(): boolean;

Returns

boolean

Whether the object is interactive.

Implementation of

ts
cse_alife_item_weapon.interactive

Inherited from

MockAlifeItem.interactive


keep_saved_data_anyway()

ts
keep_saved_data_anyway(): boolean;

Returns

boolean

Implementation of

ts
cse_alife_item_weapon.keep_saved_data_anyway

Inherited from

MockAlifeItem.keep_saved_data_anyway


move_offline()

Call Signature

ts
move_offline(): boolean;
Returns

boolean

Whether the object should move while offline.

Implementation of
ts
cse_alife_item_weapon.move_offline
Inherited from

MockAlifeItem.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_item_weapon.move_offline
Inherited from

MockAlifeItem.move_offline


name()

ts
name<T>(): T;

Type Parameters

Type Parameter
T extends string

Returns

T

Runtime object name.

Implementation of

ts
cse_alife_item_weapon.name

Inherited from

MockAlifeItem.name


on_before_register()

ts
on_before_register(): void;

Returns

void

Implementation of

ts
cse_alife_item_weapon.on_before_register

Inherited from

MockAlifeItem.on_before_register


on_register()

ts
on_register(): void;

Returns

void

Implementation of

ts
cse_alife_item_weapon.on_register

Inherited from

MockAlifeItem.on_register


on_spawn()

ts
on_spawn(): void;

Returns

void

Implementation of

ts
cse_alife_item_weapon.on_spawn

Inherited from

MockAlifeItem.on_spawn


on_unregister()

ts
on_unregister(): void;

Returns

void

Implementation of

ts
cse_alife_item_weapon.on_unregister

Inherited from

MockAlifeItem.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_item_weapon.section_name

Inherited from

MockAlifeItem.section_name


set_ammo_elapsed()

ts
set_ammo_elapsed(count: number): void;

Set ammo currently loaded in the weapon.

Parameters

ParameterTypeDescription
countnumberLoaded ammo count.

Returns

void

Implementation of

ts
cse_alife_item_weapon.set_ammo_elapsed

set_yaw()

ts
set_yaw(yaw: number): void;

Set object yaw.

Parameters

ParameterTypeDescription
yawnumberYaw angle.

Returns

void

Implementation of

ts
cse_alife_item_weapon.set_yaw

Inherited from

MockAlifeItem.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_item_weapon.STATE_Read

Inherited from

MockAlifeItem.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_item_weapon.STATE_Write

Inherited from

MockAlifeItem.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_item_weapon.switch_offline

Inherited from

MockAlifeItem.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_item_weapon.switch_online

Inherited from

MockAlifeItem.switch_online


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_item_weapon.UPDATE_Read

Inherited from

MockAlifeItem.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_item_weapon.UPDATE_Write

Inherited from

MockAlifeItem.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_item_weapon.use_ai_locations

Inherited from

MockAlifeItem.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_item_weapon.used_ai_locations

Inherited from

MockAlifeItem.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_item_weapon.visible_for_map
Inherited from

MockAlifeItem.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_item_weapon.visible_for_map
Inherited from

MockAlifeItem.visible_for_map


create()

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

Parameters

ParameterType
configIMockAlifeObjectConfig

Returns

MockAlifeItemWeapon

Overrides

MockAlifeItem.create


mock()

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

Parameters

ParameterType
configIMockAlifeObjectConfig

Returns

cse_alife_item_weapon

Overrides

MockAlifeItem.mock


mockWithClassId()

ts
static mockWithClassId(classId: number): cse_alife_object;

Parameters

ParameterType
classIdnumber

Returns

cse_alife_object

Inherited from

MockAlifeItem.mockWithClassId


toMock()

ts
static toMock(object: cse_alife_object): MockAlifeObject;

Parameters

ParameterType
objectcse_alife_object

Returns

MockAlifeObject

Inherited from

MockAlifeItem.toMock

Properties

alive

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

Inherited from

MockAlifeItem.alive


angle

ts
angle: vector;

Server-side orientation angles.

Implementation of

ts
cse_alife_item_weapon.angle

Inherited from

MockAlifeItem.angle


canSave

ts
canSave: boolean;

Inherited from

MockAlifeItem.canSave


canSwitchOffline

ts
canSwitchOffline: boolean;

Inherited from

MockAlifeItem.canSwitchOffline


canSwitchOnline

ts
canSwitchOnline: boolean;

Inherited from

MockAlifeItem.canSwitchOnline


classId

ts
classId: TXR_class_id;

Inherited from

MockAlifeItem.classId


clear_smart_terrain

ts
clear_smart_terrain: Mock<UnknownFunction>;

Inherited from

MockAlifeItem.clear_smart_terrain


community

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

Type Parameters

Type ParameterDefault type
T extends stringstring

Returns

T

Inherited from

MockAlifeItem.community


id

ts
id: number;

Server object id.

Implementation of

ts
cse_alife_item_weapon.id

Inherited from

MockAlifeItem.id


isInteractive

ts
isInteractive: boolean;

Inherited from

MockAlifeItem.isInteractive


isUsefulForNpc

ts
isUsefulForNpc: boolean = false;

Inherited from

MockAlifeItem.isUsefulForNpc


isVisibleForMap

ts
isVisibleForMap: boolean;

Inherited from

MockAlifeItem.isVisibleForMap


m_game_vertex_id

ts
m_game_vertex_id: number;

Game graph vertex used by ALife simulation.

Implementation of

ts
cse_alife_item_weapon.m_game_vertex_id

Inherited from

MockAlifeItem.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_item_weapon.m_level_vertex_id

Inherited from

MockAlifeItem.m_level_vertex_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_item_weapon.m_story_id

Inherited from

MockAlifeItem.m_story_id


objectAlive

ts
objectAlive: boolean;

Inherited from

MockAlifeItem.objectAlive


objectAmmoElapsed

ts
objectAmmoElapsed: number = 0;

objectAmmoMagSize

ts
objectAmmoMagSize: number = 30;

objectCommunity

ts
objectCommunity: string;

Inherited from

MockAlifeItem.objectCommunity


objectName

ts
objectName: string;

Inherited from

MockAlifeItem.objectName


objectUpgrades

ts
objectUpgrades: Set<string>;

Inherited from

MockAlifeItem.objectUpgrades


online

ts
online: boolean;

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

Implementation of

ts
cse_alife_item_weapon.online

Inherited from

MockAlifeItem.online


parent_id

ts
parent_id: number;

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

Implementation of

ts
cse_alife_item_weapon.parent_id

Inherited from

MockAlifeItem.parent_id


position

ts
position: vector;

Server-side world position.

Implementation of

ts
cse_alife_item_weapon.position

Inherited from

MockAlifeItem.position


script_version

ts
script_version: number;

Script data version stored with this object.

Implementation of

ts
cse_alife_item_weapon.script_version

Inherited from

MockAlifeItem.script_version


section

ts
section: string;

Inherited from

MockAlifeItem.section


shouldMoveOffline

ts
shouldMoveOffline: boolean;

Inherited from

MockAlifeItem.shouldMoveOffline


spawn_ini

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

Returns

Spawn ini attached to this object, if any.

Implementation of

ts
cse_alife_item_weapon.spawn_ini

Inherited from

MockAlifeItem.spawn_ini


spawnIni

ts
spawnIni: ini_file | null;

Inherited from

MockAlifeItem.spawnIni


update

ts
update: Mock<UnknownFunction>;

Run the server-side ALife update for this object.

Implementation of

ts
cse_alife_item_weapon.update

Inherited from

MockAlifeItem.update


usesAiLocations

ts
usesAiLocations: boolean;

Inherited from

MockAlifeItem.usesAiLocations