SetWorldObjectState: Difference between revisions
Jump to navigation
Jump to search
Update Lua API reference |
Complete Lua function catalog |
||
| Line 37: | Line 37: | ||
* The identifier must refer to an object known to the replicated world-object system. | * The identifier must refer to an object known to the replicated world-object system. | ||
[[Category:Lua Functions]] | |||
[[Category:Server Functions]] | [[Category:Server Functions]] | ||
[[Category:World Functions]] | [[Category:World Functions]] | ||
Latest revision as of 09:55, 15 August 2026
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.