Smallghost
Based on game build 714014 | Last updated: 2026-03-07
Overview
The smallghost prefab implements the mechanics for the Ghost Child (Wendy's ghost companion), handling quest-based toy collection, dynamic environmental feedback via hot/cold effect scaling, player linking/unlinking, and integration with DST’s quest, follower, and locomotion systems. It coordinates closely with the follower, leader, playerprox, knownlocations, skilltreeupdater, and talker components to respond to player proximity, manage quest state, and synchronize gameplay feedback.
Usage example
-- Typically not instantiated directly by mods; created via prefab spawning.
-- Example of internal usage in quest logic:
local ghost = SpawnPrefab("smallghost")
ghost:SetPosition(x, y, z)
ghost.LinkToPlayer(player)
ghost.sg:GoToState("quest_begin")
Dependencies & tags
Components used: follower, knownlocations, playerprox, skilltreeupdater, talker, questowner, locomotor, sanityaura, inspectable, trader, network, dynamicshadow, animstate, soundemitter, transform
Tags added: ghost, ghostkid, flying, girl, noauradamage, NOBLOCK, trader
Tags checked: ghostlyfriend (for client-side talk permission), reviver (for trading hint)
Properties
No public properties exposed beyond internal instance variables (inst._toys, inst._playerlink, inst._hotcold_fx, inst._hairstyle, inst._cancelled, inst._toy_datas, inst._shard_id, inst._toy_center_position, inst.PickupToy, inst.LinkToPlayer, inst.LinkToHome). These are initialized and managed internally.
Main functions
PickupToy(toy)
- Description: Handles collection of a quest toy, removes it from tracking, spawns associated
ghostflowerspawn effects (including extra flowers for Wendy’s skill upgrades), and triggers quest completion if no toys remain. - Parameters:
toy(entity) - the toy prefab entity being collected. - Returns: Nothing.
- Error states: Returns early if
toyis not in the current quest’sinst._toysset.
LinkToPlayer(player)
- Description: Binds the ghost to a specific player as its leader, removes player proximity limbo behavior, and configures leader death/onremove callbacks.
- Parameters:
player(entity) - the player entity to follow and link to. - Returns: Nothing.
LinkToHome(home)
- Description: Binds the ghost to a static location (e.g., a gravestone), remembers its position as "home", and ensures limbo behavior is skipped only when the player is not close.
- Parameters:
home(entity) - the entity (typically a gravestone) acting as the ghost’s anchor. - Returns: Nothing.
sethairstyle(hairstyle)
- Description: Sets the ghost’s hair variant by overriding the
smallghost_hairsymbol usingghost_kidanimations. - Parameters:
hairstyle(number or nil) - index (0–3);nilor0uses default hair. - Returns: Nothing.
Events & listeners
- Listens to:
onremove(on itself, from toys) → triggerson_toy_removedto update quest progress.onremove(on_playerlink) → triggersunlink_from_playerandinst._on_leader_removed.death(on_playerlink) → triggersinst._on_leader_deathto unlink.animover(onhotcold_fx) → restarts random idle animation.
- Pushes:
- None directly; relies on component events (
follower,leader,playerprox,questowner) and state graph transitions for interactivity.
- None directly; relies on component events (