From d05c27a8a86ba09bc62f8e4701436155ec1cfef6 Mon Sep 17 00:00:00 2001 From: ctcpip Date: Fri, 7 Jun 2024 15:52:31 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20remove=20menu=20key=20handler=20?= =?UTF-8?q?when=20getting=20input?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/multiplayer.js | 2 ++ src/netrisse.js | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/multiplayer.js b/src/multiplayer.js index c5b18ec..763400b 100644 --- a/src/multiplayer.js +++ b/src/multiplayer.js @@ -18,6 +18,7 @@ module.exports = function(screen, seed, intro, mainBoardPosition) { switch (name) { case '1': { + screen.term.removeListener('key', keyHandler); screen.clear(); let cursorX = 5; let cursorY = 3; @@ -69,6 +70,7 @@ module.exports = function(screen, seed, intro, mainBoardPosition) { screen.d(cursorX + 4, errorY + 1, err.errors.map(e => e.message), { color: 'brightred' }); screen.d(5, errorY + 3, '2) Back 🔙', { color: 'amber' }); screen.render(); + screen.term.on('key', keyHandler); }); }); diff --git a/src/netrisse.js b/src/netrisse.js index 3dcf91b..7730a50 100644 --- a/src/netrisse.js +++ b/src/netrisse.js @@ -7,9 +7,6 @@ const intro = require('./intro'); // multiplayer game modes: battle (default), friendly // need to wait to start the game until all players are ready (2nd board is not null) -// need to deal with concurrency issues -- what if p1 paused the game, p2 does a hold (or move), successful on p2 screen but not p1 screen because game paused -// probably change the logic to always allow the movement if it was not the main board - const colorEnabled = true; const screen = new Screen(colorEnabled);