From cda8392795933435a42691edb451258ddda11465 Mon Sep 17 00:00:00 2001 From: Kim Ravn Hansen Date: Wed, 22 Oct 2025 10:13:14 +0200 Subject: [PATCH] Bugfixes --- scenes/authentication/authenticationScene.js | 2 +- scenes/playerCreation/playerCreationScene.js | 2 +- scenes/playerCreation/playerCreationSene.js | 53 -------------------- 3 files changed, 2 insertions(+), 55 deletions(-) delete mode 100755 scenes/playerCreation/playerCreationSene.js diff --git a/scenes/authentication/authenticationScene.js b/scenes/authentication/authenticationScene.js index 1e1cd6e..30c3361 100755 --- a/scenes/authentication/authenticationScene.js +++ b/scenes/authentication/authenticationScene.js @@ -1,7 +1,7 @@ import { Security } from "../../utils/security.js"; import { Config } from "../../config.js"; import { GameScene } from "../gameLoop/gameScene.js"; -import { PlayerCreationScene } from "../playerCreation/playerCreationSene.js"; +import { PlayerCreationScene } from "../playerCreation/playerCreationScene.js"; import { Prompt } from "../prompt.js"; import { Scene } from "../scene.js"; import { gGame } from "../../models/globals.js"; diff --git a/scenes/playerCreation/playerCreationScene.js b/scenes/playerCreation/playerCreationScene.js index 0bd1c48..dffa5df 100755 --- a/scenes/playerCreation/playerCreationScene.js +++ b/scenes/playerCreation/playerCreationScene.js @@ -16,7 +16,7 @@ export class PlayerCreationScene extends Scene { onReady() { // // If there are too many players, stop allowing new players in. - if (gGame._players.size >= Config.maxPlayers) { + if (gGame.players.size >= Config.maxPlayers) { this.session.calamity("Server is full, no more players can be created"); } diff --git a/scenes/playerCreation/playerCreationSene.js b/scenes/playerCreation/playerCreationSene.js deleted file mode 100755 index 0bd1c48..0000000 --- a/scenes/playerCreation/playerCreationSene.js +++ /dev/null @@ -1,53 +0,0 @@ -import { Config } from "../../config.js"; -import { gGame } from "../../models/globals.js"; -import { Security } from "../../utils/security.js"; -import { Scene } from "../scene.js"; -import { CreateUsernamePrompt } from "./createUsernamePrompt.js"; - -export class PlayerCreationScene extends Scene { - intro = "= Create Player"; - - /** @protected @type {Player} */ - player; - - /** @protected @type {string} */ - password; - - onReady() { - // - // If there are too many players, stop allowing new players in. - if (gGame._players.size >= Config.maxPlayers) { - this.session.calamity("Server is full, no more players can be created"); - } - - this.showPrompt(new CreateUsernamePrompt(this)); - } - - /** - * Called when the player has entered a valid and available username. - * - * @param {string} username - */ - usernameAccepted(username) { - const player = gGame.createPlayer(username); - this.player = player; - - this.session.sendSystemMessage("salt", player.salt); - this.session.sendText(`Username _*${username}*_ is available, and I've reserved it for you :)`); - - // - this.session.sendError("TODO: create a createPasswordPrompt and display it."); - } - - /** - * - * Called when the player has entered a password and confirmed it. - * - * @param {string} password - */ - passwordAccepted(password) { - this.password = password; - this.session.sendText("*_Success_* ✅ You will now be asked to log in again, sorry for that ;)"); - this.player.setPasswordHash(Security.generateHash(this.password)); - } -}