static bool Prefix(MapParent settlement) { Settlement factionBase = settlement as Settlement; if (WorldObjectRemnantColony.CanCreateRemnantColony(factionBase)) { //custom text for remnant colony Map map = settlement.Map; StringBuilder stringBuilder = new StringBuilder(); IEnumerable <Pawn> source = map.mapPawns.PawnsInFaction(Faction.OfPlayer); if (source.Any()) { StringBuilder stringBuilder2 = new StringBuilder(); foreach (Pawn current in from x in source orderby x.IsColonist descending select x) { if (stringBuilder2.Length > 0) { stringBuilder2.AppendLine(); } stringBuilder2.Append(" " + current.LabelCap); } stringBuilder.Append("ConfirmAbandonHomeWithColonyPawns".Translate(stringBuilder2.ToString())); } //any pawns we wont use in the remnant colony will be banished(e.g. animals and prisoner) PawnDiedOrDownedThoughtsUtility.BuildMoodThoughtsListString( map.mapPawns.AllPawns.Except(WorldObjectRemnantColony.GetPawnsFromSettlementForRemnantColony(factionBase)), PawnDiedOrDownedThoughtsKind.Banished, stringBuilder, null, "\n\n" + "ConfirmAbandonHomeNegativeThoughts_Everyone".Translate(), "ConfirmAbandonHomeNegativeThoughts"); Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation(stringBuilder.ToString(), delegate { typeof(SettlementAbandonUtility).GetMethod("Abandon", BindingFlags.NonPublic | BindingFlags.Static).Invoke(null, new Object[] { settlement }); }, false, null)); return(false); } return(true); }
public ModelPlaceOrder(WorldObjectRemnantColony colony) { this.colony = colony; }