diff --git a/About/About.xml b/About/About.xml index 1f80c3cd..a4aa338d 100644 --- a/About/About.xml +++ b/About/About.xml @@ -3,7 +3,7 @@ Prison Labor Avius 0.17.0 - Version 0.8.4 + Version 0.8.6 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/Assemblies/PrisonLabor.dll b/Assemblies/PrisonLabor.dll index 6e1cd3c0..05a505fd 100644 Binary files a/Assemblies/PrisonLabor.dll and b/Assemblies/PrisonLabor.dll differ diff --git a/Defs/Hediffs.xml b/Defs/Hediffs.xml index 6c5b3fbb..7a6226b8 100644 --- a/Defs/Hediffs.xml +++ b/Defs/Hediffs.xml @@ -15,7 +15,7 @@
  • Manipulation - -0.2 + -0.3
  • diff --git a/Defs/ThinkTreeDef.xml b/Defs/ThinkTreeDef.xml index e7376221..c6180ef8 100644 --- a/Defs/ThinkTreeDef.xml +++ b/Defs/ThinkTreeDef.xml @@ -11,7 +11,6 @@
  • -
  • diff --git a/Textures/LaborAreaClear1.png b/Images/LaborAreaClear1.png similarity index 100% rename from Textures/LaborAreaClear1.png rename to Images/LaborAreaClear1.png diff --git a/Textures/LaborAreaExpand1.png b/Images/LaborAreaExpand1.png similarity index 100% rename from Textures/LaborAreaExpand1.png rename to Images/LaborAreaExpand1.png diff --git a/Textures/deleteLabor.png b/Images/deleteLabor.png similarity index 100% rename from Textures/deleteLabor.png rename to Images/deleteLabor.png diff --git a/Textures/extendLabor.png b/Images/extendLabor.png similarity index 100% rename from Textures/extendLabor.png rename to Images/extendLabor.png diff --git a/Textures/inspire1.png b/Images/inspire1.png similarity index 100% rename from Textures/inspire1.png rename to Images/inspire1.png diff --git a/Textures/inspire2.png b/Images/inspire2.png similarity index 100% rename from Textures/inspire2.png rename to Images/inspire2.png diff --git a/Languages/ChineseSimplified/DefInjected/ConceptDef/ConceptDef.xml b/Languages/ChineseSimplified/DefInjected/ConceptDef/ConceptDef.xml new file mode 100644 index 00000000..25f0a7d4 --- /dev/null +++ b/Languages/ChineseSimplified/DefInjected/ConceptDef/ConceptDef.xml @@ -0,0 +1,20 @@ + + + + 监狱劳力 + 你可以强迫你的囚犯为你干活。\n\n为了达到这一目的,你必须先在囚犯的面板上选择“强迫工作”选项。\n\n囚犯将在允许的区域内工作。请确保囚犯能够到达工作区域。\n\n他们只能做烹调,挖矿,切割植物,收获,打扫或种植等不需要特殊技能的工作。\n\n囚犯有时会拒绝工作,理由可能是受伤,饥饿疲劳或单纯的不想干而已。\n\n提示:你可以在“工作”面板指定工作的种类。\n\n提示:如果你在监狱里放了一个炉子,请确保囚犯能够拿到生食来做饭。\n\n提示:你可以通过永久开启门来让囚犯通过。 + + 激励囚犯Motivating prisoners + 你的一个囚犯停止工作了。\n他在变得更有动力之前将不会工作。\n\n你可以在“需求”面板里查看他的积极性。\n\n请确保你有足够的监视者(可在工作面板中查看),或是命令你的殖民者站在囚犯旁边。\n\n若囚犯保持低积极性,可能会发生反叛。 + + 囚犯种植 + 囚犯只可以种植土豆或棉花等不需要特殊技能的作物。然而他们仍然能够收获任意作物。 + + 监狱劳力管理 + 你可以在数日内管理你的监狱劳力。\n\n你可以在“工作”面板中管理工作类型。\n\n你可以在“限制”栏里设置囚犯何时工作,休息和睡觉。\n\n你可以限制某项工作为“只允许囚犯”。你可以用建筑栏内的“工作区域”来设置囚犯行动范围。\n工作现在有“只允许囚犯”的选项。 + + 囚犯时间管制 + 你可以给囚犯们设置时间限制。\n\n“工作”时间将会强迫囚犯去工作,即使他们还处于饥饿或疲劳状态。\n\n“娱乐”时间会让囚犯从工作中解脱,并且给他们一些积极性加成。\n\n“睡眠”时间将会强迫囚犯待在监狱里。\n\n“任何事”是默认设置。 + + + \ No newline at end of file diff --git a/Languages/ChineseSimplified/DefInjected/HediffDef/Hediffs.xml b/Languages/ChineseSimplified/DefInjected/HediffDef/Hediffs.xml new file mode 100644 index 00000000..f575d63b --- /dev/null +++ b/Languages/ChineseSimplified/DefInjected/HediffDef/Hediffs.xml @@ -0,0 +1,9 @@ + + + + 囚犯锁链 + 未激活 + 激活 + + + \ No newline at end of file diff --git a/Languages/ChineseSimplified/DefInjected/IncidentDef/Incidents.xml b/Languages/ChineseSimplified/DefInjected/IncidentDef/Incidents.xml new file mode 100644 index 00000000..026a213c --- /dev/null +++ b/Languages/ChineseSimplified/DefInjected/IncidentDef/Incidents.xml @@ -0,0 +1,9 @@ + + + + 反叛 + {0}开始了一场反叛行动。囚犯在 {1} 派系周围团结起来,拿起了自制武器开始反抗。 + 反叛 + + + \ No newline at end of file diff --git a/Languages/ChineseSimplified/DefInjected/JobDef/JobDef.xml b/Languages/ChineseSimplified/DefInjected/JobDef/JobDef.xml new file mode 100644 index 00000000..b48e5bc7 --- /dev/null +++ b/Languages/ChineseSimplified/DefInjected/JobDef/JobDef.xml @@ -0,0 +1,11 @@ + + + + 监视囚犯 TargetA. + 喂 TargetA 给 TargetB. + 挖掘 TargetA. + 收获 TargetA. + 割除 TargetA. + + + \ No newline at end of file diff --git a/Languages/ChineseSimplified/DefInjected/NeedDef/Needs.xml b/Languages/ChineseSimplified/DefInjected/NeedDef/Needs.xml new file mode 100644 index 00000000..dc471945 --- /dev/null +++ b/Languages/ChineseSimplified/DefInjected/NeedDef/Needs.xml @@ -0,0 +1,8 @@ + + + + 积极性 + 积极性表示囚犯工作的动力。动力可以靠殖民者站在旁边来增加。 + + + \ No newline at end of file diff --git a/Languages/ChineseSimplified/DefInjected/WorkGiverDef/WorkGiverDef.xml b/Languages/ChineseSimplified/DefInjected/WorkGiverDef/WorkGiverDef.xml new file mode 100644 index 00000000..63a54d8c --- /dev/null +++ b/Languages/ChineseSimplified/DefInjected/WorkGiverDef/WorkGiverDef.xml @@ -0,0 +1,33 @@ + + + + 监视囚犯 + 监视囚犯 + 监视囚犯中 + + 为囚犯送餐 + 为囚犯送餐 + 送餐给 + + 挖掘 + 挖掘 + 挖掘中 + + 切割植物 + 切割 + 切割植物中 + + 收获作物 + 收获 + 收获作物中 + + 播种作物 + 播种 + 播种作物中 + + 打扫卫生 + 打扫 + 打扫中 + + + \ No newline at end of file diff --git a/Languages/ChineseSimplified/Keyed/Keys.xml b/Languages/ChineseSimplified/Keyed/Keys.xml new file mode 100644 index 00000000..b23a228c --- /dev/null +++ b/Languages/ChineseSimplified/Keyed/Keys.xml @@ -0,0 +1,47 @@ + + + 强迫工作 + 工作和招募 + 你的囚犯停止工作了! + 监视者报告阙值 + 停止工作阙值 + 囚犯无法做的工作 + 显示新消息 + 当检测到囚犯时显示模组更新消息 + 默认囚犯互动模式 + 允许的工作类型: + 允许全部 + 允许全部工作类型 + 允许的工作类型: + 浏览 + 激励技巧(!) + 当选择时,囚犯将需要被激励\n\n警告:需要重新载入存档。 + 囚犯可以种植高级作物 + 当禁用时囚犯只能种不需要技能的植物。 + 重启并重新存储你的游戏 + 此操作后你就能安全的禁用此模组。 + 禁用模组 + 当开启时,存档将会转化成“安全模式”,并且可以在模组被移除后继续游戏。 + 版本: + 难度: + 默认 + 普通 + 轻松 + 简单 + 和平 + 搞笑 + 囚犯不在工作。 + 囚犯在偷懒。尝试增加他们的积极性。 + 这些囚犯在摸鱼:\n\n{0}\n尝试增加他们的积极性。 + 囚犯正在饥饿状态 + 囚犯由于饥饿停止了工作。 + 这些囚犯由于饥饿停止了工作:\n\n{0} + 囚犯工作区域 + 囚犯工作区域是只有囚犯才能工作的区域。殖民者只能在此区域内执行监视工作。 + 清除工作区域 + 扩张工作区域 + 只允许殖民者 + 只允许囚犯 + 只允许殖民地 + + diff --git a/README.md b/README.md index b4e33b7a..1da64914 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

    - v0.7 + v0.7

    diff --git a/Source/Behaviour_MotivationIcon.cs b/Source/Behaviour_MotivationIcon.cs index d291e806..16af2da7 100644 --- a/Source/Behaviour_MotivationIcon.cs +++ b/Source/Behaviour_MotivationIcon.cs @@ -1,4 +1,5 @@ using RimWorld.Planet; +using System; using UnityEngine; using Verse; @@ -6,6 +7,9 @@ namespace PrisonLabor { internal class Behaviour_MotivationIcon : MonoBehaviour { + // TODO delete later + private static bool displayedError = false; + private static readonly Texture2D inspiredTexture = ContentFinder.Get("InspireIcon", false); private static readonly Texture2D motivatedTexture = ContentFinder.Get("MotivateIcon", false); private static readonly Vector3 iconPos = new Vector3(0f, 0f, 1.3f); @@ -33,26 +37,37 @@ private void DrawIcon(Texture2D texture, Vector3 pawnPos) public virtual void OnGUI() { - //TODO add icons enabled - var iconsEnabled = true; - var inGame = Find.GameInfo != null && Find.World != null && Find.World.renderer != null && !WorldRendererUtility.WorldRenderedNow; - - if (iconsEnabled && inGame) - foreach (var pawn in Find.VisibleMap.mapPawns.AllPawns) - { - if (pawn == null) continue; - if (pawn.RaceProps == null) continue; + try + { + //TODO add icons enabled + var iconsEnabled = true; + var inGame = Find.GameInfo != null && Find.World != null && Find.World.renderer != null && !WorldRendererUtility.WorldRenderedNow; - if (pawn.IsPrisonerOfColony) + if (iconsEnabled && inGame) + foreach (var pawn in Find.VisibleMap.mapPawns.AllPawns) { - var need = pawn.needs.TryGetNeed(); - if (need != null && need.Motivated) - if (need.Insipred) - DrawIcon(inspiredTexture, pawn.DrawPos); - else - DrawIcon(motivatedTexture, pawn.DrawPos); + if (pawn == null) continue; + if (pawn.RaceProps == null) continue; + + if (pawn.IsPrisonerOfColony) + { + var need = pawn.needs.TryGetNeed(); + if (need != null && need.Motivated) + if (need.Insipred) + DrawIcon(inspiredTexture, pawn.DrawPos); + else + DrawIcon(motivatedTexture, pawn.DrawPos); + } } + } + catch (NullReferenceException e) + { + if (!displayedError) + { + Log.Message("[Debug] (Ignore that) Prison labor null reference in OnGui() : " + e.Message); + displayedError = true; } + } } diff --git a/Source/BillUtility.cs b/Source/BillUtility.cs index d4d7b210..06129088 100644 --- a/Source/BillUtility.cs +++ b/Source/BillUtility.cs @@ -16,6 +16,8 @@ public static GroupMode IsFor(Bill key) public static void SetFor(Bill key, GroupMode value) { + if (!Map.ContainsKey(key)) + Map[key] = new BillGroupData(); Map[key].Mode = value; } diff --git a/Source/HarmonyPatches/HarmonyPatches.cs b/Source/HarmonyPatches/HPatcher.cs similarity index 99% rename from Source/HarmonyPatches/HarmonyPatches.cs rename to Source/HarmonyPatches/HPatcher.cs index b3b1039d..8c3dcb83 100644 --- a/Source/HarmonyPatches/HarmonyPatches.cs +++ b/Source/HarmonyPatches/HPatcher.cs @@ -9,7 +9,7 @@ namespace PrisonLabor.HarmonyPatches { - internal static class HarmonyPatches + internal static class HPatcher { public static void Init() { diff --git a/Source/HarmonyPatches/Patch_BillCheckbox.cs b/Source/HarmonyPatches/Patch_BillCheckbox.cs index c1abd214..6ab15c4c 100644 --- a/Source/HarmonyPatches/Patch_BillCheckbox.cs +++ b/Source/HarmonyPatches/Patch_BillCheckbox.cs @@ -29,7 +29,7 @@ private static IEnumerable Transpiler(ILGenerator gen, MethodBa { "RimWorld.Bill_Production bill", }; - var billField = HarmonyPatches.FindOperandAfter(opCodes0, operands0, instr); + var billField = HPatcher.FindOperandAfter(opCodes0, operands0, instr); OpCode[] opCodes1 = { OpCodes.Ldloc_S, @@ -46,7 +46,7 @@ private static IEnumerable Transpiler(ILGenerator gen, MethodBa "Boolean ButtonText(System.String, System.String)", "System.Reflection.Emit.Label", }; - var label = HarmonyPatches.FindOperandAfter(opCodes1, operands1, instr); + var label = HPatcher.FindOperandAfter(opCodes1, operands1, instr); // Begin rect - start of scrollable view int step2 = 0; @@ -95,19 +95,19 @@ private static IEnumerable Transpiler(ILGenerator gen, MethodBa typeof(Patch_BillCheckbox).GetMethod("GroupExclusionButton")); ci.labels.Remove((Label)label); } - if(HarmonyPatches.IsFragment(opCodes3, operands3, ci, ref step3)) + if(HPatcher.IsFragment(opCodes3, operands3, ci, ref step3)) { var instruction = new CodeInstruction(OpCodes.Call, typeof(Patch_BillCheckbox).GetMethod("StopScrolling")); instruction.labels.AddRange(ci.labels); ci.labels.Clear(); yield return instruction; } - if (HarmonyPatches.IsFragment(opCodes2, operands2, ci, ref step4)) + if (HPatcher.IsFragment(opCodes2, operands2, ci, ref step4)) { yield return new CodeInstruction(OpCodes.Call, typeof(Patch_BillCheckbox).GetMethod("SetRect")); } yield return ci; - if(HarmonyPatches.IsFragment(opCodes2, operands2, ci, ref step2)) + if(HPatcher.IsFragment(opCodes2, operands2, ci, ref step2)) { yield return new CodeInstruction(OpCodes.Ldloc_2); yield return new CodeInstruction(OpCodes.Call, typeof(Patch_BillCheckbox).GetMethod("StartScrolling")); diff --git a/Source/HarmonyPatches/Patch_BillPrevention.cs b/Source/HarmonyPatches/Patch_BillPrevention.cs index 4a7ca072..0e801617 100644 --- a/Source/HarmonyPatches/Patch_BillPrevention.cs +++ b/Source/HarmonyPatches/Patch_BillPrevention.cs @@ -31,7 +31,7 @@ private static IEnumerable Transpiler(ILGenerator gen, MethodBa "System.Reflection.Emit.Label", "System.Reflection.Emit.Label", }; - var label = (Label)HarmonyPatches.FindOperandAfter(opCodes, operands, instr); + var label = (Label)HPatcher.FindOperandAfter(opCodes, operands, instr); OpCode[] opCodes2 = { @@ -59,7 +59,7 @@ private static IEnumerable Transpiler(ILGenerator gen, MethodBa foreach (var ci in instr) { yield return ci; - if (HarmonyPatches.IsFragment(opCodes2, operands2, ci, ref step)) + if (HPatcher.IsFragment(opCodes2, operands2, ci, ref step)) { yield return new CodeInstruction(OpCodes.Ldarg_1); yield return new CodeInstruction(OpCodes.Ldloc_1); diff --git a/Source/HarmonyPatches/Patch_LaborForbid.cs b/Source/HarmonyPatches/Patch_LaborForbid.cs index 30f51f5d..763ca584 100644 --- a/Source/HarmonyPatches/Patch_LaborForbid.cs +++ b/Source/HarmonyPatches/Patch_LaborForbid.cs @@ -17,36 +17,84 @@ internal class Patch_LaborForbid private static IEnumerable Transpiler(ILGenerator gen, MethodBase mBase, IEnumerable instr) { - var pawn = HarmonyPatches.FindOperandAfter(new[] { OpCodes.Ldfld }, new[] { "Verse.Pawn pawn" }, instr); - var jobgiver = HarmonyPatches.FindOperandAfter(new[] {OpCodes.Ldloc_S }, new[] { "RimWorld.JobGiver_Work+c__AnonStorey2A9 (27)" }, instr ); - var scanner = HarmonyPatches.FindOperandAfter(new[] { OpCodes.Ldfld }, new[] { "RimWorld.WorkGiver_Scanner scanner" }, instr); + var pawn = HPatcher.FindOperandAfter(new[] { OpCodes.Ldfld }, new[] { "Verse.Pawn pawn" }, instr); + var jobgiver = HPatcher.FindOperandAfter(new[] {OpCodes.Ldloc_S }, new[] { "RimWorld.JobGiver_Work+c__AnonStorey2A9 (27)" }, instr ); + var scanner = HPatcher.FindOperandAfter(new[] { OpCodes.Ldfld }, new[] { "RimWorld.WorkGiver_Scanner scanner" }, instr); + var cell = HPatcher.FindOperandAfter(new[] {OpCodes.Ldloc_S }, new[] { "Verse.IntVec3 (19)" }, instr ); - OpCode[] opcodes = + OpCode[] opcodes1 = { OpCodes.Ldloc_S, OpCodes.Ldftn, OpCodes.Newobj, }; - String[] operands = + String[] operands1 = { "RimWorld.JobGiver_Work+c__AnonStorey2A9 (27)", "Boolean <>m__14E(Verse.Thing)", "Void .ctor(Object, IntPtr)", }; - int step = 0; + int step1 = 0; + + OpCode[] opCodes2 = + { + OpCodes.Bge_Un, + OpCodes.Ldloc_S, + OpCodes.Ldloc_S, + OpCodes.Ldfld, + OpCodes.Call, + OpCodes.Brtrue, + OpCodes.Ldloc_S, + OpCodes.Ldfld, + OpCodes.Ldloc_S, + OpCodes.Ldfld, + OpCodes.Ldloc_S, + OpCodes.Callvirt, + OpCodes.Brfalse, + }; + String[] operands2 = + { + "System.Reflection.Emit.Label", + "Verse.IntVec3 (19)", + "RimWorld.JobGiver_Work+c__AnonStorey2A8 (26)", + "Verse.Pawn pawn", + "Boolean IsForbidden(IntVec3, Verse.Pawn)", + "System.Reflection.Emit.Label", + "RimWorld.JobGiver_Work+c__AnonStorey2A9 (27)", + "RimWorld.WorkGiver_Scanner scanner", + "RimWorld.JobGiver_Work+c__AnonStorey2A8 (26)", + "Verse.Pawn pawn", + "Verse.IntVec3 (19)", + "Boolean HasJobOnCell(Verse.Pawn, IntVec3)", + "System.Reflection.Emit.Label", + }; + int step2 = 0; foreach (var ci in instr) { + HPatcher.CreateDebugFileOnDesktop("grow", instr); + yield return ci; - if (HarmonyPatches.IsFragment(opcodes, operands, ci, ref step)) + if (HPatcher.IsFragment(opcodes1, operands1, ci, ref step1)) { yield return new CodeInstruction(OpCodes.Pop); - yield return new CodeInstruction(OpCodes.Ldarg_1, null); + yield return new CodeInstruction(OpCodes.Ldarg_1); yield return new CodeInstruction(OpCodes.Ldloc_S, jobgiver); yield return new CodeInstruction(OpCodes.Ldfld, scanner); yield return new CodeInstruction(OpCodes.Call, typeof(Patch_LaborForbid).GetMethod("CreatePredicate")); } + + if(HPatcher.IsFragment(opCodes2, operands2, ci, ref step2)) + { + yield return new CodeInstruction(OpCodes.Ldloc_S, cell); + yield return new CodeInstruction(OpCodes.Ldarg_1); + yield return new CodeInstruction(OpCodes.Ldloc_S, jobgiver); + yield return new CodeInstruction(OpCodes.Ldfld, scanner); + yield return new CodeInstruction(OpCodes.Call, typeof(Patch_LaborForbid).GetMethod("GetWorkType")); + yield return new CodeInstruction(OpCodes.Call, typeof(LaborExclusionUtility).GetMethod("IsDisabledByLabor")); + yield return new CodeInstruction(OpCodes.Brtrue, ci.operand); + } } } @@ -56,5 +104,11 @@ public static Predicate CreatePredicate(Pawn pawn, WorkGiver_Scanner scan && scanner.HasJobOnThing(pawn, t, false) && !LaborExclusionUtility.IsDisabledByLabor(t.Position, pawn, scanner.def.workType); } + + public static WorkTypeDef GetWorkType(WorkGiver_Scanner scanner) + { + return scanner.def.workType; + } } -} \ No newline at end of file +} + \ No newline at end of file diff --git a/Source/Initialization.cs b/Source/Initialization.cs index dd8d9107..07de087c 100644 --- a/Source/Initialization.cs +++ b/Source/Initialization.cs @@ -1,4 +1,5 @@ -using Verse; +using PrisonLabor.HarmonyPatches; +using Verse; namespace PrisonLabor { @@ -7,7 +8,7 @@ internal class Initialization { static Initialization() { - HarmonyPatches.HarmonyPatches.Init(); + HPatcher.Init(); PrisonLaborPrefs.Init(); PrisonLaborMod.Init(); VersionUtility.CheckVersion(); diff --git a/Source/JobGiver_Joy.cs b/Source/JobGiver_Joy.cs deleted file mode 100644 index 87a08e92..00000000 --- a/Source/JobGiver_Joy.cs +++ /dev/null @@ -1,82 +0,0 @@ -using RimWorld; -using Verse; -using Verse.AI; - -namespace PrisonLabor -{ - internal class JobGiver_Joy : ThinkNode_JobGiver - { - private DefMap joyGiverChances; - - - protected virtual bool CanDoDuringMedicalRest => false; - - public override float GetPriority(Pawn pawn) - { - if (pawn.timetable != null && pawn.timetable.CurrentAssignment == TimeAssignmentDefOf.Joy) - return 10f; - return 0f; - } - - protected virtual bool JoyGiverAllowed(JoyGiverDef def) - { - return true; - } - - protected virtual Job TryGiveJobFromJoyGiverDefDirect(JoyGiverDef def, Pawn pawn) - { - return def.Worker.TryGiveJob(pawn); - } - - public override void ResolveReferences() - { - joyGiverChances = new DefMap(); - } - - protected override Job TryGiveJob(Pawn pawn) - { - if (pawn.timetable == null || pawn.timetable.CurrentAssignment != TimeAssignmentDefOf.Joy) - return null; - if (pawn.InBed() && HealthAIUtility.ShouldSeekMedicalRest(pawn)) - return null; - var allDefsListForReading = DefDatabase.AllDefsListForReading; - //JoyToleranceSet tolerances = pawn.needs.joy.tolerances; - for (var i = 0; i < allDefsListForReading.Count; i++) - { - var joyGiverDef = allDefsListForReading[i]; - joyGiverChances[joyGiverDef] = 0f; - if (JoyGiverAllowed(joyGiverDef)) - if (joyGiverDef.Worker.MissingRequiredCapacity(pawn) == null) - { - if (joyGiverDef.pctPawnsEverDo < 1f) - { - Rand.PushState(pawn.thingIDNumber ^ 63216713); - if (Rand.Value >= joyGiverDef.pctPawnsEverDo) - { - Rand.PopState(); - goto IL_FB; - } - Rand.PopState(); - } - var num = joyGiverDef.Worker.GetChance(pawn); - //float num2 = 1f - tolerances[joyGiverDef.joyKind]; - //num *= num2 * num2; - joyGiverChances[joyGiverDef] = num; - } - IL_FB: - ; - } - for (var j = 0; j < joyGiverChances.Count; j++) - { - JoyGiverDef def; - if (!allDefsListForReading.TryRandomElementByWeight(d => joyGiverChances[d], out def)) - break; - var job = TryGiveJobFromJoyGiverDefDirect(def, pawn); - if (job != null) - return job; - joyGiverChances[def] = 0f; - } - return null; - } - } -} \ No newline at end of file diff --git a/Source/Need_Motivation.cs b/Source/Need_Motivation.cs index 145ad52e..62ff6256 100644 --- a/Source/Need_Motivation.cs +++ b/Source/Need_Motivation.cs @@ -14,7 +14,7 @@ public class Need_Motivation : Need private const float LazyLevel = 0.2f; private const float NeedInspirationLevel = 0.5f; - private const float LazyRate = 0.003f; + private const float LazyRate = 0.002f; private const float HungryRate = 0.006f; private const float TiredRate = 0.006f; private const float HealthRate = 0.006f; diff --git a/Source/NewsDialog.cs b/Source/NewsDialog.cs index 5c39ba30..384a1456 100644 --- a/Source/NewsDialog.cs +++ b/Source/NewsDialog.cs @@ -25,6 +25,7 @@ internal class NewsDialog : Window public static bool news_0_8_0 = false; public static bool news_0_8_1 = false; public static bool news_0_8_3 = false; + public static bool news_0_8_6 = false; // Fields private string[] titles; @@ -43,6 +44,23 @@ public void Init() { List titlesList = new List(); List itemsList = new List(); + if (news_0_8_6 || showAll) + { + titlesList.Add("Prison Labor Beta v0.8.6"); + string[] itemsArray = + { + "[img]NewsElement_Locks[/img]Locks mod:\nIf you want to allow prisoners to pass by closed doors, please check out my other mod called Locks", + "[gap]", + "fixed bug that Sowing job do not comply to Labor Area", + "fixed bug with JoyGiver debris (sorry about that)", + "reduced number of null reference errors with OnGui() method (fixed in v 0.8.5)", + "single warden will be able to maintain 7 prisoners, instead of 5 (because of laziness rate reduction) (changed in v 0.8.5)", + "decreased laziness rate to 0.002, instead of 0.003 (prisoners will get lazy 1.5x slower) (changed in v 0.8.5)", + "decreased manipulation to 70% (instead of 80%) (changed in v 0.8.5)", + "fixed null reference exception at loading game (fixed in v 0.8.4)", + }; + itemsList.Add(itemsArray); + } if (news_0_8_3 || showAll) { titlesList.Add("Prison Labor Beta v0.8.3"); diff --git a/Source/PrefsData.cs b/Source/PrefsData.cs index aa689974..ccc62de6 100644 --- a/Source/PrefsData.cs +++ b/Source/PrefsData.cs @@ -42,7 +42,9 @@ public enum Version v0_8_1, v0_8_2, v0_8_3, - v0_8_4 + v0_8_4, + v0_8_5, + v0_8_6 } [Flags] diff --git a/Source/PrisonLabor.csproj b/Source/PrisonLabor.csproj index 18fc149b..120da1d5 100644 --- a/Source/PrisonLabor.csproj +++ b/Source/PrisonLabor.csproj @@ -75,7 +75,7 @@ - + @@ -90,7 +90,6 @@ - @@ -132,6 +131,30 @@ Organizer\changelog.txt + + Defs\ConceptDef.xml + + + Defs\Hediffs.xml + + + Defs\Incidents.xml + + + Defs\JobDef.xml + + + Defs\Needs.xml + + + Defs\PrisonerInteractionModeDef.xml + + + Defs\ThinkTreeDef.xml + + + Defs\WorkGiverDef.xml + Language\Keys.xml @@ -140,6 +163,9 @@ + + Organizer\credits.md + Organizer\README.md diff --git a/Source/VersionUtility.cs b/Source/VersionUtility.cs index 10812977..1d5a175f 100644 --- a/Source/VersionUtility.cs +++ b/Source/VersionUtility.cs @@ -8,8 +8,8 @@ namespace PrisonLabor { class VersionUtility { - public const Version versionNumber = Version.v0_8_4; - public const string versionString = "0.8.4"; + public const Version versionNumber = Version.v0_8_6; + public const string versionString = "0.8.6"; public static void CheckVersion() { @@ -55,6 +55,11 @@ public static void CheckVersion() NewsDialog.news_0_8_3 = true; NewsDialog.autoShow = true; } + if (PrisonLaborPrefs.LastVersion < Version.v0_8_6) + { + NewsDialog.news_0_8_6 = true; + NewsDialog.autoShow = true; + } Log.Message($"Enabled Prison Labor v{versionString}"); PrisonLaborPrefs.Version = versionNumber; diff --git a/TaskList.txt b/TaskList.txt index 31afc06e..0db1f174 100644 --- a/TaskList.txt +++ b/TaskList.txt @@ -8,4 +8,8 @@ Agenda: ========================== revolts - add different weapons depending on points - - rewrite all numbers \ No newline at end of file + - rewrite all numbers + - inspire lowest/closest motivation + - try to inspire most of prisoners at once + - add buff to mood if motivation is low + - add buff to mood for free time \ No newline at end of file diff --git a/Textures/NewsElement_Locks.png b/Textures/NewsElement_Locks.png new file mode 100644 index 00000000..5b9b7cfa Binary files /dev/null and b/Textures/NewsElement_Locks.png differ diff --git a/changelog.txt b/changelog.txt index c5b582db..3928f43b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,12 @@ Changelog: +0.8.6 +- fixed bug that Sowing job do not comply to Labor Area +- removed JoyGiver debris +0.8.5 +- reduced number of null reference errors with OnGui() method. +- single warden will be able to maintain 7 prisoners, instead of 5 (because of laziness rate reduction) +- decreased laziness rate to 0.002, instead of 0.003 (prisoners will get lazy 1.5x slower) +- decreased manipulation to 70% (instead of 80%) 0.8.4 - fixed null reference exception at loading game 0.8.3 diff --git a/credits.md b/credits.md new file mode 100644 index 00000000..e69de29b