Sgwormwood Fruitdragon
Based on game build 714014 | Last updated: 2026-03-08
Overview
This stategraph implements the complete behavioral state machine for the Fruit Dragon, a boss entity encountered in the Wormwood biome. It orchestrates animations, sound effects, combat state transitions, and interactions with status effects like freezing, electrocution, death, and sleep. It integrates with core components (combat, health, locomotor) and leverages shared state helpers from commonstates.lua.
Usage example
This stategraph is automatically assigned to the Fruit Dragon entity during its prefab initialization and is not intended for manual instantiation. Modders typically reference it when overriding or extending behavior, for example:
-- Example of inspecting or modifying the stategraph at runtime
inst.sg:GoToState("attack", target_entity)
Dependencies & tags
Components used: combat, health, locomotor
Tags: Adds idle, canrotate, attack, busy, caninterrupt, frozen (via inherited states); checks busy, hit, electrocute
Inherits states from: commonstates.lua (AddHitState, AddDeathState, AddWalkStates, AddRunStates, AddSleepStates, AddFrozenStates, AddElectrocuteStates, AddSinkAndWashAshoreStates, AddVoidFallStates)
Properties
No public properties. The stategraph is stateless beyond runtime sg.statemem usage (e.g., storing target during attack).
Main functions
Not applicable. This is a declarative StateGraph definition — it does not expose functional methods. State transitions and behaviors are configured via static states and events tables and executed by the stategraph engine.
Events & listeners
- Listens to:
doattack– initiates theattackstate if healthy and not busy (with conditions).attacked– triggers thehitstate unless blocked bybusy, unlesscaninterruptorfrozen.animover(state-specific) – returns toidleafter animation completion.- Common state handlers:
onsleep,onfreeze,onelectrocute,ondeath,onlocomote,onsink,onfallinvoid
- Pushes: Not applicable (event dispatch is internal to the stategraph engine).