public override void OnResult(Quest quest) { var map = quest.HomeMap; var pos = QuestUtility.FindDropSpot(map); DropPodUtility.DropThingsNear(pos, map, things, canRoofPunch: false); Messages.Message("QuestReceived".Translate().Formatted(Label), new LookTargets(pos, map), MessageTypeDefOf.PositiveEvent); }
public override void OnResult(Quest quest) { var map = quest.HomeMap; var pos = QuestUtility.FindDropSpot(map); DropPodUtility.DropThingsNear(pos, map, things, canRoofPunch: false); Find.LetterStack.ReceiveLetter( "QuestReceivedLabel".Translate(), "QuestReceived".Translate().Formatted(Label), LetterDefOf.NeutralEvent, new LookTargets(pos, map)); }
public override void MapComponentTick() { if ((Find.TickManager.TicksGame + map.Parent.ID) % EventTimeCycle == 0) { if (!LoadedModManager.GetMod <Mod_Cities>().GetSettings <ModSettings_Cities>().enableEvents) { return; } if (map.Parent is City city && !city.Abandoned) { if (city.Faction.HostileTo(Faction.OfPlayer)) { var storyComp = Find.Storyteller.storytellerComps.First(x => x is StorytellerComp_OnOffCycle || x is StorytellerComp_RandomMain); var parms = storyComp.GenerateParms(IncidentCategoryDefOf.ThreatBig, map); parms.faction = city.Faction; parms.raidStrategy = RaidStrategyDefOf.ImmediateAttack; parms.raidArrivalMode = DefDatabase <PawnsArrivalModeDef> .GetRandom(); parms.raidArrivalModeForQuickMilitaryAid = true; parms.points += RaidPointIncrease; IncidentDefOf.RaidEnemy.Worker.TryExecute(parms); } else { var pos = QuestUtility.FindDropSpot(map); var things = new List <Thing>(); var foodCount = (int)(map.mapPawns.SpawnedPawnsInFaction(map.ParentFaction).Count *EventTimeCycle / 60000F * DailyFoodGivenPerPerson); for (var i = 0; i < foodCount; i++) { var thing = ThingMaker.MakeThing(ThingDefOf.MealSurvivalPack); map.GetComponent <MapComponent_City>().cityOwnedThings.Add(thing); things.Add(thing); } DropPodUtility.DropThingsNear(pos, map, things, canRoofPunch: false); } } } }