Skip to main content

Farm Plant Defs

Based on game build 714014 | Last updated: 2026-03-05

Overview

farm_plant_defs.lua is a data file defining static configuration tables for each farmable plant in the game. These tables (PLANT_DEFS) contain metadata used by the farming system to determine growth timelines, moisture requirements, seasonal preferences, nutrient consumption/restoration, killjoy tolerance, weight distribution, sounds, and UI/prefab references. The file is not a component, but rather a shared data dictionary referenced by farming-related prefabs and logic (e.g., plant growth, harvest, and registry systems).

Usage example

local PLANT_DEFS = require "prefabs/farm_plant_defs"

-- Access growth time data for tomato
local tomato_def = PLANT_DEFS.tomato
print(tomato_def.grow_time.full) -- e.g., 4 * TUNING.TOTAL_DAY_TIME

-- Get watermelon moisture settings
local water_def = PLANT_DEFS.watermelon
print(water_def.moisture.drink_rate)

Dependencies & tags

Components used: None identified
Tags: Adds modded = true to any new entries via metatable __newindex.

Properties

PropertyTypeDefault ValueDescription
grow_timetablenilContainer for germination and growth stage time ranges (seed, sprout, small, med, full, oversized, regrow).
moisturetablenilMoisture consumption config (drink_rate, min_percent).
good_seasonstablenilBoolean map of season names (spring, summer, autumn, winter) that the plant tolerates.
nutrient_consumptiontable{0,0,0}Ordered nutrient consumption per stage (typically [N, P, K]).
nutrient_restorationtable{nil,nil,nil}Restoration amounts per nutrient stage (computed from consumption).
max_killjoys_tolerancenumberTUNING.FARM_PLANT_KILLJOY_TOLERANCEMaximum killjoy count the plant can tolerate before growth penalty.
prefabstring"farm_plant_"..veggiePrefab name used for the plant entity.
seedstringveggie.."_seeds" or "seeds" (randomseed)String ID of the seed item required to plant.
plant_type_tagstring"farm_plant_"..veggieTag used internally (e.g., for pollinator stress).
plantregistryinfoarray of tablesBuilt-in registry stage definitionsConfiguration for UI display of plant growth stages.
plantregistrywidgetstring"widgets/redux/farmplantpage"Widget path for the plant’s registry UI page.
plantregistrysummarywidgetstring"widgets/redux/farmplantsummarywidget"Widget path for the plant’s registry summary view.
pictureframeanimtable{anim = "emoteXL_happycheer", time = 0.5}Picture-frame animation name and duration for the plant.
soundstable{}Sound paths for grow events (grow_oversized, grow_full, grow_rot).
iscarvablebooleanfalseMarks plants that can be carved (currently only pumpkin).
fireproofbooleanfalseMarks plants unaffected by fire (currently only dragonfruit).
is_randomseedbooleanfalseMarks the random seed placeholder plant type.

Main functions

MakeGrowTimes(germination_min, germination_max, full_grow_min, full_grow_max)

  • Description: Helper function that computes staged growth time ranges and full-grown/oversized/perish durations for a plant. Returns a table of time values for each growth stage.
  • Parameters:
    germination_min (number) – Minimum germination time (in segments or seconds, typically 12 * TUNING.SEG_TIME).
    germination_max (number) – Maximum germination time.
    full_grow_min (number) – Minimum full-growth time (will be divided among sprout → small → med stages).
    full_grow_max (number) – Maximum full-growth time.
  • Returns: Table with keys: seed (germination time range), sprout, small, med (stage durations), full (full-grown perish duration), oversized (oversized perish duration), regrow (regrowth time range).
  • Error states: None.

Events & listeners

Not applicable.