diff --git a/server/world/conf.go b/server/world/conf.go index 3514b3a5c..44569721c 100644 --- a/server/world/conf.go +++ b/server/world/conf.go @@ -95,6 +95,7 @@ func (conf Config) New() *World { conf: conf, ra: conf.Dim.Range(), set: s, + tick: s.CurrentTick, } w.weather = weather{w: w} var h Handler = NopHandler{} diff --git a/server/world/tick.go b/server/world/tick.go index 9c025d807..ed38457c4 100644 --- a/server/world/tick.go +++ b/server/world/tick.go @@ -49,6 +49,9 @@ func (t ticker) tick(tx *Tx) { w.set.Unlock() return } + + var tick int64 + if w.advance { w.set.CurrentTick++ if w.set.TimeCycle { @@ -57,9 +60,13 @@ func (t ticker) tick(tx *Tx) { if w.set.WeatherCycle { w.advanceWeather() } + tick = w.set.CurrentTick + } else { + w.tick++ + tick = w.tick } - rain, thunder, tick, tim := w.set.Raining, w.set.Thundering && w.set.Raining, w.set.CurrentTick, int(w.set.Time) + rain, thunder, tim := w.set.Raining, w.set.Thundering && w.set.Raining, int(w.set.Time) w.set.Unlock() if tick%20 == 0 { diff --git a/server/world/world.go b/server/world/world.go index 403d3c5ee..6f6cfa4ea 100644 --- a/server/world/world.go +++ b/server/world/world.go @@ -37,7 +37,9 @@ type World struct { o sync.Once - set *Settings + set *Settings + tick int64 + handler atomic.Pointer[Handler] weather