Esempio n. 1
0
        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();
        }