Bugfix for work types that pawns are incapable of getting reset when reloading a save

This commit is contained in:
bbradson
2023-06-04 18:01:30 +02:00
parent ca9321add8
commit 365d9fd3f3
3 changed files with 3 additions and 2 deletions
@@ -17,8 +17,9 @@ public class DisabledWorkTypesOptimization : ClassWithFishPatches
= AccessTools.Method(typeof(Pawn), nameof(Pawn.GetDisabledWorkTypes));
[HarmonyPriority(Priority.VeryLow)]
public static bool Prefix(Pawn __instance, bool permanentOnly, out List<WorkTypeDef> __result)
=> (__result = permanentOnly
public static bool Prefix(Pawn __instance, bool permanentOnly, ref List<WorkTypeDef> __result)
=> Current.programStateInt != ProgramState.Playing
|| (__result = permanentOnly
? __instance.cachedDisabledWorkTypesPermanent
: __instance.cachedDisabledWorkTypes) is null;
}