RimWorld

RimWorld

Gloomy Vanilla Overhaul
Nyanko-re 29 Nov, 2024 @ 2:53pm
Bugfixes
Two errors in Vanilla.xml:
1. PatchOperationAdd attempts to find the comps node under RoyalBed, but RoyalBed's comps were moved to a parent and thus the patch can't find it:
<li Class="PatchOperationAdd"> <xpath>Defs/ThingDef[defName="RoyalBed"]/comps</xpath> <value> <li Class="Gloomylynx.CompProperties_SecondLayerFollow"> <graphicData> <texPath>Things/Building/Furniture/GL_ClassyDoubleBedFrame</texPath> <graphicClass>Graphic_Multi</graphicClass> <shaderType>Transparent</shaderType> <drawSize>(4,4)</drawSize> </graphicData> <altitudeLayer>Pawn</altitudeLayer> </li> <li Class="Gloomylynx.CompProperties_SecondLayer"> <graphicData> <texPath>Things/Building/Furniture/GL_ClassyDoubleBedLace</texPath> <graphicClass>Graphic_Multi</graphicClass> <shaderType>Transparent</shaderType> <drawSize>(4.05,4.05)</drawSize> <color>(1,1,1,0.93)</color> </graphicData> <altitudeLayer>Blueprint</altitudeLayer> </li> </value> </li>

This can be fixed by adding a check that adds the comps node to RoyalBed right beforehand:
<li Class="PatchOperationConditional"> <xpath>Defs/ThingDef[defName="RoyalBed"]/comps</xpath> <nomatch Class="PatchOperationAdd"> <xpath>Defs/ThingDef[defName="RoyalBed"]</xpath> <value> <comps /> </value> </nomatch> </li>



2. [defName="SimpleResearchBench"][not(comps)] doesn't seem to work:
<li Class="PatchOperationAdd"> <xpath>Defs/ThingDef[defName="SimpleResearchBench"][not(comps)]</xpath> <value> <comps /> </value> </li>

But the intended effect can be achieved by replacing it with a PatchOperationConditional to add an empty comps field if one doesn't already exist:
<li Class="PatchOperationConditional"> <xpath>Defs/ThingDef[defName="SimpleResearchBench"]/comps</xpath> <nomatch Class="PatchOperationAdd"> <xpath>Defs/ThingDef[defName="SimpleResearchBench"]</xpath> <value> <comps /> </value> </nomatch> </li>

There's also one other issue, where the drapery layer of the Royal Bed doesn't show up properly. At some point, a RimWorld update made it so that you need to add a RealtimeOnly drawerType node to it:
<?xml version="1.0" encoding="utf-8" ?> <!-- If Gloomy Vanilla Overhaul is installed, add an xml node to the beds that fixes the drapery layer not showing up --> <Patch> <Operation Class="PatchOperationFindMod"> <mods> <li>Gloomy Vanilla Overhaul</li> </mods> <match Class="PatchOperationAdd"> <xpath>Defs/ThingDef[defName="RoyalBed"]</xpath> <value> <drawerType>RealtimeOnly</drawerType> </value> </match> </Operation> </Patch>

Funnily enough, I actually figured this out while trying to fix Polyamory Gloomy Bed, which has the exact same issue.
Last edited by Nyanko-re; 29 Nov, 2024 @ 3:03pm