Shard Sinkholes
Overview
This component synchronizes sinkhole target information (such as player identifiers and state: idle, warning, or attack) across the master shard and individual shards in Don't Starve Together. It uses network variables for efficient state syncing and responds to relevant world-wide events to maintain consistency.
Dependencies & Tags
- Relies on
TheWorld.ismastershardandTheWorld.ismastersimflags for conditional logic. - Uses network infrastructure:
net_hash,net_tinybyte, andTheWorld:PushEvent. - Adds no explicit tags or components.
Properties
No public properties are directly exposed or documented; initialization occurs via internal network variable construction. The only publicly accessible member explicitly set is:
| Property | Type | Default Value | Description |
|---|---|---|---|
inst | Entity | (passed in) | The entity instance this component is attached to. |
Main Functions
No public methods are defined. All functionality is handled internally by event callbacks and network variable updates.
OnSinkholesUpdate(src, data)
- Description: (Master shard only) Processes sinkhole update events from the world, synchronizing local network variable values for up to two targets based on incoming data.
- Parameters:
src: The event source (typicallyTheWorld).data: A table containing atargetsarray with per-target data (e.g.,userhash,warn,attack).
OnSinkholesDirty()
- Description: (Non-master shard only) Collects current local sinkhole target data from network variables and pushes it to the master shard via the
"secondary_sinkholesupdate"event. - Parameters: None (called as an event listener).
Events & Listeners
- Listens for
"master_sinkholesupdate"(master shard only) → triggersOnSinkholesUpdate. - Listens for
"sinkholesdirty"(non-master shard only) → triggersOnSinkholesDirty. - Pushes
"secondary_sinkholesupdate"(non-master shard only) with sinkhole target data during sync.