I'm making a food mod, but I'm faced with the problem of setting the properties of ready-made food. Is it possible to call a function separately for raw food and another function for cooked. Or is it possible to write a function in which to somehow specify an action for ready and raw food separately.
Sample. I have a food.
item Meat
{
HungerChange=-30,
Weight=1.6,
Type=Food,
FoodType=Meat,
DisplayName=Meat,
DisplayCategory = food,
Icon=Meat1,
DangerousUncooked = TRUE,
Calories = 220,
Carbohydrates = 0,
Lipids = 9,
Proteins = 31,
IsCookable = TRUE,
MinutesToCook = 30,
MinutesToBurn = 60,
StaticModel = Meat1,
OnEat = function1,
}
And i have function
function function1(food, player)
local bodyDamage = player:getBodyDamage()
local currentUnhappyness = bodyDamage:getUnhappynessLevel()
bodyDamage:setUnhappynessLevel(currentUnhappyness + 50);
bodyDamage:getBodyPart(BodyPartType.Torso_Lower):setBurned();
end
end
This function executed when food is raw and cooked. I want to have a separate functions on raw food and cooked.
How can i perform it.
I figured, i can create another food
ReplaceOnCooked = CookedMeat,
and create another OnEat function for this item. But this way resetting DaysFresh and too hard to create so many food copies. models and textures, and break some my future plans.