Sgbeeguard
Based on game build 714014 | Last updated: 2026-03-08
Overview
SGbeeguard is the state graph for the Bee Guard enemy, defining how the entity transitions between states such as idle, walk, attack, hit, death, spawn-in, and flee. It integrates with core components like health, combat, and locomotor, and relies on common state handlers for sleep, freeze, electrocution, and corpse management. The state graph controls animations, physics behavior, invincibility windows, and sound triggers during key gameplay events.
Usage example
-- The state graph is automatically assigned to Bee Guard prefabs via the return statement:
-- return StateGraph("beeguard", states, events, "init")
-- No manual instantiation is required; prefabs using this state graph register it via:
-- inst.StateGraph = SGbeeguard
Dependencies & tags
Components used: health, combat, locomotor
Tags added by states: idle, busy, nosleep, nofreeze, noattack, noelectrocute, canrotate, moving, flight, hit, attack, caninterrupt, NOCLICK
Tags added/removed dynamically: NOCLICK (added on spawn-in, removed upon completion), caninterrupt (added during sleep entry, removed during sleep progression)
Properties
No public properties are initialized in the state graph. State-specific data is stored in inst.sg.mem and inst.sg.statemem, which are internal to the state machine.
Main functions
Not applicable (this is a declarative state graph definition, not an imperative class with methods)
Events & listeners
- Listens to:
doattack— triggers transition toattackif not busy or dead.attacked— triggers transition tohitor cancels interruption based on state tags and health.flee— triggersflyawaystate or queueswantstoflyawayif busy.animover— triggers next animation-based transitions inwalk_start,walk,walk_stop,hit, andattack.- Standard event handlers via
CommonHandlers.OnLocomote,OnDeath,OnFreeze,OnElectrocute,OnSleepEx,OnWakeEx,OnCorpseChomped, andOnCorpseDeathAnimOver.
- Pushes:
- None directly; relies on
inst:PushEventcalls within event handlers (e.g., viaCommonHandlersor timeline functions). - Invokes
invincibletoggleevent indirectly viahealth:SetInvincible(). - Plays sounds and triggers visual FX using
SoundEmitter,AnimState, andDynamicShadow.
- None directly; relies on