Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NRE in Pawn_HealthTracker_HealthTick.TryHealRandomInjury #48

Open
NoirFry opened this issue Jun 16, 2020 · 3 comments
Open

NRE in Pawn_HealthTracker_HealthTick.TryHealRandomInjury #48

NoirFry opened this issue Jun 16, 2020 · 3 comments

Comments

@NoirFry
Copy link
Collaborator

NoirFry commented Jun 16, 2020

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))
@rheirman
Copy link
Owner

rheirman commented Jun 19, 2020

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.

@NoirFry
Copy link
Collaborator Author

NoirFry commented Jun 20, 2020

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.

@NoirFry
Copy link
Collaborator Author

NoirFry commented Jun 20, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants