[MOD HELP] New Recipe

Started by 6135, January 03, 2015, 10:55:49 PM

Previous topic - Next topic

6135

So my goal here is to make a recipe for the smelter which allows me to turn rock chunks. e.g limestone chunks, granite chunks, and so on and so fort ). I've managed to add it to the smelter without changing the worktable ( <recipeUsers><li>ElectricSmelter</li></recipeUsers>
Thanks to Igabod, but the colonist don't want to work on it when i add the bill.What am i doing wrong?
Also i get red errors on the debug log.
Here are the errors

Cannot call ItemFromXmlFile with resolveCrossRefs=true while loading is already in progress.

(Filename: C:/BuildAgent/work/d63dfc6385190b60/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 49)

Could not resolve cross-reference to Verse.ThingDef named StoneChunks


And here is the recipe i added

<RecipeDefs>
<RecipeDef>
<defName>MakeMetalFromRocks</defName>
<label>make metal from rocks</label>
<description>Melts rocks into metal.</description>
<jobString>Smelting metal from rocks.</jobString>
<workAmount>750</workAmount>
<workSpeedStat>SmeltingSpeed</workSpeedStat>
<efficiencyStat>SmeltingEfficiency</efficiencyStat>
<effectWorking>Smelt</effectWorking>
<soundWorking>Recipe_Smelt</soundWorking>
    <ingredients>
<li>
<filter>
<categories>
<li>StoneChunks</li>
</categories>
</filter>
<count>1</count>
</li>
</ingredients>
<products>
      <Steel>5</Steel>
    </products>
    <fixedIngredientFilter>
      <thingDefs>
        <li>StoneChunks</li>
      </thingDefs>
    </fixedIngredientFilter>
    <skillGains>
      <Crafting>100</Crafting>
    </skillGains>
<recipeUsers><li>ElectricSmelter</li></recipeUsers>
  </RecipeDef>
</RecipeDefs>

mipen

The error you are getting is caused by the reference to 'StoneChunks' in your recipe. I'm not 100% sure but I think this is in the fixedIngredientFilter tag, where you have put StoneChunks. 'StoneChunks' is a category defname, yes? If so, then it will be causing the error. You will need to change it to something like:
<filter>
               <categories>                  <li>StoneChunks</li>
               </categories>
            </filter>
Or something similar, I am not too sure and I can't check it. You can always look at the core recipe defs to see how they work. The one that makes food uses categories so that would be s good one to look at.
I can't remember exactly how it goes, but with respect to the colonists not doing the work, you must also have written either a workgiverdef or jobdef (I'm not sure which one) if you look in the core files for those two defs, I'm sure you'll be able to work out which one. It will only have a few lines to it, just detailing the workbench you are using and the defname of the recipe you are making. I hope that helps, I can't check if any of that is correct though at the moment, but if I am remembering correctly then that should be how it's done

6135

Thanks i fixed it with your help :D
But it turns out you do not need to change the fixedingredientfilter but i needed to change thingDefs to categories
I've tested it and it works.
here is the fixed recipe

<?xml version="1.0" encoding="utf-8" ?>
<RecipeDefs>
<RecipeDef>
<defName>MakeMetalFromRocks</defName>
<label>make metal from rocks</label>
<description>Melts rocks into metal.</description>
<jobString>Smelting metal from rocks.</jobString>
<workAmount>750</workAmount>
<workSpeedStat>SmeltingSpeed</workSpeedStat>
<efficiencyStat>SmeltingEfficiency</efficiencyStat>
<effectWorking>Smelt</effectWorking>
<soundWorking>Recipe_Smelt</soundWorking>
    <ingredients>
<li>
<filter>
<categories>
<li>StoneChunks</li>
</categories>
</filter>
<count>1</count>
</li>
</ingredients>
<products>
      <Steel>5</Steel>
    </products>
<fixedIngredientFilter>
      <categories>
        <li>StoneChunks</li>
      </categories>
</fixedIngredientFilter>
    <skillGains>
      <Crafting>100</Crafting>
    </skillGains>
<recipeUsers><li>ElectricSmelter</li></recipeUsers>
  </RecipeDef>
</RecipeDefs>