Sgotter
Based on game build 714014 | Last updated: 2026-03-08
Overview
SGotter is a StateGraph definition for the Otter character that orchestrates behavior via a finite state machine. It handles core mechanics including locomotion (land/water transitions via hop states), eating, combat attacks, item interaction (pickup/drop/steal), sleeping, freezing, electrocution, and corpse handling. It integrates with multiple components—amphibiouscreature, locomotor, and combat—and builds upon reusable common states provided by commonstates.lua.
Usage example
This file is not meant to be used directly by mods; it is a shared stategraph loaded by the Otter prefab. Modders should not instantiate it manually. To modify Otter behavior, extend or override its stategraph via prefab-specific hooks or use mod overrides (e.g., AddStateGraphPostInit("otter", ...)).
Dependencies & tags
Components used:
amphibiouscreature(checksin_water, triggers water-specific logic)locomotor(stops movement viaStopMoving,Stop)combat(triggersDoAttack)
Tags used:
busy(applied duringeat,toss_fish, pickup/drop/steal)eating(applied duringeat)
Properties
No public properties are declared in the constructor. Configuration is done via state definitions and dynamic checks.
Main functions
This file does not expose standalone functions as a component. It defines and returns a StateGraph instance using CommonStates helpers. Key configuration sections:
State configuration helpers (internal)
All CommonStates.* functions (e.g., AddCombatStates, AddAmphibiousCreatureHopStates) are imported from ./stategraphs/commonstates.lua. They accept:
states: the state table to populate- Configuration objects defining animation names, timelines (including
FrameEventandSoundFrameEvent), and callbacks - State tags and transition targets
No additional parameters or behaviors are added beyond what commonstates.lua provides. Custom Otter states (eat, toss_fish, taunt) include onenter, timeline, and events handlers.
Events & listeners
Listens to (via CommonHandlers):
onlocomote,onsleep,onwake,onattack,onattacked,ondeath,onhop,onfreeze,onelectrocute,onchomped(corpse interaction)animover— triggersgo_to_idle(foreat,toss_fish, etc.)
Pushes events:
- None directly. Relies on
CommonHandlersand stategraph engine for event propagation.