Skip to main content

Ruins Shadeling

Based on game build 714014 | Last updated: 2026-03-07

Overview

The ruins_shadeling prefab represents a non-combative ambient entity in the Ruins. It remains motionless in a seated pose, provides a sanity aura (negative when the player is insane), and drops loot upon despawning or death. Its loot table dynamically switches between LOOT (containing nightmarefuel) and LOOT_RIFT (containing horrorfuel) depending on whether a shadow rift is active in the world. It supports seamless removal when off-screen and transitions between states using animation callbacks.

Usage example

local shadeling = SpawnPrefab("ruins_shadeling")
shadeling.Transform:SetPosition(x, y, z)
shadeling.Despawn() -- triggers wake animation and delayed removal

Dependencies & tags

Components used: health, combat, lootdropper, sanityaura, transparentonsanity, planarentity, riftspawner
Tags added: shadowcreature, monster, shadow, shadow_aligned, gestaltnoloot, NOBLOCK, NOCLICK, notarget (added conditionally via DisableCombat)
Tags checked: None directly by this prefab’s internal logic beyond tag-based API calls.

Properties

PropertyTypeDefault ValueDescription
sleeptaskTasknilReference to the off-screen removal timer task.
despawnedbooleanfalseFlag indicating the shadeling has been marked for despawn but not yet removed.
scrapbook_inspectonseenbooleantrueControls whether the scrapbook entry shows on first visual inspection.
scrapbook_animstring"scrapbook"Scrapbook display animation.
scrapbook_overridedatatable{ { "chair", "ruins_chair", "chair" } }Scrapbook icon override.
scrapbook_hidesymboltable{ "shad_parts2_red", "shad_head_white" }Symbols hidden in scrapbook view.
scrapbook_thingtypestring"creature"Scrapbook display category.
transparentonsanity.most_alphanumber0.7Max transparency when sanity-affected (client-side).
transparentonsanity.osc_ampnumber0.1Oscillation amplitude for transparency flicker (client-side).
components.health.maxhealthnumber1Max health, fixed at 1.
components.health.nofadeoutbooleantruePrevents fading out on death.
components.combat.hiteffectsymbolstring"shad_head"Symbol used for hit visual FX.
components.sanityaura.aurafnfunctionCalcSanityAuraCallback to compute sanity aura strength.
components.lootdropper.loottableInitially LOOT, changes to LOOT_RIFT if rift activeLoot table used on despawn/death.

Main functions

Despawn()

  • Description: Marks the shadeling for removal, plays the "wake" animation, disables combat targeting, and schedules removal after animation completes.
  • Parameters: None.
  • Returns: Nothing.
  • Error states: No-op if already despawned or dead (unless it has already been removed via OnEntitySleep).

OnDeath(inst)

  • Description: Handles post-death logic: removes itself after an animation delay and drops loot.
  • Parameters: inst (entity) — the dead shadeling.
  • Returns: Nothing.
  • Error states: Removes itself; no further calls possible after execution.

DoDropLoot(inst)

  • Description: Drops loot at the shadeling’s position and triggers the ruins_shadeling_looted event. Then marks the instance for removal depending on sleep state.
  • Parameters: inst (entity).
  • Returns: Nothing.

DisableCombat(inst)

  • Description: Adds NOCLICK and notarget tags to prevent interaction.
  • Parameters: inst (entity).
  • Returns: Nothing.

TryRemoveOffScreen(inst)

  • Description: Callback run after a short delay when the entity goes to sleep; removes the entity only if it is still off-screen and not about to drop loot.
  • Parameters: inst (entity).
  • Returns: Nothing.

CheckRift()

  • Description: Detects whether a shadow rift is active. If active, adds planarentity, updates loot to LOOT_RIFT, and shows shadow symbols. If inactive, reverts to base LOOT and hides shadow symbols.
  • Parameters: None (uses inst from closure).
  • Returns: Nothing.

Events & listeners

  • Listens to:
    • death (on inst) — triggers OnDeath.
    • animover (on inst) — triggers removal after Despawn.
    • ms_riftaddedtopool (on TheWorld) — triggers CheckRift.
    • ms_riftremovedfrompool (on TheWorld) — triggers CheckRift.
  • Pushes:
    • ruins_shadeling_looted — fired when loot is dropped.