Sgshadowtentacle
Based on game build 714014 | Last updated: 2026-03-08
Overview
SGshadowtentacle is the stategraph responsible for governing the behavior and animation flow of the Shadow Tentacle entity. It defines sequential states (idle, taunt, attack_pre, attack, attack_post, death) that control movement, attack timing, and death reaction. The stategraph integrates with the combat component to respond to combat events like newcombattarget and coordinate attacks via custom DoAttack logic, which also forwards aggro to the tentacle's owner under specific conditions.
Usage example
-- The stategraph is automatically applied when a Shadow Tentacle entity is created.
-- As a stategraph definition, it is not instantiated directly in mod code.
-- However, modders may extend or override it by:
-- 1. Creating a new stategraph with the same name.
-- 2. Using 'override' scripts in modmain.lua if necessary.
-- Example of listening for its events in a prefab's logic:
inst:ListenForEvent("death", function(inst) print("Tentacle died!") end)
Dependencies & tags
Components used: combat
Tags added: idle, invisible, taunting, attack, busy
Tags checked: None explicitly — tags are used with HasStateTag internally.
Properties
No public properties
Main functions
DoAttack(inst)
- Description: Performs an attack action using the
combatcomponent and conditionally redirects the target’s attention from the tentacle back to the tentacle’s owner. This function is scheduled viaFrameEventduring theattackstate. - Parameters:
inst(entity) — the Shadow Tentacle instance. - Returns: Nothing.
- Error states: May have no effect if
inst.components.combat.targetisnil, or if owner/target components are missing.
Events & listeners
- Listens to:
death— triggers transition to thedeathstate.newcombattarget— if currently idle, transitions totauntstate.animover— triggers transitions toattack_post(intauntstate) or entity removal (indeathstate).animqueueover— triggers transition fromattacktoattack_post.
- Pushes: None directly — events are handled internally by state transitions.