边缘世界 RimWorld

边缘世界 RimWorld

Thanks For All The Fish
pyrce  [开发者] 2018 年 10 月 18 日 下午 9: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>
< >
正在显示第 1 - 2 条,共 2 条留言
Trunken 2019 年 5 月 26 日 上午 9:08 
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.
最后由 Trunken 编辑于; 2019 年 5 月 28 日 下午 5:38
pyrce  [开发者] 2019 年 5 月 28 日 下午 9: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
< >
正在显示第 1 - 2 条,共 2 条留言
每页显示数: 1530 50