Shadowchanneler
Based on game build 714014 | Last updated: 2026-03-07
Overview
shadowchanneler is a prefab function that creates a boss-phase entity responsible for channeling shadow minions. It acts as a commander for shadow soldiers, manages its own invulnerability and appearance transitions, and dynamically adjusts its sanity aura based on observer sanity status. It is constructed using core ECS components including health, combat, sanityaura, entitytracker, and savedrotation, and includes client-side visual effects via transparentonsanity.
Usage example
-- This prefab is instantiated internally by the game during boss phases.
-- Modders should not manually create it; instead, reference it via prefabs.shadowchanneler
local shadow_channeler = Prefab("shadowchanneler", nil, assets)
-- The prefab includes custom logic in its `fn()` constructor and event handlers.
Dependencies & tags
Components used: health, combat, sanityaura, entitytracker, savedrotation, transparentonsanity
Tags added: shadowcreature, monster, hostile, shadow, notraptrigger, notarget, shadow_aligned, NOBLOCK, NOCLICK
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
killed | boolean | nil | Internal flag indicating whether the shadow channeler has died; used to prevent duplicate death logic. |
persists | boolean | true (initially) | Set to false on death to prevent save persistence. |
controller_priority_override_is_targeting_player | boolean | true | Gives the channeler high AI targeting priority when determining hostiles near the player. |
Main functions
CalcSanityAura(inst, observer)
- Description: Computes the radius and magnitude of the sanity aura based on whether the observer is insane.
- Parameters:
inst(Entity) — the shadow channeler instance.
observer(Entity) — the entity observing the aura (e.g., a player). - Returns: Number — negative value (
-TUNING.SANITYAURA_MED) if observer is insane, otherwise0. - Error states: None — relies on
Sanity:IsCrazy()which is deprecated but functional.
KeepTargetFn()
- Description: Used by the
combatcomponent to override default target persistence logic. - Parameters: None.
- Returns:
false— forces the entity to not keep its current target, enabling dynamic re-targeting behavior. - Error states: None.
OnAppear(inst)
- Description: Initializes visible appearance after the “appear” animation completes, unless the entity was already killed.
- Parameters:
inst(Entity) — the shadow channeler instance. - Returns: Nothing.
- Error states: Early exit if
inst.killedistrue. Also cleans up animation callbacks and togglesnotarget/invincibleflags.
OnDeath(inst)
- Description: Handles death sequence: sets
killedflag, plays “disappear” animation, marks as non-persistent, removes listeners, and schedules removal after animation ends. - Parameters:
inst(Entity) — the shadow channeler instance. - Returns: Nothing.
- Error states: Early exit if
inst.killedis alreadytrue.
OnGotCommander(inst, data)
- Description: Updates the “stalker” entity tracker when a new commander is assigned, replacing stale references.
- Parameters:
inst(Entity) — the shadow channeler instance.
data(table) — event payload containingcommander(Entity). - Returns: Nothing.
- Error states: Skips update if tracker already has the correct commander.
OnLostCommander(inst, data)
- Description: Removes the “stalker” tracker entry when the commander is lost.
- Parameters:
inst(Entity) — the shadow channeler instance.
data(table) — event payload containingcommander(Entity). - Returns: Nothing.
- Error states: Skips removal if tracker does not match the lost commander.
OnLoadPostPass(inst)
- Description: After world load, re-registers the channeler as a soldier under its tracked “stalker” (commander), if still valid.
- Parameters:
inst(Entity) — the shadow channeler instance. - Returns: Nothing.
- Error states: Skips registration if
stalkeror itscommandercomponent is missing.
nodebrisdmg(inst, amount, overtime, cause, ignore_invincible, afflicter, ignore_absorb)
- Description: Custom damage redirector for
healthcomponent — blocks all damage except from entities taggedquakedebris. - Parameters:
afflicter(Entity ornil) — source of the damage. - Returns:
trueonly ifafflicterhas tagquakedebris, otherwisefalse. - Error states: Returns
falseifafflicterisnil.
Events & listeners
- Listens to:
animover— triggersOnAppearafter animations complete.death— triggersOnDeathupon health reaching zero.gotcommander— updates “stalker” tracker when a commander is assigned.lostcommander— cleans up “stalker” tracker when commander is lost.
- Pushes:
- None directly — relies on underlying components (
health,commander) to emit standard DST events.
- None directly — relies on underlying components (