public static bool Reserve(PawnDestinationReservationManager __instance, Pawn p, Job job, IntVec3 loc) { if (p.Faction == null) { return(false); } Pawn claimant; if (p.Drafted && p.Faction == Faction.OfPlayer && (__instance.IsReserved(loc, out claimant) && claimant != p) && (!claimant.HostileTo((Thing)p) && claimant.Faction != p.Faction) && (claimant.mindState == null || claimant.mindState.mentalStateHandler == null || !claimant.mindState.mentalStateHandler.InMentalState || claimant.mindState.mentalStateHandler.CurStateDef.category != MentalStateCategory.Aggro && claimant.mindState.mentalStateHandler.CurStateDef.category != MentalStateCategory.Malicious)) { claimant.jobs.EndCurrentJob(JobCondition.InterruptForced, true, true); } ObsoleteAllClaimedBy2(p); PawnDestinationReservationManager.PawnDestinationSet destinationSet = GetPawnDestinationSetFor2(p.Faction); List <PawnDestinationReservationManager.PawnDestinationReservation> list = destinationSet.list; lock (list) { list.Add(new PawnDestinationReservationManager.PawnDestinationReservation() { target = loc, claimant = p, job = job }); } return(false); }
public static bool Reserve(PawnDestinationReservationManager __instance, Pawn p, Job job, IntVec3 loc) { if (p.Faction != null) { if (p.Drafted && p.Faction == Faction.OfPlayer && __instance.IsReserved(loc, out Pawn claimant) && claimant != p && !claimant.HostileTo(p) && claimant.Faction != p.Faction && ( claimant.mindState == null || claimant.mindState.mentalStateHandler == null || !claimant.mindState.mentalStateHandler.InMentalState || ( claimant.mindState.mentalStateHandler.CurStateDef.category != MentalStateCategory.Aggro && claimant.mindState.mentalStateHandler.CurStateDef.category != MentalStateCategory.Malicious))) { claimant.jobs.EndCurrentJob(JobCondition.InterruptForced); } __instance.ObsoleteAllClaimedBy(p); lock (__instance) { __instance.GetPawnDestinationSetFor(p.Faction).list.Add(new PawnDestinationReservation { target = loc, claimant = p, job = job }); } } return(false); }