PatchOperation.Context - notfood/PatchOperationHighlander GitHub Wiki

Given a xpath, using the following operations, limit their context to the xpath and run them in sequence. Huge performance gain as multiple operations are limited to small portions of the xml document. Can apply to any xpath with children.

Examples:

For the xpath /Defs/ThingDef[@Name="NonDeconstructibleAncientBuildingBase"] change building/deconstructible, building/claimable and statBases

<Operation Class="PatchOperation.Context">
  <xpath>/Defs/ThingDef[@Name="NonDeconstructibleAncientBuildingBase"]</xpath>
  <operations>
    
    <li Class="PatchOperationReplace">
      <xpath>/ThingDef/building/deconstructible</xpath>
      <value>
        <deconstructible>true</deconstructible>
      </value>
    </li>
    
    <li Class="PatchOperationReplace">
      <xpath>/ThingDef/building/claimable</xpath>
      <value>
        <claimable>true</claimable>
      </value>
    </li>
    
    <li Class="PatchOperationAdd">
      <xpath>/ThingDef/statBases</xpath>
      <value>
        <WorkToBuild>1500</WorkToBuild>
      </value>
    </li>
    
  </operations>
</Operation>
⚠️ **GitHub.com Fallback** ⚠️