diff --git a/1.3/Assemblies/PrisonLabor.dll b/1.3/Assemblies/PrisonLabor.dll
index 90d0e85..c24ee99 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 ceda33a..b132d3b 100644
--- a/About/About.xml
+++ b/About/About.xml
@@ -25,7 +25,7 @@
- Version 1.3.2
+ Version 1.3.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 253fa34..9c38c9c 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
-
+
diff --git a/Source/Core/AI/ThinkNodes/ThinkNode_Labor.cs b/Source/Core/AI/ThinkNodes/ThinkNode_Labor.cs
index 5ca8e83..2bda478 100644
--- a/Source/Core/AI/ThinkNodes/ThinkNode_Labor.cs
+++ b/Source/Core/AI/ThinkNodes/ThinkNode_Labor.cs
@@ -33,18 +33,25 @@ protected override bool Satisfied(Pawn pawn)
// Prisoner will escape if get ready to run.
// If he can run he will start ticking impatient, once complete he will get ready.
-
+
var prisonerComp = pawn.TryGetComp();
- if (pawn.guest.PrisonerIsSecure && RCellFinder.TryFindBestExitSpot(pawn, out c, TraverseMode.ByPawn))
+ if (prisonerComp != null)
{
- if (prisonerComp.escapeTracker.ReadyToEscape)
- return false;
+ if (pawn.guest.PrisonerIsSecure && RCellFinder.TryFindBestExitSpot(pawn, out c, TraverseMode.ByPawn))
+ {
+ if (prisonerComp.EscapeTracker.ReadyToEscape)
+ return false;
+ else
+ prisonerComp.EscapeTracker.CanEscape = true;
+ }
else
- prisonerComp.escapeTracker.CanEscape = true;
+ {
+ prisonerComp.EscapeTracker.CanEscape = false;
+ }
}
else
{
- prisonerComp.escapeTracker.CanEscape = false;
+ DebugLogger.warn($"Prisoner comp is null for {pawn.NameShortColored}");
}
diff --git a/Source/Core/AI/WorkGivers/WorkGiver_Supervise.cs b/Source/Core/AI/WorkGivers/WorkGiver_Supervise.cs
index 68c8b82..3d2ccde 100644
--- a/Source/Core/AI/WorkGivers/WorkGiver_Supervise.cs
+++ b/Source/Core/AI/WorkGivers/WorkGiver_Supervise.cs
@@ -23,7 +23,7 @@ public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
return null;
var prisonerComp = prisoner.TryGetComp(); ;
- if (!PrisonLaborUtility.LaborEnabled(prisoner) && prisonerComp != null && !prisonerComp.escapeTracker.CanEscape)
+ if (!PrisonLaborUtility.LaborEnabled(prisoner) && prisonerComp != null && !prisonerComp.EscapeTracker.CanEscape)
return null;
if (PrisonLaborUtility.RecruitInLaborEnabled(prisoner))
return new Job(JobDefOf.PrisonerAttemptRecruit, t);
@@ -31,7 +31,7 @@ public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
return new Job(JobDefOf.PrisonerConvert, t);
if (PrisonLaborUtility.EnslaveInLaborEnabled(prisoner))
return new Job(JobDefOf.PrisonerEnslave, t);
- if ((!PrisonLaborUtility.WorkTime(prisoner) || !need.ShouldBeMotivated) && prisonerComp != null && !prisonerComp.escapeTracker.CanEscape)
+ if ((!PrisonLaborUtility.WorkTime(prisoner) || !need.ShouldBeMotivated) && prisonerComp != null && !prisonerComp.EscapeTracker.CanEscape)
return null;
return new Job(DefDatabase.GetNamed("PrisonLabor_PrisonerSupervise"), prisoner);
diff --git a/Source/Core/Components/PrisonerComp.cs b/Source/Core/Components/PrisonerComp.cs
index ea90ad3..3d59833 100644
--- a/Source/Core/Components/PrisonerComp.cs
+++ b/Source/Core/Components/PrisonerComp.cs
@@ -15,7 +15,19 @@ namespace PrisonLabor.Core.Components
public class PrisonerComp : ThingComp
{
- public EscapeTracker escapeTracker;
+ private EscapeTracker escapeTracker;
+
+ public EscapeTracker EscapeTracker
+ {
+ get
+ {
+ if (escapeTracker == null)
+ {
+ escapeTracker = new EscapeTracker(this.parent as Pawn);
+ }
+ return escapeTracker;
+ }
+ }
private bool Active
{
@@ -83,7 +95,7 @@ public override void CompTickRare()
{
if (Active)
{
- escapeTracker?.Tick();
+ EscapeTracker.Tick();
}
}
}
diff --git a/Source/Core/MainButton_Window/ColumnWorker_EscapeTracker.cs b/Source/Core/MainButton_Window/ColumnWorker_EscapeTracker.cs
index 262bda6..636fa92 100644
--- a/Source/Core/MainButton_Window/ColumnWorker_EscapeTracker.cs
+++ b/Source/Core/MainButton_Window/ColumnWorker_EscapeTracker.cs
@@ -17,7 +17,7 @@ protected override string GetTextFor(Pawn pawn)
var prisonerComp = pawn.TryGetComp();
if(prisonerComp != null)
{
- return (prisonerComp.escapeTracker.ReadyToEscape ? "ready" : prisonerComp.escapeTracker.ReadyToRunPercentage + " %");
+ return (prisonerComp.EscapeTracker.ReadyToEscape ? "ready" : prisonerComp.EscapeTracker.ReadyToRunPercentage + " %");
}
return null;
@@ -28,7 +28,7 @@ protected override string GetTip(Pawn pawn)
var prisonerComp = pawn.TryGetComp();
if (prisonerComp != null)
{
- return $"(Cap:{ prisonerComp.escapeTracker.EscapeLevel})";
+ return $"(Cap:{ prisonerComp.EscapeTracker.EscapeLevel})";
}
return null;
}
diff --git a/Source/Core/Meta/Version.cs b/Source/Core/Meta/Version.cs
index c8d4406..7bbd22d 100644
--- a/Source/Core/Meta/Version.cs
+++ b/Source/Core/Meta/Version.cs
@@ -70,6 +70,7 @@ public enum Version
v1_2_5,
v1_3,
v1_3_1,
- v1_3_2
+ v1_3_2,
+ v1_3_3
}
}
diff --git a/Source/Core/Meta/VersionUtility.cs b/Source/Core/Meta/VersionUtility.cs
index b1337cc..9fc21d2 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_2;
- public const string versionString = "1.3.2";
+ public const Version versionNumber = Version.v1_3_3;
+ public const string versionString = "1.3.3";
public static Version VersionOfSaveFile { get; set; }
diff --git a/Source/Core/Other/DebugLogger.cs b/Source/Core/Other/DebugLogger.cs
index c454f97..b2a5a23 100644
--- a/Source/Core/Other/DebugLogger.cs
+++ b/Source/Core/Other/DebugLogger.cs
@@ -22,5 +22,10 @@ public static void info(string msg)
{
Log.Message(msg);
}
+
+ internal static void warn(string msg)
+ {
+ Log.Warning(msg);
+ }
}
}
diff --git a/Source/HarmonyPatches/Patches_Escaping/Patch_EscapingPrisoner.cs b/Source/HarmonyPatches/Patches_Escaping/Patch_EscapingPrisoner.cs
index 525598b..6df2eaf 100644
--- a/Source/HarmonyPatches/Patches_Escaping/Patch_EscapingPrisoner.cs
+++ b/Source/HarmonyPatches/Patches_Escaping/Patch_EscapingPrisoner.cs
@@ -42,7 +42,7 @@ public static bool IsReadyToEscape(Pawn pawn)
{
var prisonerComp = pawn.TryGetComp();
- if (prisonerComp != null && prisonerComp.escapeTracker.ReadyToEscape)
+ if (prisonerComp != null && prisonerComp.EscapeTracker.ReadyToEscape)
return true;
else
return false;
diff --git a/Source/Organizer/NewsFeed.xml b/Source/Organizer/NewsFeed.xml
index 3a3be8e..1333533 100644
--- a/Source/Organizer/NewsFeed.xml
+++ b/Source/Organizer/NewsFeed.xml
@@ -4,6 +4,7 @@
+
Prison Labor v 1.3.0
diff --git a/changelog.txt b/changelog.txt
index efe1582..badc8db 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,4 +1,6 @@
Changelog:
+1.3.3
+- NPR fixes for EscapeTracker
1.3.2
- Added Multiplayer mod compatibility (https://github.com/Thomas107500)
1.3.1