simplyWiri / Loadout-Compositing

GNU Lesser General Public License v3.0
12 stars 8 forks source link

Bug: HAR races without a PawnKindDef causing errors #77

Closed thailyn closed 8 months ago

thailyn commented 10 months ago

I am using this mod with a HAR race that (as far as I can tell, looking through the other mod's XML defs) does not have an associated PawnKindDef. The consequence of this is pawns with that race do not get a LoadoutComponent comp class added to them, as the code that looks for races starts from PawnKindDefs:

https://github.com/simplyWiri/Loadout-Compositing/blob/450d71ca11039d266ae293b816876dc4cba633fd/Source/Patches/Notify_LoadedLevelChanged_Patch.cs#L16-L21

The result is various parts of this mod trigger errors when doing things related to the pawn, since the IsValidLoadoutHolder method returns true for these races. For example, when trying to open that pawn's tag list or in ThinkNode_LoadoutRealisation.TryIssueJobPackage, the mod throws NREs because pawn.TryGetComp<LoadoutComponent>() returns a null value, but is assumed to be not null (the latter throws an error about every time that pawn tries to find something to do, it seems).

simplyWiri commented 8 months ago

Thats quirky - I imagine there are quite a few things which rely on pawns having a "valid" pawn kind def. I can patch this, but I feel like the mod in question should probably add a placeholder pawn kind def.

simplyWiri commented 8 months ago

I had a look at solving this, I don't like what I'd need to do to fix it. I'm going to leave this for now, pawns w/o pawn kinds don't make much sense.