From 16ef54e5a57d9b749a9e1bc94321ade6a2f04925 Mon Sep 17 00:00:00 2001 From: Peter Date: Mon, 7 Aug 2023 00:22:56 +0200 Subject: [PATCH] refactor: use self --- src/game.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/game.ts b/src/game.ts index f556fa2b4..e0e845d3b 100644 --- a/src/game.ts +++ b/src/game.ts @@ -602,14 +602,17 @@ export default class Game { this.activeCreature = this.players[0].creatures[0]; // Prevent errors - this.UI = new UI( - { - get isAcceptingInput() { - return !this.freezedInput; + { + const self = this; + this.UI = new UI( + { + get isAcceptingInput() { + return !self.freezedInput; + }, }, - }, - this, - ); // Create UI (not before because some functions require creatures to already exist) + this, + ); // Create UI (not before because some functions require creatures to already exist) + } // DO NOT CALL LOG BEFORE UI CREATION this.gameState = 'playing';