used msUntil start because server has different time than client

This commit is contained in:
evanpelle
2024-09-02 17:29:38 -07:00
parent 37b91df2b8
commit cac66c2186
4 changed files with 6 additions and 4 deletions
+4 -1
View File
@@ -24,8 +24,11 @@ const gm = new GameManager(getConfig())
// New GET endpoint to list lobbies
app.get('/lobbies', (req, res) => {
const now = Date.now()
res.json({
lobbies: gm.gamesByPhase(GamePhase.Lobby).map(g => ({id: g.id, startTime: g.startTime(), numClients: g.numClients()})),
lobbies: gm.gamesByPhase(GamePhase.Lobby)
.map(g => ({id: g.id, msUntilStart: g.startTime() - now, numClients: g.numClients()}))
// .sort((a, b) => a.startTime - b.startTime),
});
});