From 20385c5ae77567a9ebe77a4bdb3798e7b5a582e5 Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Tue, 7 Jul 2020 18:36:20 +0100 Subject: [PATCH] Add tick tracking to the world --- pkg/game/world.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/game/world.go b/pkg/game/world.go index cdd8fa1..4358ef3 100644 --- a/pkg/game/world.go +++ b/pkg/game/world.go @@ -37,6 +37,12 @@ type World struct { // Set of possible words to use for names words []string + + // TicksPerDay is the amount of ticks in a single day + TicksPerDay int + + // Current number of ticks from the start + CurrentTicks int } var wordsFile = os.Getenv("WORDS_FILE") @@ -65,6 +71,8 @@ func NewWorld(chunkSize int) *World { CommandIncoming: make(map[string]CommandStream), Atlas: atlas.NewAtlas(chunkSize), words: lines, + TicksPerDay: 24, + CurrentTicks: 0, } } @@ -436,6 +444,9 @@ func (w *World) ExecuteCommandQueues() { // Add any incoming commands from this tick and clear that queue w.EnqueueAllIncoming() + + // Increment the current tick count + w.CurrentTicks++ } // ExecuteCommand will execute a single command