-
-
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.
- Loading branch information
Hazzer
authored
Apr 13, 2022
1 parent
d57c111
commit c68fd99
Showing
20 changed files
with
150 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,37 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Defs> | ||
<ThinkTreeDef> | ||
<defName>PrisonLabor_WorkThinkTree</defName> | ||
<insertTag>Humanlike_PostDuty</insertTag> | ||
<insertPriority>80</insertPriority> | ||
<thinkRoot Class="PrisonLabor.Core.AI.ThinkNodes.ThinkNode_Labor"> | ||
<invert>false</invert> | ||
<subNodes> | ||
<li Class="PrisonLabor.Core.AI.ThinkNodes.ThinkNode_SeekSafeTemperature"> | ||
<ThinkTreeDef> | ||
<defName>PrisonLabor_WorkThinkTree</defName> | ||
<insertTag>Humanlike_PostDuty</insertTag> | ||
<insertPriority>80</insertPriority> | ||
<thinkRoot Class="PrisonLabor.Core.AI.ThinkNodes.ThinkNode_Labor"> | ||
<invert>false</invert> | ||
<subNodes> | ||
<li Class="JobGiver_SeekSafeTemperature"/> | ||
<li Class="PrisonLabor.Core.AI.ThinkNodes.ThinkNode_SeekSafeTemperature"> | ||
<subNodes> | ||
<li Class="JobGiver_SeekSafeTemperature"/> | ||
</subNodes> | ||
</li> | ||
<li Class="PrisonLabor.Core.AI.ThinkNodes.ThinkNode_IsMotivated"> | ||
<subNodes> | ||
<li Class="JobGiver_TakeDrugsForDrugPolicy"/> | ||
</subNodes> | ||
</li> | ||
<li Class="ThinkNode_Tagger"> | ||
<tagToGive>ChangingApparel</tagToGive> | ||
<subNodes> | ||
<li Class="JobGiver_PrisonerGetDressed" /> | ||
</subNodes> | ||
</li> | ||
<li Class="ThinkNode_Priority"> | ||
<subNodes> | ||
<li Class="PrisonLabor.Core.AI.JobGivers.JobGiver_BedTime" /> | ||
<li Class="PrisonLabor.Core.AI.JobGivers.JobGiver_PickupWeapon" /> | ||
<li Class="PrisonLabor.Core.AI.JobGivers.JobGiver_Diet" /> | ||
<li Class="PrisonLabor.Core.AI.JobGivers.JobGiver_Labor" /> | ||
</subNodes> | ||
</li> | ||
</subNodes> | ||
</li> | ||
<li Class="ThinkNode_Tagger"> | ||
<tagToGive>ChangingApparel</tagToGive> | ||
<subNodes> | ||
<li Class="JobGiver_PrisonerGetDressed" /> | ||
</subNodes> | ||
</li> | ||
<li Class="ThinkNode_Priority"> | ||
<subNodes> | ||
<li Class="PrisonLabor.Core.AI.JobGivers.JobGiver_BedTime" /> | ||
<li Class="PrisonLabor.Core.AI.JobGivers.JobGiver_PickupWeapon" /> | ||
<li Class="PrisonLabor.Core.AI.JobGivers.JobGiver_Diet" /> | ||
<li Class="PrisonLabor.Core.AI.JobGivers.JobGiver_Labor" /> | ||
</subNodes> | ||
</li> | ||
</subNodes> | ||
</thinkRoot> | ||
</ThinkTreeDef> | ||
</thinkRoot> | ||
</ThinkTreeDef> | ||
</Defs> |
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,26 @@ | ||
using PrisonLabor.Core.Needs; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using RimWorld; | ||
using Verse; | ||
using Verse.AI; | ||
|
||
namespace PrisonLabor.Core.AI.ThinkNodes | ||
{ | ||
class ThinkNode_IsMotivated : ThinkNode_Conditional | ||
{ | ||
protected override bool Satisfied(Pawn pawn) | ||
{ | ||
bool motivatedPrisoner = pawn.IsPrisonerOfColony && pawn.IsMotivated(); | ||
if (motivatedPrisoner && pawn.drugs == null) | ||
{ | ||
//Migration from older version of PL | ||
pawn.drugs = new Pawn_DrugPolicyTracker(pawn); | ||
} | ||
return motivatedPrisoner; | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -75,6 +75,7 @@ public enum Version | |
v1_3_4, | ||
v1_3_5, | ||
v1_3_6, | ||
v1_3_7 | ||
v1_3_7, | ||
v1_3_8 | ||
} | ||
} |
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,19 @@ | ||
using PrisonLabor.Core.Meta; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Verse; | ||
|
||
namespace PrisonLabor.Core.Needs | ||
{ | ||
public static class NeedsUtils | ||
{ | ||
public static bool IsMotivated(this Pawn pawn) | ||
{ | ||
var need = pawn.needs.TryGetNeed<Need_Motivation>(); | ||
return !PrisonLaborPrefs.EnableMotivationMechanics || ( need != null && !need.IsLazy); | ||
} | ||
} | ||
} |
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
32 changes: 32 additions & 0 deletions
32
Source/HarmonyPatches/Patches_Work/Patch_WorkGiver_CleanSnow.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,32 @@ | ||
using HarmonyLib; | ||
using PrisonLabor.Core; | ||
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.HarmonyPatches.Patches_Work | ||
{ | ||
[HarmonyPatch(typeof(WorkGiver_ClearSnow), "HasJobOnCell")] | ||
class Patch_WorkGiver_CleanSnow | ||
{ | ||
static bool Postfix(bool __result, Pawn pawn, IntVec3 c, bool forced) | ||
{ | ||
if(pawn.IsPrisonerOfColony) | ||
{ | ||
WorkGiverDef workGiverDef = DefDatabase<WorkGiverDef>.GetNamed("CleanClearSnow"); | ||
return pawn.Map.snowGrid.GetDepth(c) >= 0.200000002980232 && | ||
!c.IsForbidden(pawn) && | ||
pawn.CanReserveAndReach(c, PathEndMode.ClosestTouch, pawn.NormalMaxDanger(), 1, -1, null, forced) && | ||
PrisonLaborUtility.CanWorkHere(c, pawn, workGiverDef.workType); | ||
|
||
|
||
} | ||
return __result; | ||
} | ||
} | ||
} |
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