RimWorld
Thanks For All The Fish
pyrce  [dezvoltator] 18 oct. 2018 la 21:38
How to Mod the Mod
Ok so here's a working example for how to add Shallow Water as a fishable location.

In your (not TFATF) mod add a "Patches/FishingPatch.xml" file. Then add these contents to the file:

<Patch> <Operation Class="PatchOperationSequence"> <success>Always</success> <operations> <li Class="PatchOperationTest"> <xpath>*/TerrainDef[defName = "WaterShallow"]/tags</xpath> <success>Invert</success> </li> <li Class="PatchOperationAdd"> <xpath>*/TerrainDef[defName = "WaterShallow"]</xpath> <value> <tags/> </value> </li> </operations> </Operation> <Operation Class="PatchOperationAdd"> <xpath>*/TerrainDef[defName = "WaterShallow"]/tags</xpath> <value> <li>Fishable</li> </value> </Operation> <Operation Class="PatchOperationSequence"> <success>Always</success> <operations> <li Class="PatchOperationTest"> <xpath>*/TerrainDef[defName = "WaterOceanShallow"]/tags</xpath> <success>Invert</success> </li> <li Class="PatchOperationAdd"> <xpath>*/TerrainDef[defName = "WaterOceanShallow"]</xpath> <value> <tags/> </value> </li> </operations> </Operation> <Operation Class="PatchOperationAdd"> <xpath>*/TerrainDef[defName = "WaterOceanShallow"]/tags</xpath> <value> <li>Fishable</li> </value> </Operation> <Operation Class="PatchOperationSequence"> <success>Always</success> <operations> <li Class="PatchOperationTest"> <xpath>*/TerrainDef[defName = "WaterMovingShallow"]/tags</xpath> <success>Invert</success> </li> <li Class="PatchOperationAdd"> <xpath>*/TerrainDef[defName = "WaterMovingShallow"]</xpath> <value> <tags/> </value> </li> </operations> </Operation> <Operation Class="PatchOperationAdd"> <xpath>*/TerrainDef[defName = "WaterMovingShallow"]/tags</xpath> <value> <li>Fishable</li> </value> </Operation> </Patch>

This adds the "Fishable" tag to each of the 3 types of shallow water.

The "PatchOperationSequence" section is required because some definitions inherit the tags section, so we need to explicitly add it to the xml if they don't make thier own tags. It effectively checks if there's a "tags" element and adds it if it's missing before we do the "PatchOperationAdd".

If you want to turn off fishing in one of the default terrain types. Add the tag "NonFishable" to the given water tile (you won't see the "Fishable" tag in the definition until a map is loaded for compatability reasons).

<Patch> <Operation Class="PatchOperationSequence"> <success>Always</success> <operations> <li Class="PatchOperationTest"> <xpath>*/TerrainDef[defName = "WaterMovingChestDeep"]/tags</xpath> <success>Invert</success> </li> <li Class="PatchOperationAdd"> <xpath>*/TerrainDef[defName = "WaterMovingChestDeep"]</xpath> <value> <tags/> </value> </li> </operations> </Operation> <Operation Class="PatchOperationAdd"> <xpath>*/TerrainDef[defName = "WaterMovingChestDeep"]/tags</xpath> <value> <li>NonFishable</li> </value> </Operation> </Patch>
< >
Se afișează 1-2 din 2 comentarii
Hello Pyrce,
is there a way to add different fish for me to use in my mod? i would really like to implement this for my food recipes and recipeusers.

Kind Regards

Edit: Using Fish Corpses, when your mod is found atm.
Editat ultima dată de Trunken; 28 mai 2019 la 17:38
pyrce  [dezvoltator] 28 mai 2019 la 21:19 
You'll want to replace the

See Overwriting defs section xpath example[rimworldwiki.com] to update the CatchFish recipe's products list.

I do something similar with a different operator in https://github.com/MSeal/RimworldThanksForTheFish/blob/master/Patches/RecipePatch.xml
< >
Se afișează 1-2 din 2 comentarii
Per pagină: 1530 50