边缘世界 RimWorld

边缘世界 RimWorld

[1.4] Vanilla Factions Expanded - Medieval
Sakura 2021 年 7 月 24 日 下午 9:45
XML Error - RimWorld 1.3
Hello, there were 2 red errors noticed during game initialization in RimWorld 1.3 with both Ideology/Royalty DLC.

XML error: Duplicate XML node name affordances in this XML block: <TerrainDef ParentName="WaterShallowBase"><defName>WaterShallow</defName><label>shallow water</label><texturePath>Terrain/Surfaces/WaterShallowRamp</texturePath><waterDepthShader>Map/WaterDepth</waterDepthShader><renderPrecedence>394</renderPrecedence><driesTo>Gravel</driesTo><statBases><Beauty>3</Beauty></statBases><affordances><li>WaterShallow</li></affordances><affordances><li>VFEM_Moatable</li></affordances></TerrainDef>

XML error: Duplicate XML node name affordances in this XML block: <TerrainDef ParentName="WaterShallowBase"><defName>Marsh</defName><label>marsh</label><texturePath>Terrain/Surfaces/Marsh</texturePath><edgeType>Water</edgeType><renderPrecedence>325</renderPrecedence><statBases><Beauty>-6</Beauty><Cleanliness>-2</Cleanliness></statBases><generatedFilth>Filth_Dirt</generatedFilth><fertility>0</fertility><takeFootprints>True</takeFootprints><avoidWander>true</avoidWander><driesTo>Soil</driesTo><extinguishesFire>true</extinguishesFire><tools><li><label>mud</label><capacities><li>KickMaterialInEyes</li></capacities><hediff>MudInEyes</hediff><cooldownTime>1.5</cooldownTime></li></tools><waterDepthShader>Map/WaterDepth</waterDepthShader><takeSplashes>true</takeSplashes><affordances><li>Marsh</li></affordances><affordances><li>VFEM_Moatable</li></affordances></TerrainDef>

Details are here: https://gist.github.com/HugsLibRecordKeeper/064cb204c97ed85bb325a2bbfb3d7337
< >
正在显示第 1 - 5 条,共 5 条留言
Licc 2021 年 9 月 4 日 上午 2:46 
Friend of mine got the same XML error, anyone got any ideas to possible reasons?
shale 2021 年 9 月 26 日 上午 6:32 
I also got this error :(
I think it has to do with `<affordances><li>Marsh</li></affordances><affordances><li>VFEM_Moatable</li></affordances>`
The "VFEM_Moatable" must come from this mod, but I don't know what is putting "Marsh"
shale 2021 年 9 月 26 日 上午 8:36 
found a solution that works for me: change the order that "Vanilla Factions Expanded - Medieval" and "ReGrowth: Core and Framework" load in
Gedrean 2021 年 10 月 7 日 下午 7:23 
Tl;dr : Read the section below the ======= signs, and follow those steps for your copy, to remove this error.

---

I receive the same errors, and do not have ReGrowth anything installed.

If I remove VFEM (Medieval), it goes away and no errors at all in the debug.

I was fairly certain it's caused by AddTerrainAffordance.xml (in 1.3/patches/) and MoatableTerrain.xml (in 1.3/defs/TerrainListDef/) both referencing "WaterShallow" and "Marsh".

To test this, I removed the references to both of them in MoatableTerrain.xml - but that did not fix it.

I then looked into AddTerrainAffordance, and noticed these two lines:

<Operation Class="PatchOperationAdd">
<xpath>/Defs/TerrainDef[defName="SoftSand" or defName="Sand" or defName="Soil" or defName="Gravel" or defName="MossyTerrain" or defName="MarshyTerrain"]/affordances</xpath>

Then, I noticed:

<Operation Class="PatchOperationAdd">
<xpath>/Defs/TerrainDef[defName="Marsh" or defName="WaterShallow"]</xpath>

In the first, containing defs that do NOT pop this error, I notice the bracket with the conditionals in it is followed by /affordances - but in the two defs that DO pop this error, no /affordances.

I tested my theory by removing the PatchOperationAdd operation and its children, saving a copy, and launching.

It launched with no errors.

I then tested by re-adding the code, but making the behavior match the first patchoperationadd almost exactly...

And it launches with no errors.

Finally, I tested by making the top line:

<xpath>/Defs/TerrainDef[defName="SoftSand" or defName="Sand" or defName="Soil" or defName="Gravel" or defName="MossyTerrain" or defName="MarshyTerrain" or defName="Marsh" or defName="WaterShallow"]/affordances</xpath>

So it takes those two entries in the same patch operation add.

Once again, tested - no errors.

----

Conclusion:
The issue is caused by 1.3\Patches\AddTerrainAffordance.xml having malformed code that patches two terrain defs, Marsh, and WaterShallow, to add the Affordance "VFEM_Moatable".

When this file is processed, it properly patches the other terrain defs referenced in the file, but these two are handled and worded differently in code. As a result, when the system tries to add a SECOND <affordances> XML node, that's when the XML parser throws an error that there is a duplicate <affordances> XML node.

The way the first operation works, it finds the existing <affordances> node, and adds the contents to it properly.



=======

Oskar, please modify 1.3\Patches\AddTerrainAffordance.xml to the following:


<?xml version="1.0" encoding="utf-8"?>
<Patch>
<Operation Class="PatchOperationAdd">
<xpath>/Defs/TerrainDef[defName="SoftSand" or defName="Sand" or defName="Soil" or defName="Gravel" or defName="MossyTerrain" or defName="MarshyTerrain" or defName="Marsh" or defName="WaterShallow"]/affordances</xpath>
<value>
<li>VFEM_Moatable</li>
</value>
</Operation>
</Patch>


This should make VFEM properly 1.3 compliant without giving XML errors.
最后由 Gedrean 编辑于; 2021 年 10 月 7 日 下午 7:26
Poindexter1985 2022 年 1 月 15 日 下午 4:09 
Thank you to Gedrean, that fix worked for me. Hopefully it gets incorporated into a future official update.
< >
正在显示第 1 - 5 条,共 5 条留言
每页显示数: 1530 50