diff --git a/1.4/Assemblies/PrisonLabor.dll b/1.4/Assemblies/PrisonLabor.dll index cdbb826..4bbf529 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 dff6738..643151f 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 2a55688..d0ccee3 100644 Binary files a/1.4/CleaningArea/Assemblies/PrisonLaborCleaningAreaCompatibility.dll and b/1.4/CleaningArea/Assemblies/PrisonLaborCleaningAreaCompatibility.dll differ diff --git a/1.4/Hospitality/Assemblies/PrisonLaborHospitalityCompatibility.dll b/1.4/Hospitality/Assemblies/PrisonLaborHospitalityCompatibility.dll index e020342..14758e0 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 1a8430d..624ca27 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 07a27e5..80df66c 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 b8279c9..ea0dd7b 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 d539464..f819630 100644 --- a/About/About.xml +++ b/About/About.xml @@ -34,7 +34,7 @@ - Version 1.4.2 + Version 1.4.3 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 369999e..a8c4825 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

- v1.4.2 + v1.4.3

diff --git a/Source/Core/Meta/Version.cs b/Source/Core/Meta/Version.cs index 4f863e6..37efac4 100644 --- a/Source/Core/Meta/Version.cs +++ b/Source/Core/Meta/Version.cs @@ -82,6 +82,7 @@ public enum Version v1_3_11, v1_4_0, v1_4_1, - v1_4_2 + v1_4_2, + v1_4_3 } } diff --git a/Source/Core/Meta/VersionUtility.cs b/Source/Core/Meta/VersionUtility.cs index 0ddd2e2..491320b 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_2; - public const string versionString = "1.4.2"; + public const Version versionNumber = Version.v1_4_3; + public const string versionString = "1.4.3"; public static Version VersionOfSaveFile { get; set; } diff --git a/Source/Core/Needs/Need_Motivation.cs b/Source/Core/Needs/Need_Motivation.cs index 4a658e5..957ae6d 100644 --- a/Source/Core/Needs/Need_Motivation.cs +++ b/Source/Core/Needs/Need_Motivation.cs @@ -53,7 +53,7 @@ public override void SetInitialLevel() IsPrisonerWorking = false; } - protected override bool IsFrozen => !PrisonLaborPrefs.EnableMotivationMechanics || base.IsFrozen; + protected override bool IsFrozen => !PrisonLaborPrefs.EnableMotivationMechanics || base.IsFrozen || pawn.Map == null; public override void NeedInterval() { diff --git a/Source/Core/PrisonLaborUtility.cs b/Source/Core/PrisonLaborUtility.cs index 5198c9e..b234d16 100644 --- a/Source/Core/PrisonLaborUtility.cs +++ b/Source/Core/PrisonLaborUtility.cs @@ -90,7 +90,7 @@ public static bool IsDisabledByLabor(IntVec3 pos, Pawn pawn, WorkTypeDef workTyp public static bool CanWorkHere(IntVec3 pos, Pawn pawn, WorkTypeDef workType) { - if (pawn.IsFreeNonSlaveColonist && pos != null && pawn.Map.areaManager.Get() != null && !WorkSettings.WorkDisabled(workType)) + if ((pawn.IsFreeNonSlaveColonist || pawn.IsColonyMech) && pos != null && pawn.Map.areaManager.Get() != null && !WorkSettings.WorkDisabled(workType)) { bool result = true; try diff --git a/Source/HarmonyPatches/Patches_Work/Patch_CarryToBuilding.cs b/Source/HarmonyPatches/Patches_Work/Patch_CarryToBuilding.cs new file mode 100644 index 0000000..8370035 --- /dev/null +++ b/Source/HarmonyPatches/Patches_Work/Patch_CarryToBuilding.cs @@ -0,0 +1,25 @@ +using HarmonyLib; +using RimWorld; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; + +namespace PrisonLabor.HarmonyPatches.Patches_Work +{ + + [HarmonyPatch(typeof(WorkGiver_CarryToBuilding), "FindBuildingFor")] + public class Patch_CarryToBuilding + { + static Building Postfix(Building __result, Pawn pawn, Pawn traveller, bool forced) + { + if (traveller.IsPrisonerOfColony && pawn.IsPrisonerOfColony && traveller == pawn) + { + return null; + } + return __result; + } + } +} diff --git a/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_Refuel.cs b/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_Refuel.cs index 1953eff..80dc27b 100644 --- a/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_Refuel.cs +++ b/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_Refuel.cs @@ -18,37 +18,37 @@ static bool Postfix(bool __result, Pawn pawn, Thing t, bool forced) { if (!__result && pawn.IsPrisonerOfColony) { - return CanRefuel(pawn, t, forced); - } + return CanRefuel(pawn, t, forced); + } return __result; } - private static bool CanRefuel(Pawn pawn, Thing t, bool forced) + private static bool CanRefuel(Pawn pawn, Thing t, bool forced) { - CompRefuelable compRefuelable = t.TryGetComp(); - if (compRefuelable == null || compRefuelable.IsFull || !compRefuelable.allowAutoRefuel || !compRefuelable.ShouldAutoRefuelNow) - { - return false; - } - if (t.IsForbiddenForPrisoner(pawn) || !pawn.CanReserveAndReach(t, PathEndMode.ClosestTouch, pawn.NormalMaxDanger(), 1, -1, null, forced)) - { - return false; - } + CompRefuelable compRefuelable = t.TryGetComp(); + if (compRefuelable == null || compRefuelable.IsFull || !compRefuelable.allowAutoRefuel || !compRefuelable.ShouldAutoRefuelNow) + { + return false; + } + if (t.IsForbiddenForPrisoner(pawn) || !pawn.CanReserveAndReach(t, PathEndMode.ClosestTouch, pawn.NormalMaxDanger(), 1, -1, null, forced)) + { + return false; + } - if (Traverse.Create(typeof(RefuelWorkGiverUtility)).Method("FindBestFuel", new[] { pawn, t }).GetValue() == null) - { - ThingFilter fuelFilter = t.TryGetComp().Props.fuelFilter; - JobFailReason.Is("NoFuelToRefuel".Translate(fuelFilter.Summary)); - return false; - } - if (t.TryGetComp().Props.atomicFueling && Traverse.Create(typeof(RefuelWorkGiverUtility)).Method("FindAllFuel", new[] { pawn, t }).GetValue>() == null) - { - ThingFilter fuelFilter2 = t.TryGetComp().Props.fuelFilter; - JobFailReason.Is("NoFuelToRefuel".Translate(fuelFilter2.Summary)); - return false; - } - return true; - } + if (Traverse.Create(typeof(RefuelWorkGiverUtility)).Method("FindBestFuel", new[] { pawn, t }).GetValue() == null) + { + ThingFilter fuelFilter = t.TryGetComp().Props.fuelFilter; + JobFailReason.Is("NoFuelToRefuel".Translate(fuelFilter.Summary)); + return false; + } + if (t.TryGetComp().Props.atomicFueling && Traverse.Create(typeof(RefuelWorkGiverUtility)).Method("FindAllFuel", new[] { pawn, t }).GetValue>() == null) + { + ThingFilter fuelFilter2 = t.TryGetComp().Props.fuelFilter; + JobFailReason.Is("NoFuelToRefuel".Translate(fuelFilter2.Summary)); + return false; + } + return true; + } } } diff --git a/Source/Organizer/NewsFeed.xml b/Source/Organizer/NewsFeed.xml index 83840ea..829135c 100644 --- a/Source/Organizer/NewsFeed.xml +++ b/Source/Organizer/NewsFeed.xml @@ -4,6 +4,7 @@ + Prison Labor v 1.4.1 diff --git a/Source/PrisonLabor.csproj b/Source/PrisonLabor.csproj index 023c9e1..f0159d0 100644 --- a/Source/PrisonLabor.csproj +++ b/Source/PrisonLabor.csproj @@ -199,6 +199,7 @@ + diff --git a/changelog.txt b/changelog.txt index 8507082..984a3eb 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,8 @@ Changelog: +1.4.3 +- Fix: game should not freeze when prisoner is seleted for gene extraction +- Fix: machanoids should not work in prison labor area +- Fix: game should not throw an error when prisoners is carred by pawn 1.4.2 - Recreation fixes 1.4.1