diff --git a/1.3/Assemblies/PrisonLabor.dll b/1.3/Assemblies/PrisonLabor.dll
index 62ba633..5502840 100644
Binary files a/1.3/Assemblies/PrisonLabor.dll and b/1.3/Assemblies/PrisonLabor.dll differ
diff --git a/About/About.xml b/About/About.xml
index 17dca46..b84c7c6 100644
--- a/About/About.xml
+++ b/About/About.xml
@@ -25,7 +25,7 @@
- Version 1.3.9
+ Version 1.3.10
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 c794913..2119942 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
-
+
diff --git a/Source/Core/AI/WorkGivers/WorkGivers_ManipulatePrisoner.cs b/Source/Core/AI/WorkGivers/WorkGivers_ManipulatePrisoner.cs
index fcad9aa..a2fb732 100644
--- a/Source/Core/AI/WorkGivers/WorkGivers_ManipulatePrisoner.cs
+++ b/Source/Core/AI/WorkGivers/WorkGivers_ManipulatePrisoner.cs
@@ -21,7 +21,7 @@ public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
return null;
if (prisoner.Downed || !pawn.CanReserve(t, 1, -1, null, false) || !prisoner.Awake())
return null;
- if (pawn.IsPrisoner)
+ if (pawn.IsPrisoner || !pawn.health.capacities.CapableOf(PawnCapacityDefOf.Talking))
return null;
@@ -29,11 +29,11 @@ public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
{
return new Job(JobDefOf.PrisonerAttemptRecruit, t);
}
- if (PrisonLaborUtility.ConvertInLaborEnabled(prisoner))
+ if (PrisonLaborUtility.ConvertInLaborEnabled(pawn, prisoner))
{
return new Job(JobDefOf.PrisonerConvert, t);
}
- if (PrisonLaborUtility.EnslaveInLaborEnabled(prisoner))
+ if (PrisonLaborUtility.EnslaveInLaborEnabled(pawn, prisoner))
{
return new Job(JobDefOf.PrisonerEnslave, t);
}
diff --git a/Source/Core/Meta/Version.cs b/Source/Core/Meta/Version.cs
index b83db50..75176ce 100644
--- a/Source/Core/Meta/Version.cs
+++ b/Source/Core/Meta/Version.cs
@@ -77,6 +77,7 @@ public enum Version
v1_3_6,
v1_3_7,
v1_3_8,
- v1_3_9
+ v1_3_9,
+ v1_3_10
}
}
diff --git a/Source/Core/Meta/VersionUtility.cs b/Source/Core/Meta/VersionUtility.cs
index 95644f9..5483230 100644
--- a/Source/Core/Meta/VersionUtility.cs
+++ b/Source/Core/Meta/VersionUtility.cs
@@ -5,8 +5,8 @@ namespace PrisonLabor.Core.Meta
{
class VersionUtility
{
- public const Version versionNumber = Version.v1_3_9;
- public const string versionString = "1.3.9";
+ public const Version versionNumber = Version.v1_3_10;
+ public const string versionString = "1.3.10";
public static Version VersionOfSaveFile { get; set; }
diff --git a/Source/Core/PrisonLaborUtility.cs b/Source/Core/PrisonLaborUtility.cs
index 70af8cd..26df433 100644
--- a/Source/Core/PrisonLaborUtility.cs
+++ b/Source/Core/PrisonLaborUtility.cs
@@ -26,25 +26,31 @@ public static bool LaborEnabled(this Pawn pawn)
public static bool RecruitInLaborEnabled(Pawn pawn)
{
- if (pawn.guest.interactionMode == PL_DefOf.PrisonLabor_workAndRecruitOption && pawn.guest.ScheduledForInteraction && pawn.health.capacities.CapableOf(PawnCapacityDefOf.Talking))
+ if (pawn.guest.interactionMode == PL_DefOf.PrisonLabor_workAndRecruitOption && pawn.guest.ScheduledForInteraction)
+ {
return true;
+ }
return false;
}
- public static bool ConvertInLaborEnabled(Pawn pawn)
+ public static bool ConvertInLaborEnabled(Pawn doer, Pawn prisoner)
{
- if (pawn.guest.interactionMode == PL_DefOf.PrisonLabor_workAndConvertOption && pawn.guest.ScheduledForInteraction && pawn.health.capacities.CapableOf(PawnCapacityDefOf.Talking))
+ if (prisoner.guest.interactionMode == PL_DefOf.PrisonLabor_workAndConvertOption && prisoner.guest.ScheduledForInteraction
+ && prisoner.Ideo != doer.Ideo && doer.Ideo == prisoner.guest.ideoForConversion)
+ {
return true;
-
+ }
return false;
}
- public static bool EnslaveInLaborEnabled(Pawn pawn)
+ public static bool EnslaveInLaborEnabled(Pawn doer, Pawn prisoner)
{
- if (pawn.guest.interactionMode == PL_DefOf.PrisonLabor_workAndEnslaveOption && pawn.guest.ScheduledForInteraction && pawn.health.capacities.CapableOf(PawnCapacityDefOf.Talking))
+ if (prisoner.guest.interactionMode == PL_DefOf.PrisonLabor_workAndEnslaveOption && prisoner.guest.ScheduledForInteraction
+ && new HistoryEvent(HistoryEventDefOf.EnslavedPrisoner, doer.Named(HistoryEventArgsNames.Doer)).Notify_PawnAboutToDo_Job())
+ {
return true;
-
+ }
return false;
}
public static bool WorkTime(Pawn pawn)
diff --git a/Source/HarmonyPatches/Patches_Food/Patch_EnableRespectingFoodPolicies.cs b/Source/HarmonyPatches/Patches_Food/Patch_EnableRespectingFoodPolicies.cs
new file mode 100644
index 0000000..f9f3007
--- /dev/null
+++ b/Source/HarmonyPatches/Patches_Food/Patch_EnableRespectingFoodPolicies.cs
@@ -0,0 +1,28 @@
+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_Food
+{
+ [HarmonyPatch(typeof(Pawn_FoodRestrictionTracker))]
+ [HarmonyPatch("GetCurrentRespectedRestriction")]
+ class Patch_EnableRespectingFoodPolicies
+ {
+ static FoodRestriction Postfix(FoodRestriction __result, Pawn_FoodRestrictionTracker __instance, Pawn getter)
+ {
+ if (__result == null)
+ {
+ if (__instance.pawn.IsPrisonerOfColony && __instance.pawn == getter)
+ {
+ return __instance.CurrentFoodRestriction;
+ }
+ }
+ return __result;
+ }
+ }
+}
diff --git a/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_PrisonerFaction.cs b/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_PrisonerFaction.cs
index 3c41048..766cef6 100644
--- a/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_PrisonerFaction.cs
+++ b/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_PrisonerFaction.cs
@@ -21,7 +21,7 @@ static IEnumerable TargetMethods()
return Assembly.GetAssembly(typeof(WorkGiver_Scanner)).GetTypes()
.Where(myType => myType.IsClass && !myType.IsAbstract && myType.IsSubclassOf(typeof(WorkGiver_Scanner)))
.SelectMany(type => type.GetMethods())
- .Where(method => method.Name.Equals("PotentialWorkThingsGlobal") || method.Name.Equals("ShouldSkip"))
+ .Where(method => method.Name.Equals("PotentialWorkThingsGlobal") || method.Name.Equals("ShouldSkip") || method.Name.Equals("HasJobOnThing"))
.Distinct()
.Cast();
}
diff --git a/Source/Organizer/NewsFeed.xml b/Source/Organizer/NewsFeed.xml
index ef7dd57..56abe2d 100644
--- a/Source/Organizer/NewsFeed.xml
+++ b/Source/Organizer/NewsFeed.xml
@@ -4,6 +4,7 @@
+
diff --git a/Source/PrisonLabor.csproj b/Source/PrisonLabor.csproj
index 2886774..d8f728e 100644
--- a/Source/PrisonLabor.csproj
+++ b/Source/PrisonLabor.csproj
@@ -150,6 +150,7 @@
+
diff --git a/changelog.txt b/changelog.txt
index 6264a08..c002fde 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,4 +1,8 @@
Changelog:
+1.3.10
+- Motivated prisoners should respect food polices
+- Fixed: prisoner should be able to use scanners
+- Fixed: warden interaction with prisoners (converting already converted prisoners, interacting with prisoners not capable to talking)
1.3.9
- Prisoner labor area fixes
1.3.8