package game // tickSystem is one step of the canonical per-tick system sequence. Name is // the human-readable identifier also encoded in building_guide/tick_order.md; // Run invokes the underlying system. The slice tickSystemOrder is the single // executable source of truth for the order in which per-tick systems fire. // // The order is what callers like the master subscriber in cmd/thoi/main.go // (registered as engine subscription ID 1, which the engine fires before all // dynamically-registered combat/aggro/respawn callbacks per processTick's // registration-ID sort) depend on. Reordering this slice is a breaking change // to game behavior; keep building_guide/tick_order.md in sync. type tickSystem struct { Name string Run func(*Game) } // TickSystemOrder returns the canonical per-tick system sequence. It is a // copy of the internal slice so callers cannot mutate the canonical order. func TickSystemOrder() []struct{ Name string } { out := make([]struct{ Name string }, len(tickSystemOrder)) for i, s := range tickSystemOrder { out[i] = struct{ Name string }{s.Name} } return out } var tickSystemOrder = []tickSystem{ {"ProcessQueuedCommands", (*Game).ProcessQueuedCommands}, {"CasinoTick", (*Game).CasinoTick}, {"MoveTick", (*Game).MoveTick}, {"SequenceTick", (*Game).SequenceTick}, {"TransientMobTick", (*Game).TransientMobTick}, {"World.Tick", func(g *Game) { g.World.Tick() }}, {"MobStore.Tick", func(g *Game) { g.MobStore.Tick() }}, {"RegenTick", (*Game).RegenTick}, {"EnergyRegenTick", (*Game).EnergyRegenTick}, {"DisconnectTick", (*Game).DisconnectTick}, {"WanderTick", (*Game).WanderTick}, {"SharedDepletionTick", (*Game).SharedDepletionTick}, {"FireTick", (*Game).FireTick}, {"AdvanceActions", (*Game).AdvanceActions}, {"TechTick", (*Game).TechTick}, {"ConsumeTick", (*Game).ConsumeTick}, {"BroadcastRespawns", (*Game).BroadcastRespawns}, {"VisualTick", (*Game).VisualTick}, {"SneakTick", (*Game).SneakTick}, {"FarmTick", (*Game).FarmTick}, {"BuffTick", (*Game).BuffTick}, {"SafespotTick", (*Game).SafespotTick}, {"HazardTick", (*Game).HazardTick}, } // RunTickSystems fires every canonical per-tick system in registration order. // It is the body of the master per-tick subscriber in cmd/thoi/main.go and the // single place that encodes per-tick system execution order. func (g *Game) RunTickSystems() { for _, s := range tickSystemOrder { s.Run(g) } }