From 2682c5d68062ea35303228b64a0c301732396001 Mon Sep 17 00:00:00 2001 From: Ben Kyd Date: Tue, 13 Apr 2021 00:36:32 +0100 Subject: [PATCH] goodddnight (a normalish sleep schedule what) --- README.md | 2 +- server/src/game-logic.js | 20 ++++++++++++++------ server/src/lobbies.js | 3 +-- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5a08ffe..560758d 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ https://www.scrabble3d.info/t2342f139-Default-rules.html If the scope allowed for it, every function would be (reasonably) unit tested. The solution to locale-ise language in HTML is extremely naive and there are a lot better ways to do it, i did what i could in the time without a full refractor and SSR. -However it is not at much detriment of readability and maintainability of the code so i diddn't deem it neccesary. +However it is not at much detriment of readability and maintainability of the code so i didn't deem it neccesary. The locales are stored in different language files so it is easier for people to contribute and thus more maintanable. diff --git a/server/src/game-logic.js b/server/src/game-logic.js index c321c30..47e9ec0 100644 --- a/server/src/game-logic.js +++ b/server/src/game-logic.js @@ -1,10 +1,19 @@ +const Logger = require('./logger.js'); +const Registrar = require('./game-registrar.js'); +const Lobbies = require('./lobbies.js'); /* GAME OBJECT { - - locale - + // reference UID + lobbyuid: uid, + locale: en, + players: [{uid, activetiles, score}], + // index of players + turn: int, + // TODO: vvv + turnstate: + tilebag: [] } NOTES - The locale is the language of the *owner of the lobby*, the dictionary @@ -12,14 +21,13 @@ NOTES */ let ActiveGames = []; -function StartGame() + +function StartGame(lobby) { } - - module.exports = { StartGame: StartGame, } diff --git a/server/src/lobbies.js b/server/src/lobbies.js index 2e06f56..e25ed86 100644 --- a/server/src/lobbies.js +++ b/server/src/lobbies.js @@ -1,6 +1,5 @@ const Logger = require('./logger.js'); const Registrar = require('./game-registrar.js'); -const { GetUserByUID } = require('./game-registrar.js'); /* LOBBY OBJECT @@ -186,7 +185,7 @@ function UserReady(useruid, callback) if (Lobbies[lobbyuid].players[player].uid === useruid) Lobbies[lobbyuid].players[player].ready = true; - callback(GetUserByUID(useruid), GetLobbyByUserUID(useruid), 'user-ready'); + callback(Registrar.GetUserByUID(useruid), GetLobbyByUserUID(useruid), 'user-ready'); return true; }