public static bool Do() { Map map = Current.Game.RandomPlayerHomeMap; IntVec3 loc; if (!TryFindEntryCell(map, out loc)) { return(false); } var pawn = GameComponent.GetRandomAllyForSpawning(); if (pawn == null) { return(false); } pawn.SetFactionDirect(Faction.OfPlayer); GenSpawn.Spawn(pawn, loc, map, WipeMode.Vanish); var def = IncidentDefs.Reunion_AllyJoin; TaggedString baseLetterLabel = def.letterLabel.Formatted(pawn.Named("PAWN")).AdjustedFor(pawn, "PAWN", true); TaggedString baseLetterText = def.letterText.Formatted(pawn.Named("PAWN")).AdjustedFor(pawn, "PAWN", true); Find.LetterStack.ReceiveLetter(baseLetterLabel, baseLetterText, def.letterDef, new LookTargets(pawn)); GameComponent.TryScheduleNextEvent(ScheduleMode.Forced); return(true); }
public override void Notify_GeneratedByQuestGen(SitePart part, Slate slate, List <Rule> outExtraDescriptionRules, Dictionary <string, string> outExtraDescriptionConstants) { // Duplicate code so modularize in Util Util.SitePartWorker_Base_Notify_GeneratedByQuestGen(part, outExtraDescriptionRules, outExtraDescriptionConstants); // Replaces PrisonerWillingToJoinQuestUtility.GeneratePrisoner Pawn pawn = GameComponent.GetRandomAllyForSpawning(); pawn.guest.SetGuestStatus(part.site.Faction, true); Util.DressPawnIfCold(pawn, part.site.Tile); part.things = new ThingOwner <Pawn>(part, true, LookMode.Deep); part.things.TryAdd(pawn, true); string text; PawnRelationUtility.Notify_PawnsSeenByPlayer(Gen.YieldSingle <Pawn>(pawn), out text, true, false); outExtraDescriptionRules.AddRange(GrammarUtility.RulesForPawn("prisoner", pawn, outExtraDescriptionConstants, true, true)); string output; if (!text.NullOrEmpty()) { output = "\n\n" + "PawnHasTheseRelationshipsWithColonists".Translate(pawn.LabelShort, pawn) + "\n\n" + text; } else { output = ""; } outExtraDescriptionRules.Add(new Rule_String("prisonerFullRelationInfo", output)); }
protected override void RunInt() { var pawn = GameComponent.GetRandomAllyForSpawning(); Slate slate = QuestGen.slate; if (storeAs.GetValue(slate) != null) { QuestGen.slate.Set(storeAs.GetValue(slate), pawn, false); } if (addToList.GetValue(slate) != null) { QuestGenUtility.AddToOrMakeList(QuestGen.slate, addToList.GetValue(slate), pawn); } QuestGen.AddToGeneratedPawns(pawn); // Vanilla code: adds the pawn to the World. // For this mod, remove them from the available list and put them in the spawned list instead. }
public override void Notify_GeneratedByQuestGen(SitePart part, Slate slate, List <Rule> outExtraDescriptionRules, Dictionary <string, string> outExtraDescriptionConstants) { // Duplicate code so modularize in Util Util.SitePartWorker_Base_Notify_GeneratedByQuestGen(part, outExtraDescriptionRules, outExtraDescriptionConstants); // Replaces DownedRefugeeQuestUtility.GenerateRefugee Pawn pawn = GameComponent.GetRandomAllyForSpawning(); Util.DressPawnIfCold(pawn, part.site.Tile); HealthUtility.DamageUntilDowned(pawn, false); HealthUtility.DamageLegsUntilIncapableOfMoving(pawn, false); part.things = new ThingOwner <Pawn>(part, true, LookMode.Deep); part.things.TryAdd(pawn, true); if (pawn.relations != null) { pawn.relations.everSeenByPlayer = true; } Pawn mostImportantColonyRelative = PawnRelationUtility.GetMostImportantColonyRelative(pawn); if (mostImportantColonyRelative != null) { PawnRelationDef mostImportantRelation = mostImportantColonyRelative.GetMostImportantRelation(pawn); TaggedString taggedString = ""; if (mostImportantRelation != null && mostImportantRelation.opinionOffset > 0) { pawn.relations.relativeInvolvedInRescueQuest = mostImportantColonyRelative; taggedString = "\n\n" + "RelatedPawnInvolvedInQuest".Translate(mostImportantColonyRelative.LabelShort, mostImportantRelation.GetGenderSpecificLabel(pawn), mostImportantColonyRelative.Named("RELATIVE"), pawn.Named("PAWN")).AdjustedFor(pawn, "PAWN", true); } else { PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref taggedString, pawn); } outExtraDescriptionRules.Add(new Rule_String("pawnInvolvedInQuestInfo", taggedString)); } outExtraDescriptionRules.AddRange(GrammarUtility.RulesForPawn("refugee", pawn, outExtraDescriptionConstants, true, true)); }
public static bool Do() { var pawn = GameComponent.GetRandomAllyForSpawning(); if (pawn == null) { return(false); } HealthUtility.DamageUntilDowned(pawn, true); var def = IncidentDefs.Reunion_AllyRefugeePod; Map map = Current.Game.RandomPlayerHomeMap; List <Thing> things = new List <Thing>(); things.Add(pawn); IntVec3 intVec = DropCellFinder.RandomDropSpot(map); pawn.guest.getRescuedThoughtOnUndownedBecauseOfPlayer = true; //pawn.mindState.WillJoinColonyIfRescued = true; // will trigger LetterRescueQuestFinished which is wrong. We want LetterRescueeJoins TaggedString baseLetterLabel = def.letterLabel.Formatted(pawn.Named("PAWN")).AdjustedFor(pawn, "PAWN", true); TaggedString baseLetterText = def.letterText.Formatted(pawn.Named("PAWN")).AdjustedFor(pawn, "PAWN", true); Find.LetterStack.ReceiveLetter(baseLetterLabel, baseLetterText, def.letterDef, new LookTargets(pawn)); ActiveDropPodInfo activeDropPodInfo = new ActiveDropPodInfo(); activeDropPodInfo.innerContainer.TryAddRangeOrTransfer(things, true, false); activeDropPodInfo.openDelay = 180; activeDropPodInfo.leaveSlag = true; DropPodUtility.MakeDropPodAt(intVec, map, activeDropPodInfo); GameComponent.TryScheduleNextEvent(true); return(true); }