I'm trying to use a patch operation sequence to check whether a def from another mod is found, then apply an Add patch to XML within my own mod if it is. Should be pretty simple, but I'm having trouble. Here's the patch:
The mod containing Anon2Dresser is More Furniture, whose def in question is here:
https://pastebin.com/0pEFDLWw
I'm trying to apply the patch to the abstract defs that my added beds inherit from, as shown here:
https://pastebin.com/SUM4g4gT
Problem as it stands is that with the patch as above, the patch isn't being applied when More Furniture is loaded. No errors are showing up in the console log.
Can anyone suggest what I'm doing wrong here?
EDIT: spdskatr on Discord has patiently explained that Shinzy is right, and I didn't need a <success>Invert</success> immediately after the PatchOperationTest xpath, so I've permanently removed it. However, now the patch seems not apply under any circumstance. See below for a small C# workaround.
Code Select
<Operation Class="PatchOperationSequence">
<success>Always</success>
<operations>
<li Class="PatchOperationTest">
<xpath>/Buildings/ThingDef[defName = "Anon2Dresser"]</xpath>
</li>
<li Class="PatchOperationAdd">
<xpath>/Defs/ThingDef[@Name = "BedBase" or @Name = "DoubleBedBase" or @Name = "RoyalBedBase"]/comps/li[@Class = "CompProperties_AffectedByFacilities"]/linkableFacilities</xpath>
<value>
<li>Anon2Dresser</li>
<li>Anon2EndTable</li>
<li>Anon2EndTableLight</li>
<li>Anon2RoyalEndTable</li>
<li>Anon2RoyalEndTableLight</li>
</value>
</li>
</operations>
</Operation>
The mod containing Anon2Dresser is More Furniture, whose def in question is here:
https://pastebin.com/0pEFDLWw
I'm trying to apply the patch to the abstract defs that my added beds inherit from, as shown here:
https://pastebin.com/SUM4g4gT
Problem as it stands is that with the patch as above, the patch isn't being applied when More Furniture is loaded. No errors are showing up in the console log.
Can anyone suggest what I'm doing wrong here?
EDIT: spdskatr on Discord has patiently explained that Shinzy is right, and I didn't need a <success>Invert</success> immediately after the PatchOperationTest xpath, so I've permanently removed it. However, now the patch seems not apply under any circumstance. See below for a small C# workaround.