XML Patching trouble

Started by Prowler, October 17, 2024, 05:18:26 PM

Previous topic - Next topic

Prowler

Doing some patching, but having trouble on mortars. Can't seem to xpath to any of the Base nodes used as parents for later turrets. Mostly been able to work around this by replacing the nodes in question within their subsequent child Defs, but BaseArtilleryBuilding seems resistant to this tactic.

For reference, core data is:

<ThingDef Name="BaseArtilleryBuilding" ParentName="BuildingBase" Abstract="True">
    <thingClass>Building_TurretGun</thingClass>
    <drawerType>MapMeshAndRealTime</drawerType>
    ...et cetera et cetera

And my patchReplace attempt is:

<Operation Class="PatchOperationReplace">
   <xpath>/Defs/ThingDef[defName="BaseArtilleryBuilding"]/building</xpath>
   <value>
        <building>
        ...et cetera

I hope there's something obviously wrong with this that I just don't know about (maybe the abstract=true bit), but otherwise I've exhausted the workarounds I could think of.



Making simple meals out of chocolate since 2568!

explorer.n11

<Operation Class="PatchOperationReplace">
   <xpath>/Defs/ThingDef[defName="BaseArtilleryBuilding"]/building</xpath>
   <value>
        <building>

About obvious thing - you dont need to write <building></building> tag if you notice it in XPath.

If not workith try -

<Operation Class="PatchOperationRemove">
      <xpath>/Defs/ThingDef[defName="BaseArtilleryBuilding"]/building</xpath>
</Operation>

<Operation Class="PatchOperationAdd">
      <xpath>Defs/ThingDef[defName="BaseArtilleryBuilding"]</xpath>
      <value>
      <building>
                  ...
      </building>
      </value>
</Operation>

Exact that way.

<Operation Class="PatchOperationAdd">
    <xpath>Defs/ThingDef[defName="BaseArtilleryBuilding"]/builting</xpath>
</Operation>

- will not work if empty, learned by my own experience.

Also check DefName - Is it shouldn't be a mortar?

Prowler

For posterity: defname "BaseArtilleryBuilding" should have been @Name "BaseArtilleryBuilding". This appears to have been the only problem.
Making simple meals out of chocolate since 2568!