Class: MockObjectBinder
Mock of the X-Ray engine object binder (client object lifecycle wrapper).
Extends
Implements
object_binder
Accessors
__name
Get Signature
get __name(): string;Returns
string
Implementation of
object_binder.__nameInherited from
__name
Get Signature
get static __name(): string;Returns
string
Inherited from
Constructors
Constructor
new MockObjectBinder(object: game_object): MockObjectBinder;Parameters
| Parameter | Type |
|---|---|
object | game_object |
Returns
MockObjectBinder
Overrides
Methods
load()
load(packet: reader): void;Load binder state.
Parameters
| Parameter | Type |
|---|---|
packet | reader |
Returns
void
Remarks
Read data written by save. The engine does not validate custom binder packet layouts.
Implementation of
object_binder.loadnet_destroy()
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
object_binder.net_destroynet_export()
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
object_binder.net_exportnet_import()
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
object_binder.net_importnet_Relcase()
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
object_binder.net_Relcasenet_save_relevant()
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
object_binder.net_save_relevantnet_spawn()
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
object_binder.net_spawnreinit()
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
object_binder.reinitreload()
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
object_binder.reloadsave()
save(packet: net_packet): void;Save binder state.
Parameters
| Parameter | Type | Description |
|---|---|---|
packet | net_packet | Destination save packet. |
Returns
void
Remarks
Write only data that load will read back in the same order.
Implementation of
object_binder.saveupdate()
update(): void;Update binder logic.
Returns
void
Remarks
Called from the owning client object's scheduled update while the object is online.
Implementation of
object_binder.updateasMock()
static asMock(binder: object_binder): MockObjectBinder;Parameters
| Parameter | Type |
|---|---|
binder | object_binder |
Returns
MockObjectBinder
create()
static create(object: game_object): MockObjectBinder;Parameters
| Parameter | Type |
|---|---|
object | game_object |
Returns
MockObjectBinder
Overrides
mock()
static mock(object: game_object): object_binder;Parameters
| Parameter | Type |
|---|---|
object | game_object |
Returns
object_binder
Overrides
Properties
canSpawn
canSpawn: boolean = true;object
object: game_object;Implementation of
object_binder.object