diff --git a/1.4/Assemblies/PrisonLabor.dll b/1.4/Assemblies/PrisonLabor.dll index a222488..8b11ebc 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 923300a..dbc7128 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 b64c769..80a7df4 100644 Binary files a/1.4/CleaningArea/Assemblies/PrisonLaborCleaningAreaCompatibility.dll and b/1.4/CleaningArea/Assemblies/PrisonLaborCleaningAreaCompatibility.dll differ diff --git a/1.4/Defs/Needs.xml b/1.4/Defs/Needs.xml index e8ab7b5..c1f6b06 100644 --- a/1.4/Defs/Needs.xml +++ b/1.4/Defs/Needs.xml @@ -8,6 +8,8 @@ 90 false false + Humanlike + true PrisonLabor_Treatment @@ -18,5 +20,7 @@ false false false + Humanlike + true diff --git a/1.4/Hospitality/Assemblies/PrisonLaborHospitalityCompatibility.dll b/1.4/Hospitality/Assemblies/PrisonLaborHospitalityCompatibility.dll index 1340443..46e3899 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 6566477..96a9f16 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 4372fe4..66720e8 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 b818084..e9f4b4f 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 c01d248..14b4e17 100644 --- a/About/About.xml +++ b/About/About.xml @@ -35,7 +35,7 @@ - Version 1.4.3 + Version 1.4.5 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 f309ec5..aceed2d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

- v1.4.4 + v1.4.5

diff --git a/Source/Core/Meta/Version.cs b/Source/Core/Meta/Version.cs index e2ddf9b..6a5f75f 100644 --- a/Source/Core/Meta/Version.cs +++ b/Source/Core/Meta/Version.cs @@ -84,6 +84,7 @@ public enum Version v1_4_1, v1_4_2, v1_4_3, - v1_4_4 + v1_4_4, + v1_4_5 } } diff --git a/Source/Core/Meta/VersionUtility.cs b/Source/Core/Meta/VersionUtility.cs index 58a819d..69f0247 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_4; - public const string versionString = "1.4.4"; + public const Version versionNumber = Version.v1_4_5; + public const string versionString = "1.4.5"; public static Version VersionOfSaveFile { get; set; } diff --git a/Source/Core/Needs/Need_Motivation.cs b/Source/Core/Needs/Need_Motivation.cs index 957ae6d..549efe7 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 || pawn.Map == null; + protected override bool IsFrozen => !PrisonLaborPrefs.EnableMotivationMechanics || !pawn.IsPrisoner || base.IsFrozen || pawn.Map == null || pawn.Dead; public override void NeedInterval() { diff --git a/Source/Core/Needs/Need_Treatment.cs b/Source/Core/Needs/Need_Treatment.cs index 328933c..df59ed6 100644 --- a/Source/Core/Needs/Need_Treatment.cs +++ b/Source/Core/Needs/Need_Treatment.cs @@ -8,139 +8,148 @@ namespace PrisonLabor.Core.Needs { - /// - /// VeryGood: 4 - /// Good: 3 - /// Normal: 2 - /// Bad: 1 - /// VeryBad: 0 - /// - public enum TreatmentCategory : byte + /// + /// VeryGood: 4 + /// Good: 3 + /// Normal: 2 + /// Bad: 1 + /// VeryBad: 0 + /// + public enum TreatmentCategory : byte + { + VeryGood = 4, + Good = 3, + Normal = 2, + Bad = 1, + VeryBad = 0, + } + + public class Need_Treatment : Need + { + private bool _resocializationReady = false; + + public float PercentageThreshVeryGood => 0.85f; + public float PercentageThreshGood => 0.65f; + public float PercentageThreshNormal => 0.35f; + public float PercentageThreshBad => 0.15f; + + public override int GUIChangeArrow => 0; + + public static NeedDef Def => PL_DefOf.PrisonLabor_Treatment; + + public bool ResocializationReady { - VeryGood = 4, - Good = 3, - Normal = 2, - Bad = 1, - VeryBad = 0, + get => _resocializationReady; + set { _resocializationReady = value; } } - public class Need_Treatment : Need + public TreatmentCategory CurCategory { - private bool _resocializationReady = false; - - public float PercentageThreshVeryGood => 0.85f; - public float PercentageThreshGood => 0.65f; - public float PercentageThreshNormal => 0.35f; - public float PercentageThreshBad => 0.15f; - - public override int GUIChangeArrow => 0; - - public static NeedDef Def => PL_DefOf.PrisonLabor_Treatment; - - public bool ResocializationReady + get + { + if (IsFrozen) { - get => _resocializationReady; - set { _resocializationReady = value; } + return TreatmentCategory.Normal; } + if (CurLevelPercentage < PercentageThreshBad) + return TreatmentCategory.VeryBad; + else if (CurLevelPercentage < PercentageThreshNormal) + return TreatmentCategory.Bad; + else if (CurLevelPercentage < PercentageThreshGood) + return TreatmentCategory.Normal; + else if (CurLevelPercentage < PercentageThreshVeryGood) + return TreatmentCategory.Good; + else + return TreatmentCategory.VeryGood; + } + } - public TreatmentCategory CurCategory - { - get - { - if (CurLevelPercentage < PercentageThreshBad) - return TreatmentCategory.VeryBad; - else if (CurLevelPercentage < PercentageThreshNormal) - return TreatmentCategory.Bad; - else if (CurLevelPercentage < PercentageThreshGood) - return TreatmentCategory.Normal; - else if (CurLevelPercentage < PercentageThreshVeryGood) - return TreatmentCategory.Good; - else - return TreatmentCategory.VeryGood; - } - } - - public static bool ShowOnList - { - get - { - return PL_DefOf.PrisonLabor_Treatment.showOnNeedList; - } - set - { - PL_DefOf.PrisonLabor_Treatment.showOnNeedList = value; - } - } - - public Need_Treatment(Pawn pawn) : base(pawn) { } - - public override void SetInitialLevel() - { - CurLevelPercentage = 0.5f; - } - - public override void NeedInterval() - { - // Joy - if (pawn.timetable != null && pawn.timetable.CurrentAssignment == TimeAssignmentDefOf.Joy) - CurLevel += BGP.JoyRate; - - // Status - if (pawn.needs.food != null) - { - var hunger = pawn.needs.TryGetNeed(); - - int statusScore = 0; - if (hunger.CurCategory < HungerCategory.UrgentlyHungry) - statusScore += 5; - if (hunger.CurCategory < HungerCategory.Hungry) - statusScore += 5; - statusScore -= (int)pawn.health.hediffSet.PainTotal / 10; - if (pawn.health.HasHediffsNeedingTend()) - statusScore -= 7; - - CurLevel += statusScore * BGP.StatusMultiplier; - } + public static bool ShowOnList + { + get + { + return PL_DefOf.PrisonLabor_Treatment.showOnNeedList; + } + set + { + PL_DefOf.PrisonLabor_Treatment.showOnNeedList = value; + } + } + public Need_Treatment(Pawn pawn) : base(pawn) { } - // Labor - var motivation = pawn.needs.TryGetNeed(); - if (motivation != null && motivation.IsPrisonerWorking) - CurLevel += BGP.LaborRate; + public override void SetInitialLevel() + { + CurLevelPercentage = 0.5f; + } - } + protected override bool IsFrozen => !pawn.IsPrisoner || base.IsFrozen || pawn.Map == null || pawn.Dead; + public override void NeedInterval() + { + if (IsFrozen) + { + return; + } + // Joy + if (pawn.timetable != null && pawn.timetable.CurrentAssignment == TimeAssignmentDefOf.Joy) + CurLevel += BGP.JoyRate; + + // Status + if (pawn.needs.food != null) + { + var hunger = pawn.needs.TryGetNeed(); + + int statusScore = 0; + if (hunger.CurCategory < HungerCategory.UrgentlyHungry) + statusScore += 5; + if (hunger.CurCategory < HungerCategory.Hungry) + statusScore += 5; + statusScore -= (int)pawn.health.hediffSet.PainTotal / 10; + if (pawn.health.HasHediffsNeedingTend()) + statusScore -= 7; + + CurLevel += statusScore * BGP.StatusMultiplier; + } + + + // Labor + var motivation = pawn.needs.TryGetNeed(); + if (motivation != null && motivation.IsPrisonerWorking) + CurLevel += BGP.LaborRate; - public override string GetTipString() - { - var stringBuilder = new StringBuilder(); - stringBuilder.AppendLine(base.GetTipString()); - return stringBuilder.ToString(); - } + } - public void NotifyPrisonerBeaten(DamageInfo dinfo, bool absorbed) - { - CurLevel += BGP.BeatenHit; - } + public override string GetTipString() + { + var stringBuilder = new StringBuilder(); + stringBuilder.AppendLine(base.GetTipString()); + return stringBuilder.ToString(); + } - public override void DrawOnGUI(Rect rect, int maxThresholdMarkers = 2147483647, float customMargin = -1f, bool drawArrows = true, bool doTooltip = true, Rect? rectForTooltip = null, bool drawLabel = true) - { - if (threshPercents == null) - { - threshPercents = new List(); - threshPercents.Add(PercentageThreshBad); - threshPercents.Add(PercentageThreshNormal); - threshPercents.Add(PercentageThreshGood); - threshPercents.Add(PercentageThreshVeryGood); - } - base.DrawOnGUI(rect, maxThresholdMarkers, customMargin, drawArrows, doTooltip, rectForTooltip); - } + public void NotifyPrisonerBeaten(DamageInfo dinfo, bool absorbed) + { + CurLevel += BGP.BeatenHit; + } - public override void ExposeData() - { - base.ExposeData(); - Scribe_Values.Look(ref _resocializationReady, "PrisonLabor_resocialization_ready", false, false); - } + public override void DrawOnGUI(Rect rect, int maxThresholdMarkers = 2147483647, float customMargin = -1f, bool drawArrows = true, bool doTooltip = true, Rect? rectForTooltip = null, bool drawLabel = true) + { + if (threshPercents == null) + { + threshPercents = new List(); + threshPercents.Add(PercentageThreshBad); + threshPercents.Add(PercentageThreshNormal); + threshPercents.Add(PercentageThreshGood); + threshPercents.Add(PercentageThreshVeryGood); + } + base.DrawOnGUI(rect, maxThresholdMarkers, customMargin, drawArrows, doTooltip, rectForTooltip); + } - public override bool ShowOnNeedList => pawn.IsPrisoner && ShowOnList; + public override void ExposeData() + { + base.ExposeData(); + Scribe_Values.Look(ref _resocializationReady, "PrisonLabor_resocialization_ready", false, false); } + + public override bool ShowOnNeedList => pawn.IsPrisoner && ShowOnList; + } } \ No newline at end of file diff --git a/Source/Organizer/NewsFeed.xml b/Source/Organizer/NewsFeed.xml index 100e06c..6a5af86 100644 --- a/Source/Organizer/NewsFeed.xml +++ b/Source/Organizer/NewsFeed.xml @@ -4,6 +4,7 @@ + diff --git a/changelog.txt b/changelog.txt index f4c4b4c..613411a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,6 @@ Changelog: +1.4.5 +- Fix: need assigments for prisoners only 1.4.4 - Fix: prisoner work window should be better displayed with greater number of prisoners - Harmony patches refactor