Skip to main content

Goatmilk

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

Overview

goatmilk is a food prefab representing fresh goat milk. It functions as a small-item consumable with moderate nutritional benefits and fast spoilage. It is tagged for use as cat food and integrates with the edible, perishable, stackable, tradable, and inventoryitem components. When it spoils, it transforms into spoiled_food.

Usage example

-- Create an instance of goatmilk
local inst = Prefab("goatmilk", fn, assets, prefabs)()

-- Access nutritional values (on master simulation)
if inst.components.edible then
local heal = inst.components.edible.healthvalue -- TUNING.HEALING_SMALL
local hunger = inst.components.edible.hungervalue -- TUNING.CALORIES_SMALL
local sanity = inst.components.edible.sanityvalue -- TUNING.SANITY_SMALL
end

-- Check spoilage status
if inst.components.perishable then
local time_left = inst.components.perishable.perishremainingtime
end

Dependencies & tags

Components used: edible, perishable, stackable, tradable, inspectable, inventoryitem
Tags: catfood, fooddrink
Spawns replacement: spoiled_food

Properties

PropertyTypeDefault ValueDescription
healthvaluenumberTUNING.HEALING_SMALLHealth restored when consumed.
hungervaluenumberTUNING.CALORIES_SMALLHunger restored when consumed.
sanityvaluenumberTUNING.SANITY_SMALLSanity restored when consumed.
perishtimenumberTUNING.PERISH_FASTDuration (in seconds) before spoilage occurs.
perishremainingtimenumberCurrent time remaining until spoilage.
onperishreplacementstring"spoiled_food"Prefab name used to replace this item upon spoiling.
maxsizenumberTUNING.STACK_SIZE_SMALLITEMMaximum stack size for this item.

Main functions

This prefab does not define custom methods. It relies entirely on component APIs.

Events & listeners

This prefab does not define event listeners or push events directly. It depends on component-level event handling (e.g., perishable manages its own update task and triggers replacement on spoilage).