Sgsalty Dog
Based on game build 714014 | Last updated: 2026-03-08
Overview
SGsalty_dog defines the state machine for the Salty Dog character, a pet entity in DST. It handles animation transitions, locomotion control (including temporary ground speed disabling during actions like pickup and give), interaction handling (giving items, picking up targets), and summoning/desummoning sequences relative to a hat (spawner). It integrates with common states for sleep, freeze, and electrocute states, as well as amphibious hopping logic.
Usage example
-- The stategraph is automatically applied to the Salty Dog prefab via its stategraph definition.
-- In code, the Salty Dog entity is typically created as a child of a player's hat (the spawner).
-- Key interactions include triggering states via events:
inst:PushEvent("summon")
inst:PushEvent("desummon")
inst:PushEvent("saltshake")
inst:PushEvent("despawn")
Dependencies & tags
Components used: health, inventory, locomotor, spawner
Tags checked/added: busy, idle, canrotate, jumping, nointerrupt, swimming
Properties
No public properties.
Main functions
inst:ShedSalt()
- Description: Internal helper method (called via
inst:ShedSalt()) to shed one salt particle. Not defined in this file but referenced in timeline frame events during thesaltshakestate. - Parameters: None.
- Returns: Nothing.
- Error states: Assumed safe if
instis valid; does not appear to have explicit failure modes in this stategraph.
inst:ShedAllSalt()
- Description: Internal helper method (called during
saltshake) to shed all salt particles from the Salty Dog. Similar toShedSalt(), this is defined externally but invoked here. - Parameters: None.
- Returns: Nothing.
- Error states: None identified.
Events & listeners
-
Listens to:
attacked— triggershitstate unless dead or already electrocuting.
death(viaCommonHandlers.OnDeath()) — transitions todeathstate.
sleep/freeze/electrocute(via common handlers) — enters appropriate states.
hop(viaCommonHandlers.OnHop()) — enters hop-related states for land/water transitions.
locomote(viaCommonHandlers.OnLocomote()) — handles movement state transitions.
summon— enterssummonstate.
desummon— entersdesummonstate, drops inventory, and returns to hat or removes self.
saltshake— enterssaltshakestate if notbusy.
despawn— entersdespawnstate, setspersists = false, and schedules removal.
animover— used across multiple states (hit,saltshake,pickup,give, etc.) to return toidleupon animation completion. -
Pushes:
gohomefailed— pushed byspawner:GoHome()on failure (viadesummonlogic).
Not directly pushed by this SG, but events it handles may trigger pushes elsewhere.