public override bool TryExecute(IncidentParms parms) { Log.Message("IncidentWorker_RefugeePodCrashInCave:TryExecute"); if (Find.Map.Biome != Util_CaveBiome.CaveBiomeDef) { return(base.TryExecute(parms)); } IntVec3 intVec = IntVec3.Invalid; TryFindRefugeePodSpot(out intVec); if (intVec.IsValid == false) { return(false); } Faction faction = Find.FactionManager.FirstFactionOfDef(FactionDefOf.Spacer); PawnGenerationRequest request = new PawnGenerationRequest(PawnKindDefOf.SpaceRefugee, faction, PawnGenerationContext.NonPlayer, false, false, false, false, true, false, 20f, false, true, true, null, null, null, null, null, null); Pawn pawn = PawnGenerator.GeneratePawn(request); HealthUtility.GiveInjuriesToForceDowned(pawn); string label = "LetterLabelRefugeePodCrash".Translate(); string text = "RefugeePodCrash".Translate(); PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, ref label, pawn); Find.LetterStack.ReceiveLetter(label, text, LetterType.BadNonUrgent, intVec, null); DropPodUtility.MakeDropPodAt(intVec, new DropPodInfo { SingleContainedThing = pawn, openDelay = 180, leaveSlag = true }); return(true); }
public override bool TryExecute(IncidentParms parms) { IntVec3 intVec = DropCellFinder.RandomDropSpot(); Find.LetterStack.ReceiveLetter("LetterLabelRefugeePodCrash".Translate(), "RefugeePodCrash".Translate(), LetterType.BadNonUrgent, intVec); Faction faction = Find.FactionManager.FirstFactionOfDef(FactionDefOf.Spacer); Pawn pawn = PawnGenerator.GeneratePawn(Verse.PawnKindDef.Named("MechanoidCovert"), faction); pawn.gender = Gender.Female; FixBackstory(pawn); FixHair(pawn); pawn.Name = NameGenerator.GenerateName(pawn); HealthUtility.GiveInjuriesToForceDowned(pawn); DropPodUtility.MakeDropPodAt(intVec, new DropPodInfo { SingleContainedThing = pawn, openDelay = 180, leaveSlag = true }); return(true); }