Sggestalt Guard Evolved
Based on game build 714014 | Last updated: 2026-03-08
Overview
This state graph defines the behavior of the evolved Gestalt Guard, a boss entity in DST. It handles entity states such as idle, attack, attack_mid, attack_far, hit, teleport, teleporting, spawned, emerge, and death. The state graph integrates with several components—including combat, health, locomotor, lootdropper, follower, sanity, and grogginess—to coordinate actions like AoE charge attacks, mid-range summoning, and far-range explosions. It uses frame events to trigger timed attack logic and leverages CommonStates.AddWalkStates for movement transitions.
Usage example
This state graph is not instantiated directly by modders. It is automatically assigned to the Gestalt Guard (evolved variant) via its prefab definition using inst.entity:AddStateGraph("gestalt_guard_evolved", "stategraphs/SGgestalt_guard_evolved"). Modders would typically interact with it indirectly by modifying the entity's components (e.g., combat, health) or by overriding its DoAttack_Mid/DoAttack_Far methods if implemented.
Dependencies & tags
Components used: combat, health, locomotor, lootdropper, follower, sanity, grogginess
Tags: idle, canrotate, busy, noattack, attack, jumping, hit, hidden, invisible
Note: Tags like busy, noattack, and attack are used as stategraph tags (checked via sg:HasStateTag/sg:HasAnyStateTag).
Properties
No public properties are defined in this state graph file. All configuration is embedded in state definitions and tunable constants (e.g., TUNING.GESTALT_ATTACK_HIT_RANGE_SQ, TUNING.GESTALT_EVOLVED_TELEPORT_TIME_INVISIBLE).
Main functions
IsValidAttackTarget(inst, target, x, z, rangesq)
- Description: Determines whether a target is valid for attack based on range, health status, state tags, tags, and combat targeting rules.
- Parameters:
inst(entity) — the attacker entity.target(entity) — the candidate target.x,z(number) — the attacker's world coordinates.rangesq(number) — squared attack range.
- Returns: Two values: a boolean (
isvalid) indicating whether the target is valid, and a number (dsq) representing the squared distance to the target. - Error states: Returns
false, dsqif the target is dead, in an invalid attack state (e.g., sleeping), tagged asbrightmareorbrightmareboss, or disallowed bycombat:CanTarget.
FindAoEChargeAttackTarget(inst)
- Description: Finds the nearest valid AoE charge attack target within the predefined range (
TUNING.GESTALT_ATTACK_HIT_RANGE_SQ), preferring the currentcombat.targetand scanning all players if needed. - Parameters:
inst(entity) — the attacker entity.
- Returns: The target entity if found; otherwise
nil. - Error states: Returns
nilif no valid target exists or the combat component's target is invalid/out of range.
DoAoEChargeAttackHitOn(inst, target)
- Description: Executes theAoE charge attack effects on a target: sanity damage, combat attack, and grogginess application (if the target survives).
- Parameters:
inst(entity) — the attacker entity.target(entity) — the target entity.
- Returns: Nothing.
- Error states: Does nothing if the target lacks the required components; gracefully skips grogginess if the target is already dead or lacks
grogginess.
Events & listeners
-
Listens to:
spawned— transitions tospawnedstate if not busy.death— transitions todeathstate.doattack— transitions toattackstate (melee).doattack_mid— transitions toattack_midstate.doattack_far— transitions toattack_farstate.attacked— transitions tohitstate if idle and not busy/dead.teleport— transitions toteleportstate with provided data.
-
Pushes: None directly; events are handled internally by the state machine.