protected override void ScatterAt(IntVec3 loc, Map map, int count = 1) { DownedRefugeeComp component = ((WorldObject)map.info.parent).GetComponent <DownedRefugeeComp>(); Pawn newThing = (component == null || !component.pawn.Any) ? DownedRefugeeQuestUtility.GenerateRefugee(map.Tile) : component.pawn.Take(component.pawn[0]); GenSpawn.Spawn(newThing, loc, map); MapGenerator.rootsToUnfog.Add(loc); }
protected override bool TryExecuteWorker(IncidentParms parms) { int tile; if (!this.TryFindTile(out tile)) { return(false); } Site site = SiteMaker.TryMakeSite_SingleSitePart(SiteCoreDefOf.DownedRefugee, (!Rand.Chance(0.3f)) ? "DownedRefugeeQuestThreat" : null, tile, null, true, null, true, null); if (site == null) { return(false); } site.sitePartsKnown = true; Pawn pawn = DownedRefugeeQuestUtility.GenerateRefugee(tile); site.GetComponent <DownedRefugeeComp>().pawn.TryAdd(pawn, true); int randomInRange = SiteTuning.QuestSiteRefugeeTimeoutDaysRange.RandomInRange; site.GetComponent <TimeoutComp>().StartTimeout(randomInRange * 60000); Find.WorldObjects.Add(site); string text = this.def.letterLabel; string text2 = string.Format(this.def.letterText.AdjustedFor(pawn, "PAWN"), new object[] { randomInRange, pawn.ageTracker.AgeBiologicalYears, pawn.story.Title, SitePartUtility.GetDescriptionDialogue(site, site.parts.FirstOrDefault <SitePart>()) }).CapitalizeFirst(); Pawn mostImportantColonyRelative = PawnRelationUtility.GetMostImportantColonyRelative(pawn); if (mostImportantColonyRelative != null) { PawnRelationDef mostImportantRelation = mostImportantColonyRelative.GetMostImportantRelation(pawn); if (mostImportantRelation != null && mostImportantRelation.opinionOffset > 0) { pawn.relations.relativeInvolvedInRescueQuest = mostImportantColonyRelative; text2 = text2 + "\n\n" + "RelatedPawnInvolvedInQuest".Translate(new object[] { mostImportantColonyRelative.LabelShort, mostImportantRelation.GetGenderSpecificLabel(pawn) }).AdjustedFor(pawn, "PAWN"); } else { PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text2, pawn); } text = text + " " + "RelationshipAppendedLetterSuffix".Translate(); } if (pawn.relations != null) { pawn.relations.everSeenByPlayer = true; } Find.LetterStack.ReceiveLetter(text, text2, this.def.letterDef, site, null, null); return(true); }
protected override void ScatterAt(IntVec3 loc, Map map, int count = 1) { DownedRefugeeComp component = map.Parent.GetComponent <DownedRefugeeComp>(); Pawn pawn = (component == null || !component.pawn.Any) ? DownedRefugeeQuestUtility.GenerateRefugee(map.Tile) : component.pawn.Take(component.pawn[0]); HealthUtility.DamageUntilDowned(pawn, allowBleedingWounds: false); HealthUtility.DamageLegsUntilIncapableOfMoving(pawn, allowBleedingWounds: false); GenSpawn.Spawn(pawn, loc, map); pawn.mindState.WillJoinColonyIfRescued = true; MapGenerator.rootsToUnfog.Add(loc); }
protected override bool TryExecuteWorker(IncidentParms parms) { int tile; if (!this.TryFindTile(out tile)) { return(false); } Site site = SiteMaker.TryMakeSite_SingleSitePart(SiteCoreDefOf.DownedRefugee, (!Rand.Chance(0.3f)) ? IncidentWorker_QuestDownedRefugee.DownedRefugeeQuestThreatTag : null, null, true, null); if (site == null) { return(false); } site.Tile = tile; Pawn pawn = DownedRefugeeQuestUtility.GenerateRefugee(tile); site.GetComponent <DownedRefugeeComp>().pawn.TryAdd(pawn, true); int randomInRange = IncidentWorker_QuestDownedRefugee.TimeoutDaysRange.RandomInRange; site.GetComponent <TimeoutComp>().StartTimeout(randomInRange * 60000); Find.WorldObjects.Add(site); string text = string.Format(this.def.letterText.AdjustedFor(pawn), pawn.Label, randomInRange).CapitalizeFirst(); Pawn mostImportantColonyRelative = PawnRelationUtility.GetMostImportantColonyRelative(pawn); if (mostImportantColonyRelative != null) { PawnRelationDef mostImportantRelation = mostImportantColonyRelative.GetMostImportantRelation(pawn); if (mostImportantRelation != null && mostImportantRelation.opinionOffset > 0) { pawn.relations.relativeInvolvedInRescueQuest = mostImportantColonyRelative; text = text + "\n\n" + "RelatedPawnInvolvedInQuest".Translate(new object[] { mostImportantColonyRelative.LabelShort, mostImportantRelation.GetGenderSpecificLabel(pawn) }).AdjustedFor(pawn); } else { PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, pawn); } } if (pawn.relations != null) { pawn.relations.everSeenByPlayer = true; } Find.LetterStack.ReceiveLetter(this.def.letterLabel, text, this.def.letterDef, site, null); return(true); }
protected override void ScatterAt(IntVec3 loc, Map map, int count = 1) { DownedRefugeeComp component = map.info.parent.GetComponent <DownedRefugeeComp>(); Pawn newThing; if (component != null && component.pawn.Any) { newThing = component.pawn.Take(component.pawn[0]); } else { newThing = DownedRefugeeQuestUtility.GenerateRefugee(map.Tile); } GenSpawn.Spawn(newThing, loc, map); MapGenerator.rootsToUnfog.Add(loc); }
protected override void ScatterAt(IntVec3 loc, Map map, int count = 1) { DownedRefugeeComp component = map.Parent.GetComponent <DownedRefugeeComp>(); Pawn pawn; if (component != null && component.pawn.Any) { pawn = component.pawn.Take(component.pawn[0]); } else { pawn = DownedRefugeeQuestUtility.GenerateRefugee(map.Tile); } GenSpawn.Spawn(pawn, loc, map, WipeMode.Vanish); pawn.mindState.willJoinColonyIfRescued = true; MapGenerator.rootsToUnfog.Add(loc); }
protected override void ScatterAt(IntVec3 loc, Map map, GenStepParams parms, int count = 1) { Pawn pawn; if (parms.sitePart != null && parms.sitePart.things != null && parms.sitePart.things.Any) { pawn = (Pawn)parms.sitePart.things.Take(parms.sitePart.things[0]); } else { DownedRefugeeComp component = map.Parent.GetComponent <DownedRefugeeComp>(); pawn = ((component == null || !component.pawn.Any) ? DownedRefugeeQuestUtility.GenerateRefugee(map.Tile) : component.pawn.Take(component.pawn[0])); } HealthUtility.DamageUntilDowned(pawn, allowBleedingWounds: false); HealthUtility.DamageLegsUntilIncapableOfMoving(pawn, allowBleedingWounds: false); GenSpawn.Spawn(pawn, loc, map); pawn.mindState.WillJoinColonyIfRescued = true; MapGenerator.rootsToUnfog.Add(loc); MapGenerator.SetVar("RectOfInterest", CellRect.CenteredOn(loc, 1, 1)); }