Winter Treestand
Based on game build 714014 | Last updated: 2026-03-07
Overview
winter_treestand is a prefabricated structure entity representing an immature winter tree sapling stage. It serves as the initial placement of a winter tree seed before growth. The entity supports interaction via the workable component (hammerable) to harvest resources early, integrates with the burnable and growable systems, and emits a placement sound and animation upon build. When planted with a seed, it transforms into a full-grown winter tree.
Usage example
local inst = SpawnPrefab("winter_treestand")
inst.Transform:SetPosition(world_position)
-- Optional: Plant a seed to grow the tree
inst:PushEvent("plantwintertreeseed", { seed = my_seed, doer = player })
-- Or hammer it to harvest wood before it grows
if inst.components.workable then
inst.components.workable:Work(1, player)
end
Dependencies & tags
Components used: lootdropper, workable, burnable, growable, inspectable, hauntable, obstacle
Tags added: winter_treestand, structure
Properties
No public properties.
Main functions
onhammered(inst)
- Description: Callback executed when the treestand is fully hammered. Drops loot (via
lootdropper) and spawns a collapse FX, then removes the entity. - Parameters:
inst(Entity) — the winter treestand instance being hammered. - Returns: Nothing.
onplanted(inst, data)
- Description: Handles planting a winter tree seed. Removes the treestand, spawns a new winter tree at the same position, starts its growth, and removes the seed.
- Parameters:
inst(Entity) — the winter treestand instance.data(table) — event payload containingseed(Entity) anddoer(Entity).
- Returns: Nothing.
onbuilt(inst)
- Description: Plays the placement sound and animation when the structure is placed in the world.
- Parameters:
inst(Entity) — the winter treestand instance. - Returns: Nothing.
onsave(inst, data)
- Description: Serializes burn state into the save data if the entity is burning or burnt.
- Parameters:
inst(Entity),data(table) — save data table to modify. - Returns: Nothing.
onload(inst, data)
- Description: Restores burn state on load if
data.burntis true by invoking theburnablecomponent’sonburnthandler. - Parameters:
inst(Entity),data(table) — loaded save data (may benil). - Returns: Nothing.
Events & listeners
- Listens to:
onbuilt— triggersonbuiltcallback to play placement animation and sound.plantwintertreeseed— triggersonplantedcallback to convert the treestand into a growing tree.
- Pushes:
itemplanted— fired inonplantedto notify the world of the planting action (not specific to this entity).