Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Source/CombatExtended/CombatExtended/AI/Comps/CompTend.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ public override Job TryGiveTacticalJob()
lastTendJobCheckedAt = GenTicks.TicksGame - COOLDOWN_TEND_JOB_CHECK / 2;
return SuppressionUtility.GetRunForCoverJob(SelPawn);
}
// Do not assign TendSelf if SelPawn is already reserved by another pawn (e.g currently being treated via TendPatient)
// Otherwise, this will trigger reservation conflict errors in TryMakePreToilReservations.
var reservations = SelPawn.Map?.reservationManager?.ReservationsReadOnly;
if (reservations != null)
{
for (int i = 0; i < reservations.Count; i++)
{
if (reservations[i].Target == SelPawn && reservations[i].Claimant != SelPawn)
{
lastTendJobCheckedAt = GenTicks.TicksGame;
return null;
}
}
}
lastTendJobAt = GenTicks.TicksGame;
Job job = JobMaker.MakeJob(CE_JobDefOf.TendSelf, SelPawn);
job.endAfterTendedOnce = false;
Expand Down
Loading