Sgwaterplant
Based on game build 714014 | Last updated: 2026-03-08
Overview
SGwaterplant is the state graph (state machine) implementation for the water plant entity in DST. It defines how the creature transitions between states such as idle, attacking, sleeping, freezing, and transformation between its three stages (bud, flower, dead). The state graph coordinates interactions with multiple components—health, combat, sleeper, freezable, lootdropper, harvestable, and burnable—to ensure correct behavioral responses to external events like attacks, wake-up triggers, freezing, and death.
Usage example
This state graph is not instantiated directly by modders. It is automatically assigned to the water plant prefab when the game loads:
-- Internally used in the water plant prefab definition:
inst:AddTag("waterplant")
inst:AddStateGraph("waterplant", "SGwaterplant")
Dependencies & tags
Components used: health, combat, sleeper, freezable, lootdropper, harvestable, burnable
Tags: The state graph itself defines and uses internal state tags such as busy, idle, attack, sleeping, frozen, thawing, spraying, canrotate, noelectrocute, nowake, waking, nosleep.
Properties
No public properties are exposed by this state graph. All state logic and transitions are internal.
Main functions
Not applicable — this file defines a state graph (StateGraph) constructor and event handlers, not standalone functions. Functions referenced are internal to state onenter, ontimeout, onexit, and timeline callbacks.
Events & listeners
-
Listens to:
attacked→ triggershitstate, subject to interruption rules and electrocution handling.newcombattarget→ triggersswitch_to_flowerif stage 2 and healthy.spray_cloud→ triggerscloudstate if not sleeping/dead/busy/spraying.barnacle_grown→ triggersbarnacle_growif not dead/busy.- Standard events via
CommonHandlers:onattack,ondeath,onsleep,onwake,onfreeze,onelectrocute. unfreeze,onthaw→ handled in frozen/thaw states.animover,ontimeout→ internal state cleanup and transition logic.
-
Pushes:
- None — this file only consumes events; no custom events are pushed.