Match abort if all players not ready in time (5s)

+ HTML Keys instructions
This commit is contained in:
LuckyLaszlo
2022-12-07 19:33:56 +01:00
parent 6985d2218f
commit d2cdc564ac
7 changed files with 139 additions and 98 deletions

View File

@@ -3,7 +3,7 @@ import * as c from "./constants.js"
import { gc, matchOptions } from "./global.js"
import * as ev from "../shared_js/class/Event.js"
import * as en from "../shared_js/enums.js"
import { matchmaking, matchmakingComplete, startGame } from "./pong.js";
import { matchmaking, matchmakingComplete, matchAbort, matchStart } from "./pong.js";
import { RacketClient } from "./class/RectangleClient.js";
import { repeatInput } from "./handleInput.js";
import { soundRoblox } from "./audio.js"
@@ -67,7 +67,11 @@ function preMatchListener(this: WebSocket, event: MessageEvent)
case en.EventTypes.matchStart:
socket.removeEventListener("message", preMatchListener);
socket.addEventListener("message", inGameListener);
startGame();
matchStart();
break;
case en.EventTypes.matchAbort:
socket.removeEventListener("message", preMatchListener);
matchAbort();
break;
}
}