public override void EjectContents() { var filthSlime = ThingDefOf.Filth_Slime; foreach (var thing in innerContainer) { if (!(thing is Pawn pawn)) { continue; } PawnComponentsUtility.AddComponentsForSpawn(pawn); pawn.filth.GainFilth(filthSlime); Trainer.ResetComp(pawn); if (!pawn.PsiTracker().Activated) { continue; } pawn.PsiTracker().TrainingSuspended = true; } if (!Destroyed) { SoundDefOf.CryptosleepCasket_Eject.PlayOneShot(SoundInfo.InMap(new TargetInfo(Position, Map))); } innerContainer.TryDropAll(InteractionCell, Map, ThingPlaceMode.Near); contentsKnown = true; }
// Verse.StartingSlaveUtility public static Pawn NewGeneratedStartingSlave() { var request = new PawnGenerationRequest( PawnKindDefOf.Slave, Faction.OfPlayer, PawnGenerationContext.PlayerStarter, -1, true, false, false, false, true, false, 26f, false, true, true, false, false, false, false, false, 0, 0, null, 1, X => !X.story.DisabledWorkTagsBackstoryAndTraits.HasFlag(WorkTags.Hauling)); Pawn pawn; try { pawn = PawnGenerator.GeneratePawn(request); } catch (Exception arg) { Log.Error( "There was an exception thrown by the PawnGenerator during generating a starting pawn. Trying one more time...\nException: " + arg); pawn = PawnGenerator.GeneratePawn(request); } pawn.relations.everSeenByPlayer = true; PawnComponentsUtility.AddComponentsForSpawn(pawn); return(pawn); }
protected virtual Pawn GenerateDemon() { PawnKindDef pdef = DemonDefOfs.Demon_Undivided; int num = Rand.RangeInclusive(0, 4); switch (num) { case 0: { pdef = DemonDefOfs.Demon_Bloodletter; break; } case 1: { pdef = DemonDefOfs.Demon_Plaguebearer; break; } case 2: { pdef = DemonDefOfs.Demon_Daemonette; break; } case 3: { pdef = DemonDefOfs.Demon_Horror; break; } case 4: { pdef = DemonDefOfs.Demon_Undivided; break; } } PawnGenerationRequest request = new PawnGenerationRequest(pdef, null); Pawn pawn = null; try { pawn = PawnGenerator.GeneratePawn(request); } catch (Exception arg) { Log.Error("There was an exception thrown by the PawnGenerator during generating a starting pawn. Trying one more time...\nException: " + arg); pawn = PawnGenerator.GeneratePawn(request); } pawn.relations.everSeenByPlayer = true; PawnComponentsUtility.AddComponentsForSpawn(pawn); return(pawn); }
// Token: 0x060024B9 RID: 9401 RVA: 0x00117A10 File Offset: 0x00115E10 public override void EjectContents() { List <Thing> list = new List <Thing>(); if (!this.contentsKnown) { list.AddRange(this.innerContainer); list.AddRange(this.UnopenedCasketsInGroup().SelectMany((Building_XenomorphCryptosleepCasket c) => c.innerContainer)); } bool contentsKnown = this.contentsKnown; ThingDef filth_Slime = ThingDefOf.Filth_Slime; foreach (Thing thing in ((IEnumerable <Thing>) this.innerContainer)) { if (thing is Pawn pawn) { PawnComponentsUtility.AddComponentsForSpawn(pawn); pawn.filth.GainFilth(filth_Slime); if (pawn.RaceProps.IsFlesh) { pawn.health.AddHediff(HediffDefOf.CryptosleepSickness, null, null, null); } } } if (!base.Destroyed) { SoundDefOf.CryptosleepCasket_Eject.PlayOneShot(SoundInfo.InMap(new TargetInfo(base.Position, base.Map, false), MaintenanceType.None)); } this.innerContainer.TryDropAll(this.InteractionCell, base.Map, ThingPlaceMode.Near, null, (x => GridsUtility.GetFirstBuilding(x, this.Map) == null)); this.contentsKnown = true; if (!contentsKnown) { // ThingDef filth_Slime = ThingDefOf.Filth_Slime; FilthMaker.TryMakeFilth(base.Position, base.Map, filth_Slime, Rand.Range(8, 12)); this.SetFaction(null, null); /* * foreach (Building_XenomorphCryptosleepCasket building_AncientCryptosleepCasket in this.UnopenedCasketsInGroup()) * { * building_AncientCryptosleepCasket.EjectContents(); * } */ List <Pawn> source = list.OfType <Pawn>().ToList <Pawn>(); IEnumerable <Pawn> enumerable = from p in source where p.RaceProps.Humanlike && p.GetLord() == null && p.Faction == Faction.OfAncientsHostile select p; if (enumerable.Any <Pawn>()) { LordMaker.MakeNewLord(Faction.OfAncientsHostile, new LordJob_AssaultColony(Faction.OfAncientsHostile, false, false, false, false, false), base.Map, enumerable); } } }
private static void Postfix(ref Pawn __result) { if (__result == null) { return; } if (Faction.OfPlayer.def.basicMemberKind != PawnKindDefOf.AndroidT2ColonistGeneral) { } else { var rnd = new Random(); PawnGenerationRequest request; switch (rnd.Next(1, 3)) { case 1: request = new PawnGenerationRequest(PawnKindDefOf.AndroidT2ColonistGeneral, Faction.OfPlayer, PawnGenerationContext.PlayerStarter, -1, true, false, false, false, true, TutorSystem.TutorialMode, 20f, false, true, true, false); break; case 2: request = new PawnGenerationRequest(PawnKindDefOf.AndroidT1ColonistGeneral, Faction.OfPlayer, PawnGenerationContext.PlayerStarter, -1, true, false, false, false, true, TutorSystem.TutorialMode, 20f, false, true, true, false); break; default: request = new PawnGenerationRequest(Faction.OfPlayer.def.basicMemberKind, Faction.OfPlayer, PawnGenerationContext.PlayerStarter, -1, true, false, false, false, true, TutorSystem.TutorialMode, 20f, false, true, true, false); break; } __result = null; try { __result = PawnGenerator.GeneratePawn(request); } catch (Exception arg) { Log.Error("There was an exception thrown by the PawnGenerator during generating a starting pawn. Trying one more time...\nException: " + arg); __result = PawnGenerator.GeneratePawn(request); } __result.relations.everSeenByPlayer = true; PawnComponentsUtility.AddComponentsForSpawn(__result); } }
public override void EjectContents() { foreach (var current in innerContainer) { if (current is Pawn pawn) { PawnComponentsUtility.AddComponentsForSpawn(pawn); } } if (!Destroyed) { SoundDef.Named("BurrowSFX").PlayOneShot(SoundInfo.InMap(new TargetInfo(Position, Map))); } innerContainer.TryDropAll(InteractionCell, Map, ThingPlaceMode.Near); contentsKnown = true; }
public static Pawn NewGeneratedStartingPawn() { PawnGenerationRequest request = new PawnGenerationRequest(Faction.OfPlayer.def.basicMemberKind, Faction.OfPlayer, PawnGenerationContext.PlayerStarter, -1, true, false, false, false, true, false, 26f, false, true, true, false, false, false, false, null, null, null, null, null, null, null); Pawn pawn = null; try { pawn = PawnGenerator.GeneratePawn(request); } catch (Exception arg) { Log.Error("There was an exception thrown by the PawnGenerator during generating a starting pawn. Trying one more time...\nException: " + arg); pawn = PawnGenerator.GeneratePawn(request); } pawn.relations.everSeenByPlayer = true; PawnComponentsUtility.AddComponentsForSpawn(pawn); return(pawn); }
public static Pawn NewGeneratedStartingPawn() { PawnGenerationRequest request = new PawnGenerationRequest(Faction.OfPlayer.def.basicMemberKind, Faction.OfPlayer, PawnGenerationContext.PlayerStarter, -1, forceGenerateNewPawn: true, newborn: false, allowDead: false, allowDowned: false, canGeneratePawnRelations: true, TutorSystem.TutorialMode, 20f); Pawn pawn = null; try { pawn = PawnGenerator.GeneratePawn(request); } catch (Exception arg) { Log.Error("There was an exception thrown by the PawnGenerator during generating a starting pawn. Trying one more time...\nException: " + arg); pawn = PawnGenerator.GeneratePawn(request); } pawn.relations.everSeenByPlayer = true; PawnComponentsUtility.AddComponentsForSpawn(pawn); return(pawn); }
public override void EjectContents() { foreach (Thing current in (IEnumerable <Thing>) this.innerContainer) { Pawn pawn = current as Pawn; if (pawn != null) { PawnComponentsUtility.AddComponentsForSpawn(pawn); } } if (!base.Destroyed) { SoundDef.Named("BurrowSFX").PlayOneShot(SoundInfo.InMap(new TargetInfo(base.Position, base.Map, false), MaintenanceType.None)); } this.innerContainer.TryDropAll(this.InteractionCell, base.Map, ThingPlaceMode.Near); this.contentsKnown = true; }
public override void EjectContents() { ForceEndJobState(); foreach (Thing thing in innerContainer) { if (thing is Pawn pawn) { PawnComponentsUtility.AddComponentsForSpawn(pawn); } } if (!Destroyed && innerContainer.Any()) { SoundDefOf.CryptosleepCasket_Eject.PlayOneShot(SoundInfo.InMap(new TargetInfo(Position, Map, false), MaintenanceType.None)); } innerContainer.TryDropAll(InteractionCell, Map, ThingPlaceMode.Near, null, null); contentsKnown = true; }
public static bool NewGeneratedStartingPawn_Prefix(ref Pawn __result) { if (Find.Scenario.name == "Resident Evil - Umbrella Corp") { var kindDef = (Rand.Value > 0.5f) ? PawnKindDef.Named("RE_UmbrellaScientist") : PawnKindDef.Named("RE_UmbrellaSecurity"); PawnGenerationRequest request = new PawnGenerationRequest(kindDef, Faction.OfPlayer, PawnGenerationContext.PlayerStarter, -1, true, false, false, false, true, TutorSystem.TutorialMode, 20f); Pawn pawn = null; try { pawn = PawnGenerator.GeneratePawn(request); if (pawn.kindDef.defName == "RE_UmbrellaScientist") { if (pawn?.story?.adulthood?.spawnCategories.Contains("RE_UmbrellaSec") == true) { var properScienceBackstories = BackstoryDatabase.allBackstories.Values.Where(x => x.slot == BackstorySlot.Adulthood && x.spawnCategories.Contains("RE_Umbrella")); pawn.story.adulthood = properScienceBackstories.RandomElement(); AccessTools.Method(typeof(PawnGenerator), "GenerateBodyType").Invoke(null, new object[] { pawn }); AccessTools.Method(typeof(PawnGenerator), "GenerateSkills").Invoke(null, new object[] { pawn }); //pawn.Drawer.renderer.graphics.ResolveAllGraphics(); } } else { if (pawn?.story?.adulthood?.spawnCategories.Contains("RE_Umbrella") == true) { var properSecurityBackstories = BackstoryDatabase.allBackstories.Values.Where(x => x.slot == BackstorySlot.Adulthood && x.spawnCategories.Contains("RE_UmbrellaSec")); pawn.story.adulthood = properSecurityBackstories.RandomElement(); AccessTools.Method(typeof(PawnGenerator), "GenerateBodyType").Invoke(null, new object[] { pawn }); AccessTools.Method(typeof(PawnGenerator), "GenerateSkills").Invoke(null, new object[] { pawn }); } } } catch (Exception arg) { Log.Error("There was an exception thrown by the PawnGenerator during generating a starting pawn. Trying one more time...\nException: " + arg); pawn = PawnGenerator.GeneratePawn(request); } pawn.relations.everSeenByPlayer = true; PawnComponentsUtility.AddComponentsForSpawn(pawn); __result = pawn; return(false); } return(true); }
public override void EjectContents() { this.ForceEndJobState(); foreach (Thing thing in ((IEnumerable <Thing>) this.innerContainer)) { Pawn pawn = thing as Pawn; if (pawn != null) { PawnComponentsUtility.AddComponentsForSpawn(pawn); } } if (!base.Destroyed && this.innerContainer.Any()) { SoundDefOf.CryptosleepCasket_Eject.PlayOneShot(SoundInfo.InMap(new TargetInfo(base.Position, base.Map, false), MaintenanceType.None)); } this.innerContainer.TryDropAll(this.InteractionCell, base.Map, ThingPlaceMode.Near, null, null); this.contentsKnown = true; }
public override void EjectContents() { ThingDef filthSlime = ThingDefOf.FilthSlime; foreach (Thing current in this.innerContainer) { Pawn pawn = current as Pawn; if (pawn != null) { PawnComponentsUtility.AddComponentsForSpawn(pawn); pawn.filth.GainFilth(filthSlime); // pawn.health.AddHediff(HediffDefOf.CryptosleepSickness, null, null); } } if (!base.Destroyed) { SoundDef.Named("CryptosleepCasketEject").PlayOneShot(SoundInfo.InMap(new TargetInfo(base.Position, base.Map, false), MaintenanceType.None)); } base.EjectContents(); }
public override void EjectContents() { foreach (Thing current in ((IEnumerable <Thing>) this.innerContainer)) { if (current is Pawn pawn) { PawnComponentsUtility.AddComponentsForSpawn(pawn); pawn.filth.GainFilth(ThingDefOf.Filth_Slime); //pawn.health.AddHediff(HediffDefOf.ToxicBuildup, null, null); HealthUtility.AdjustSeverity(pawn, HediffDefOf.ToxicBuildup, 0.3f); } } if (this.MapHeld != null) { this.innerContainer.TryDropAll(this.PositionHeld, this.MapHeld, ThingPlaceMode.Near); } this.contentsKnown = true; if (!this.Destroyed) { this.Destroy(DestroyMode.KillFinalize); } }
public static Pawn NewGeneratedStartingPawn(PawnKindDef kindDef) { if (kindDef == null) { Log.Error("KindDef NULL"); } PawnGenerationRequest request = new PawnGenerationRequest(kindDef, Faction.OfPlayer, PawnGenerationContext.PlayerStarter, -1, true, false, false, false, true, TutorSystem.TutorialMode, 20f, false, true, true, true, false, false, false, false, 0f, 0f, null, 1f, null, null, null, null, null, null, null, null, null, null, null, null); Pawn pawn = null; try { pawn = PawnGenerator.GeneratePawn(request); } catch (Exception arg) { Log.Error("There was an exception thrown by the PawnGenerator during generating a starting pawn. Trying one more time...\nException: " + arg); pawn = PawnGenerator.GeneratePawn(request); } pawn.relations.everSeenByPlayer = true; PawnComponentsUtility.AddComponentsForSpawn(pawn); return(pawn); }
public void EjectContents() { ThingDef filth_Slime = ThingDefOf.Filth_Slime; foreach (Thing thing in this.innerContainer) { Pawn pawn = thing as Pawn; if (pawn != null) { PawnComponentsUtility.AddComponentsForSpawn(pawn); pawn.filth.GainFilth(filth_Slime); this.InnerPawn.health.AddHediff(AlteredCarbonDefOf.AC_EmptySleeve); } } if (!base.Destroyed) { SoundStarter.PlayOneShot(SoundDefOf.CryptosleepCasket_Eject, SoundInfo.InMap(new TargetInfo(base.Position, base.Map, false), 0)); } this.innerContainer.TryDropAll(this.InteractionCell, base.Map, ThingPlaceMode.Near, null, null); this.contentsKnown = true; ResetGraphics(); }
public override void EjectContents() { ThingDef filth_Slime = ThingDefOf.Filth_Slime; foreach (Thing thing in ((IEnumerable <Thing>) this.innerContainer)) { Pawn pawn = thing as Pawn; if (pawn != null) { PawnComponentsUtility.AddComponentsForSpawn(pawn); pawn.filth.GainFilth(filth_Slime); if (pawn.RaceProps.IsFlesh) { pawn.health.AddHediff(HediffDefOf.CryptosleepSickness, null, null, null); } } } if (!base.Destroyed) { SoundDefOf.CryptosleepCasket_Eject.PlayOneShot(SoundInfo.InMap(new TargetInfo(base.Position, base.Map, false), MaintenanceType.None)); } state = ReactorState.Empty; base.EjectContents(); }
public static Pawn GenerateDemon(PawnKindDef demonKind = null) { PawnKindDef pdef = DemonDefOfs.Demon_Undivided; if (demonKind != null) { pdef = demonKind; } else { int num = Rand.RangeInclusive(0, 4); switch (num) { case 0: { pdef = DemonDefOfs.Demon_Bloodletter; break; } case 1: { pdef = DemonDefOfs.Demon_Plaguebearer; break; } case 2: { pdef = DemonDefOfs.Demon_Daemonette; break; } case 3: { pdef = DemonDefOfs.Demon_Horror; break; } case 4: { pdef = DemonDefOfs.Demon_Undivided; break; } } } PawnGenerationRequest request = new PawnGenerationRequest(pdef, Find.FactionManager.FirstFactionOfDef(C_FactionDefOf.ChaosCult)); Pawn pawn = null; try { pawn = PawnGenerator.GeneratePawn(request); } catch (Exception arg) { Log.Error("There was an exception thrown by the PawnGenerator during generating a starting pawn. Trying one more time...\nException: " + arg); pawn = PawnGenerator.GeneratePawn(request); } pawn.relations.everSeenByPlayer = true; PawnComponentsUtility.AddComponentsForSpawn(pawn); return(pawn); }
private void TransformPawn(Pawn pawn) { TransformationRequest request; Mutagen mutagen; switch (_state) { case ChamberState.Transforming: request = new TransformationRequest(pawnTFKind, pawn) { forcedGender = TFGender.Switch, forcedGenderChance = 50, manhunterSettingsOverride = ManhunterTfSettings.Never, factionResponsible = Faction, forcedFaction = Faction }; mutagen = MutagenDefOf.defaultMutagen.MutagenCached; break; case ChamberState.MergeInto: request = new TransformationRequest(pawnTFKind, pawn, (Pawn)linkTo.innerContainer[0]) { forcedGender = TFGender.Switch, forcedGenderChance = 50, manhunterSettingsOverride = ManhunterTfSettings.Never, factionResponsible = Faction, forcedFaction = Faction }; mutagen = MutagenDefOf.MergeMutagen.MutagenCached; break; case ChamberState.MergeOutOf: return; case ChamberState.Idle: default: throw new ArgumentOutOfRangeException(); } TransformedPawn pmInst = mutagen.Transform(request); if (pmInst == null) { Log.Error($"mutagenic chamber could not transform pawns {string.Join(",",request.originals.Select(p => p.Name.ToStringFull).ToArray())} using mutagen {mutagen.def.defName}"); return; } SendLetter(pawn); base.EjectContents(); if (_state == ChamberState.MergeInto) { linkTo.EjectContents(); } foreach (Pawn pmInstOriginalPawn in pmInst.OriginalPawns) { if (pmInstOriginalPawn == null) { continue; } TransformerUtility.CleanUpHumanPawnPostTf(pmInstOriginalPawn, null); } foreach (Pawn pmInstOriginalPawn in pmInst.OriginalPawns) { pmInstOriginalPawn.DeSpawn(); } var comp = Find.World.GetComponent <PawnmorphGameComp>(); comp.AddTransformedPawn(pmInst); Find.TickManager.slower.SignalForceNormalSpeedShort(); PawnComponentsUtility.AddComponentsForSpawn(pmInst.TransformedPawns.First()); pawn.ownership.UnclaimAll(); if (modulator != null) { modulator.triggered = true; if (modulator.merging) { modulator.merging = false; modulator.random = true; } } if (!Destroyed) { SoundDefOf.CryptosleepCasket_Eject.PlayOneShot(SoundInfo.InMap(new TargetInfo(base.Position, base.Map))); fuelComp.ConsumeFuel(fuelComp.Fuel); } }
protected override bool TryExecuteWorker(IncidentParms parms) { Log.Message("Shia TryExecuteWorker Launched"); parms.raidArrivalMode = PawnsArrivalModeDefOf.EdgeWalkIn; parms.raidStrategy = RaidStrategyDefOf.ImmediateAttack; parms.points = 50; if (!TryResolveRaidFaction(parms)) { Log.Error("Failed to resolve shia raid faction"); return(false); } Find.TickManager.slower.SignalForceNormalSpeedShort(); Find.StoryWatcher.statsRecord.numRaidsEnemy++; var list = new List <Pawn>(); Log.Message("Trying to make a shia"); var shia = GenerateShia(parms); list.Add(shia); Log.Message("Made a shia"); if (list.Count == 0) { Log.Error("Got no pawns spawning raid from parms " + parms); return(false); } if (!parms.raidArrivalMode.Worker.TryResolveRaidSpawnCenter(parms)) { Log.Error("Failed to resolve raid spawn center"); return(false); } TargetInfo target = shia; //TargetInfo targetTest = new TargetInfo(parms.spawnCenter,map,false); parms.raidArrivalMode.Worker.Arrive(list, parms); PawnComponentsUtility.AddComponentsForSpawn(shia); //Is the below lines even needed? //DropPodUtility.DropThingsNear(parms.spawnCenter, map, list.Cast<Thing>(), parms.raidPodOpenDelay, false, true, true); //target = new TargetInfo(parms.spawnCenter, map, false); //message player var stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Points = " + parms.points.ToString("F0")); foreach (var current2 in list) { var str = current2.equipment?.Primary == null ? "unarmed" : current2.equipment.Primary.LabelCap; stringBuilder.AppendLine(current2.KindLabel + " - " + str); } PawnRelationUtility.Notify_PawnsSeenByPlayer(list, out _); Find.LetterStack.ReceiveLetter(Consts_ShiaSurprise.letterLabel, Consts_ShiaSurprise.letterText, DefOfs_ShiaSurprise.ThreatSmall, target, parms.faction, null, null, stringBuilder.ToString()); TaleRecorder.RecordTale(DefOfs_ShiaSurprise.Raid); parms.raidStrategy.Worker.MakeLords(parms, list); LessonAutoActivator.TeachOpportunity(ConceptDefOf.EquippingWeapons, OpportunityType.Critical); //Lord lord = LordMaker.MakeNewLord(parms.faction, new LordJob_AssaultColony(parms.faction, false, false, false, true, false), map, list); //Does not seem to be a 1.0 counterpart to the below line //AvoidGridMaker.RegenerateAvoidGridsFor(parms.faction, map); SoundDef.Named("Shia").PlayOneShot(SoundInfo.OnCamera()); return(true); }
public static void Listener(ref Pawn __result) { if (__result == null) { return; } if (Faction.OfPlayer.def.basicMemberKind.defName != "AndroidT2ColonistGeneral") { return; } else { Random rnd = new Random(); PawnGenerationRequest request; string pkd = ""; if (!Utils.TXSERIE_LOADED) { switch (rnd.Next(1, 3)) { case 1: pkd = "AndroidT2ColonistGeneral"; break; case 2: pkd = "AndroidT1ColonistGeneral"; break; default: pkd = Faction.OfPlayer.def.basicMemberKind.defName; break; } } else { switch (rnd.Next(1, 5)) { case 1: pkd = "AndroidT2ColonistGeneral"; break; case 2: pkd = "AndroidT1ColonistGeneral"; break; case 3: pkd = "ATPP_Android2ITXKind"; break; case 4: pkd = "ATPP_Android2TXKind"; break; default: pkd = Faction.OfPlayer.def.basicMemberKind.defName; break; } } request = new PawnGenerationRequest(DefDatabase <PawnKindDef> .GetNamed(pkd, false), Faction.OfPlayer, PawnGenerationContext.PlayerStarter, -1, true, false, false, false, true, TutorSystem.TutorialMode, 20f, false, true, true, false, false, false, false); __result = null; try { __result = PawnGenerator.GeneratePawn(request); } catch (Exception e) { Log.Error("[ATPP] StartingPawnUtility.NewGeneratedStartingPawn " + e.Message + " " + e.StackTrace, false); __result = PawnGenerator.GeneratePawn(request); } __result.relations.everSeenByPlayer = true; PawnComponentsUtility.AddComponentsForSpawn(__result); } }
public static void IntroduceFaction(CustomFactionDef newFaction) { Faction faction = SpawnNewFactionIntoWorld(newFaction); if (faction == null) { return; } SpawnNewFactionBasesIntoWorld(faction, 3); //Prevents errors where pawns will refuse to walk around and throw errors. // This is primarily due to the game not being designed for // dynamic faction introduction. foreach (Map m in Find.Maps) { m.pawnDestinationReservationManager.RegisterFaction(faction); } var map = Find.AnyPlayerHomeMap; IntVec3 result; if (!RCellFinder.TryFindRandomPawnEntryCell(out result, map, CellFinder.EdgeRoadChance_Hostile)) { Log.Error($"Failed to find spawning point along map edge for {faction.Name}"); } PawnGenerationRequest request = new PawnGenerationRequest(newFaction.representativeKind, faction, PawnGenerationContext.NonPlayer, -1, forceGenerateNewPawn: true, newborn: false, allowDead: false, allowDowned: false, canGeneratePawnRelations: true); Pawn pawn = null; try { pawn = PawnGenerator.GeneratePawn(request); } catch { Log.Error($"Failed to generate a representative pawn for {faction.Name}"); } pawn.relations.everSeenByPlayer = true; PawnComponentsUtility.AddComponentsForSpawn(pawn); GenSpawn.Spawn(pawn, result, map); IntVec3 chillSpot; RCellFinder.TryFindRandomSpotJustOutsideColony(pawn, out chillSpot); LordJob_VisitColonyUntilConditionSatisfied lordJob = new LordJob_VisitColonyUntilConditionSatisfied(faction, chillSpot); LordMaker.MakeNewLord(faction, lordJob, map, new List <Pawn>() { pawn }); var ft = Find.World.GetComponent <WorldComponent_FactionsTracker>(); if (ft.joinedFactionDef == null) { ft.activeRepresentatives.Add(pawn); } else { Messages.Message("SCP_AlreadyJoined".Translate(pawn.Faction.def.label), pawn, MessageTypeDefOf.RejectInput); } Find.LetterStack.ReceiveLetter( "SCP_FactionArrival".Translate(), "SCP_FactionArrivalDesc".Translate(newFaction.LabelCap), LetterDefOf.NeutralEvent, pawn); }