Skip to content

Commit

Permalink
Stock up skips if surgery is to be done
Browse files Browse the repository at this point in the history
  • Loading branch information
alextd committed Oct 15, 2018
1 parent 82ad29d commit 04b0f2d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Source/StockUp/JobGiver_StockUp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,23 @@ public static class SmartMedicineJobDefOf

public class JobGiver_StockUp : ThinkNode_JobGiver
{
public static bool Skip(Pawn pawn)
{
Log.Message($"Skip need tend?");
if (pawn.Map.mapPawns.AllPawnsSpawned.Any(p => HealthAIUtility.ShouldBeTendedNowByPlayer(p) && pawn.CanReserveAndReach(p, PathEndMode.ClosestTouch, Danger.Deadly)))
return true;

if (pawn.Map.mapPawns.AllPawnsSpawned.Any(p => p is IBillGiver billGiver && billGiver.BillStack.AnyShouldDoNow && pawn.CanReserveAndReach(p, PathEndMode.ClosestTouch, Danger.Deadly)))
return true;

return false;
}
protected override Job TryGiveJob(Pawn pawn)
{
Log.Message($"{pawn} JobGiver_StockUp");
if (pawn.StockUpIsFull()) return null;

Log.Message($"Skip need tend?");
if (pawn.Map.mapPawns.AllPawnsSpawned.Any(p => HealthAIUtility.ShouldBeTendedNowByPlayer(p) && pawn.CanReserveAndReach(p, PathEndMode.ClosestTouch, Danger.Deadly)))
if (Skip(pawn))
return null;

Log.Message($"any things?");
Expand Down

0 comments on commit 04b0f2d

Please sign in to comment.