Nightmarefissure
Based on game build 714014 | Last updated: 2026-03-06
Overview
nightmarefissure is a prefab factory that creates dynamic environmental entities used in DST's nightmare events (e.g., Ruins nightmare fights, Grottowar). It manages lighting, animations, and child spawner behavior across multiple phases (calm, warn, wild, dawn, controlled). The fissure responds to the world's nightmarephase state, spawns nightmarebeak, crawlingnightmare, or ruinsnightmare entities via childspawner, and optionally supports dreadstone mining mechanics via workable and lootdropper. It integrates with shadowthrallmanager for boss event coordination and ensures proper persistence and network sync.
Usage example
-- The prefab is not instantiated directly; it is returned by the factory function.
-- Example usage is in-level creation via PrefabManager or level scripts.
local fissure = SpawnPrefab("fissure")
fissure.MakeTempFissure(fissure) -- Forces immediate transition to calm state and marks as temporary
Dependencies & tags
Components used:
childspawner– manages spawning and regenerating child entitieslootdropper– spawns dreadstone on mined fissures (only for fissure types inAllowShadowThralls)workable– enables dreadstone mining (only for fissure types inAllowShadowThralls)inspectable– conditionally added to display "Dreadstone Stack" name when minerals are presenthealth,combat,knownlocations– used conditionally duringkillchildren()or in Grottowar variant
Tags:
- Adds
okayforarenato prevent interference with arena combat logic.
Properties
No public properties are exposed in this script; all internal state is stored in instance fields (inst._*) and component-owned variables.
Main functions
The following functions are callable on the fissure instance (inst) or registered as callbacks:
inst.MakeTempFissure()
- Description: Marks the fissure as temporary (
inst.temp = true), forces it into thecalmstate, and prepares it for auto-removal after animations complete. Used for one-time event transitions. - Parameters: None.
- Returns: Nothing.
- Error states: None.
inst.OnNightmarePhaseChanged(phase, instant)
- Description: Triggers a state transition (
calm,warn,wild,dawn, orcontrolled) based on the world'snightmarephase. Handles delays, controlled fissure overrides, and temp fissure resets. - Parameters:
phase(string) – Target phase name.instant(boolean) – If true, animations and light changes occur immediately; otherwise, a random delay up to2seconds is applied.
- Returns: Nothing.
inst:MakeTempFissure()
- Description: Idempotent entry point for marking a fissure as temporary and transitioning to
calmstate.
OnFissureMinedFinished(inst, worker)
- Description: Called by the
workablecomponent after dreadstone mining completes. Removes theinspectablecomponent, resets names/symbols, spawns threedreadstoneitems, plays a sound, and notifies theshadowthrallmanager. - Parameters:
inst– fissure instance.worker– entity that performed the mining (unused).
- Returns: Nothing.
OnReleasedFromControl(inst)
- Description: Exits the
controlledstate (e.g., end of boss phase). Restores default visuals and light, initiates a 7-frame transition animation, and cleans up components. If mining is possible, it prepares for dreadstone regrowth.
inst.OnEntitySleep() / inst.OnEntityWake()
- Description: Manage sound looping and fissure registration with
shadowthrallmanagerduring world sleep/wake cycles.
Events & listeners
- Listens to:
"lightdirty"(client) – triggers light updates (OnLightDirty)."animover"(client) – detects when theidle_open_riftanimation finishes incontrolledstate."animqueueover"(client) – used to triggerErodeAwayon temporary fissures after transition.
- Pushes: None directly; relies on component events (
lootdropper/workablecallbacks).
State functions (states[phase])
Each state (calm, warn, wild, dawn, controlled) configures physics, light radius, animation sequence, sound, and child spawner behavior:
calm: Closes fissure, kills children, radius0.warn: Low-intensity light (radius 2), prepares for spawning.wild: Full-intensity light (radius 5), starts spawning children.dawn: Intermediate light (radius 2), mimics wild but transitions out.controlled: Fixed light (radius 3, orange tint), unique animation (idle_open_rift), disables child spawning, and prevents dreadstone regrowth (_nofissurechildren).
Utility functions
fade_to(inst, rad, instant)– Animates light radius transitions with frame-based interpolation.OnUpdateLight(inst, dframes)– Called periodically to advance light animation frames and update radius.spawnchildren(inst)/killchildren(inst)– Start/stop child spawner and reset children.GetRareChildFn(inst, isemergency, target)– Chooses betweenruinsnightmareornightmarebeakbased on rift status and tuning.