diff --git a/1.4/Assemblies/PrisonLabor.dll b/1.4/Assemblies/PrisonLabor.dll index 78c4b92..49ff026 100644 Binary files a/1.4/Assemblies/PrisonLabor.dll and b/1.4/Assemblies/PrisonLabor.dll differ diff --git a/1.4/CashRegistry/Assemblies/PrisonLaborCashRegistryCompatibility.dll b/1.4/CashRegistry/Assemblies/PrisonLaborCashRegistryCompatibility.dll index 8a9dbc6..ed4cd19 100644 Binary files a/1.4/CashRegistry/Assemblies/PrisonLaborCashRegistryCompatibility.dll and b/1.4/CashRegistry/Assemblies/PrisonLaborCashRegistryCompatibility.dll differ diff --git a/1.4/CleaningArea/Assemblies/PrisonLaborCleaningAreaCompatibility.dll b/1.4/CleaningArea/Assemblies/PrisonLaborCleaningAreaCompatibility.dll index 48b71f9..eac3a85 100644 Binary files a/1.4/CleaningArea/Assemblies/PrisonLaborCleaningAreaCompatibility.dll and b/1.4/CleaningArea/Assemblies/PrisonLaborCleaningAreaCompatibility.dll differ diff --git a/1.4/ColonyGroups/Assemblies/PrisonLaborColonyGroupsCompatibility.dll b/1.4/ColonyGroups/Assemblies/PrisonLaborColonyGroupsCompatibility.dll index d789ec7..b0d7ad8 100644 Binary files a/1.4/ColonyGroups/Assemblies/PrisonLaborColonyGroupsCompatibility.dll and b/1.4/ColonyGroups/Assemblies/PrisonLaborColonyGroupsCompatibility.dll differ diff --git a/1.4/Hospitality/Assemblies/PrisonLaborHospitalityCompatibility.dll b/1.4/Hospitality/Assemblies/PrisonLaborHospitalityCompatibility.dll index 8fb3d32..13f3575 100644 Binary files a/1.4/Hospitality/Assemblies/PrisonLaborHospitalityCompatibility.dll and b/1.4/Hospitality/Assemblies/PrisonLaborHospitalityCompatibility.dll differ diff --git a/1.4/Kijin/Assemblies/PrisonLaborKijinCompatibility.dll b/1.4/Kijin/Assemblies/PrisonLaborKijinCompatibility.dll index 5e8a32c..efd8f46 100644 Binary files a/1.4/Kijin/Assemblies/PrisonLaborKijinCompatibility.dll and b/1.4/Kijin/Assemblies/PrisonLaborKijinCompatibility.dll differ diff --git a/1.4/Quarry/Assemblies/PrisonLaborQuarryCompatibility.dll b/1.4/Quarry/Assemblies/PrisonLaborQuarryCompatibility.dll index 13be35a..93ca79a 100644 Binary files a/1.4/Quarry/Assemblies/PrisonLaborQuarryCompatibility.dll and b/1.4/Quarry/Assemblies/PrisonLaborQuarryCompatibility.dll differ diff --git a/1.4/Therapy/Assemblies/PrisonLaborTherapyCompatibility.dll b/1.4/Therapy/Assemblies/PrisonLaborTherapyCompatibility.dll index 3075d0f..851cc60 100644 Binary files a/1.4/Therapy/Assemblies/PrisonLaborTherapyCompatibility.dll and b/1.4/Therapy/Assemblies/PrisonLaborTherapyCompatibility.dll differ diff --git a/About/About.xml b/About/About.xml index 0284a2e..7266209 100644 --- a/About/About.xml +++ b/About/About.xml @@ -35,7 +35,7 @@ - Version 1.4.6 + Version 1.4.7 This mod force prisoners to work. To enable this feature prisoners must have "Force to work" option checked ("Prisoner" tab). Prison labor needs management that consist: - Motivation - prisoners need to be motivated by presence of colonists. Wardens have new job - supervising prisoners. Low motivation can lead to revolts. diff --git a/README.md b/README.md index c2111af..c722975 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

- v1.4.6 + v1.4.7

diff --git a/Source/Core/Meta/Version.cs b/Source/Core/Meta/Version.cs index ac4e8b1..791a4e8 100644 --- a/Source/Core/Meta/Version.cs +++ b/Source/Core/Meta/Version.cs @@ -86,6 +86,7 @@ public enum Version v1_4_3, v1_4_4, v1_4_5, - v1_4_6 + v1_4_6, + v1_4_7 } } diff --git a/Source/Core/Meta/VersionUtility.cs b/Source/Core/Meta/VersionUtility.cs index b5cda28..aead99f 100644 --- a/Source/Core/Meta/VersionUtility.cs +++ b/Source/Core/Meta/VersionUtility.cs @@ -5,8 +5,8 @@ namespace PrisonLabor.Core.Meta { public class VersionUtility { - public const Version versionNumber = Version.v1_4_6; - public const string versionString = "1.4.6"; + public const Version versionNumber = Version.v1_4_7; + public const string versionString = "1.4.7"; public static Version VersionOfSaveFile { get; set; } diff --git a/Source/HarmonyPatches/Patches_LaborArea/Patch_Scanner_HasJob.cs b/Source/HarmonyPatches/Patches_LaborArea/Patch_Scanner_HasJob.cs index 376c13b..ed2dae6 100644 --- a/Source/HarmonyPatches/Patches_LaborArea/Patch_Scanner_HasJob.cs +++ b/Source/HarmonyPatches/Patches_LaborArea/Patch_Scanner_HasJob.cs @@ -1,6 +1,7 @@ using HarmonyLib; using PrisonLabor.Core; using PrisonLabor.Core.AI.WorkGivers; +using PrisonLabor.Core.Other; using RimWorld; using System; using System.Collections.Generic; @@ -12,25 +13,40 @@ namespace PrisonLabor.HarmonyPatches.Patches_LaborArea { - [HarmonyPatch] - class Patch_Scanner_HasJob + [HarmonyPatch] + class Patch_Scanner_HasJob + { + static IEnumerable TargetMethods() { - static IEnumerable TargetMethods() - { - return Assembly.GetAssembly(typeof(WorkGiver_Scanner)).GetTypes() - .Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(WorkGiver_Scanner)) && myType != typeof(WorkGiver_Supervise) && myType != typeof(WorkGiver_Warden)) - .SelectMany(type => type.GetMethods()) - .Where(method => method.Name.Equals("HasJobOnThing")) - .Cast(); - } + return Assembly.GetAssembly(typeof(WorkGiver_Scanner)).GetTypes() + .Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(WorkGiver_Scanner)) && myType != typeof(WorkGiver_Supervise) && myType != typeof(WorkGiver_Warden)) + .SelectMany(type => type.GetMethods()) + .Where(method => method.Name.Equals("HasJobOnThing")) + .Cast(); + } - static bool Postfix(bool __result, WorkGiver_Scanner __instance, Pawn pawn, Thing t, bool forced = false) + static bool Postfix(bool __result, WorkGiver_Scanner __instance, Pawn pawn, Thing t, bool forced = false) + { + if (__result && t != null) + { + WorkTypeDef workType = AdjustWorkType(__instance); + return workType == null ? __result : PrisonLaborUtility.CanWorkHere(t.Position, pawn, workType); + } + return __result; + } + + private static WorkTypeDef AdjustWorkType(WorkGiver_Scanner instance) + { + if (instance.def == null) + { + if (instance is WorkGiver_Repair) { - if (__result && t != null ) - { - return PrisonLaborUtility.CanWorkHere(t.Position, pawn, __instance.def.workType); - } - return __result; + return WorkTypeDefOf.Construction; } + DebugLogger.warn($"Work giver scanner without def: {instance.GetType().FullName}"); + return null; + } + return instance.def.workType; } + } } diff --git a/Source/Organizer/NewsFeed.xml b/Source/Organizer/NewsFeed.xml index efcc06f..0a6905c 100644 --- a/Source/Organizer/NewsFeed.xml +++ b/Source/Organizer/NewsFeed.xml @@ -4,6 +4,7 @@ + diff --git a/changelog.txt b/changelog.txt index 7bdb02b..9e60264 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,6 @@ Changelog: +1.4.7 +- Fixes for Vultures from "Reinforced Mechanoid 2" 1.4.6 - Chinese translation update (https://github.com/shiuanyue) - Mechanitor and Mechs should be assignable from bills menu