Creating custom food is almost identical to creating custom items, and custom food posses all the overrides that custom items do.
Custom food can also have custom MealEffects that trigger upon consuming the food.
Creating Meals
To create a custom meal, create a class that overrides CustomMeal:
Custom Meals support all the overrides that custom items do, despite the fact that many of them are non-functional. all overrides that modify the behaviour of the item in-inventory don’t function, as you don’t pick up meals into your inventory.
WARNING:
Overriding ItemPickupToImitate with any item that isn’t a meal will cause an error!
CustomMeal support the following overrides:
Type
Name
Default
List<List<InventoryItem.ITEM_TYPE>>
Recipe
[REQUIRED]
CookingData.MealEffects[]
MealEffects
[REQUIRED]
Vector3
ItemDisplayOffset
null
MealQuality
Quality
MealQuality.NORMAL
float
TummyRating
0
int
SatiationLevel
0
bool
MealSafeToEat
true
Adding Meals
To add a custom meal into the game, simply use CustomItemManager.Add().
Example:
Assigning the result of CustomItemManager.Add() allows you to reference that meal elsewhere in your code using Plugin.ExampleMeal.
Creating Drinks
To create a custom drink, create a class that overrides CustomDrink:
WARNING:
Overriding ItemPickupToImitate with any item that isn’t a drink will cause an error!
CustomDrink supports the following overrides:
Type
Name
Default
List<List<InventoryItem.ITEM_TYPE>>
Recipe
[REQUIRED]
CookingData.MealEffects[]
MealEffects
[REQUIRED]
int
SatiationLevel
0
Vector3
ItemDisplayOffset
null
int
Pleasure
0
Adding Drinks
To add a custom drink into the game, simply use CustomItemManager.Add().
Example:
Creating MealEffects
MealEffects occur when a follower or player consume a meal. To create a custom MealEffect you first create a class overriding CustomMealEffect. Example:
To add the effect to the game, simply use CustomMealEffectManager.Add().
Example:
Assigning the result of CustomMealEffectmManager.Add() allows you to reference that meal elsewhere in your code using Plugin.ExampleMealEffect.
WARNING: Make sure to register Custom Meal Effects before you register your custom meals, otherwise any custom meal effects Won’t work. Alternatively use Lazy loading.
CustomMealEffect supports the following overrides:
Type
Name
Default
string
InternalName
[REQUIRED]
Action<FollowerBrain>
Effect
[REQUIRED]
bool
EffectEnabled()
true
bool
Positive()
true
string
Description()
$“CookingData/{InternalName}/Description”
string
DescriptionSuffix()
""
Final Steps
For the icon to load, you need to put it in the appropriate location. For the example, this would be /Assets/example_food.png relative to the root folder containing the .dll
Directory structure: