Add tick tracking to the world
This commit is contained in:
parent
5928dfdb20
commit
20385c5ae7
1 changed files with 11 additions and 0 deletions
|
@ -37,6 +37,12 @@ type World struct {
|
||||||
|
|
||||||
// Set of possible words to use for names
|
// Set of possible words to use for names
|
||||||
words []string
|
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")
|
var wordsFile = os.Getenv("WORDS_FILE")
|
||||||
|
@ -65,6 +71,8 @@ func NewWorld(chunkSize int) *World {
|
||||||
CommandIncoming: make(map[string]CommandStream),
|
CommandIncoming: make(map[string]CommandStream),
|
||||||
Atlas: atlas.NewAtlas(chunkSize),
|
Atlas: atlas.NewAtlas(chunkSize),
|
||||||
words: lines,
|
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
|
// Add any incoming commands from this tick and clear that queue
|
||||||
w.EnqueueAllIncoming()
|
w.EnqueueAllIncoming()
|
||||||
|
|
||||||
|
// Increment the current tick count
|
||||||
|
w.CurrentTicks++
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExecuteCommand will execute a single command
|
// ExecuteCommand will execute a single command
|
||||||
|
|
Loading…
Add table
Reference in a new issue