aboutsummaryrefslogtreecommitdiff
path: root/internal/game/cmd_ticktest.go
blob: 6cadab7fbf1e6709a2b70e1e5cd37a59c0528d51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package game

import (
	"fmt"

	"thirdcollapse/internal/net"
)

func (g *Game) doTickTest(sess *net.Session) {
	count := 0
	g.Ticks.Subscribe(5, func() bool {
		count++
		sess.WriteLine(fmt.Sprintf("[Tick #%d] 600ms heartbeat is working.", count))
		if count >= 3 {
			sess.WriteLine("[Tick test complete.]")
			return false
		}
		return true
	})
	sess.WriteLine("Tick test started — you'll see 3 messages at 5-tick intervals while commands still work.")
}