[RESOLVED] How to make a food only edible after it has been cooked?

Started by erdrik, October 18, 2014, 09:26:49 PM

Previous topic - Next topic

erdrik

How to make a food only edible after it has been cooked?

I want to add woodlogs to a food recipe for a wood stove, but it only works if the woodlog has food entries.
But now colonists will eat wood logs. How can I stop them from eating woodlogs but still eat the resulting cooked meals?

ItchyFlea

#1
The code below is a modification to the SimpleMeal recipe where 1 piece of wood is now a required part of the meal:
<RecipeDef>
<defName>CookMealSimple</defName>
<label>cook simple meal</label>
<description>Cooks a straightforward meal from one ingredient.</description>
<jobString>Cooking simple meal.</jobString>
<workAmount>240</workAmount>
<workSpeedStat>CookSpeed</workSpeedStat>
<workEffect>Cook</workEffect>
<sustainerSoundDef>Recipe_CookMeal</sustainerSoundDef>
<ingredients>
<li>
<filter>
<categories>
<li>FoodRaw</li>
</categories>
</filter>
<count>10</count>
</li>
<li>
<filter>
<thingDefs>
<li>WoodLog</li>
</thingDefs>
</filter>
<count>1</count>
</li>
</ingredients>
<products>
<MealSimple>1</MealSimple>
</products>
<fixedIngredientFilter>
<categories>
<li>FoodRaw</li>
</categories>
<thingDefs>
<li>WoodLog</li>
</thingDefs>
</fixedIngredientFilter>
<defaultIngredientFilter>
<categories>
<li>FoodRaw</li>
</categories>
<thingDefs>
<li>WoodLog</li>
</thingDefs>
<exceptedThingDefs>
<li>Human_Meat</li>
</exceptedThingDefs>
</defaultIngredientFilter>
<skillGains>
<li>
<skill>Cooking</skill>
<xp>60</xp>
</li>
</skillGains>
</RecipeDef>

What I have added to the recipe above is 1 wood log as part of the recipe, and have also added the woodlog to the ingredient filters (<fixedIngredientFilter> and <defaultIngredientFilter>) so that you don't have to make the wood log into a food item for it to be used in the recipe.
The ingredient filters might be where the problem you're encountering lies. (It's tripped me up many times.) If a recipe has something as part of the ingredients list, but that item is not included in the ingredient filters list, the item can never be produced, and the game isn't able to tell you why.
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

erdrik

That was the first thing I tried. It does not work.
It makes the meal fine, but throws an error when the colonist tries to eat the meal.
The error prevents the colonist from receiving any nutrients and remains hungry, the meal is still lost.

EDIT:
To clarify, my problem was not being able to make the meal.
Rather getting the colonist to be able to eat it, but not be able to eat the wood.

ItchyFlea

I see what you mean about the problems caused by that. I don't know if there's a solution. Hopefully somebody else who knows more about the meal system can answer this question.
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

Dave-In-Texas

I'm still feeling my way into the realm of modding rimworld but it seems to me the solution is a two parter.

make your recipe with the required ingredients for the food itself, as if you were cooking it on the cook Table.   Then create a 'table' (call it grill) that is 'powered' by wood that cooks food and operates off a 'bills' system.   If there's a way to restrict it from cooking on the classic cook table, great - otherwise mod it out.   the food doesn't have wood in its ingredients list so shouldnt bug out when they try to eat it

erdrik

Work around found. (would still like a directly coded solution eventualy)
Set food quality of the wood log to Plant.

Animals probably can still eat the logs, but humans will not.
Humans will eat the resulting meals just fine.

Thanks for the help.