Sgpigelitefighter
Based on game build 714014 | Last updated: 2026-03-08
Overview
SGpigelitefighter is a stategraph that governs the behavior and animation states of the Pig Elite Fighter entity in DST. It defines state transitions for actions including idle, attack, hit, death, spawn-in (posing), and despawn. The stategraph integrates with core components like combat, health, locomotor, and talker, and extends base states (walk, run, sleep, frozen, electrocute, hop) via CommonStates helpers. It manages variant-specific visual builds and sound cues using inst.sg.mem.variation to determine appearance and timing.
Usage example
-- The stategraph is instantiated and used internally by the game engine for the "pigelitefighter" prefab.
-- It is not typically added manually in mod code, but can be referenced or extended via:
local sg = GetStateGraph("pigelitefighter")
-- Modders may override or extend states/events in modmain.lua or via prefabs.
Dependencies & tags
Components used: combat, health, locomotor, talker, soundemitter, animstate, physics, transform
Tags added/removed per state:
idle:idle,canrotateattack:attack,busy(removed on exit)hit:busydeath:busyspawnin:intropose,busy,nofreeze,nosleep,noattack,jumping,noelectrocutedespawn:endpose,busy,nofreeze,nosleep,noattack,jumping,noelectrocute
Properties
No public properties defined in constructor. State behavior is configured via states, events, and mem-stored data (e.g., inst.sg.mem.variation, inst.sg.mem.isobstaclepassthrough).
Main functions
Stategraph is returned as a StateGraph object; no public methods are defined in this file.
Events & listeners
Listens to:
attacked— handled byCommonHandlers.OnAttacked()(triggershitstate)death— handled byCommonHandlers.OnDeath()(triggersdeathstate)despawn— triggersdespawnstate if idle and not deadonsink— triggersdespawnif not deadhop— handled byCommonHandlers.OnHop()(adds hop states)locomote— handled byCommonHandlers.OnLocomote(true, true)(adds walk/run states)freeze/electrocute— handled byCommonHandlers.OnFreeze()andCommonHandlers.OnElectrocute()sleep_ex/wake_ex— handled byCommonHandlers.OnSleepEx()andCommonHandlers.OnWakeEx()animover— transitions out ofidle,attack,hitstates on animation completionanimqueueover— triggers entity removal on despawn animation completionontimeout(spawnin) — emits chat chatter for spawn-inonnosleepanimqueueover— transitions from sleep toidleafter sleep animation
Pushes:
locomote— vialocomotor:Stop()and stategraph logic- Custom events via
CommonHandlershelpers (e.g.,attack,attackover,corpse_deathanimover)