Flower
Based on game build 714014 | Last updated: 2026-03-05
Overview
The flower prefab is a static environment entity that spawns with random animation states and can dynamically transform into a thorny rose (flower_rose) under specific conditions (e.g., during a full moon via transformer logic—currently commented out in code). It supports interaction via the pickable, inspectable, and halloweenmoonmutable components, and triggers sanity effects or damage when picked by certain entities. It also integrates with the scrapbook system and supports in-world regrowth and world state–based decay in caves.
Usage example
local flower = SpawnPrefab("flower")
flower.Transform:SetPosition(x, y, z)
-- Manually set type to rose (e.g., via world event)
flower:PushEvent("flower_transform_to_rose")
Dependencies & tags
Components used:
animstate, transform, network, inspectable, pickable, halloweenmoonmutable, roseinspectable
Tags: flower, cattoy, thorny (added only when animname == "rose")
Properties
| Property | Type | Default Value | Description |
|---|---|---|---|
animname | string | "f1"–"f10" or "rose" | Current animation state name; determines visual appearance and thorn status. |
planted | boolean | nil | Indicates whether the flower was manually placed (prevents automatic regrowth registration). |
_isrose | net_bool | false | Networked boolean tracking if the flower is currently a rose; triggers OnIsRoseDirty. |
scrapbook_proxy | string? | "flower_rose" (rose) or nil | Used by scrapbook system to reference related entry. |
Main functions
setflowertype(inst, name)
- Description: Sets or updates the flower’s animation state. If set to
"rose", adds thethornytag and updates networked state; otherwise removes the tag. Only changes ifnamediffers from currentanimname. - Parameters:
name(string?) — optional target animation name. Ifnil, picks random name fromnamesorrosewithROSE_CHANCE. - Returns: Nothing.
- Error states: No-op if
namematches currentanimname.
onpickedfn(inst, picker)
- Description: Callback fired when the flower is picked; applies sanity delta to the picker (if valid) and inflicts thorn damage if it is a rose and picker lacks
bramble_resistantor is not ashadowminion. - Parameters:
inst(Entity) — the flower entity.
picker(Entity?) — entity that picked the flower, may benil. - Returns: Nothing.
- Error states: Early returns if
pickerisnilor missingsanity/combatcomponents.
DieInDarkness(inst)
- Description: Checks for nearby daylight sources within
TUNING.DAYLIGHT_SEARCH_RANGE. If no light is found, removes the flower and spawnsflower_withered. - Parameters:
inst(Entity) — the flower entity. - Returns: Nothing.
CheckForPlanted(inst)
- Description: Adds unpicked flower to regrowth manager if
inst.plantedis falsy. - Parameters:
inst(Entity) — the flower entity. - Returns: Nothing.
Events & listeners
- Listens to:
isrosedirty— triggersOnIsRoseDirtyto update scrapbook proxy when rose status changes. - Pushes:
thorns— sent to picker upon rose damage.
plantkilled— sent to world on pick. - World state listeners (caves only):
iscaveday— schedulesDieInDarknessduring cave day.