diff --git a/game/public/brain/brainGame.js b/game/public/brain/brainGame.js index d559f36..c04297e 100644 --- a/game/public/brain/brainGame.js +++ b/game/public/brain/brainGame.js @@ -367,17 +367,10 @@ class BrainGame { } getWorldEventByName = (e) => { - if (this.world?.events) { - const eventKeys = Object.keys(this.world.events) - for (let i = 0; i < eventKeys.length; i++) { - if (eventKeys[i].toLowerCase() === e.toLowerCase()) { - return eventKeys[i] - } - } - // If no match, return null - return null + if (this.world?.events.has(e)) { + return this.world.events[e] } - else return null + return null } doWorldEvent = (e) => { diff --git a/game/public/brain/gen/world/world.js b/game/public/brain/gen/world/world.js index 627d7f9..93ae58c 100644 --- a/game/public/brain/gen/world/world.js +++ b/game/public/brain/gen/world/world.js @@ -28,13 +28,12 @@ class World { // } // Events (these should all be strings to house chat commands) - this.events = { - worldStart: "", - gameStart: "", - gameEnd: "", + this.events = new Map() + this.events["worldStart"] = "" + this.events["gameStart"] = "" + this.events["gameEnd"] = "" // playerDie: "" // ... - } this.getWorldSeed = () => { return this._wSeed }