move socket handling to extra file (not GameCommon)

This commit is contained in:
Zutatensuppe 2020-12-23 20:35:36 +01:00
parent f1625b75ff
commit 35364c1058
4 changed files with 52 additions and 46 deletions

View file

@ -40,7 +40,6 @@ function loadAllGames() {
},
puzzle: game.puzzle,
players: game.players,
sockets: [],
evtInfos: {}
})
}
@ -58,7 +57,6 @@ async function createGameObject(gameId, targetTiles, image, ts) {
},
await createPuzzle(rng, targetTiles, image, ts),
[],
[],
{}
)
}
@ -76,7 +74,6 @@ async function createGame(gameId, targetTiles, image, ts) {
},
puzzle: await createPuzzle(rng, targetTiles, image, ts),
players: [],
sockets: [],
evtInfos: {},
})
@ -97,11 +94,6 @@ function addPlayer(gameId, playerId, ts) {
changedGames[gameId] = true
}
function addSocket(gameId, socket) {
GameCommon.addSocket(gameId, socket)
changedGames[gameId] = true
}
function handleInput(gameId, playerId, input, ts) {
const idx = GameCommon.getPlayerIndexById(gameId, playerId)
const diff = ts - GameCommon.getStartTs(gameId)
@ -136,7 +128,6 @@ export default {
persistChangedGames,
createGame,
addPlayer,
addSocket,
handleInput,
getAllGames: GameCommon.getAllGames,
getRelevantPlayers: GameCommon.getRelevantPlayers,
@ -146,10 +137,7 @@ export default {
getTileCount: GameCommon.getTileCount,
exists: GameCommon.exists,
playerExists: GameCommon.playerExists,
socketExists: GameCommon.socketExists,
removeSocket: GameCommon.removeSocket,
get: GameCommon.get,
getSockets: GameCommon.getSockets,
getStartTs: GameCommon.getStartTs,
getFinishTs: GameCommon.getFinishTs,
}