-
-
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.
Merge pull request #247 from Aviuz/1.3.6
release candidate
- Loading branch information
Showing
38 changed files
with
396 additions
and
400 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<Patch> | ||
<Operation Class="PatchOperationSequence"> | ||
<success>Normal</success> | ||
<operations> | ||
<li Class="PatchOperationReplace"> | ||
<xpath>*/WorkGiverDef[defName="DoExecution"]/workType</xpath> | ||
<value> | ||
<workType>PrisonLabor_Jailor</workType> | ||
</value> | ||
</li> | ||
<li Class="PatchOperationReplace"> | ||
<xpath>*/WorkGiverDef[defName="ExecuteGuiltyColonist"]/workType</xpath> | ||
<value> | ||
<workType>PrisonLabor_Jailor</workType> | ||
</value> | ||
</li> | ||
<li Class="PatchOperationReplace"> | ||
<xpath>*/WorkGiverDef[defName="ReleasePrisoner"]/workType</xpath> | ||
<value> | ||
<workType>PrisonLabor_Jailor</workType> | ||
</value> | ||
</li> | ||
<li Class="PatchOperationReplace"> | ||
<xpath>*/WorkGiverDef[defName="TakePrisonerToBed"]/workType</xpath> | ||
<value> | ||
<workType>PrisonLabor_Jailor</workType> | ||
</value> | ||
</li> | ||
</operations> | ||
</Operation> | ||
|
||
</Patch> |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<Patch> | ||
<Operation Class="PatchOperationSequence"> | ||
<success>Normal</success> | ||
<operations> | ||
<li Class="PatchOperationReplace"> | ||
<xpath>*/WorkGiverDef[defName="ExecuteSlave"]/workType</xpath> | ||
<value> | ||
<workType>PrisonLabor_Jailor</workType> | ||
</value> | ||
</li> | ||
</operations> | ||
</Operation> | ||
</Patch> |
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 |
---|---|---|
@@ -0,0 +1,68 @@ | ||
using CashRegister.Shifts; | ||
using HarmonyLib; | ||
using PrisonLabor.Core.Other; | ||
using RimWorld; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Verse; | ||
|
||
namespace PrisonLabor.CompatibilityPatches | ||
{ | ||
static class CashRegister | ||
{ | ||
private static ModSearcher modSeeker; | ||
internal static void Init() | ||
{ | ||
ModSearcher modSeeker = new ModSearcher("Cash Register"); | ||
if (modSeeker.LookForMod()) | ||
{ | ||
Patch(); | ||
} | ||
} | ||
|
||
private static void Patch() | ||
{ | ||
try | ||
{ | ||
MethodBase methodBase = GetTargetMethod(); | ||
if (methodBase != null) | ||
{ | ||
var harmony = new Harmony("Harmony_PrisonLabor_CashRegister"); | ||
harmony.Patch(methodBase, postfix: new HarmonyMethod(typeof(CashRegister).GetMethod("PostFixCandidates"))); | ||
Log.Message("Prison Labor: Cash Register mod patched"); | ||
} | ||
} | ||
catch (Exception e) | ||
{ | ||
Log.Error($"PrisonLaborException: failed to proceed Cash Register mod patches: {e.ToString()}"); | ||
} | ||
|
||
} | ||
|
||
public static IEnumerable<Pawn> PostFixCandidates(IEnumerable<Pawn> __result, CompAssignableToPawn __instance) | ||
{ | ||
foreach(Pawn pawn in __result) | ||
{ | ||
yield return pawn; | ||
} | ||
|
||
if (__instance.parent.Spawned && __instance is CompAssignableToPawn_Shifts) | ||
{ | ||
foreach(Pawn pawn in __instance.parent.Map.mapPawns.PrisonersOfColonySpawned) | ||
{ | ||
yield return pawn; | ||
} | ||
} | ||
} | ||
|
||
private static MethodBase GetTargetMethod() | ||
{ | ||
return AccessTools.Method(typeof(CompAssignableToPawn), "get_AssigningCandidates"); | ||
} | ||
} | ||
|
||
} |
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() | |
//NoWaterNoLife.Init(); | ||
Quarry.Init(); | ||
Kajin2.Init(); | ||
CashRegister.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
45 changes: 45 additions & 0 deletions
45
Source/Core/AI/WorkGivers/WorkGivers_ManipulatePrisoner.cs
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,45 @@ | ||
using RimWorld; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Verse; | ||
using Verse.AI; | ||
|
||
namespace PrisonLabor.Core.AI.WorkGivers | ||
{ | ||
class WorkGivers_ManipulatePrisoner : WorkGiver_Warden | ||
{ | ||
public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false) | ||
{ | ||
var prisoner = t as Pawn; | ||
|
||
if (prisoner == null) | ||
return null; | ||
if (!ShouldTakeCareOfPrisoner(pawn, prisoner)) | ||
return null; | ||
if (prisoner.Downed || !pawn.CanReserve(t, 1, -1, null, false) || !prisoner.Awake()) | ||
return null; | ||
if (pawn.IsPrisoner) | ||
return null; | ||
|
||
|
||
if (PrisonLaborUtility.RecruitInLaborEnabled(prisoner)) | ||
{ | ||
return new Job(JobDefOf.PrisonerAttemptRecruit, t); | ||
} | ||
if (PrisonLaborUtility.ConvertInLaborEnabled(prisoner)) | ||
{ | ||
return new Job(JobDefOf.PrisonerConvert, t); | ||
} | ||
if (PrisonLaborUtility.EnslaveInLaborEnabled(prisoner)) | ||
{ | ||
return new Job(JobDefOf.PrisonerEnslave, t); | ||
} | ||
|
||
return null; | ||
} | ||
} | ||
} | ||
|
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 |
---|---|---|
|
@@ -73,6 +73,7 @@ public enum Version | |
v1_3_2, | ||
v1_3_3, | ||
v1_3_4, | ||
v1_3_5 | ||
v1_3_5, | ||
v1_3_6 | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
using PrisonLabor.Core.GameSaves; | ||
using PrisonLabor.Tweaks; | ||
using UnityEngine; | ||
using Verse; | ||
|
||
|
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
36 changes: 0 additions & 36 deletions
36
Source/HarmonyPatches/Patches_Construction/Patch_RoofReservation.cs
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.