Exemple #1
0
        public static void StartPrisonBreak(Pawn initiator)
        {
            PrisonBreakUtility.participatingRooms.Clear();
            foreach (IntVec3 current in GenRadial.RadialCellsAround(initiator.Position, 20f, true))
            {
                if (current.InBounds(initiator.Map))
                {
                    Room room = current.GetRoom(initiator.Map, RegionType.Set_Passable);
                    if (room != null && room.isPrisonCell)
                    {
                        PrisonBreakUtility.participatingRooms.Add(room);
                    }
                }
            }
            PrisonBreakUtility.RemoveRandomRooms(PrisonBreakUtility.participatingRooms, initiator);
            int sapperThingID = -1;

            if (Rand.Value < 0.5f)
            {
                sapperThingID = initiator.thingIDNumber;
            }
            PrisonBreakUtility.allEscapingPrisoners.Clear();
            foreach (Room current2 in PrisonBreakUtility.participatingRooms)
            {
                PrisonBreakUtility.StartPrisonBreakIn(current2, PrisonBreakUtility.allEscapingPrisoners, sapperThingID, PrisonBreakUtility.participatingRooms);
            }
            PrisonBreakUtility.participatingRooms.Clear();
            if (PrisonBreakUtility.allEscapingPrisoners.Any <Pawn>())
            {
                PrisonBreakUtility.SendPrisonBreakLetter(PrisonBreakUtility.allEscapingPrisoners);
            }
            PrisonBreakUtility.allEscapingPrisoners.Clear();
        }
        public static void StartPrisonBreak(Pawn initiator, out string letterText, out string letterLabel, out LetterDef letterDef)
        {
            PrisonBreakUtility.participatingRooms.Clear();
            foreach (IntVec3 current in GenRadial.RadialCellsAround(initiator.Position, 20f, true))
            {
                if (current.InBounds(initiator.Map))
                {
                    Room room = current.GetRoom(initiator.Map, RegionType.Set_Passable);
                    if (room != null && room.isPrisonCell)
                    {
                        PrisonBreakUtility.participatingRooms.Add(room);
                    }
                }
            }
            PrisonBreakUtility.RemoveRandomRooms(PrisonBreakUtility.participatingRooms, initiator);
            int sapperThingID = -1;

            if (Rand.Value < 0.5f)
            {
                sapperThingID = initiator.thingIDNumber;
            }
            PrisonBreakUtility.allEscapingPrisoners.Clear();
            foreach (Room current2 in PrisonBreakUtility.participatingRooms)
            {
                PrisonBreakUtility.StartPrisonBreakIn(current2, PrisonBreakUtility.allEscapingPrisoners, sapperThingID, PrisonBreakUtility.participatingRooms);
            }
            PrisonBreakUtility.participatingRooms.Clear();
            if (PrisonBreakUtility.allEscapingPrisoners.Any <Pawn>())
            {
                StringBuilder stringBuilder = new StringBuilder();
                for (int i = 0; i < PrisonBreakUtility.allEscapingPrisoners.Count; i++)
                {
                    stringBuilder.AppendLine("    " + PrisonBreakUtility.allEscapingPrisoners[i].LabelShort);
                }
                letterText = "LetterPrisonBreak".Translate(new object[]
                {
                    stringBuilder.ToString().TrimEndNewlines()
                });
                letterLabel = "LetterLabelPrisonBreak".Translate();
                letterDef   = LetterDefOf.ThreatBig;
                PrisonBreakUtility.allEscapingPrisoners.Clear();
            }
            else
            {
                letterText  = null;
                letterLabel = null;
                letterDef   = null;
            }
            Find.TickManager.slower.SignalForceNormalSpeed();
        }