RimWorld

RimWorld

Corruption Core
Speckhouse 12 Jul, 2020 @ 11:05am
Bug reports - exceptions when updating god status when mood is nullified, incompatibility with simple slavery
Hi. Thanks for the mod, you've clearly had to reach fairly deep into the game's workings to make it happen.

I've been having some issues with it, and I've managed to fix them too, so I thought I'd get back to you to get you the info

First of all, there appears to be some problem when an action/mood affects the god favour of a pawn, and the mood effect is nullified. This is based in HarmonyPatches.cs.

on line 111 you find out the severity of the moodled by calling the MoodOffset() method. If the effect is nullified, this causes an exception. This can prevent the score from counting, and even stops pawns from completing certain actions (butchering humanlikes, eating dishes with human meat (raw human meat isn't a problem for some reason though))

JobDriver threw exception in initAction for pawn Azsaguchzs driver=JobDriver_Ingest
System.NullReferenceException: Object reference not set to an instance of an object
at RimWorld.ThoughtUtility.NullifyingTrait
at RimWorld.ThoughtUtility.ThoughtNullified
at RimWorld.Thought_Memory.MoodOffset
at Corruption.Core.HarmonyPatches.TryGainMemoryPostfix

on line 102 there is a line that seems to attempt to prevent the code getting to that point in the first place, but it doesn't work for some reason. I've even tried using the ThoughtNullified function to reinforce the condition, but I got the same result.

I've replaced the MoodOffset call with newThought.CurStage.baseMoodEffect. Which is not quite the same thing, but is fairly similar. Plus, mama slaneeswould probably be just as happy whether the guy eating his brother is a cannibal or not

Now, this might be caused by some other mods, I'm running quite a few, so I'm not sure how replicable it is.



The other issue was incompatibility with simple slavery. This is in particular a problem with corruption: psykers, but it could be an issue with other mods in core too.

In Patches\Patches_Psycker.xml there is this.

<Operation Class="PatchOperationAdd">
<xpath>*/ThingDef[defName="Human"]</xpath>
<value>
<comps>
<li>
<compClass>Corruption.Psykers.CompPsyker</compClass>
</li>
</comps>
</value>
</Operation>

here you are adding comps/compclass to Human def. But simple slavery also adds a comps/compclass to humans. Due to this, if corruption is loaded after simple slavery, it will also add the <comps> tag, causing the node to have two <comps> tags, which causes an error message during startup (i haven't tested the actual impact though).

Due to this, many mods check first if comps/nullifyTraits/other tag groups exist, and based on that decide whether to add the tag, or only add another element into the tag.

<Operation Class="PatchOperationSequence">
<success>Always</success>
<operations>
<li Class="PatchOperationConditional">
<xpath>*/ThingDef[defName="Human"]/comps</xpath>
<nomatch Class="PatchOperationAdd">
<xpath>*/ThingDef[defName="Human"]</xpath>
<value>
<comps>
</comps>
</value>
</nomatch>
</li>
<li Class="PatchOperationAdd">
<xpath>*/ThingDef[defName="Human"]/comps</xpath>
<value>
<li>
<compClass>Corruption.Psykers.CompPsyker</compClass>
</li>
</value>
</li>
</operations>
</Operation>

Something like this. It's long and tedious, but it does improve the mod's compatibility with other mods, which might alter the same values. It's harder to maintain of course, but I think that the added robustness pays off occasionally.

The third problem is that all my guys keep being saints in term of soul corruption somehow, even if I'm doing some pretty f*d up stuff (I proudly declare that there is not a SINGLE grave in my colony. All the corpses have been eaten, and I've got more human leather than any other leather) This might be related to the first bug, though, I'll get back to you if i find out more.

Well, hope that helps with your work. Again, thanks for your work, and enjoy your day.
< >
Showing 1-1 of 1 comments
Ohu  [developer] 13 Jul, 2020 @ 1:07pm 
Thank you very much for this detailed report. I'll add the fixes you posted ASAP.
< >
Showing 1-1 of 1 comments
Per page: 1530 50