public IEnumerable <FiringIncident> MakeIntervalIncidents() { if (mapParent != null && mapParent.HasMap) { return(ThreatsGenerator.MakeIntervalIncidents(parms, mapParent.Map, base.EnableTick + threatStartTicks)); } return(Enumerable.Empty <FiringIncident>()); }
public override IEnumerable <FiringIncident> MakeIntervalIncidents(IIncidentTarget target) { foreach (FiringIncident item in ThreatsGenerator.MakeIntervalIncidents(Props.parms, target, (target as Map)?.generationTick ?? 0)) { item.source = this; yield return(item); } }
public static void DebugGetFutureIncidents(int numTestDays, bool currentMapOnly, out Dictionary <IIncidentTarget, int> incCountsForTarget, out int[] incCountsForComp, out List <Pair <IncidentDef, IncidentParms> > allIncidents, out int threatBigCount, StringBuilder outputSb = null, StorytellerComp onlyThisComp = null, ThreatsGeneratorParams onlyThisThreatsGenerator = null, QuestPart onlyThisQuestPart = null) { int ticksGame = Find.TickManager.TicksGame; IncidentQueue incidentQueue = Find.Storyteller.incidentQueue; List <IIncidentTarget> allIncidentTargets = Find.Storyteller.AllIncidentTargets; tmpOldStoryStates.Clear(); for (int i = 0; i < allIncidentTargets.Count; i++) { IIncidentTarget incidentTarget = allIncidentTargets[i]; tmpOldStoryStates.Add(incidentTarget, incidentTarget.StoryState); new StoryState(incidentTarget).CopyTo(incidentTarget.StoryState); } Find.Storyteller.incidentQueue = new IncidentQueue(); int num = numTestDays * 60; incCountsForComp = new int[Find.Storyteller.storytellerComps.Count]; incCountsForTarget = new Dictionary <IIncidentTarget, int>(); allIncidents = new List <Pair <IncidentDef, IncidentParms> >(); threatBigCount = 0; for (int j = 0; j < num; j++) { IEnumerable <FiringIncident> enumerable = (onlyThisThreatsGenerator != null) ? ThreatsGenerator.MakeIntervalIncidents(onlyThisThreatsGenerator, Find.CurrentMap, ticksGame) : ((onlyThisComp != null) ? Find.Storyteller.MakeIncidentsForInterval(onlyThisComp, Find.Storyteller.AllIncidentTargets) : ((onlyThisQuestPart == null) ? Find.Storyteller.MakeIncidentsForInterval() : (from x in Find.Storyteller.MakeIncidentsForInterval() where x.sourceQuestPart == onlyThisQuestPart select x))); foreach (FiringIncident item in enumerable) { if (item == null) { Log.Error("Null incident generated."); } if (!currentMapOnly || item.parms.target == Find.CurrentMap) { item.parms.target.StoryState.Notify_IncidentFired(item); allIncidents.Add(new Pair <IncidentDef, IncidentParms>(item.def, item.parms)); if (!incCountsForTarget.ContainsKey(item.parms.target)) { incCountsForTarget[item.parms.target] = 0; } incCountsForTarget[item.parms.target]++; string text; if (item.def.category != IncidentCategoryDefOf.ThreatBig) { text = ((item.def.category != IncidentCategoryDefOf.ThreatSmall) ? " " : "S "); } else { threatBigCount++; text = "T "; } string text2; if (onlyThisThreatsGenerator != null) { text2 = ""; } else { int num2 = Find.Storyteller.storytellerComps.IndexOf(item.source); if (num2 >= 0) { incCountsForComp[num2]++; text2 = "M" + num2 + " "; } else { text2 = ""; } } text2 = text2.PadRight(4); outputSb?.AppendLine(text2 + text + (Find.TickManager.TicksGame.TicksToDays().ToString("F1") + "d").PadRight(6) + " " + item); } } Find.TickManager.DebugSetTicksGame(Find.TickManager.TicksGame + 1000); } Find.TickManager.DebugSetTicksGame(ticksGame); Find.Storyteller.incidentQueue = incidentQueue; for (int k = 0; k < allIncidentTargets.Count; k++) { tmpOldStoryStates[allIncidentTargets[k]].CopyTo(allIncidentTargets[k].StoryState); } tmpOldStoryStates.Clear(); }