Adding Pests & Diseases
Pests and diseases are defined in static Lua files under data/
.
They apply negative effects to specific plant types and progress over time unless cured. These definitions are used by the growing system to apply random or conditional challenges to plants.
Structure: Pests
A pest definition must include the following fields:
plant_types
Array of plant keys this pest can affect (e.g. "cabbage"
, "tomato"
)
label
Human-readable name
severity
Optional severity label (informational only)
effects
Tiered effect values applied per severity (low
, medium
, high
)
cure
Required item to cure the pest (with id
, label
, and amount
)
increase_rate
How fast the severity escalates (e.g. ticks until next stage)
Example: cabbage_loopers
cabbage_loopers
cabbage_loopers = {
plant_types = { "cabbage", "tomato", "corn" },
label = "Cabbage Loopers",
severity = "low",
effects = {
low = { quality = 2, health = 1 },
medium = { quality = 4, health = 3 },
high = { quality = 6, health = 5 }
},
cure = { id = "organic_pesticide", label = "Organic Pesticide", amount = 1 },
increase_rate = 4
}
Structure: Diseases
Diseases follow the exact same structure and fields as pests.
Example: downy_mildew
downy_mildew
downy_mildew = {
plant_types = { "cabbage", "tomato", "corn" },
label = "Downy Mildew",
severity = "low",
effects = {
low = { quality = 2, health = 1 },
medium = { quality = 4, health = 2 },
high = { quality = 6, health = 3 }
},
cure = { id = "copper_fungicide", label = "Copper Fungicide", amount = 1 },
increase_rate = 5
}
Effects Table
The effects
table defines what penalties are applied to the plant per severity tier.
Each tier must include:
quality
: Reduction in final yield qualityhealth
: Reduction in overall plant health
These values are cumulative and applied when the condition escalates.
Cure Field
The cure
field defines which item is required to remove the pest or disease. Structure:
cure = {
id = "item_name",
label = "Item Label",
amount = 1
}
This item must exist in your inventory system.
Increase Rate
This value determines how quickly the condition escalates to a higher severity level. Lower values escalate faster.
increase_rate = 4 -- escalates every 4 ticks
Registering New Pests or Diseases
To add a new entry:
Open
data/pests.lua
ordata/diseases.lua
.Add a new key to the returned table.
Define the structure following the format above.
Ensure
plant_types
includes only valid keys fromdata/plants.lua
.
Example: Adding a New Disease
powdery_mildew = {
plant_types = { "tomato" },
label = "Powdery Mildew",
severity = "low",
effects = {
low = { quality = 2, health = 1 },
medium = { quality = 4, health = 2 },
high = { quality = 6, health = 3 }
},
cure = { id = "sodium_bicarbonate", label = "Sodium Bicarbonate", amount = 1 },
increase_rate = 5
}
Add this to the return table in data/diseases.lua
.
Pests follow the same format.
Last updated