private static void StartPrisonBreakIn(Room room, List <Pawn> outAllEscapingPrisoners, int sapperThingID, HashSet <Room> participatingRooms) { escapingPrisonersGroup.Clear(); AddPrisonersFrom(room, escapingPrisonersGroup); if (escapingPrisonersGroup.Any()) { foreach (Room participatingRoom in participatingRooms) { if (participatingRoom != room && RoomsAreCloseToEachOther(room, participatingRoom)) { AddPrisonersFrom(participatingRoom, escapingPrisonersGroup); } } if (RCellFinder.TryFindRandomExitSpot(escapingPrisonersGroup[0], out IntVec3 spot, TraverseMode.PassDoors) && TryFindGroupUpLoc(escapingPrisonersGroup, spot, out IntVec3 groupUpLoc)) { LordMaker.MakeNewLord(escapingPrisonersGroup[0].Faction, new LordJob_PrisonBreak(groupUpLoc, spot, sapperThingID), room.Map, escapingPrisonersGroup); for (int i = 0; i < escapingPrisonersGroup.Count; i++) { Pawn pawn = escapingPrisonersGroup[i]; if (pawn.CurJob != null && pawn.GetPosture().Laying()) { pawn.jobs.EndCurrentJob(JobCondition.InterruptForced); } else { pawn.jobs.CheckForJobOverride(); } pawn.guest.everParticipatedInPrisonBreak = true; pawn.guest.lastPrisonBreakTicks = Find.TickManager.TicksGame; outAllEscapingPrisoners.Add(pawn); } escapingPrisonersGroup.Clear(); } } }
private static void StartPrisonBreakIn(Room room, List <Pawn> outAllEscapingPrisoners, int sapperThingID, HashSet <Room> participatingRooms) { PrisonBreakUtility.escapingPrisonersGroup.Clear(); PrisonBreakUtility.AddPrisonersFrom(room, PrisonBreakUtility.escapingPrisonersGroup); if (!PrisonBreakUtility.escapingPrisonersGroup.Any <Pawn>()) { return; } foreach (Room current in participatingRooms) { if (current != room) { if (PrisonBreakUtility.RoomsAreCloseToEachOther(room, current)) { PrisonBreakUtility.AddPrisonersFrom(current, PrisonBreakUtility.escapingPrisonersGroup); } } } IntVec3 exitPoint; if (!RCellFinder.TryFindRandomExitSpot(PrisonBreakUtility.escapingPrisonersGroup[0], out exitPoint, TraverseMode.PassDoors)) { return; } IntVec3 groupUpLoc; if (!PrisonBreakUtility.TryFindGroupUpLoc(PrisonBreakUtility.escapingPrisonersGroup, exitPoint, out groupUpLoc)) { return; } LordMaker.MakeNewLord(PrisonBreakUtility.escapingPrisonersGroup[0].Faction, new LordJob_PrisonBreak(groupUpLoc, exitPoint, sapperThingID), room.Map, PrisonBreakUtility.escapingPrisonersGroup); for (int i = 0; i < PrisonBreakUtility.escapingPrisonersGroup.Count; i++) { Pawn pawn = PrisonBreakUtility.escapingPrisonersGroup[i]; if (pawn.CurJob != null && pawn.jobs.curDriver.layingDown != LayingDownState.NotLaying) { pawn.jobs.EndCurrentJob(JobCondition.InterruptForced, true); } else { pawn.jobs.CheckForJobOverride(); } pawn.guest.everParticipatedInPrisonBreak = true; pawn.guest.lastPrisonBreakTicks = Find.TickManager.TicksGame; outAllEscapingPrisoners.Add(pawn); } PrisonBreakUtility.escapingPrisonersGroup.Clear(); }