Sgchest Mimic
Based on game build 714014 | Last updated: 2026-03-08
Overview
SGchest_mimic is the state graph for the chest mimic entity, defining its behavioral transitions between idle, attack, taunt, spawn, death, and action states (e.g., pickup, eat). It integrates with multiple components—combat, health, locomotor, lootdropper, and inventory—to coordinate attacks, movement, sound playback, loot dropping, and animation sequencing. The state graph uses common states (e.g., hit, eat, walk) extended by custom timelines and sound events specific to the mimic's theme.
Usage example
-- The state graph is automatically assigned to the mimic prefab via its definition.
-- It is not added manually but referenced internally as the entity's SG.
-- Example internal trigger:
inst.sg:GoToState("spawn", true) -- Start mimic with chest opened
inst.sg:GoToState("attack", target) -- Initiate attack on a given target
Dependencies & tags
Components used: combat, health, locomotor, lootdropper, inventory
Tags: idle, canrotate, attack, busy, jumping, hit, debris
Properties
No public properties. State memory is stored in inst.sg.statemem and inst.sg.mem internally.
Main functions
This file defines a state graph via StateGraph(...), not individual public functions. However, it configures behavior through state definitions and event handlers.
Events & listeners
- Listens to:
attacked— transitions tohitstate if not dead and not in attackdeath— transitions todeathstate usingstatemem.deadflagdoattack— initiatesattackstate if not dead and not busy/hitanimqueueover,animover, frame events (via timelines)- Standard common handlers:
OnSleep(),OnLocomote(false, true),OnFreeze()
- Pushes:
entity_droploot(viaLootDropper:DropLoot())