Statue Marble
Based on game build 714014 | Last updated: 2026-03-07
Overview
statue_marble is a breakable decorative object placed in the world, implemented as a prefab using the Entity Component System. It integrates with the workable, lootdropper, and inspectable components to define its mining interaction, loot table, and inspection status. The statue supports four visual types (determined by typeid) and tracks state across saves, including type-specific behavior like publishing ms_unlockchesspiece events and using dedicated scrapbook assets for specific variants.
Usage example
-- Spawn a default statue (type 1, Muse)
local statue = SpawnPrefab("statue_marble")
-- Explicitly set the statue type (e.g., type 4, Pawn)
statue:SetStatueType(4)
-- Wait for mining to complete (e.g., via listening for entity removal)
statue:ListenForEvent("onremove", function()
print("Statue destroyed!")
end)
Dependencies & tags
Components used: lootdropper, inspectable, workable
Tags: Adds statue to the entity; uses swap_statue symbol override for animation variants.
Special tags checked: None beyond statue.
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
typeid | number | 1 (via math.random(4)) | Index (1–4) indicating visual and loot type; used to select animation, loot, and scrapbook assets. |
scrapbook_anim | string | "full" (only for specific prefabs) | Animation name used in scrapbook UI. |
scrapbook_speechname | string | "statue_marble" (only for specific prefables) | Localized speech name used in scrapbook. |
scrapbook_build | string | "statue_small_type1_build" (only for specific prefabs) | Symbol build override used in scrapbook. |
Main functions
SetStatueType(inst, typeid)
- Description: Sets the visual and loot type of the statue based on
typeid. Applies the appropriate animation override for theswap_statuesymbol and updatesinst.typeid. - Parameters:
inst(entity) — The statue instance.typeid(number, optional) — Integer 1–4 specifying statue appearance and loot. Defaults tomath.random(4).
- Returns: Nothing.
- Error states: None; gracefully handles defaulting and duplicate calls.
LootSetFn(lootdropper)
- Description: Configures the loot dropped by this statue based on its
typeid. Uses the globalSKETCH_UNLOCKStable to determine the sketch prefab (e.g.,"chesspiece_muse_sketch") and updates theLootDropper's fixed loot list. - Parameters:
lootdropper(component) — TheLootDroppercomponent instance.
- Returns: Nothing.
- Error states: Returns without modifying loot if the corresponding
SKETCH_UNLOCKSentry is an empty string ("").
OnWorked(inst, worker, workleft)
- Description: Called each tick during mining and when work completes (
workleft <= 0). Plays animation segments based on progress and handles destruction logic. - Parameters:
inst(entity) — The statue instance.worker(entity ornil) — The mining actor (may benilduring load).workleft(number) — Remaining work units.
- Returns: Nothing.
- Error states: When
workleft <= 0, removes the entity. On load (whenworker == nil), delegates toOnWorkLoad, which re-invokesOnWorked.
GetStatus(inst)
- Description: Returns a string identifier for the statue’s type, used by the
inspectablecomponent for UI display (e.g.,"TYPE1"). - Parameters:
inst(entity) — The statue instance.
- Returns:
string— Formatted type string ("TYPE"..tostring(inst.typeid)).
Events & listeners
- Listens to: None directly (event listeners are registered externally for
statue_marbleentities, e.g., in prefabs usinginst:ListenForEvent(...)). - Pushes:
ms_unlockchesspiece— Triggered when a statue of type 1 (Muse) or 4 (Pawn) is fully mined; value is"muse"or"pawn"respectively.entity_droploot— Implicitly fired bylootdropper:DropLoot.onremove— Emitted when the entity is removed after mining.