Closed hamishcampbell closed 1 year ago
Running Hooks.callAll('tokenActionHudCoreReady')
in console appears to cleanly boot it.
I've noticed this when Foundry doesn't load straight into a scene. It's because the hooks are nested and the HUD is expecting a canvas. Is this true for your world?
I'm brand-new to Foundry hooks, but looking through the code - it seems that:
tokenActionHudCoreApiReady
: https://github.com/Larkinabout/fvtt-token-action-hud-core/blob/c27f1b77f9d91c1628510cb54b79aa13647eb7bc/scripts/init.js#L36tokenActionHudSystemReady
: https://github.com/Larkinabout/fvtt-token-action-hud-dnd5e/blob/64eae03322c3da765149c441dc9a41c9681e84c1/scripts/init.js#L10tokenActionHudCoreReady
: https://github.com/Larkinabout/fvtt-token-action-hud-core/blob/c27f1b77f9d91c1628510cb54b79aa13647eb7bc/scripts/init.js#L72However tokenActionHudCoreReady
isn't registered until canvasReady
is run, and this appears to happen after the above - or at least it is in my configuration.
It seems to me that tokenActionHudCoreReady
should be registered outside of canvasReady
:
https://github.com/Larkinabout/fvtt-token-action-hud-core/blob/c27f1b77f9d91c1628510cb54b79aa13647eb7bc/scripts/init.js#L76. Currently, it doesn't exist at the time the module triggers tokenActionHudCoreReady
so nothing happens and I don't quite understand why it should happen on every canvasReady
. E.g. canvasReady
is called on each scene load, so the hook is presumbly registered multiple times over the lifetime of a session, which doesn't seem right?
I've noticed this when Foundry doesn't load straight into a scene. It's because the hooks are nested and the HUD is expecting a canvas. Is this true for your world?
It is! And yes if I activate a scene and reload the issue goes away. Thanks, that's a useful workaround.
Good to hear. I'll look at using a different sequence of hooks. It was nested that way to avoid triggering the code before Foundry VTT was ready, but it has this unintended consequence.
Thanks. tldr; for future visitors: if the HUD doesn't appear to load correctly, make sure you have an initial scene set.
Fixed in Token Action HUD Core 1.4.9.
Describe the bug
Token HUD not visible.
Steps to reproduce
Pressing H causes the following in console (Firefox):
Interestingly, if I break there are run
game.initialize()
the HUD now appears and begins working, although with some hooks (e.g. show/hide onH
) running twice. So it sounds like it's not booting correctly, but some hooks are registered but the instance isn't attached togame
correctly.Versions: