Table of Contents

Class FoodNutritionProperties

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll

Allows you to make collectibles edible, and adds data about their nutrition. Open in GitHub

[DocumentAsJson]
public class FoodNutritionProperties
Inheritance
FoodNutritionProperties
Inherited Members
Extension Methods

Examples

"nutritionPropsByType": {
	"*-flyagaric-*": {
		"satiety": 80,
		"health": -6.5,
		"foodcategory": "Vegetable"
	},
	"*-earthball-*": {
		"satiety": 80,
		"health": -8,
		"foodcategory": "Vegetable"
	},
 ...

Fields

EatenStack

When an instance of this collectible is eaten, what item stack should be returned to the player? Possible example: Eating a 'meat on a stick' item would return a single stick. (Note: Bowl meals/liquids are specially designed to do this through their attributes and class.)

[DocumentAsJson("Optional", "None", false)]
public JsonItemStack EatenStack

Field Value

JsonItemStack

FoodCategory

The category of the food.

[DocumentAsJson("Recommended", "Fruit", false)]
public EnumFoodCategory FoodCategory

Field Value

EnumFoodCategory

Health

The health restored by the food. Usually actually used to hurt the player with negative values.

[DocumentAsJson("Optional", "0", false)]
public float Health

Field Value

float

Satiety

The saturation restored by the food.

[DocumentAsJson("Recommended", "0", false)]
public float Satiety

Field Value

float

SatietyLossDelay

The delay before that extra saturation starts to go away.

[DocumentAsJson("Optional", "10", false)]
public float SatietyLossDelay

Field Value

float

Properties

HealthDurationSec

If greater than zero, healing will be turned into healing over time and will be fully applied over this time. If HealthTicks is set to 1, it will mean that healing will just be delayed by HealthDurationSec.

[DocumentAsJson("Optional", "0", false)]
public float HealthDurationSec { get; set; }

Property Value

float

HealthTicks

If HealthDurationSec greater than zero, total healing will be split into this many portions, each applied in HealthDurationSec/HealthTicks time after another.

[DocumentAsJson("Optional", "1", false)]
public int HealthTicks { get; set; }

Property Value

int

Intoxication

How much eating this will affect the player's intoxication. (0..1)

[DocumentAsJson("Optional", "0", false)]
public float Intoxication { get; set; }

Property Value

float

Psychedelic

How much eating this will affect the player's psychedelic perception. (0..1)

[DocumentAsJson("Optional", "0", false)]
public float Psychedelic { get; set; }

Property Value

float

Saturation

Obsolete - Please use Satiety instead.

[DocumentAsJson("Obsolete", "", false)]
[Obsolete("Use Satiety instead.")]
public float Saturation { get; set; }

Property Value

float

SaturationLossDelay

Obsolete - Please use SatietyLossDelay instead.

[DocumentAsJson("Obsolete", "", false)]
[Obsolete("Use SatietyLossDelay instead.")]
public float SaturationLossDelay { get; set; }

Property Value

float

Methods

Clone()

Duplicates the nutrition properties, which includes cloning the stack that was eaten.

public FoodNutritionProperties Clone()

Returns

FoodNutritionProperties