Sggingerbreadpig
Based on game build 714014 | Last updated: 2026-03-08
Overview
SGgingerbreadpig defines the stategraph for the Gingerbread Pig, a festive seasonal creature. It orchestrates transitions between idle, scared, hit, and death states based on internal logic and external events (e.g., player proximity, damage, death). It leverages CommonStates to inherit standard locomotion, freezing, and sleep behaviors, and integrates with core components such as health, locomotor, and lootdropper to react to game events.
Usage example
local inst = CreateEntity()
inst:AddTag("gingerbreadpig")
inst:AddComponent("health")
inst:AddComponent("locomotor")
inst:AddComponent("lootdropper")
-- Stategraph is assigned automatically when the prefab is instantiated
-- via the StateGraph system, not directly via inst:AddStateGraph()
Dependencies & tags
Components used: health, locomotor, lootdropper
Tags: gingerbreadpig (inferred from StateGraph name), busy, idle (state tags)
External references: commonstates.lua, ACTIONS.GOHOME, ACTIONS.PICK
Properties
No public properties are defined in the constructor. The stategraph is configured entirely via state definitions, event handlers, and action handlers.
Main functions
Not applicable. This file returns a pre-constructed StateGraph object. It does not expose callable methods or functions directly.
Events & listeners
- Listens to:
animover– transitions fromidle,scared, andhitstates back toidlewhen animations complete.attacked– triggershitstate if the entity is alive and not transforming.death– triggersdeathstate.onplayernear– triggersscaredstate when a player approaches.OnStep,OnLocomote,OnSleep,OnFreeze– inherited fromCommonHandlers.
- Pushes: No events are explicitly pushed by this stategraph. It relies on component events (
attacked,death) and internal animations for coordination.