add Time, reducing some duplication

This commit is contained in:
Zutatensuppe 2021-04-14 19:30:45 +02:00
parent e737015d7e
commit b6999e4f1f
7 changed files with 70 additions and 85 deletions

View file

@ -1,5 +1,6 @@
import Geometry from './Geometry.js'
import Protocol from './Protocol.js'
import Time from './Time.js'
import Util from './Util.js'
// Map<gameId, GameObject>
@ -89,14 +90,14 @@ function playerExists(gameId, playerId) {
}
function getRelevantPlayers(gameId, ts) {
const minTs = ts - 30000
const minTs = ts - 30 * Time.SEC
return getAllPlayers(gameId).filter(player => {
return player.ts >= minTs || player.points > 0
})
}
function getActivePlayers(gameId, ts) {
const minTs = ts - 30000
const minTs = ts - 30 * Time.SEC
return getAllPlayers(gameId).filter(player => {
return player.ts >= minTs
})