RimWorld

RimWorld

Borg Race (Revisited)
Nolabritt  [udvikler] 14. juli 2020 kl. 6:20
Handy patch to make building minifiable
This patch operation is used to make a target building minifiable. Just replace the the DefName and place in a patch xml. DefName in this example is ShipTurret_Laser. This code checks to see if the node already exists, if not, then it makes one, if yes, then it replaces it.




<Operation Class="PatchOperationSequence">
<success>Always</success>
<operations>
<li Class="PatchOperationConditional"><success>Always</success>
<xpath>/Defs/ThingDef[defName = "ShipTurret_Laser"]/minifiedDef</xpath>
<nomatch Class="PatchOperationAdd">
<xpath>/Defs/ThingDef[defName = "ShipTurret_Laser"]</xpath>
<value>
<minifiedDef>MinifiedThing</minifiedDef>
</value>
</nomatch>
<match Class="PatchOperationReplace">
<xpath>/Defs/ThingDef[defName = "ShipTurret_Laser"]/minifiedDef</xpath>
<value>
<minifiedDef>MinifiedThing</minifiedDef>
</value>
</match>
</li>
<li Class="PatchOperationConditional"><success>Always</success>
<xpath>/Defs/ThingDef[defName = "ShipTurret_Laser"]/statBases/Mass</xpath>
<nomatch Class="PatchOperationAdd">
<xpath>/Defs/ThingDef[defName = "ShipTurret_Laser"]/statBases</xpath>
<value>
<Mass>1000</Mass>
</value>
</nomatch>
<match Class="PatchOperationReplace">
<xpath>/Defs/ThingDef[defName = "ShipTurret_Laser"]/statBases/Mass</xpath>
<value><Mass>1000</Mass></value>
</match>
</li>
<li Class="PatchOperationConditional"><success>Always</success>
<xpath>/Defs/ThingDef[defName = "ShipTurret_Laser"]/thingCategories</xpath>
<nomatch Class="PatchOperationAdd">
<xpath>/Defs/ThingDef[defName = "ShipTurret_Laser"]</xpath>
<value>
<thingCategories>
<li>BuildingsProduction</li>
</thingCategories>
</value>
</nomatch>
<match Class="PatchOperationReplace">
<xpath>/Defs/ThingDef[defName = "ShipTurret_Laser"]/thingCategories</xpath>
<value>
<thingCategories>
<li>BuildingsProduction</li>
</thingCategories>
</value>
</match>
</li>
</operations>
</Operation>
Sidst redigeret af Nolabritt; 24. juli 2020 kl. 10:19