Skip to content

Commit

Permalink
Remove outdated prison labor patch as mod's dev seems to have fixed c…
Browse files Browse the repository at this point in the history
…ompat issues

-Prison Labor added missing rest need NULL checks
  • Loading branch information
aRandomKiwi committed Aug 2, 2021
1 parent 4855c07 commit 518884c
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 96 deletions.
Binary file modified 1.3/Assemblies/AndroidTiers.dll
Binary file not shown.
8 changes: 0 additions & 8 deletions Source/Androids For RW1.3/AndroidTiers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,6 @@ public AndroidTiersPP(ModContentPack content) : base(content)
Log.Message("[ATPP] BIRDS AND BEES found");
}

Assembly assemblyPrisonLabor = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly assembly) => assembly.FullName.ToLower().StartsWith("prisonlabor"));
if (assemblyPrisonLabor != null)
{
Utils.PRISONLABOR_LOADED = true;
Utils.prisonLaborAssembly = assemblyPrisonLabor;
Log.Message("[ATPP] Prison Labor found");
}

Assembly assemblySaveOurShip2 = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly assembly) => assembly.FullName.ToLower().StartsWith("shipshaveinsides"));
if (assemblySaveOurShip2 != null)
{
Expand Down
43 changes: 0 additions & 43 deletions Source/Androids For RW1.3/Utils/CPatchs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,49 +36,6 @@ public static bool Psychology_AnxietyEnabledPrefix(ref bool __result)

public static Need_DummyRest dummyRest;

public static bool PrisonLabor_WorkTimePrefix(Pawn pawn, ref bool __result)
{
if (pawn != null && pawn.IsAndroidTier())
{
if (pawn.timetable == null)
__result = true;
else if (pawn.timetable.CurrentAssignment == TimeAssignmentDefOf.Work)
__result = true;
else if (pawn.timetable.CurrentAssignment == TimeAssignmentDefOf.Anything)
{
if (HealthAIUtility.ShouldSeekMedicalRest(pawn) ||
pawn.health.hediffSet.HasTemperatureInjury(TemperatureInjuryStage.Serious) ||
pawn.needs.food.CurCategory > HungerCategory.Hungry)
__result = false;
else
__result = true;
}
else
__result = false;

return false;
}

return true;
}

public static bool PrisonLabor_GetChangePointsPrefix(ref bool __result, Pawn ___pawn)
{
if (___pawn.IsAndroidTier())
{
___pawn.needs.rest = (Need_Rest)dummyRest;
}
return true;
}

public static void PrisonLabor_GetChangePointsPostfix(ref bool __result, Pawn ___pawn)
{
if (___pawn.IsAndroidTier())
{
___pawn.needs.rest = null;
}
}



public static void SaveOurShip2_hasSpaceSuit(Pawn thePawn, ref bool __result)
Expand Down
43 changes: 0 additions & 43 deletions Source/Androids For RW1.3/Utils/GC_ATPP.cs
Original file line number Diff line number Diff line change
Expand Up @@ -521,49 +521,6 @@ public GC_ATPP(Game game)
}
}*/

//PRISON LABOR Patching
if (Utils.PRISONLABOR_LOADED)
{
try
{
MethodInfo postfix = null;
MethodInfo original =null;
MethodInfo prefix = null;

//Utils.harmonyInstance;
Type t1 = Utils.prisonLaborAssembly.GetType("PrisonLabor.Core.PrisonLaborUtility");

//Try for old release
if (t1 == null)
{
Log.Message("[ATPP] PrisonLabor V1 not detected trying add compatibility with old release");

original = Utils.prisonLaborAssembly.GetType("PrisonLabor.PrisonLaborUtility").GetMethod("WorkTime", BindingFlags.Static | BindingFlags.Public);
prefix = typeof(CPaths).GetMethod("PrisonLabor_WorkTimePrefix", BindingFlags.Static | BindingFlags.Public);
Utils.harmonyInstance.Patch(original, new HarmonyMethod(prefix));

original = Utils.prisonLaborAssembly.GetType("PrisonLabor.Need_Motivation").GetMethod("get_LazinessRate", BindingFlags.Instance | BindingFlags.NonPublic);
prefix = typeof(CPaths).GetMethod("PrisonLabor_GetChangePointsPrefix", BindingFlags.Static | BindingFlags.Public);
postfix = typeof(CPaths).GetMethod("PrisonLabor_GetChangePointsPostfix", BindingFlags.Static | BindingFlags.Public);
}
else {
original = t1.GetMethod("WorkTime", BindingFlags.Static | BindingFlags.Public);
prefix = typeof(CPaths).GetMethod("PrisonLabor_WorkTimePrefix", BindingFlags.Static | BindingFlags.Public);
Utils.harmonyInstance.Patch(original, new HarmonyMethod(prefix));

original = Utils.prisonLaborAssembly.GetType("PrisonLabor.Core.Needs.Need_Motivation").GetMethod("GetChangePoints", BindingFlags.Instance | BindingFlags.NonPublic);
prefix = typeof(CPaths).GetMethod("PrisonLabor_GetChangePointsPrefix", BindingFlags.Static | BindingFlags.Public);
postfix = typeof(CPaths).GetMethod("PrisonLabor_GetChangePointsPostfix", BindingFlags.Static | BindingFlags.Public);
}

Utils.harmonyInstance.Patch(original, new HarmonyMethod(prefix), new HarmonyMethod(postfix));
}
catch (Exception e)
{
Log.Message("[ATPP] PrisonLaborPatching " + e.Message + " " + e.StackTrace);
}
}

//SoS2 patching
if (Utils.SAVEOURSHIP2_LOADED)
{
Expand Down
2 changes: 0 additions & 2 deletions Source/Androids For RW1.3/Utils/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public static class Utils
static public bool CELOADED = false;
static public bool MEDICINEPATCH_LOADED = false;
static public bool BIRDSANDBEES_LOADED = false;
static public bool PRISONLABOR_LOADED = false;
static public bool SAVEOURSHIP2_LOADED = false;
static public bool WORKTAB_LOADED = false;
static public bool HOSPITALITY_LOADED = false;
Expand Down Expand Up @@ -57,7 +56,6 @@ public static class Utils
public static Assembly smartMedicineAssembly;
public static Assembly medicinePatchAssembly;
public static Assembly androidTiersAssembly;
public static Assembly prisonLaborAssembly;
public static Assembly saveOurShip2Assembly;
public static Assembly hospitalityAssembly;
public static Assembly searchAndDestroyAssembly;
Expand Down
Binary file modified Source/Androids For RW1.3/obj/Debug/AndroidTiers.dll
Binary file not shown.

0 comments on commit 518884c

Please sign in to comment.