PatchOperation.FindModByID - notfood/PatchOperationHighlander GitHub Wiki

Just like its vanilla PatchOperationFindMod counterpart, executes the PatchOperation in match if found otherwise nomatch. Optionally set <all>True</all> to only execute when the whole list matches.

Examples:

Basic usage. If the mod identified by ccl.patchoperationhighlander is active, from the given xpath replace deconstructible otherwise claimable.

<Operation Class="PatchOperation.FindModByID">
  <mods>
    <li>ccl.patchoperation.highlander</li>
  </mods>
  <match Class="PatchOperationReplace">
    <xpath>/Defs/ThingDef[@Name="NonDeconstructibleAncientBuildingBase"]/building/deconstructible</xpath>
    <value>
      <deconstructible>true</deconstructible>
    </value>
  </match>
  <nomatch Class="PatchOperationReplace">
    <xpath>/Defs/ThingDef[@Name="NonDeconstructibleAncientBuildingBase"]/building/claimable</xpath>
    <value>
      <claimable>true</claimable>
    </value>
  </nomatch>
</Operation>

Same as above but with Context.

<Operation Class="PatchOperation.Context">
  <xpath>/Defs/ThingDef[@Name="NonDeconstructibleAncientBuildingBase"]</xpath>
  <operations>
    <li Class="PatchOperation.FindModByID">
      <mods>
        <li>ccl.patchoperation.highlander</li>
      </mods>
      <match Class="PatchOperationReplace">
        <xpath>/ThingDef/building/deconstructible</xpath>
        <value>
          <deconstructible>true</deconstructible>
        </value>
      </match>
      <nomatch Class="PatchOperationReplace">
        <xpath>/ThingDef/building/claimable</xpath>
        <value>
          <claimable>true</claimable>
        </value>
      </nomatch>
    </li>
  </operations>
</Operation>

Match multiple mods.

<Operation Class="PatchOperation.FindModByID">
  <all>True</all>
  <mods>
    <li>ccl.patchoperation.highlander</li>
    <li>ccl.alienraces</li>
  </mods>
  <match Class="PatchOperation.LogText">
    <value>Matched them all</value>
  </match>
  <nomatch Class="PatchOperation.LogText">
    <value>One or more are missing</value>
  </nomatch>
</Operation>
⚠️ **GitHub.com Fallback** ⚠️