-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Compatibility with quarry * v1.1.5 release canditate * Fixes for prisoner patient * remove logging * add dll Co-authored-by: Hazzer <[email protected]>
- Loading branch information
Showing
16 changed files
with
141 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ internal static void Run() | |
SeedsPlease.Init(); | ||
//NoWaterNoLife.Init(); | ||
WorkTab.Init(); | ||
Quarry.Init(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
using HarmonyLib; | ||
using PrisonLabor.Core; | ||
using RimWorld; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Verse; | ||
using Verse.AI; | ||
|
||
namespace PrisonLabor.CompatibilityPatches | ||
{ | ||
internal static class Quarry | ||
{ | ||
private static bool foundType; | ||
internal static void Init() | ||
{ | ||
if (Check()) | ||
{ | ||
Patch(); | ||
} | ||
} | ||
|
||
private static void Patch() | ||
{ | ||
try | ||
{ | ||
MethodBase methodBase = getTargetMethod(); | ||
if (methodBase != null) | ||
{ | ||
var harmony = new Harmony("Harmony_PrisonLabor_Quarry"); | ||
harmony.Patch(methodBase, postfix: new HarmonyMethod(typeof(Quarry).GetMethod("postfix_Job"))); | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
Log.Error($"PrisonLaborException: failed to proceed Query mod patches: {e.ToString()}"); | ||
} | ||
|
||
} | ||
|
||
public static Job postfix_Job(Job __result, Pawn pawn, Thing t, bool forced) | ||
{ | ||
WorkTypeDef workDef = DefDatabase<WorkTypeDef>.GetNamed("QuarryMining"); | ||
|
||
if (__result != null && pawn.Faction.IsPlayer && !pawn.IsPrisonerOfColony && PrisonLaborUtility.IsDisabledByLabor(__result.targetA.Cell, pawn, workDef)) | ||
{ | ||
return null; | ||
} | ||
return __result; | ||
} | ||
private static MethodBase getTargetMethod() | ||
{ | ||
WorkGiverDef workDef = DefDatabase<WorkGiverDef>.GetNamed("QRY_MineQuarry"); | ||
return workDef.giverClass.GetMethod("JobOnThing"); | ||
} | ||
|
||
private static bool Check() | ||
{ | ||
try | ||
{ | ||
var mod = LoadedModManager.RunningMods.First(m => m.Name == "Quarry 1.1"); | ||
foundType = mod != null; | ||
Verse.Log.Message($"[PL] Trying to find: {mod}, Result: {foundType}"); | ||
} | ||
catch | ||
{ | ||
foundType = false; | ||
} | ||
return foundType; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,7 @@ public enum Version | |
v1_1_0, | ||
v1_1_2, | ||
v1_1_3, | ||
v1_1_4 | ||
v1_1_4, | ||
v1_1_5 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters