Esempio n. 1
0
        public void CollapseRoofsMarkedToCollapse()
        {
            RoofCollapseBuffer roofCollapseBuffer = map.roofCollapseBuffer;

            if (!roofCollapseBuffer.CellsMarkedToCollapse.Any())
            {
                return;
            }
            tmpCrushedThings.Clear();
            RoofCollapserImmediate.DropRoofInCells(roofCollapseBuffer.CellsMarkedToCollapse, map, tmpCrushedThings);
            if (tmpCrushedThings.Any())
            {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.AppendLine("RoofCollapsed".Translate());
                stringBuilder.AppendLine();
                stringBuilder.AppendLine("TheseThingsCrushed".Translate());
                tmpCrushedNames.Clear();
                for (int i = 0; i < tmpCrushedThings.Count; i++)
                {
                    Thing  thing = tmpCrushedThings[i];
                    Corpse corpse;
                    if ((corpse = thing as Corpse) == null || !corpse.Bugged)
                    {
                        string item = thing.LabelShortCap;
                        if (thing.def.category == ThingCategory.Pawn)
                        {
                            item = thing.LabelCap;
                        }
                        if (!tmpCrushedNames.Contains(item))
                        {
                            tmpCrushedNames.Add(item);
                        }
                    }
                }
                foreach (string tmpCrushedName in tmpCrushedNames)
                {
                    stringBuilder.AppendLine("    -" + tmpCrushedName);
                }
                Find.LetterStack.ReceiveLetter("LetterLabelRoofCollapsed".Translate(), stringBuilder.ToString().TrimEndNewlines(), LetterDefOf.NegativeEvent, new TargetInfo(roofCollapseBuffer.CellsMarkedToCollapse[0], map));
            }
            else
            {
                Messages.Message("RoofCollapsed".Translate(), new TargetInfo(roofCollapseBuffer.CellsMarkedToCollapse[0], map), MessageTypeDefOf.SilentInput);
            }
            tmpCrushedThings.Clear();
            roofCollapseBuffer.Clear();
        }
Esempio n. 2
0
        public void CollapseRoofsMarkedToCollapse()
        {
            RoofCollapseBuffer roofCollapseBuffer = this.map.roofCollapseBuffer;

            if (roofCollapseBuffer.CellsMarkedToCollapse.Any <IntVec3>())
            {
                this.tmpCrushedThings.Clear();
                RoofCollapserImmediate.DropRoofInCells(roofCollapseBuffer.CellsMarkedToCollapse, this.map, this.tmpCrushedThings);
                if (this.tmpCrushedThings.Any <Thing>())
                {
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.AppendLine("RoofCollapsed".Translate());
                    stringBuilder.AppendLine();
                    stringBuilder.AppendLine("TheseThingsCrushed".Translate());
                    this.tmpCrushedNames.Clear();
                    for (int i = 0; i < this.tmpCrushedThings.Count; i++)
                    {
                        Thing  thing = this.tmpCrushedThings[i];
                        string item  = thing.LabelShort.CapitalizeFirst();
                        if (thing.def.category == ThingCategory.Pawn)
                        {
                            item = thing.LabelCap;
                        }
                        if (!this.tmpCrushedNames.Contains(item))
                        {
                            this.tmpCrushedNames.Add(item);
                        }
                    }
                    foreach (string str in this.tmpCrushedNames)
                    {
                        stringBuilder.AppendLine("    -" + str);
                    }
                    Find.LetterStack.ReceiveLetter("LetterLabelRoofCollapsed".Translate(), stringBuilder.ToString().TrimEndNewlines(), LetterDefOf.NegativeEvent, new TargetInfo(roofCollapseBuffer.CellsMarkedToCollapse[0], this.map, false), null, null);
                }
                else
                {
                    string text = "RoofCollapsed".Translate();
                    Messages.Message(text, new TargetInfo(roofCollapseBuffer.CellsMarkedToCollapse[0], this.map, false), MessageTypeDefOf.SilentInput, true);
                }
                this.tmpCrushedThings.Clear();
                roofCollapseBuffer.Clear();
            }
        }
Esempio n. 3
0
        public void CollapseRoofsMarkedToCollapse()
        {
            RoofCollapseBuffer roofCollapseBuffer = this.map.roofCollapseBuffer;

            if (roofCollapseBuffer.CellsMarkedToCollapse.Count > 0)
            {
                RoofCollapserImmediate.DropRoofInCells(roofCollapseBuffer.CellsMarkedToCollapse, this.map);
                if (roofCollapseBuffer.CrushedThingsForLetter.Count > 0)
                {
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.AppendLine("RoofCollapsed".Translate());
                    stringBuilder.AppendLine();
                    stringBuilder.AppendLine("TheseThingsCrushed".Translate());
                    HashSet <string> hashSet = new HashSet <string>();
                    foreach (Thing item2 in roofCollapseBuffer.CrushedThingsForLetter)
                    {
                        string item = item2.LabelShort.CapitalizeFirst();
                        if (item2.def.category == ThingCategory.Pawn)
                        {
                            item = item2.LabelCap;
                        }
                        if (!hashSet.Contains(item))
                        {
                            hashSet.Add(item);
                        }
                    }
                    foreach (string item3 in hashSet)
                    {
                        stringBuilder.AppendLine("    -" + item3);
                    }
                    Find.LetterStack.ReceiveLetter("LetterLabelRoofCollapsed".Translate(), stringBuilder.ToString(), LetterDefOf.NegativeEvent, new TargetInfo(roofCollapseBuffer.CellsMarkedToCollapse[0], this.map, false), null);
                }
                else
                {
                    string text = "RoofCollapsed".Translate();
                    Messages.Message(text, new TargetInfo(roofCollapseBuffer.CellsMarkedToCollapse[0], this.map, false), MessageTypeDefOf.NegativeHealthEvent);
                }
                roofCollapseBuffer.Clear();
            }
        }