Waxed Plants
Based on game build 714014 | Last updated: 2026-03-07
Overview
waxed_plants.lua is a helper script that creates prefabs for various plant and tree types with “waxed” visual variants—typically used for seasonal or decorative variants in DST. It relies heavily on WAXED_PLANTS.CreateWaxedPlant (defined in prefabs/waxed_plant_common.lua) to instantiate entities with appropriate animation sets, physics, minimap icons, and dynamic behavior functions. It integrates with components such as pickable, growable, witherable, and burnable to adapt visuals based on game state (e.g., picking, growth stage, withering, burning).
Usage example
-- Include the script to generate waxed plant prefabs
local waxed_plants = require "prefabs/waxed_plants"
-- Example: Access a generated waxed berrybush prefab by name
local berrybush_waxed = require "prefabs/waxed_plants.berrybush"
-- Create the entity and use standard prefab APIs
local inst =prefab_spawn(berrybush_waxed.prefab)
inst.Transform:SetPosition(x, y, z)
Dependencies & tags
Components used: burnable, growable, pickable, witherable
Tags: None identified
Properties
No public properties
Main functions
Plantable_GetAnimFn(inst)
- Description: Returns the appropriate animation name based on the state of
pickable,witherable, andgrowablecomponents. - Parameters:
inst(TheEntity) — entity instance with optionalpickable,growable,witherablecomponents. - Returns: String —
"idle","picked", or"dead".
FarmPlant_GetAnimFn(inst)
- Description: Returns animation name based on growth stage and
oversizedflag, or"randomseed"for seeds. - Parameters:
inst(TheEntity) — entity withgrowablecomponent and optionalplant_defandis_oversizedproperties. - Returns: String — stage name like
"crop_seed","crop_sprout","crop_oversized", etc.
WeedPlant_GetAnimFn(inst)
- Description: Returns animation name based on growth stage, adjusting for the
small_maturestate if plant is marked mature. - Parameters:
inst(TheEntity) — entity withgrowablecomponent and optionalmatureproperty. - Returns: String — stage name like
"small","small_mature","full", etc.
CreateWaxedBerryBush(name)
- Description: Factory function to create a waxed berry bush prefab instance.
- Parameters:
name(string) — prefab name variant (e.g.,"berrybush","berrybush2"). - Returns: Table — finalized prefab definition.
CreateWaxedSapling(is_moon)
- Description: Factory function to create a waxed sapling (e.g.,
"sapling"or"sapling_moon"). - Parameters:
is_moon(boolean) — whether to create the moon sapling. - Returns: Table — finalized prefab definition.
CreateWaxedFarmPlant(plant_def)
- Description: Factory function to create a waxed farm plant prefab, using a
PLANT_DEFSentry. - Parameters:
plant_def(table) — plant definition fromfarm_plant_defs.lua. - Returns: Table — finalized prefab definition.
CreateWaxedWeedPlant(plant_def)
- Description: Factory function to create a waxed weed plant prefab, using a
WEED_DEFSentry. - Parameters:
plant_def(table) — plant definition fromweed_defs.lua. - Returns: Table — finalized prefab definition.
Evergreen_GetAnimFn(inst)
- Description: Returns animation name based on burn/stump state and sway animation.
- Parameters:
inst(TheEntity) — entity withburnable,stumptag, andanimstable. - Returns: String — e.g.,
"evergreen_stump","evergreen_sway1_loop_normal".
DeciduousTree_GetAnimFn(inst)
- Description: Returns animation name for deciduous trees, adjusted for burn/stump and leaf color variants.
- Parameters:
inst(TheEntity) — entity withanimsandbuildproperties. - Returns: String — e.g.,
"tree_leaf_sway1_loop_red".
MoonAndPalmconeTree_GetAnimFn(inst)
- Description: Returns animation name for moon or palmcone trees based on sway and size.
- Parameters:
inst(TheEntity) — entity withsizeand animation state. - Returns: String — e.g.,
"sway1_loop_tall","burnt_short".
OceanTree_GetAnimFn(inst)
- Description: Returns animation name for ocean trees, adjusting for bloom state (
#inst.buds_used > 0) and burn/stump. - Parameters:
inst(TheEntity) — entity withbuds_usedtable and animation state. - Returns: String — e.g.,
"sway1_loop_bloomed".
AncientTree_GetAnimFn(inst)
- Description: Returns animation name for ancient trees, adjusted for stump and
"pickable"tag. - Parameters:
inst(TheEntity) — entity withtype,"stump"tag, and"pickable"tag. - Returns: String — e.g.,
"ancienttree_pine_stump","sway1_loop_full".
CreateWaxedAncientTree(type, data)
- Description: Factory function for waxed ancient trees.
- Parameters:
type(string) — tree type;data(table) — tree definition fromancienttree_defs.lua. - Returns: Table — finalized prefab definition.
CreateWaxedAncientTreeSapling(type, data)
- Description: Factory function for waxed ancient tree saplings.
- Parameters:
type(string);data(table). - Returns: Table — finalized prefab definition.
Events & listeners
None identified