diff --git a/1.4/Assemblies/PrisonLabor.dll b/1.4/Assemblies/PrisonLabor.dll
index df47e9d..4c420ed 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 e08b25a..d7552f3 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 553835b..84498a7 100644
Binary files a/1.4/CleaningArea/Assemblies/PrisonLaborCleaningAreaCompatibility.dll and b/1.4/CleaningArea/Assemblies/PrisonLaborCleaningAreaCompatibility.dll differ
diff --git a/1.4/ColonyGroups/Assemblies/PrisonLaborColonyGroupsCompatibility.dll b/1.4/ColonyGroups/Assemblies/PrisonLaborColonyGroupsCompatibility.dll
index e937cdd..8ae00e6 100644
Binary files a/1.4/ColonyGroups/Assemblies/PrisonLaborColonyGroupsCompatibility.dll and b/1.4/ColonyGroups/Assemblies/PrisonLaborColonyGroupsCompatibility.dll differ
diff --git a/1.4/Defs/Interrogation/InterrogationDefs.xml b/1.4/Defs/Interrogation/InterrogationDefs.xml
index 94d27e1..da7e0e2 100644
--- a/1.4/Defs/Interrogation/InterrogationDefs.xml
+++ b/1.4/Defs/Interrogation/InterrogationDefs.xml
@@ -4,61 +4,9 @@
PL_GenQuest
OpportunitySite_ItemStash
- OpportunitySite_WorkSite
+ OpportunitySite_WorkSite
-
- PL_InterrogationChair
- interrogation chair
- Not comfortable chair used to interrogate prisoners.
-
- Things/Building/Furniture/DiningChair
- Graphic_Multi
- (1,1)
-
- (0.25,0.234375,0.5,0.28125)
- (0.25,0.234375,0.5,0.28125)
- (0.28125,0.25,0.453125,0.25)
- (0.28125,0.25,0.453125,0.25)
-
-
- (0.23, 0.26, 0.23)
-
-
- Building
-
- 100
- 8000
- 5
- 1.0
- 1
- 0.30
- 5
-
- true
-
- Metallic
- Woody
-
- 45
- 30
- Misc7
- 0.35
- South
- 2410
-
- true
- true
-
- 4
-
- ComplexFurniture
-
-
-
-
-
-
PL_InterrogationRoom
interrogation room
diff --git a/1.4/Defs/Interrogation/InterrogationPatterns.xml b/1.4/Defs/Interrogation/InterrogationPatterns.xml
index cbe8b30..44e5800 100644
--- a/1.4/Defs/Interrogation/InterrogationPatterns.xml
+++ b/1.4/Defs/Interrogation/InterrogationPatterns.xml
@@ -22,7 +22,7 @@
PL_Interrogation
false
PL_Interrogation
- SelectedThing
+ PL_SelectedThing
PL_InterrogationRoom
PL_Interrogation
false
@@ -93,7 +93,7 @@
warden
- DeliverPawnToCell
+ PL_DeliverPawnToCell
@@ -123,7 +123,7 @@
prisoner
- StandOnCell
+ PL_StandOnCell
@@ -145,12 +145,43 @@
- Speech_Ideoligious_Male
- Speech_Ideoligious_Female
+ Speech_Ideoligious_Male
+ Speech_Ideoligious_Female
+
+ PL_DeliverPawnToCell
+ HighPriority
+ Off
+
+
+
+
+ true
+ Jog
+
+
+
+
+
+ PL_StandOnCell
+
+
+
+
+ 60
+
+
+
+
+
+
+
+ PL_SelectedThing
+ RitualTargetFilter_SelectedThing
+
PL_Interrogate
PrisonLabor.Core.Interrogation.Ritual.JobDriver_Interrogate
diff --git a/1.4/Hospitality/Assemblies/PrisonLaborHospitalityCompatibility.dll b/1.4/Hospitality/Assemblies/PrisonLaborHospitalityCompatibility.dll
index 6880cbb..a7937e7 100644
Binary files a/1.4/Hospitality/Assemblies/PrisonLaborHospitalityCompatibility.dll and b/1.4/Hospitality/Assemblies/PrisonLaborHospitalityCompatibility.dll differ
diff --git a/1.4/Ideology/Defs/PL_Ideology_InterrogationDefs.xml b/1.4/Ideology/Defs/PL_Ideology_InterrogationDefs.xml
new file mode 100644
index 0000000..c811234
--- /dev/null
+++ b/1.4/Ideology/Defs/PL_Ideology_InterrogationDefs.xml
@@ -0,0 +1,55 @@
+
+
+
+ PL_InterrogationChair
+ interrogation chair
+ Not comfortable chair used to interrogate prisoners.
+
+ Things/Building/Furniture/DiningChair
+ Graphic_Multi
+ (1,1)
+
+ (0.25,0.234375,0.5,0.28125)
+ (0.25,0.234375,0.5,0.28125)
+ (0.28125,0.25,0.453125,0.25)
+ (0.28125,0.25,0.453125,0.25)
+
+
+ (0.23, 0.26, 0.23)
+
+
+ Building
+
+ 100
+ 8000
+ 5
+ 1.0
+ 1
+ 0.30
+ 5
+
+ true
+
+ Metallic
+ Woody
+
+ 45
+ 30
+ Misc7
+ 0.35
+ South
+ 2410
+
+ true
+ true
+
+ 4
+
+ ComplexFurniture
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/1.4/Kijin/Assemblies/PrisonLaborKijinCompatibility.dll b/1.4/Kijin/Assemblies/PrisonLaborKijinCompatibility.dll
index d750c5b..6f62230 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 381ffd8..5ef90a6 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 a6d894a..84c2ab8 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 1762220..b2f9c05 100644
--- a/About/About.xml
+++ b/About/About.xml
@@ -35,7 +35,7 @@
- Version 1.4.8
+ Version 1.4.9
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 64640f4..5a8acb7 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
-
+
diff --git a/Source/Core/Interrogation/InterrogationDefsOf.cs b/Source/Core/Interrogation/InterrogationDefsOf.cs
index c8c9be7..0c52ca7 100644
--- a/Source/Core/Interrogation/InterrogationDefsOf.cs
+++ b/Source/Core/Interrogation/InterrogationDefsOf.cs
@@ -9,16 +9,24 @@
namespace PrisonLabor.Core.Interrogation
{
- [DefOf]
+ [DefOf]
public static class InterrogationDefsOf
{
+ [MayRequireIdeology]
public static InterrogationQuestGenDef PL_GenQuest;
+ [MayRequireIdeology]
public static ThoughtDef PL_BitMe;
+ [MayRequireIdeology]
public static ThoughtDef PL_KindInterrogation;
+ [MayRequireIdeology]
public static ThoughtDef PL_Interrogated;
+ [MayRequireIdeology]
public static ThoughtDef PL_BrutallyInterrogated;
+ [MayRequireIdeology]
public static JobDef PL_Interrogate;
+ [MayRequireIdeology]
public static InteractionDef PL_InterrogateInteraction;
+ [MayRequireIdeology]
public static InteractionDef PL_BeIntrrogatedInteraction;
}
}
diff --git a/Source/Core/Interrogation/Ritual/JobGiver_Interrogate.cs b/Source/Core/Interrogation/Ritual/JobGiver_Interrogate.cs
index 5c5f948..70c859f 100644
--- a/Source/Core/Interrogation/Ritual/JobGiver_Interrogate.cs
+++ b/Source/Core/Interrogation/Ritual/JobGiver_Interrogate.cs
@@ -45,6 +45,7 @@ protected override Job TryGiveJob(Pawn pawn)
{
job.interaction = lordToil_Ritual.stage.BehaviorForRole(lordJob_Ritual.RoleFor(pawn).id).speakerInteraction;
}
+
job.speechSoundMale = (soundDefMale ?? SoundDefOf.Speech_Leader_Male);
job.speechSoundFemale = (soundDefFemale ?? SoundDefOf.Speech_Leader_Female);
job.speechFaceSpectatorsIfPossible = faceSpectatorsIfPossible;
diff --git a/Source/Core/Meta/Version.cs b/Source/Core/Meta/Version.cs
index 2c0d6ab..e724939 100644
--- a/Source/Core/Meta/Version.cs
+++ b/Source/Core/Meta/Version.cs
@@ -88,6 +88,7 @@ public enum Version
v1_4_5,
v1_4_6,
v1_4_7,
- v1_4_8
+ v1_4_8,
+ v1_4_9
}
}
diff --git a/Source/Core/Meta/VersionUtility.cs b/Source/Core/Meta/VersionUtility.cs
index fbe4cf3..fb65562 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_8;
- public const string versionString = "1.4.8";
+ public const Version versionNumber = Version.v1_4_9;
+ public const string versionString = "1.4.9";
public static Version VersionOfSaveFile { get; set; }
diff --git a/Source/HarmonyPatches/HPatcher.cs b/Source/HarmonyPatches/HPatcher.cs
index 4e56782..7604fb7 100644
--- a/Source/HarmonyPatches/HPatcher.cs
+++ b/Source/HarmonyPatches/HPatcher.cs
@@ -10,220 +10,227 @@
namespace PrisonLabor.HarmonyPatches
{
- public static class HPatcher
+ public static class HPatcher
+ {
+
+ static readonly MethodInfo getFactionMethod = AccessTools.PropertyGetter(typeof(Thing), nameof(Thing.Faction));
+ // For logging purposes, it stores whenever each fragment was completed
+ private static Dictionary fragments;
+
+ public static void Init()
{
- // For logging purposes, it stores whenever each fragment was completed
- private static Dictionary fragments;
+ var harmony = new Harmony("Harmony_PrisonLabor");
- public static void Init()
- {
- var harmony = new Harmony("Harmony_PrisonLabor");
-
- // SECTION - Classic patches
- try
- {
- // Clear old data, to avoid misleading info
- fragments = new Dictionary();
-
- harmony.PatchAll(Assembly.GetExecutingAssembly());
-
- // Print out not completed methods
- foreach (var f in fragments.Keys)
- {
- if (!fragments[f])
- Log.Error($"PrisonLaborWarning: Harmony patch failed to find \"{f}\" fragment.");
- }
- }
- catch (Exception e)
- {
- Log.Error($"PrisonLaborException: failed to proceed harmony patches: {e.InnerException.Message}");
- Log.Error(e.ToString());
- }
- }
+ // SECTION - Classic patches
+ try
+ {
+ // Clear old data, to avoid misleading info
+ fragments = new Dictionary();
- ///
- /// CIL Debugging method. Creates debug file on desktop that list all CIL code instructions in the method.
- ///
- ///
- ///
- public static void CreateDebugFileOnDesktop(string fileName, IEnumerable instr)
- {
- // Set a variable to the Desktop path.
- string myDesktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
-
- // Write the string array to a new file.
- using (StreamWriter outputFile = new StreamWriter(myDesktopPath + @"\" + fileName + ".txt"))
- {
- outputFile.WriteLine("================");
- outputFile.WriteLine("Body of " + fileName + " method", fileName);
- outputFile.WriteLine("================");
- foreach (CodeInstruction instruction in instr)
- {
- var instructionString = instruction.opcode.ToString();
- instructionString += " | ";
- instructionString += instruction.operand is Label ? $"Label {instruction.operand.GetHashCode()}" : instruction.operand;
- instructionString += " | ";
- if (instruction.labels.Count > 0)
- foreach (var label in instruction.labels)
- instructionString += $"Label {label.GetHashCode()}";
- else
- instructionString += "no labels";
- outputFile.WriteLine(instructionString);
- }
- }
- }
+ harmony.PatchAll(Assembly.GetExecutingAssembly());
- ///
- /// This method is used to add some CIL instructions after certain fragment in original code.
- /// It should be used inside foreach loop, and return true if particular iteration is the desired one.
- ///
- ///
- ///
- ///
- ///
- ///
- public static bool IsFragment(OpCode[] opCodes, String[] operands, CodeInstruction instr, ref int step, string fragmentName, bool perfectMatch = true)
+ // Print out not completed methods
+ foreach (var f in fragments.Keys)
{
- if (opCodes.Length != operands.Length)
- {
- Log.Error("PrisonLaborException: IsFragment() arguments does not match requirments. Trace:" + new StackTrace());
- return false;
- }
-
- if (!fragments.ContainsKey(fragmentName))
- fragments.Add(fragmentName, false);
- if (step < 0 || step >= opCodes.Length)
- {
- return false;
- }
-
- var finalStep = opCodes.Length;
-
-
- if (InstructionMatching(instr, opCodes[step], operands[step], perfectMatch))
- step++;
- else
- step = 0;
-
- if (step == finalStep)
- {
- step++;
- fragments[fragmentName] = true;
- return true;
- }
- return false;
+ if (!fragments[f])
+ Log.Error($"PrisonLaborWarning: Harmony patch failed to find \"{f}\" fragment.");
}
+ }
+ catch (Exception e)
+ {
+ Log.Error($"PrisonLaborException: failed to proceed harmony patches: {e.InnerException.Message}");
+ Log.Error(e.ToString());
+ }
+ }
- ///
- /// This method is used to find particular label that is assigned to last instruction's operand
- ///
- ///
- ///
- ///
- ///
- ///
- public static object FindOperandAfter(OpCode[] opCodes, String[] operands, IEnumerable instr, bool perfectMatch = true)
+ ///
+ /// CIL Debugging method. Creates debug file on desktop that list all CIL code instructions in the method.
+ ///
+ ///
+ ///
+ public static void CreateDebugFileOnDesktop(string fileName, IEnumerable instr)
+ {
+ // Set a variable to the Desktop path.
+ string myDesktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
+
+ // Write the string array to a new file.
+ using (StreamWriter outputFile = new StreamWriter(myDesktopPath + @"\" + fileName + ".txt"))
+ {
+ outputFile.WriteLine("================");
+ outputFile.WriteLine("Body of " + fileName + " method", fileName);
+ outputFile.WriteLine("================");
+ foreach (CodeInstruction instruction in instr)
{
- if (opCodes.Length != operands.Length)
- {
- Log.Error("PrisonLaborException: FindOperandAfter() arguments does not match requirments. Trace:" + new StackTrace());
- return null;
- }
-
- var finalStep = opCodes.Length;
-
- int step = 0;
- foreach (var ci in instr)
- {
- if (InstructionMatching(ci, opCodes[step], operands[step], perfectMatch))
- step++;
- else
- step = 0;
-
- if (step == finalStep)
- return ci.operand;
- }
-
- Log.Error("PrisonLaborException: FindOperandAfter() didn't find any lines. Trace:" + new StackTrace());
- return null;
+ var instructionString = instruction.opcode.ToString();
+ instructionString += " | ";
+ instructionString += instruction.operand is Label ? $"Label {instruction.operand.GetHashCode()}" : instruction.operand;
+ instructionString += " | ";
+ if (instruction.labels.Count > 0)
+ foreach (var label in instruction.labels)
+ instructionString += $"Label {label.GetHashCode()}";
+ else
+ instructionString += "no labels";
+ outputFile.WriteLine(instructionString);
}
+ }
+ }
- public static IEnumerable ReplaceFragment(OpCode[] opCodes, String[] operands, IEnumerable instr, IEnumerable newFragment, string fragmentName, bool perfectMatch = true)
+ ///
+ /// This method is used to add some CIL instructions after certain fragment in original code.
+ /// It should be used inside foreach loop, and return true if particular iteration is the desired one.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static bool IsFragment(OpCode[] opCodes, String[] operands, CodeInstruction instr, ref int step, string fragmentName, bool perfectMatch = true)
+ {
+ if (opCodes.Length != operands.Length)
+ {
+ Log.Error("PrisonLaborException: IsFragment() arguments does not match requirments. Trace:" + new StackTrace());
+ return false;
+ }
+
+ if (!fragments.ContainsKey(fragmentName))
+ fragments.Add(fragmentName, false);
+ if (step < 0 || step >= opCodes.Length)
+ {
+ return false;
+ }
+
+ var finalStep = opCodes.Length;
+
+
+ if (InstructionMatching(instr, opCodes[step], operands[step], perfectMatch))
+ step++;
+ else
+ step = 0;
+
+ if (step == finalStep)
+ {
+ step++;
+ fragments[fragmentName] = true;
+ return true;
+ }
+ return false;
+ }
+
+ ///
+ /// This method is used to find particular label that is assigned to last instruction's operand
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public static object FindOperandAfter(OpCode[] opCodes, String[] operands, IEnumerable instr, bool perfectMatch = true)
+ {
+ if (opCodes.Length != operands.Length)
+ {
+ Log.Error("PrisonLaborException: FindOperandAfter() arguments does not match requirments. Trace:" + new StackTrace());
+ return null;
+ }
+
+ var finalStep = opCodes.Length;
+
+ int step = 0;
+ foreach (var ci in instr)
+ {
+ if (InstructionMatching(ci, opCodes[step], operands[step], perfectMatch))
+ step++;
+ else
+ step = 0;
+
+ if (step == finalStep)
+ return ci.operand;
+ }
+
+ Log.Error("PrisonLaborException: FindOperandAfter() didn't find any lines. Trace:" + new StackTrace());
+ return null;
+ }
+
+ public static IEnumerable ReplaceFragment(OpCode[] opCodes, String[] operands, IEnumerable instr, IEnumerable newFragment, string fragmentName, bool perfectMatch = true)
+ {
+ // Convert to list, to freely jump between lines
+ var instructions = instr.ToList();
+
+ // Find last index of fragment
+ int index = -1;
+ int step = 0;
+ for (int i = 0; i < instructions.Count; i++)
+ {
+ if (HPatcher.IsFragment(opCodes, operands, instructions[i], ref step, fragmentName, perfectMatch))
{
- // Convert to list, to freely jump between lines
- var instructions = instr.ToList();
-
- // Find last index of fragment
- int index = -1;
- int step = 0;
- for (int i = 0; i < instructions.Count; i++)
- {
- if (HPatcher.IsFragment(opCodes, operands, instructions[i], ref step, fragmentName, perfectMatch))
- {
- index = i;
- break;
- }
- }
-
- // Jump back to begining of fragment
- index -= operands.Length - 1;
-
- // If no fragment is found throw exception (or somehow begining of fragment is lower than 0)
- if (index < 0)
- {
- throw new Exception($"Couldn't find fragment {fragmentName}");
- }
-
- // Remove fragment
- instructions.RemoveRange(index, operands.Length);
-
- // Add fragment
- instructions.InsertRange(index, newFragment);
-
- return instructions;
+ index = i;
+ break;
}
+ }
+
+ // Jump back to begining of fragment
+ index -= operands.Length - 1;
- public static IEnumerable InjectFragmentBefore(OpCode[] opCodes, String[] operands, IEnumerable instr, IEnumerable newFragment, string fragmentName, bool perfectMatch = true)
+ // If no fragment is found throw exception (or somehow begining of fragment is lower than 0)
+ if (index < 0)
+ {
+ throw new Exception($"Couldn't find fragment {fragmentName}");
+ }
+
+ // Remove fragment
+ instructions.RemoveRange(index, operands.Length);
+
+ // Add fragment
+ instructions.InsertRange(index, newFragment);
+
+ return instructions;
+ }
+
+ public static IEnumerable InjectFragmentBefore(OpCode[] opCodes, String[] operands, IEnumerable instr, IEnumerable newFragment, string fragmentName, bool perfectMatch = true)
+ {
+ // Convert to list, to freely jump between lines
+ var instructions = instr.ToList();
+
+ // Find last index of fragment
+ int index = -1;
+ int step = 0;
+ for (int i = 0; i < instructions.Count; i++)
+ {
+ if (HPatcher.IsFragment(opCodes, operands, instructions[i], ref step, fragmentName, perfectMatch))
{
- // Convert to list, to freely jump between lines
- var instructions = instr.ToList();
-
- // Find last index of fragment
- int index = -1;
- int step = 0;
- for (int i = 0; i < instructions.Count; i++)
- {
- if (HPatcher.IsFragment(opCodes, operands, instructions[i], ref step, fragmentName, perfectMatch))
- {
- index = i;
- break;
- }
- }
-
- // Jump back to begining of fragment
- index -= operands.Length;
-
- // If no fragment is found throw exception (or somehow begining of fragment is lower than 0)
- if (index < 0)
- {
- throw new Exception($"Couldn't find fragment {fragmentName}");
- }
-
- // Add fragment
- instructions.InsertRange(index + 1, newFragment);
-
- return instructions;
+ index = i;
+ break;
}
+ }
- private static bool InstructionMatching(CodeInstruction instr, OpCode opCode, string operand, bool perfectMatch)
- {
- bool matchingOpCodes = instr.opcode == opCode;
- bool noOperands = instr.operand == null || string.IsNullOrEmpty(operand);
- bool matchingOperands;
- if (perfectMatch) matchingOperands = instr.operand != null && instr.operand.ToString() == operand;
- else matchingOperands = instr.operand != null && instr.operand.ToString().Contains(operand);
+ // Jump back to begining of fragment
+ index -= operands.Length;
- return matchingOpCodes && (noOperands || matchingOperands);
- }
+ // If no fragment is found throw exception (or somehow begining of fragment is lower than 0)
+ if (index < 0)
+ {
+ throw new Exception($"Couldn't find fragment {fragmentName}");
+ }
+
+ // Add fragment
+ instructions.InsertRange(index + 1, newFragment);
+
+ return instructions;
+ }
+
+ private static bool InstructionMatching(CodeInstruction instr, OpCode opCode, string operand, bool perfectMatch)
+ {
+ bool matchingOpCodes = instr.opcode == opCode;
+ bool noOperands = instr.operand == null || string.IsNullOrEmpty(operand);
+ bool matchingOperands;
+ if (perfectMatch) matchingOperands = instr.operand != null && instr.operand.ToString() == operand;
+ else matchingOperands = instr.operand != null && instr.operand.ToString().Contains(operand);
+
+ return matchingOpCodes && (noOperands || matchingOperands);
+ }
+
+ public static bool IsGetFactionOperand(CodeInstruction inst)
+ {
+ return inst.opcode == OpCodes.Callvirt && inst.OperandIs(getFactionMethod);
}
+ }
}
diff --git a/Source/HarmonyPatches/Patches_Work/Patch_Breastfeed.cs b/Source/HarmonyPatches/Patches_Work/Patch_Breastfeed.cs
index a22b16c..5443112 100644
--- a/Source/HarmonyPatches/Patches_Work/Patch_Breastfeed.cs
+++ b/Source/HarmonyPatches/Patches_Work/Patch_Breastfeed.cs
@@ -17,8 +17,6 @@ namespace PrisonLabor.HarmonyPatches.Patches_Work
[HarmonyPatch(new[] { typeof(Pawn), typeof(Pawn) })]
class Patch_BreastfeedCompatibleFactions
{
- static readonly MethodInfo expectedMethod = AccessTools.PropertyGetter(typeof(Pawn), nameof(Pawn.Faction));
-
[HarmonyPatch("HasBreastfeedCompatibleFactions")]
static bool Postfix(bool __result, Pawn mom, Pawn baby)
{
diff --git a/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_PrisonerFaction.cs b/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_PrisonerFaction.cs
index e64273f..cac41bf 100644
--- a/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_PrisonerFaction.cs
+++ b/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_PrisonerFaction.cs
@@ -16,7 +16,6 @@ namespace PrisonLabor.HarmonyPatches.Patches_Work
[HarmonyPatch]
public class Patch_WorkGiver_PrisonerFaction
{
- static readonly MethodInfo expectedMethod = AccessTools.PropertyGetter(typeof(Pawn), nameof(Pawn.Faction));
static IEnumerable TargetMethods()
{
foreach (MethodBase mb in Assembly.GetAssembly(typeof(WorkGiver_Scanner)).GetTypes()
@@ -35,7 +34,7 @@ static IEnumerable TargetMethods()
}
public static IEnumerable Transpiler(ILGenerator gen, MethodBase mBase, IEnumerable inst)
- {
+ {
var codes = new List(inst);
for (int i = 0; i < codes.Count(); i++)
{
@@ -52,8 +51,8 @@ public static IEnumerable Transpiler(ILGenerator gen, MethodBas
}
private static bool ShouldPatch(CodeInstruction actual, CodeInstruction prev)
- {
- return prev.opcode == OpCodes.Ldarg_1 && actual.opcode == OpCodes.Callvirt && actual.OperandIs(expectedMethod);
+ {
+ return prev.opcode == OpCodes.Ldarg_1 && HPatcher.IsGetFactionOperand(actual);
}
}
}
diff --git a/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_Refuel.cs b/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_Refuel.cs
index 068925f..20e0d05 100644
--- a/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_Refuel.cs
+++ b/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_Refuel.cs
@@ -5,24 +5,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Reflection;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using Verse;
using Verse.AI;
+using static Verse.HediffCompProperties_RandomizeSeverityPhases;
namespace PrisonLabor.HarmonyPatches.Patches_Work
{
[HarmonyPatch(typeof(RefuelWorkGiverUtility), "CanRefuel")]
class Patch_WorkGiver_Refuel
{
- static IEnumerable Transpiler(IEnumerable instructions)
+ static IEnumerable Transpiler(MethodBase mBase, IEnumerable instructions)
{
var codes = new List(instructions);
for (int i = 0; i < codes.Count(); i++)
{
if (i > 0 && ShouldPatch(codes[i], codes[i - 1]))
{
+ DebugLogger.debug($"Patch_WorkGiver_Refuel patch: {mBase.ReflectedType.Assembly.GetName().Name}.{mBase.ReflectedType.Name}.{mBase.Name}");
yield return new CodeInstruction(OpCodes.Call, typeof(PrisonLaborUtility).GetMethod(nameof(PrisonLaborUtility.GetPawnFaction)));
}
else
@@ -34,7 +37,7 @@ static IEnumerable Transpiler(IEnumerable inst
private static bool ShouldPatch(CodeInstruction actual, CodeInstruction prev)
{
- return prev.opcode == OpCodes.Ldarg_0 && actual.opcode == OpCodes.Callvirt && actual.operand != null && actual.operand.ToString().Contains("RimWorld.Faction get_Faction()");
+ return prev.opcode == OpCodes.Ldarg_0 && HPatcher.IsGetFactionOperand(actual);
}
static bool Postfix(bool __result, Pawn pawn, Thing t, bool forced)
{
diff --git a/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_Repair.cs b/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_Repair.cs
index c656486..8cee861 100644
--- a/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_Repair.cs
+++ b/Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_Repair.cs
@@ -7,6 +7,8 @@
using System.Reflection;
using Verse;
using Verse.AI;
+using PrisonLabor.Core.Other;
+using static Verse.HediffCompProperties_RandomizeSeverityPhases;
namespace PrisonLabor.HarmonyPatches.Patches_Work
{
@@ -19,13 +21,14 @@ static IEnumerable TargetMethods()
yield return typeof(RepairUtility).GetMethod(nameof(RepairUtility.PawnCanRepairNow));
}
- static IEnumerable Transpiler(IEnumerable instructions)
+ static IEnumerable Transpiler(MethodBase mBase, IEnumerable instructions)
{
var codes = new List(instructions);
for (int i = 0; i < codes.Count(); i++)
{
if (i > 0 && ShouldPatch(codes[i], codes[i - 1]))
{
+ DebugLogger.debug($"Patch_RepairUtility patch: {mBase.ReflectedType.Assembly.GetName().Name}.{mBase.ReflectedType.Name}.{mBase.Name}");
yield return new CodeInstruction(OpCodes.Call, typeof(PrisonLaborUtility).GetMethod(nameof(PrisonLaborUtility.GetPawnFaction)));
}
else
@@ -37,7 +40,7 @@ static IEnumerable Transpiler(IEnumerable inst
private static bool ShouldPatch(CodeInstruction actual, CodeInstruction prev)
{
- return prev.opcode == OpCodes.Ldarg_0 && actual.opcode == OpCodes.Callvirt && actual.operand != null && actual.operand.ToString().Contains("RimWorld.Faction get_Faction()");
+ return prev.opcode == OpCodes.Ldarg_0 && HPatcher.IsGetFactionOperand(actual);
}
}
diff --git a/Source/HarmonyPatches/Patches_WorkSettings/Patch_ResetWorktableWhenRecruited.cs b/Source/HarmonyPatches/Patches_WorkSettings/Patch_ResetWorktableWhenRecruited.cs
index a7d9eb2..d1a5cb1 100644
--- a/Source/HarmonyPatches/Patches_WorkSettings/Patch_ResetWorktableWhenRecruited.cs
+++ b/Source/HarmonyPatches/Patches_WorkSettings/Patch_ResetWorktableWhenRecruited.cs
@@ -23,7 +23,7 @@ static void Prefix(Pawn recruiter, Pawn recruitee)
if (recruitee != null && recruitee.IsPrisonerOfColony && recruiter != null && recruiter.Faction == Faction.OfPlayer)
{
CleanPrisonersStatus.Clean(recruitee);
- Log.Message($"[PrisonLabor] Removed prisoners effects from {recruitee.LabelShort}");
+ DebugLogger.debug($"Removed prisoners effects from {recruitee.LabelShort}");
}
}
diff --git a/Source/Organizer/NewsFeed.xml b/Source/Organizer/NewsFeed.xml
index a45f194..9264a7b 100644
--- a/Source/Organizer/NewsFeed.xml
+++ b/Source/Organizer/NewsFeed.xml
@@ -4,6 +4,16 @@
+
+ Prison Labor v1.4.9
+
+ - [-] Unfortunately interrogation requires Ideology DLC
+ - [-] Interrogation Chair should load with Ideology DLC. If already placed in your game, one time error may occur.
+ - [-] Some fixes and code refactor
+ - [gap]
+ - I was hoping that interrogation can be handled without Ideology DLC. Unfortunately, too many mechanisms are checked when DLC is installed. So... sorry for incontinence ;/
+
+
Prison Labor v1.4.8
diff --git a/changelog.txt b/changelog.txt
index d6d9bec..538bdd7 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,4 +1,8 @@
Changelog:
+1.4.9
+- Unfortunately interrogation requires Ideology DLC
+- Interrogation Chair should load with Ideology DLC. If already placed in your game, one time error may occur.
+- Some fixes and code refactor
1.4.8
- Apparel policy can be assigned to prisoners
- Motivated prisoner will respect assigned apparel policy