WhatTheHack
WhatTheHack copied to clipboard
NRE in Pawn_HealthTracker_HealthTick.TryHealRandomInjury
NRE here:
...
if (pawn.IsHashIntervalTick(50) && !pawn.IsHashIntervalTick(100) && !pawn.Position.Fogged(pawn.Map))
...
as pawn.Map
can be null
when mechaniod is healing and is in a caravan.
I added null check like that:
if (pawn.IsHashIntervalTick(50) && !pawn.IsHashIntervalTick(100) && pawn.Map != null && !pawn.Position.Fogged(pawn.Map))
Hey, sorry for not getting back to you earlier. Did you test this with just vanilla? I have the same question for the other issues you posted. I never had all these three issue, so I'd like to know if its a mod conflict, or not.
It would also be great if you could create a pull request for the three fixes, if you're familiar with how git works that shouldn't be a problem.
I check two others errors with only Harmony, Core, Royalty and Hugslib and they do appear.
RimWorld.Planet.TrySatisfyPawnNeeds
with Pawn_PsychicEntropyTracker psychicEntropy = pawn.psychicEntropy;
was added with Royalty DLC, so this one most likely worked fined before Royalty DLC was released. But now even if you didn't purchase Royalty, the game's dll was already updated and error will appear for everyone.
Dialog_FormCaravan_DoBottomButtons.AddWarnings
gives NRE too. With this one, i'm not sure why exactly is warnings == null
and how it was before. Never used it. But now it's null even without mods.
Pawn_HealthTracker_HealthTick.TryHealRandomInjury
is hard to test, as previous errors don't allow to form and travel as a caravan. But i'm sure it will be error too.
When pawn is in a caravan, his pawn.Map
is null. I use it in my mods, so i'm sure of it.
Actually, there're more things that don't work, but don't throw any errors.
When traveling with mechanoids, even if you have portable platform and fuel - mechanoids won't recharge. Their power need will go down, and the fuel will be consumed too.
That's because public static bool HasValidCaravanPlatform(this Pawn pawn)
is returning false
.
Not sure, but i guess that's because the mechnoid is losing his ownership of the platform when he's in a caravan.
Same with Needs.PowerProduction
I just quick-fixed it for myself, not sure if the optimal way or not.
Made PR #44 for NREs
But 'not charging' is still an issue. Not sure about PR for that one, as i changed charging logic for myself a little. I don't count platforms at all, as i expect all mechanoids can charge on one platform, rotating or something. So i just check if a platform is exist in a caravan and there's a fuel. That's good enough for me.