Yotc Carratshrine
Based on game build 714014 | Last updated: 2026-03-07
Overview
The yotc_carratshrine prefab represents an interactive structure that accepts specific offerings (carrots or seed items), unlocks prototyping capabilities upon offering, and supports burning mechanics. It transitions between three primary states—EMPTY, OFFERED, and BURNT—and integrates with the world's YOTC race prize manager to visually update its idol symbol. The shrine delegates offering acceptance to a trader component, manages offering lifecycle events, and adapts loot and animation behavior when burnt or hammered.
Usage example
local shrine = SpawnPrefab("yotc_carratshrine")
shrine.Transform:SetPosition(x, y, z)
-- To offer a carrot to the shrine (triggers prototyping)
shrine.components.trader:AcceptItem(carrot_prefab)
-- To manually set an offering if pre-loading
if shrine.offering == nil then
shrine.components.trader.onaccept(shrine, giver, carrot_prefab)
end
Dependencies & tags
Components used: burnable, hauntable, inspectable, lootdropper, prototyper, trader, workable, yotc_raceprizemanager (world-level), inventoryitem (indirect), fueled (indirect via MakeMediumBurnable), propagator (indirect), soundemitter, animstate, minimapentity, transform, network, obstaclephysics, dehydratable, lunarhailbuildup.
Tags: Adds structure, carratshrine, prototyper (pristine state only).
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
offering | entity or nil | nil | Reference to the currently offered item (carrot or seeds). Cleared when consumed, perished, or burnt. |
Main functions
SetOffering(inst, offering, loading)
- Description: Sets a new offering on the shrine, registers lifecycle listeners, updates visuals (symbol override for carrot vs seeds), and activates the
prototypercomponent. - Parameters:
inst(entity) — The shrine entity.offering(entity) — The item to place as offering.loading(boolean) — Iftrue, suppresses audio/animation feedback (used for save/load).
- Returns: Nothing.
- Error states: Early-return if
offeringis already set.
MakeEmpty(inst)
- Description: Clears the current offering (if any), removes the
prototypercomponent, and reinitializes thetradercomponent with callback and configuration. - Parameters:
inst(entity) — The shrine entity.
- Returns: Nothing.
DropOffering(inst, worker)
- Description: Removes and returns the current offering to the scene (either flung to a worker or world position), cleans up listeners, and hides the seeds symbol.
- Parameters:
inst(entity) — The shrine entity.worker(entity ornil) — If provided, launches the offering at the worker usingLaunchAt.
- Returns: Nothing.
PrizeChange(inst, instant)
- Description: Updates the idol animation based on whether a race prize is available in the world (YOTC event logic). Hides/shows
idol_1andidol_3animations. - Parameters:
inst(entity) — The shrine entity.instant(boolean) — Iftrue, skips animation playback (used on load).
- Returns: Nothing.
Events & listeners
- Listens to:
onremove(offering) — CallsMakeEmpty.perished(offering) — CallsOnOfferingPerished.onbuilt(shrine) — Callsonbuilt.yotc_ratraceprizechange(world) — CallsPrizeChange.ondeconstructstructure(shrine) — CallsDropOffering.
- Pushes:
- No events are directly pushed by this prefab's functions. State changes affect component listeners or trigger world events via callbacks (
onburnt,onaccept, etc.).
- No events are directly pushed by this prefab's functions. State changes affect component listeners or trigger world events via callbacks (
Note: This prefab’s internal logic primarily resides in event callbacks and initialization functions rather than standalone methods. Its observable behavior is mediated through component interactions (
trader,workable,burnable).