Masking Edit in mod causes errors for some people (and RED X)

Started by jabbamonkey, April 18, 2021, 08:14:11 AM

Previous topic - Next topic

jabbamonkey

I created some updated WORKBENCHES in a mod, and this required editing the Def for the masking. One person said they are getting an error and seeing a red X for a workbench. I think this may be an issue with conflicting mods that affect the workbenches I edited. Can someone help me fix the code, so it overrides other mods (my knowledge of XML is VERY limited) .....

Here are the two error messages...
Quote1)
XML error: Duplicate XML node name shaderType in this XML block: <graphicData><texPath>Things/Building/Production/TableTailorHand</texPath>

2)
XML Verse.GraphicData defines the same field twice: shaderType.
Field contents: CutoutComplex.
Whole XML:
<graphicData><texPath>Things/Building/Production/TableTailorHand</texPath>

Here is an example of the modified workbench code:
<li Class="patchOperationAdd">
<success>Always</success>
<xpath>*/ThingDef[defName = "HandTailoringBench"]/graphicData</xpath>
<value>
<shaderType>CutoutComplex</shaderType>
</value>
</li>


Note: I  know the image path is correct, and I am not receiving errors on my end. Also, the user didn't provide their log, so I don't know what mods could be affecting this.

Shinzy

Looking at the hand tailoring bench; it already has the cutout complex shader type you're adding with the patch
It's possible the hand tailoring bench didn't have a shader type back when you first made this mod, but there seems to be one now

the error is complaining about duplicate of the thing you're adding with the patch, so I think you could actually even just get rid of the patch entirely

I do find it really strange that you're not seeing the error yourself!
have you got dev mode enabled? Some errors don't get shown without it

jabbamonkey

Well, I tend to use Gloomy's Production/Furniture mods AFTER my mod, and they replace the TailorBench as well. So, I am assuming that their TailorBench code OVERRIDES mine....

Yup, just removed Gloomy's mods and the error showed up on my game load. I'll just remove the code from my mod. Thanks!

Shinzy

Oooh! in this case you could also make one of them sequence operations to test if the shader exists and if not then add one.. But I have to admit, it might just not be worth the time and effort and headache. Have to draw the line somewhere :P

jabbamonkey

I sort of WANT to do that, to make the mod as good as possible ... BUT, I also don't want to do that, because I'll be "pulling out my hair" trying to figure it HOW to do it.
:)

Fakeaccount123

did you try "PatchOperationReplace" instead of add? it seems like you are trying to add somethig that is already there. Why don't you replace it instead?

jabbamonkey

Checking to see if something is there first, is a safe thing to do (and avoids issues in the future).

I can JUST REPLACE ... then I'd get an error if it doesn't exist.

If I JUST ADD, then I'd get an error if it does exist already.