Statueharp
Based on game build 714014 | Last updated: 2026-03-07
Overview
statueharp is a static environmental object representing a harp-shaped marble statue. It serves as a breakable object in the world, designed to be mined using the MINE action. When destroyed, it spawns visual feedback (rock_break_fx) and drops a configurable amount of marble loot. The prefab also implements experimental logic for Charlie-induced modifications (e.g., vine overlays and premature partial destruction) via the doCharlieTest callback and supports persistent state saving/loading.
Usage example
local inst = Prefab("statueharp", fn, assets, prefabs)
-- This prefab is instantiated automatically by the game engine via its Prefab definition.
-- External code interacts with it only through its components:
inst.components.workable:WorkedBy(player, amount)
inst.components.lootdropper:DropLoot(position)
Dependencies & tags
Components used: lootdropper, workable, inspectable
Tags: Adds statue
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
charlies_work | boolean | false | Indicates if Charlie's modification (vine build + potential early damage) has been applied. |
charlie_test | boolean | false | Tracks whether the Charlie test has been run (set once per instance lifetime). |
scrapbook_build | string | "statue_small_harp_build" | Build name used for scrapbook rendering. |
scrapbook_anim | string | "full" | Animation name used for scrapbook rendering. |
Main functions
OnWorked(inst, worker, workleft)
- Description: Callback invoked when the statue is mined. If
workleft <= 0, it spawns an FX, drops loot, and removes the statue. Otherwise, it plays an appropriate animation based on remaining work. - Parameters:
inst(Entity) – the statue entity.
worker(Entity ornil) – the entity performing the work (may beTheWorldin test scenarios).
workleft(number) – remaining work required to fully break the statue. - Returns: Nothing.
OnWorkLoad(inst)
- Description: Load-time callback that re-applies the
OnWorkedlogic upon world load, ensuring correct animation state matches savedworkleft. - Parameters:
inst(Entity) – the statue entity. - Returns: Nothing.
doCharlieTest(inst)
- Description: Runs once at spawn time to randomly apply Charlie’s modifier: adds a vine build override and may simulate partial mining if the statue is intact. Only runs if
inst.charlie_testisfalse. - Parameters:
inst(Entity) – the statue entity. - Returns: Nothing.
- Error states: No-op if
inst.charlie_testis alreadytrue.
invokecharliesanger(inst)
- Description: Applies the Charlie-specific vine build (
statue_small_harp_vine_build) as an override. - Parameters:
inst(Entity) – the statue entity. - Returns: Nothing.
Events & listeners
- Listens to: None (no
inst:ListenForEventcalls). - Pushes: None (no
inst:PushEventcalls).