public override void MapComponentTick() { // No Rare version of MapComponentTick, so this will do. if (!AncestorUtils.IsIntervalTick()) { return; } if (!this.initialized) { this.Initialize(); } for (int i = this.despawnBuffer.Count - 1; i >= 0; i--) { this.DespawnVisitor(this.despawnBuffer[i]); } if (!this.visitSchedule.IsScheduledForCurrentSeason) { this.visitSchedule = AncestorVisitScheduler.BuildSeasonScheduleForCurrentSeason(); } this.visitSchedule.VisitScheduleTickInterval(); this.approval.ApprovalTrackerTickInterval(this); this.timer.AncestorMemoTimerTickInterval(this.approval); }
public override void ExposeData() { base.ExposeData(); Scribe_Values.LookValue <bool>(ref initialized, "initialized", false); Scribe_Values.LookValue <int>(ref numAncestorsToVisit, "numAncestorsToVisit", 3); Scribe_Deep.LookDeep <ApprovalTracker>(ref this.approval, "approval", new object[0]); Scribe_Deep.LookDeep <AncestorMemoTimer>(ref this.timer, "timer", new object[0]); Scribe_Collections.LookList <Pawn>(ref this.unspawnedAncestors, "unspawnedAncestors", LookMode.Deep, new object[0]); Scribe_Collections.LookList <Building>(ref this.spawners, "spawners", LookMode.MapReference); // Probably there's a better way to do this! if (this.visitSchedule == null) { var seasonStart = AncestorUtils.EstStartOfSeasonAt(Find.TickManager.TicksGame); this.visitSchedule = AncestorVisitScheduler.BuildSeasonSchedule(seasonStart); } Scribe_Deep.LookDeep <VisitScheduleForSeason>(ref this.visitSchedule, "visitSchedule", new object[0]); }
private void Initialize() { var introDef = DefDatabase <ConceptDef> .GetNamed("MTW_AncestorShrineIntro"); LessonAutoActivator.TeachOpportunity(introDef, OpportunityType.Important); if (this.AncestorFaction != null) { while (this.unspawnedAncestors.Count() < AncestorConstants.MIN_ANCESTORS) { this.unspawnedAncestors.Add(this.GenAncestor()); } } else { this.AlertNullFaction(); } this.visitSchedule = AncestorVisitScheduler.BuildSeasonScheduleForCurrentSeason(); this.visitSchedule.DisableAlreadyPassedVisits(); this.approval = new ApprovalTracker(); this.timer = new AncestorMemoTimer(); this.initialized = true; }