kckaiwei / TurnMarker-alt

Turn Marker is a module for Foundry VTT that adds an image under a token who is currently active in the combat tracker.
7 stars 16 forks source link

Issue new to Foundry 9 prevents chat message but trivially easy to fix... #87

Open lupestro opened 2 years ago

lupestro commented 2 years ago

I found and locally fixed a trivial issue that prevents chat message from appearing. In the following code at the bottom of chatter.js, I replaced combatant._actor with combatant.actor:

    static placeImage(combatant) {
        if (Settings.getIncludeAnnounceImage()) {
            let img = combatant.img;
            if (combatant.actor.data.img) {
                img = combatant.actor.data.img;
            }
            return `<div style="flex:3;padding-right:4px"><img src="${img}" style="border: none;" /></div>`;
            // return `<div style="flex:3;"><video><source="${combatant.img}"></video></div>`;
        } else return '';
    }

There is another issue that already existed in utils.js in , when deleting the tiles, which I've patched locally as well. This code, which is invoked from ready, assumes that there is a scene on the canvas. A guard clause for the existence of canvas.scene before using it to call getEmbeddedCollection(...) will prevent it from spewing an error in the console.log on startup.

I have no idea what other issues exist. This module looks like it is capable of doing a lot more than what little I use it for, so as I get more into it, I'll see what I find.