OnWorldObjectStateChange

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search

onWorldObjectStateChange

Triggered when a synchronized usable world object changes state.

Availability

This event is available in server-side scripts.

Callback signature

onWorldObjectStateChange(objectId, objectType, lit, usable, serverTimeMs, sourcePlayerId)

Parameters

Name Type Description
objectId string Stable 64-bit object ID represented as a string.
objectType int Object-type enum for a campfire, torch, bed, or generic usable object.
lit bool Whether the object is lit, when applicable.
usable bool Whether the object is currently usable.
serverTimeMs int Server timestamp of the state change.
sourcePlayerId int The player that caused the change, if any.

Examples

Handle the event:

addEventHandler("onWorldObjectStateChange", root, function(objectId, objectType, lit, usable, serverTimeMs, sourcePlayerId)
    outputDebugString("World object " .. objectId .. " lit=" .. tostring(lit))
end)

Notes

  • The authoritative state is replayed to late joiners.