边缘世界 RimWorld

边缘世界 RimWorld

HousekeeperAssistanceCat
SlippyCheeze 2022 年 7 月 2 日 上午 11:24
[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. :)
< >
正在显示第 1 - 4 条,共 4 条留言
SlippyCheeze 2022 年 7 月 2 日 上午 11:41 
Note: I found this because they got in a loop performing the maintenance tasks from https://psteamcommunity.yuanyoumao.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  [开发者] 2022 年 7 月 4 日 下午 4:04 
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 2022 年 7 月 5 日 上午 12:52 
@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.
< >
正在显示第 1 - 4 条,共 4 条留言
每页显示数: 1530 50