Sglureplant
Based on game build 714014 | Last updated: 2026-03-08
Overview
SGlureplant is a StateGraph that defines the full behavioral state machine for the Lure Plant entity (e.g., lureplant prefab). It governs animation selection, timing, sound triggers, and transitions between states such as idleout, idlein, hidebait, showbait, hitout, hitin, and death states. It integrates with the health component to avoid re-entering hit states when the entity is dead, and uses common electrocution handlers for lightning damage responses.
Usage example
The SGlureplant stategraph is not added manually — it is automatically assigned to lureplant prefabs during entity creation. A modder would typically interact with it indirectly by triggering events on the instance:
local inst = TheWorld.Map:GetEntity("lureplant")
if inst and inst.sg then
-- Force the lure plant to emerge and show bait
inst.sg:GoToState("showbait")
-- Or trigger a hit response programmatically
inst:PushEvent("attacked", { attacker = some_actor })
end
Dependencies & tags
Components used: health
Tags added/removed: States use tags including "idle", "busy", "hiding", "vine", "noelectrocute", "hit". The stategraph dynamically adds/removes "hiding", "vine", and "noelectrocute" tags based on state transitions and event handlers.
Properties
No public properties — this is a StateGraph definition, not a component with instance state.
Main functions
This stategraph is returned as a StateGraph instance from StateGraph(...), and does not define public functions beyond the standard stategraph callbacks.
Events & listeners
- Listens to:
death→ triggersdeathvineordeathstate based on"vine"tagattacked→ triggers hit response (hitout,hitin, orhithibernate) if not dead; handles electrocution viaCommonHandlersworked→ triggers hit response (same logic asattacked)
- Pushes:
"hidebait"→ triggered fromhitoutstate on animation completion"freshspawn"→ fired on exit fromspawnstate