Ruinsnightmare Horn Attack
Based on game build 714014 | Last updated: 2026-03-07
Overview
ruinsnightmare_horn_attack is a client-server entity prefab that manifests as a high-speed projectile used in the Ruins Nightmare boss's attack pattern. It travels forward from its spawn position, applying AoE damage to nearby valid targets, then transitions into a collision fx state upon reaching its designated collision point (the boss's position). It integrates with the updatelooper, combat, health, and planarentity components, leveraging easing for speed interpolation and physics override for motion.
Usage example
-- Typically instantiated via the Ruins Nightmare's brain or behavior logic
local horn = SpawnPrefab("ruinsnightmare_horn_attack")
if horn ~= nil then
horn.components.ruinsnightmare_horn_attack:SetUp(owner, target, other)
end
Dependencies & tags
Components used: combat, health, planarentity, updatelooper
Tags: Adds FX to the entity upon collision transition. Checks INLIMBO, notarget, noattack, flight, invisible, playerghost, _combat, player for target filtering.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
owner | entity | nil | Reference to the entity that launched the attack; used to query combat stats and planarity. |
collision_x | number or nil | nil | X coordinate where the projectile should trigger collision/fx transition. |
collision_z | number or nil | nil | Z coordinate where the projectile should trigger collision/fx transition. |
targets | table | {} | A hash table tracking entities already hit in this attack to prevent duplicate damage. |
_initial_speed | number | INITIAL_SPEED (5.5) or INITIAL_SPEED_RIFTS (7.0) | Starting forward speed (units/sec), adjusted for planar rift variants. |
_final_speed | number | FINAL_SPEED (13.5) or FINAL_SPEED_RIFTS (15.0) | Target speed after interpolation over FINAL_SPEED_TIME. |
_pair | entity or nil | nil | Reference to the twin projectile (used in paired attacks), for co-cleanup on collision. |
_OnUpdateFn | function | OnUpdate | The update callback registered with updatelooper, called every frame. |
Main functions
SetUp(owner, target, other)
- Description: Initializes the projectile’s position and orientation: spawns it
INITIAL_DIST_FROM_TARGETunits away from the target position, faces it toward the target, sets collision coordinates, registers the update loop, and adjusts visuals/speed for planar rift variants. Must be called once after instantiation. - Parameters:
owner(entity) – the entity responsible for launching the attack.target(entity) – the intended location/target (typically the Ruins Nightmare itself).other(entity ornil) – optional second projectile to form a pair; sets_pairbidirectionally.
- Returns: Nothing.
- Error states: No explicit error handling;
other._pair = instassumesotheris non-niland writable.
OnUpdate(inst)
- Description: The core update loop that moves the projectile linearly along its forward direction, checks for collision with the designated point, applies AoE damage to valid targets within range, and manages speed via cubic easing. Terminates by transitioning to collision fx if the target point is reached.
- Parameters: None (uses
instfrom the update loop). - Returns: Nothing.
- Error states:
- Returns early if
owner.components.combatisnil. - Skips damage application if
vis already ininst.targets, is invalid, in limbo, dead, or not targetable by the owner's combat component. - Only applies knockback if
owner.components.planarentityexists.
- Returns early if
TurnIntoCollisionFx(inst)
- Description: Transforms the projectile into a collision effect entity: teleports it to the collision point, plays the
horn_atk_pstanimation, plays a collision sound, removes itself from the update loop, sets motor velocity to zero, adds theFXtag, and schedules self-destruction on animation end or entity sleep. - Parameters: None (uses
inst). - Returns: Nothing.
Events & listeners
- Listens to:
animover(on fx entity) – triggersinst:Remove()after collision animation completes.entitysleep(on fx entity) – triggersinst:Remove()if the entity is put to sleep.
- Pushes:
knockback(on hit targets) – with payload{ knocker = inst, radius = AOE_DAMAGE_RADIUS, strengthmult = 0.6, forcelanded = true }if the owner has theplanarentitycomponent.