RimWorld

RimWorld

HousekeeperAssistanceCat
SlippyCheeze 2 Jul, 2022 @ 11:24am
[BUG] RimWorld.JobGiver_HousekeeperCat.PawnCanUseWorkGiver incorrectly skips some checks
Hoi. I assume that came in from your recent rewrite, but you have a logic error in the method `JobGiver_HousekeeperCat.PawnCanUseWorkGiver`.

if (!giver.def.nonColonistsCanDo) { return (bool)(pawn.Faction?.IsPlayer); }

That logic means that if the work is flagged "only colonists can do" (nonColonistsCanDo=false) then the `given.ShouldSkip` check is ignored.

Which explains why my HousekeeperCat is stuck in a loop where they repeat a job that *should* have been filtered out by the ShouldSkip check, but isn't...

The correct logic, from the original code, is instead:

if ( ! (giver.def.nonColonistsCanDo || (bool)pawn.Faction?.IsPlayer) ) { return false; }

Thanks for the mod, BTW, I really like those kitties. :)
< >
Showing 1-4 of 4 comments
SlippyCheeze 2 Jul, 2022 @ 11:41am 
Note: I found this because they got in a loop performing the maintenance tasks from https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2803673873

It should be sufficient to use the current version of that mod along with these cats, and see this reproduced; they get in a loop of forever repeating the maintenance task that they can't complete (because they have no apparel / weapon to repair.)

Technically, I think, this is also a bug in the LTS Maintenance mod, which returns a Job object if asked – even if ShouldSkip() would have returned true. Pretty sure it is also a logic bug on your jobgiver too, though.
ignis  [developer] 4 Jul, 2022 @ 4:04pm 
Not sure it is a good idea. ShouldSkip of some work giver may try to treat them as full colonist for some reason, causing exception. I'll try to test it.
SlippyCheeze 5 Jul, 2022 @ 12:52am 
@ignis, so far it is working correctly for me, but I understand the concern. Perhaps trying that, and catching the exception, is the way to handle it? (or I guess hard-code a check for this specific job?)

Otherwise you should probably declare an incompatibility with the [LTS]Maintenance mod; the cats will not be able to do anything but uselessly consume resources.
< >
Showing 1-4 of 4 comments
Per page: 1530 50