SetWorldObjectState

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 09:49, 15 August 2026 by QCherry (talk | contribs) (Update Lua API reference)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

setWorldObjectState

Sets the authoritative replicated state of a known usable world object.

Syntax

bool setWorldObjectState(string objectId, string objectType, bool lit, bool usable [, int serverTime = 0])

Parameters

Name Type Required Description
objectId string yes The opaque decimal world-object identifier.
objectType string yes One of campfire, torch, bed, or usable.
lit bool yes Whether a fire-capable object is lit.
usable bool yes Whether players may currently use the object.
serverTime int no Optional non-negative authoritative timestamp in milliseconds; 0 uses the server's current time.

Returns

Returns true when the state is accepted and replicated; otherwise returns false.

Examples

Light a synchronized campfire:

setWorldObjectState(objectId, "campfire", true, true)

Notes

  • Available only in server-side resource scripts.
  • The state is server-authoritative and replayed to late joiners.
  • The identifier must refer to an object known to the replicated world-object system.