Added check to make sure pawn is in gathering area before joining

This commit is contained in:
c0ffee 2021-04-17 22:49:02 -07:00
parent 49fb421099
commit 5892f561fb
2 changed files with 14 additions and 1 deletions

Binary file not shown.

View File

@ -52,7 +52,20 @@ namespace RJW_Events
return null;
}
List<Pawn> targets = LordUtility.GetLord(pawn).ownedPawns;
List<Pawn> targets = LordUtility.GetLord(pawn).ownedPawns.Where((Pawn p) => {
if(p?.mindState?.duty == null)
{
return false;
}
IntVec3 cell = p.mindState.duty.focus.Cell;
if (GatheringsUtility.InGatheringArea(p.Position, cell, p.Map)) {
return true;
}
return false;
}).ToList();
if (!BestPawnForOrgyExists(pawn, targets, out Pawn pawn2))
{