Need help with recipes

Started by admiralKew, July 17, 2017, 02:26:44 AM

Previous topic - Next topic

admiralKew

I'm working on a patch for Stuffified Construction and Combat Extended. Stuffified Construction adds multiple types of wood, while changing the 'WoodLog' resource to be the output of 'Synthwood' harvest.

That makes it so that you need to research hydroponics, and then Synthwood in order to craft arrows.

The patch I'm working on should allow players to use these new wood types to craft arrows.

Here is the recipedef for CE's 'make great arrows' recipe. I need to change the requirements from 'woodlog' to the new 'Woody' category, but I have no idea how to set that up.

<RecipeDef ParentName="AmmoRecipeNeolithicBase">
    <defName>MakeAmmo_GreatArrow_Stone</defName>
    <label>make stone great arrows x10</label>
    <description>Craft 10 stone great arrows.</description>
    <jobString>Making stone great arrows.</jobString>
    <ingredients>
      <li>
        <filter>
          <thingDefs>
            <li>WoodLog</li>
          </thingDefs>
        </filter>
        <count>2</count>
      </li>
    </ingredients>
    <fixedIngredientFilter>
      <thingDefs>
        <li>WoodLog</li>
      </thingDefs>
    </fixedIngredientFilter>
    <products>
      <Ammo_GreatArrow_Stone>10</Ammo_GreatArrow_Stone>
    </products>
  </RecipeDef>

jamaicancastle

Check in Stuffified Construction for a ThingCategoryDef (not StuffCategoryDef) for wood products. Then in the recipe code, change:
        <filter>
          <thingDefs>
            <li>WoodLog</li>
          </thingDefs>
        </filter>


to:
        <filter>
          <categories>
            <li>[whatever the thingCategoryDef for wood is called]</li>
          </categories>
        </filter>


and likewise for the fixedIngredientFilter.

Sp0nge

It seems like all woodtypes are put into the category as normal wood.

https://github.com/Sixdd6/Stuffified-Construction/blob/master/Defs/ThingDefs_Items/Various_Wood.xml

As far as my limitied understanding of coding goes you will need to make a new thingCategoryDef for those types of woods if you want them to be usable seperatly.

Easiest way to do it would be to add: <researchPrerequisite>Synthwood</researchPrerequisite>?

jamaicancastle

You shouldn't need to add a new category, WoodLogs should do fine as long as you set the filter to be a category rather than a def and to include the "s".

That will allow you to use any of the natural woods as well as synthwood for arrows. If for some reason you want to exclude synthwood, you could use an exception like so:
<filter>
<categories>
<li>WoodLogs</li>
</categories>
<exceptedThingDefs>
<li>WoodLog</li>
</exceptedThingDefs>
</filter>