Sgprimemate
Based on game build 714014 | Last updated: 2026-03-08
Overview
SGprimemate is the state graph for the Prime Mate character in DST. It defines all core behavioral states—including idle, walking, combat, rowing, eating, taunting, diving, and corpse handling—via the stategraph system. It integrates with multiple components (combat, inventory, locomotor, drownable, health, talker, timer) to drive animations, physics, sound, and state transitions. This stategraph is initialized using StateGraph and built upon reusable utility functions from commonstates.lua for walking, sleep, combat, frozen, electrocute, corpse, and init states.
Usage example
The stategraph is not instantiated manually by modders; it is registered automatically by the game via the return statement at the end of the file. To use it for a custom entity, assign it via inst:AddStateGraph("primemate", "primemate") during prefab construction, ensuring the entity has the required components.
local inst = CreateEntity()
inst:AddStateGraph("primemate", "primemate")
-- Ensure required components are present:
inst:AddComponent("combat")
inst:AddComponent("health")
inst:AddComponent("inventory")
inst:AddComponent("locomotor")
inst:AddComponent("drownable")
inst:AddComponent("talker")
inst:AddComponent("timer")
Dependencies & tags
Components used: combat, drownable, health, inventory, locomotor, talker, timer, weapon, oar, equippable, setbonus, inventoryitem, curseditem, revivablecorpse
Tags added: busy, idle, canrotate, nomorph, cheering, drowning, corpse
Tags checked: player, debuffed, buffed, ignoretalking, personal_possession
Properties
No public properties are defined in the constructor.
Main functions
Not applicable — SGprimemate is a stategraph definition, not a class with public functions.
Events & listeners
- Listens to:
locomote(viaCommonHandlers.OnLocomote)freeze(viaCommonHandlers.OnFreeze)electrocute(viaCommonHandlers.OnElectrocute)attacked(viaCommonHandlers.OnAttacked)death(viaCommonHandlers.OnDeath)sleep(viaCommonHandlers.OnSleep)doattack(custom handler triggersattackstate)command(custom handler triggerstauntstate)onsink(handles sinking/falling into water, drops inventory, removes entity)cheer(custom handler triggerscheerstate)animover,animqueueover,unequip(state-specific handlers)- Corpse-related events (via
CommonHandlers.OnCorpseChomped)
- Pushes: None defined directly; relies on internal
inst.sg:GoToState(...)transitions and component events.