Skip to content

Class: MockObjectBinder

Mock of the X-Ray engine object binder (client object lifecycle wrapper).

Extends

Implements

  • object_binder

Accessors

__name

Get Signature

ts
get __name(): string;
Returns

string

Implementation of

ts
object_binder.__name

Inherited from

MockLuabindClass.__name


__name

Get Signature

ts
get static __name(): string;
Returns

string

Inherited from

MockLuabindClass.__name

Constructors

Constructor

ts
new MockObjectBinder(object: game_object): MockObjectBinder;

Parameters

ParameterType
objectgame_object

Returns

MockObjectBinder

Overrides

MockLuabindClass.constructor

Methods

load()

ts
load(packet: reader): void;

Load binder state.

Parameters

ParameterType
packetreader

Returns

void

Remarks

Read data written by save. The engine does not validate custom binder packet layouts.

Implementation of

ts
object_binder.load

net_destroy()

ts
net_destroy(): void;

Handle this client object destruction.

Returns

void

Remarks

Called when this client object goes offline or is destroyed. This is the binder's own cleanup hook. net_Relcase is for another object being released.

Implementation of

ts
object_binder.net_destroy

net_export()

ts
net_export(): void;

Export binder network state.

Returns

void

Remarks

Pair this with net_import when the binder participates in network state synchronization.

Implementation of

ts
object_binder.net_export

net_import()

ts
net_import(): void;

Import binder network state.

Returns

void

Remarks

Pair this with net_export when the binder participates in network state synchronization.

Implementation of

ts
object_binder.net_import

net_Relcase()

ts
net_Relcase(): void;

Release references to a game object that is about to be destroyed.

Returns

void

Source

src/xrEngine/xr_object_list.cpp, CObjectList::SingleUpdate.

Source

src/xrGame/GameObject.cpp, CGameObject::net_Relcase.

Source

src/xrGame/script_binder.cpp, CScriptBinder::net_Relcase.

Remarks

The engine broadcasts this to every active and sleeping client object for every object in the destroy queue. Use it only to drop references to object; the callback is not limited to binders that reference it.

Keep overrides small, tolerate unrelated objects, and do not store or use object after this callback returns. The broadcast cost is roughly (active + sleeping client objects) * destroyed objects.

Implementation of

ts
object_binder.net_Relcase

net_save_relevant()

ts
net_save_relevant(): boolean;

Decide whether binder state should be saved over the network.

Returns

boolean

Whether the state is relevant for network save.

Remarks

The base implementation returns false.

Implementation of

ts
object_binder.net_save_relevant

net_spawn()

ts
net_spawn(): boolean;

Handle network spawn.

Returns

boolean

Whether spawn succeeded.

Source

src/xrGame/script_binder.cpp, CScriptBinder::net_Spawn.

Remarks

Client-side online spawn hook. It can run again for the same logical ALife object when the engine recreates its online client object. Return false to reject the client spawn. The base implementation returns true.

Implementation of

ts
object_binder.net_spawn

reinit()

ts
reinit(): void;

Reinitialize binder runtime state.

Returns

void

Remarks

Called when the owning client object is reinitialized. Keep persistent state in save and load, not here.

Implementation of

ts
object_binder.reinit

reload()

ts
reload(): void;

Reload binder configuration.

Returns

void

Remarks

Called after the engine creates the script binder from the section's script_binding callback.

Implementation of

ts
object_binder.reload

save()

ts
save(packet: net_packet): void;

Save binder state.

Parameters

ParameterTypeDescription
packetnet_packetDestination save packet.

Returns

void

Remarks

Write only data that load will read back in the same order.

Implementation of

ts
object_binder.save

update()

ts
update(): void;

Update binder logic.

Returns

void

Remarks

Called from the owning client object's scheduled update while the object is online.

Implementation of

ts
object_binder.update

asMock()

ts
static asMock(binder: object_binder): MockObjectBinder;

Parameters

ParameterType
binderobject_binder

Returns

MockObjectBinder


create()

ts
static create(object: game_object): MockObjectBinder;

Parameters

ParameterType
objectgame_object

Returns

MockObjectBinder

Overrides

MockLuabindClass.create


mock()

ts
static mock(object: game_object): object_binder;

Parameters

ParameterType
objectgame_object

Returns

object_binder

Overrides

MockLuabindClass.mock

Properties

canSpawn

ts
canSpawn: boolean = true;

object

ts
object: game_object;

Implementation of

ts
object_binder.object