public static void TryGiveThoughts(IEnumerable <Pawn> victims, PawnDiedOrDownedThoughtsKind thoughtsKind) { foreach (Pawn victim in victims) { PawnDiedOrDownedThoughtsUtility.TryGiveThoughts(victim, null, thoughtsKind); } }
public static void Banish(Pawn pawn, int tile = -1) { if (pawn.Faction != Faction.OfPlayer && pawn.HostFaction != Faction.OfPlayer) { Log.Warning("Tried to banish " + pawn + " but he's neither a colonist, tame animal, nor prisoner."); } else { if (tile == -1) { tile = pawn.Tile; } bool flag = PawnBanishUtility.WouldBeLeftToDie(pawn, tile); PawnDiedOrDownedThoughtsUtility.TryGiveThoughts(pawn, null, (PawnDiedOrDownedThoughtsKind)((!flag) ? 1 : 2)); Caravan caravan = pawn.GetCaravan(); if (caravan != null) { CaravanInventoryUtility.MoveAllInventoryToSomeoneElse(pawn, caravan.PawnsListForReading, null); caravan.RemovePawn(pawn); if (flag) { if (Rand.Value < 0.800000011920929) { pawn.Kill(null, null); } else { PawnBanishUtility.HealIfPossible(pawn); } } if (pawn.guest != null) { pawn.guest.SetGuestStatus(null, false); } if (pawn.Faction == Faction.OfPlayer) { Faction newFaction = default(Faction); if (Find.FactionManager.TryGetRandomNonColonyHumanlikeFaction(out newFaction, pawn.Faction != null && (int)pawn.Faction.def.techLevel >= 3, false, TechLevel.Undefined)) { pawn.SetFaction(newFaction, null); } else { pawn.SetFaction(Faction.OfSpacer, null); } } } else { if (pawn.guest != null) { pawn.guest.SetGuestStatus(null, false); } if (pawn.Faction == Faction.OfPlayer) { pawn.SetFaction(Faction.OfSpacer, null); } } } }
public static void Banish(Pawn pawn, int tile = -1) { if (pawn.Faction != Faction.OfPlayer && pawn.HostFaction != Faction.OfPlayer) { Log.Warning(string.Concat("Tried to banish ", pawn, " but he's neither a colonist, tame animal, nor prisoner.")); return; } if (tile == -1) { tile = pawn.Tile; } bool flag = WouldBeLeftToDie(pawn, tile); if (!pawn.IsQuestLodger()) { PawnDiedOrDownedThoughtsUtility.TryGiveThoughts(pawn, null, (!flag) ? PawnDiedOrDownedThoughtsKind.Banished : PawnDiedOrDownedThoughtsKind.BanishedToDie); } Caravan caravan = pawn.GetCaravan(); if (caravan != null) { CaravanInventoryUtility.MoveAllInventoryToSomeoneElse(pawn, caravan.PawnsListForReading); caravan.RemovePawn(pawn); if (flag) { if (Rand.Value < 0.8f) { pawn.Kill(null, null); } else { HealIfPossible(pawn); } } } if (pawn.guest != null) { pawn.guest.SetGuestStatus(null); } if (pawn.Faction == Faction.OfPlayer) { if (!pawn.Spawned && Find.FactionManager.TryGetRandomNonColonyHumanlikeFaction_NewTemp(out var faction, pawn.Faction != null && (int)pawn.Faction.def.techLevel >= 3)) { if (pawn.Faction != faction) { pawn.SetFaction(faction); } } else if (pawn.Faction != null) { pawn.SetFaction(null); } }
public void Kidnap(Pawn pawn, Pawn kidnapper) { if (kidnappedPawns.Contains(pawn)) { Log.Error("Tried to kidnap already kidnapped pawn " + pawn); return; } if (pawn.Faction == faction) { Log.Error("Tried to kidnap pawn with the same faction: " + pawn); return; } pawn.PreKidnapped(kidnapper); if (pawn.Spawned) { pawn.DeSpawn(); } kidnappedPawns.Add(pawn); if (!Find.WorldPawns.Contains(pawn)) { Find.WorldPawns.PassToWorld(pawn); if (!Find.WorldPawns.Contains(pawn)) { Log.Error("WorldPawns discarded kidnapped pawn."); kidnappedPawns.Remove(pawn); } } if (pawn.Faction == Faction.OfPlayer) { PawnDiedOrDownedThoughtsUtility.TryGiveThoughts(pawn, null, PawnDiedOrDownedThoughtsKind.Lost); BillUtility.Notify_ColonistUnavailable(pawn); if (kidnapper != null) { Find.LetterStack.ReceiveLetter("LetterLabelPawnsKidnapped".Translate(pawn.Named("PAWN")), "LetterPawnsKidnapped".Translate(pawn.Named("PAWN"), kidnapper.Faction.Named("FACTION")), LetterDefOf.NegativeEvent); } } QuestUtility.SendQuestTargetSignals(pawn.questTags, "Kidnapped", this.Named("SUBJECT"), kidnapper.Named("KIDNAPPER")); Find.GameEnder.CheckOrUpdateGameOver(); }