public void Kidnap(Pawn pawn, Pawn kidnapper) { if (kidnappedPawns.Contains(pawn)) { Log.Error("Tried to kidnap already kidnapped pawn " + pawn); } else if (pawn.Faction == faction) { Log.Error("Tried to kidnap pawn with the same faction: " + pawn); } else { 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) { BillUtility.Notify_ColonistUnavailable(pawn); } } }
public void Kidnap(Pawn pawn, Pawn kidnapper) { if (this.kidnappedPawns.Contains(pawn)) { Log.Error("Tried to kidnap already kidnapped pawn " + pawn, false); return; } if (pawn.Faction == this.faction) { Log.Error("Tried to kidnap pawn with the same faction: " + pawn, false); return; } pawn.PreKidnapped(kidnapper); if (pawn.Spawned) { pawn.DeSpawn(DestroyMode.Vanish); } this.kidnappedPawns.Add(pawn); if (!Find.WorldPawns.Contains(pawn)) { Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Decide); if (!Find.WorldPawns.Contains(pawn)) { Log.Error("WorldPawns discarded kidnapped pawn.", false); this.kidnappedPawns.Remove(pawn); } } if (pawn.Faction == Faction.OfPlayer) { BillUtility.Notify_ColonistUnavailable(pawn); } }
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(); }