From 93aa6dd5a912a1762cc7c2a21db67da964d7de99 Mon Sep 17 00:00:00 2001 From: theripper93 Date: Wed, 14 Jul 2021 23:44:35 +0200 Subject: [PATCH] rendering fixes --- packs/macros.db | 2 +- scripts/main.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/packs/macros.db b/packs/macros.db index 7db28ee..0ed70d0 100644 --- a/packs/macros.db +++ b/packs/macros.db @@ -1,6 +1,6 @@ {"name":"Create Boss Bar MLT","type":"script","author":"Cspu3pxFr7tu7SU7","img":"icons/magic/unholy/hand-claw-glow-orange.webp","scope":"global","command":"//Put the name of the token in the MLT arguments field\n\nlet bbtoken = canvas.tokens.placeables.find(t=>t.data.name==args[0])\nif(!canvas.scene._bossBars || !canvas.scene._bossBars[bbtoken.id]){\nif(game.user.isGM)BossBar.create(bbtoken)\n}","folder":null,"sort":0,"permission":{"default":0,"Cspu3pxFr7tu7SU7":3},"flags":{"advanced-macros":{"runAsGM":false},"core":{"sourceId":"Macro.OqEpN5Ub8wadJNAr"}},"_id":"LD5Wc6K0vLQw0att"} {"name":"Remove custom bar for token","type":"script","author":"Cspu3pxFr7tu7SU7","img":"icons/svg/dice-target.svg","scope":"global","command":"let ctoken = canvas.tokens.controlled[0]\nunsetFlagsForToken(ctoken)\nasync function unsetFlagsForToken(token){\nawait token.document.unsetFlag(\"bossbar\", \"bgTex\")\nawait token.document.unsetFlag(\"bossbar\", \"fgTex\")\n}","folder":null,"sort":0,"permission":{"default":0,"Cspu3pxFr7tu7SU7":3},"flags":{"advanced-macros":{"runAsGM":false},"core":{"sourceId":"Macro.04DDbjukwigEJq1D"}},"_id":"NgsZIUucxqVrddbx"} {"name":"Set custom bar for token","type":"script","author":"Cspu3pxFr7tu7SU7","img":"icons/svg/dice-target.svg","scope":"global","command":"let ctoken = canvas.tokens.controlled[0]\nconst backgroundImg = \"\"\nconst foregroundImg = \"\"\nsetFlagsForToken(ctoken)\nasync function setFlagsForToken(token){\nawait token.document.setFlag(\"bossbar\", \"bgTex\",backgroundImg)\nawait token.document.setFlag(\"bossbar\", \"fgTex\",foregroundImg)\n}","folder":null,"sort":0,"permission":{"default":0,"Cspu3pxFr7tu7SU7":3},"flags":{"advanced-macros":{"runAsGM":false},"core":{"sourceId":"Macro.bPTJoRUXU1MqO0CF"}},"_id":"ZxpprfiHveCnuyTR"} -{"name":"Create Boss Bar MLT(Camera Pan)","type":"script","author":"Cspu3pxFr7tu7SU7","img":"icons/magic/unholy/hand-fire-skeleton-pink.webp","scope":"global","command":"//Put the name of the token in the MLT arguments field\n\nlet bbtoken = canvas.tokens.placeables.find(t=>t.data.name==args[0])\nif(!canvas.scene._bossBars || !canvas.scene._bossBars[bbtoken.id]){\nif(game.user.isGM){\nBossBar.panCamera(bbtoken)\nBossBar.create(bbtoken)\n}\n}","folder":null,"sort":0,"permission":{"default":0,"Cspu3pxFr7tu7SU7":3},"flags":{"advanced-macros":{"runAsGM":false},"core":{"sourceId":"Macro.ysnG5S2jR18S9QEF"}},"_id":"iWwnlmoMWqNGJ54U"} {"name":"Add Selected Token to Boss Bar","type":"script","author":"Cspu3pxFr7tu7SU7","img":"icons/magic/unholy/hand-light-pink.webp","scope":"global","command":"BossBar.create(_token)","folder":null,"sort":0,"permission":{"default":0,"Cspu3pxFr7tu7SU7":3},"flags":{"advanced-macros":{"runAsGM":false},"core":{"sourceId":"Macro.070NA2tmF2bhZ2Li"}},"_id":"dqmTmcs9mefSCdCv"} {"name":"Remove Selected token from Boss Bar","type":"script","author":"Cspu3pxFr7tu7SU7","img":"icons/magic/unholy/strike-body-explode-disintegrate.webp","scope":"global","command":"canvas.scene._bossBars[_token.id].destroy()","folder":null,"sort":0,"permission":{"default":0,"Cspu3pxFr7tu7SU7":3},"flags":{"advanced-macros":{"runAsGM":false},"core":{"sourceId":"Macro.SGGHqfDRzqwFcRv0"}},"_id":"i584asmB1rm9ID1Z"} +{"name":"Create Boss Bar MLT(Camera Pan)","type":"script","author":"Cspu3pxFr7tu7SU7","img":"icons/magic/unholy/hand-fire-skeleton-pink.webp","scope":"global","command":"//Put the name of the token in the MLT arguments field\n\nlet bbtoken = canvas.tokens.placeables.find(t=>t.data.name==args[0])\nif(!canvas.scene._bossBars || !canvas.scene._bossBars[bbtoken.id]){\nif(game.user.isGM){\nBossBar.panCamera(bbtoken)\nBossBar.create(bbtoken)\n}\n}","folder":null,"sort":0,"permission":{"default":0,"Cspu3pxFr7tu7SU7":3},"flags":{"advanced-macros":{"runAsGM":false},"core":{"sourceId":"Macro.ysnG5S2jR18S9QEF"}},"_id":"iWwnlmoMWqNGJ54U"} diff --git a/scripts/main.js b/scripts/main.js index e54397a..175385a 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -89,8 +89,10 @@ Hooks.once("ready", function () { scope: "world", }); - Hooks.on("renderApplication", async () => { - BossBar.renderBossBar(); + Hooks.on("renderApplication", (app) => { + if (app.id == "controls" || app.id =="navigation" || app.id == "camera-views") { + BossBar.renderBossBar(); + } }); BossBar.renderBossBar(); });