From 5e6042174416b34cfa4a8fe3e9b9fcd00ca9a93c Mon Sep 17 00:00:00 2001 From: Giddy Date: Sat, 5 Nov 2022 14:08:36 +0000 Subject: [PATCH] fix: wait for flag set before doing flag read --- about-face.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/about-face.js b/about-face.js index c0b503c..856a6e4 100644 --- a/about-face.js +++ b/about-face.js @@ -37,8 +37,8 @@ Hooks.once("init", () => { precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL, }); }); -Hooks.on("canvasReady", () => { - if (canvas.scene?.flags?.[MODULE_ID] == undefined) canvas.scene.setFlag(MODULE_ID, "sceneEnabled", true); +Hooks.on("canvasReady", async () => { + if (canvas.scene?.flags?.[MODULE_ID] == null) await canvas.scene.setFlag(MODULE_ID, "sceneEnabled", true); if (canvas.scene?.flags?.[MODULE_ID].sceneEnabled) canvas.scene.tokens.forEach((tokenDocument) => drawAboutFaceIndicator(tokenDocument.object)); }); Hooks.on("preCreateToken", onPreCreateToken);