Patching recipe to use different resources

Started by Bud8013, December 06, 2021, 09:58:30 PM

Previous topic - Next topic

Bud8013

Hello, I require assistance on patching a recipeDef to be able to use a different material for another mod alongside my own.

I have a medieval mod that adds coal powered benches and preserved foods using a building. As a request by someone, they asked if my smoking recipes can use the Salt's from Vanilla Expanded Cooking. I have tried to add or even replace the salt from my mod with VEC's but it either doesn't work or brings up errors.

<Patch>
    <Operation Class="PatchOperationFindMod">
        <mods>
            <li>Vanilla Cooking Expanded</li>
        </mods>
        <match Class="PatchOperationSequence">
            <operations>
                <li Class="PatchOperationAdd">
                    <xpath>Defs/RecipeDef[defName="Make_SaltMeat"]/ingredients/li/filter/thingDefs</xpath>
                    <value>
<li>VCE_Salt</li>
                    </value>
                </li>
</operations>
</match>
</Operation>
</Patch>


This is just 1 of the 6 I need to patch but if I can just get help on just 1 of them that would be wonderful. I can't figure it out but any help would be wonderful.

Shinzy

You could try to take a little step back and replace the entire ingredients list segment instead of just single ingredient

Now I acknowledge this does sound stupid and that's cuz I am, BUT this is a method that worked for me when I had trouble replacing a single line from a list before

This is just a suggestion based on my own brute force modding and as such take it with grain of VCE_salt

Bud8013

How would I do something like that? I tried by just replacing it directly by using the PatchOperationReplace command but it just brings up an error.

    <Operation Class="PatchOperationFindMod">
        <mods>
            <li>Vanilla Cooking Expanded</li>
        </mods>
        <match Class="PatchOperationSequence">
            <operations>
                <li Class="PatchOperationReplace">
                    <xpath>Defs/RecipeDef[defName="Make_SaltMeat"]</xpath>
                    <value>
<ingredients>
<li>
<filter>
<categories>
<li>MeatRaw</li>
<li>AnimalProductRaw</li>
</categories>
</filter>
<count>1</count>
</li>
<li>
<filter>
<thingDefs>
<li>MW_Salt</li>
<li>VCE_Salt</li>
</thingDefs>
</filter>
<count>0.25</count>
</li>
</ingredients>
                    </value>
                </li>
</operations>
</match>
</Operation>

Shinzy

I'm a bit rusty with patching as I've not done one in well over a year now but I believe the replace path needs to be like this when you are replacing a thing
<xpath>Defs/RecipeDef[defName="Make_SaltMeat"]/ingredients</xpath>

You might wanna try to replace the salt directly again just incase the replace path you tried earlier was wrong in similar fashion