Open eryon opened 1 year ago
It looks like it's working correctly for me.
The issue is this beeing a mixed wrapper i think https://github.com/ironmonk88/monks-combat-details/blob/main/monks-combat-details.js#L174
You can use the same method i use to add extra condition while still keeping it a WRAPPER instead of MIXED https://github.com/theripper93/combat-tracker-dock/blob/master/scripts/config.js#L406
Even after the update this is still throwing unecessary compatibility errors
you can just change
patchFunc("Combatant.prototype.visible", function (wrapped, ...args) {
if (this.hidden) return this.isOwner;
if ((setting('hide-enemies') && !this.combat.started) || (setting("hide-until-turn") && this.combat.started && getProperty(this, "flags.monks-combat-details.reveal" ) !== true)) {
if (this.combat && !game.user.isGM) {
let idx = this.combat.turns.findIndex(t => t.id == this.id);
return this.hasPlayerOwner || (this.combat.started && (this.combat.round > 1 || !setting("hide-until-turn") || this.combat.turn >= idx));
}
}
return wrapped(...args);
}, "MIXED");
to
patchFunc("Combatant.prototype.visible", function (wrapped, ...args) {
if (this.hidden) return wrapped(...args);
if ((setting('hide-enemies') && !this.combat.started) || (setting("hide-until-turn") && this.combat.started && getProperty(this, "flags.monks-combat-details.reveal" ) !== true)) {
if (this.combat && !game.user.isGM) {
let idx = this.combat.turns.findIndex(t => t.id == this.id);
return wrapped(...args) && (this.hasPlayerOwner || (this.combat.started && (this.combat.round > 1 || !setting("hide-until-turn") || this.combat.turn >= idx)));
}
}
return wrapped(...args);
}, "WRAPPER");
and it should stop throwing warnings (the line is https://github.com/ironmonk88/monks-combat-details/blob/main/monks-combat-details.js#L196C1-L205C25 )
That said, if you want to simplify you don't even need to check for CCT, you can just substitute the whole block with this
patchFunc("Combatant.prototype.visible", function (wrapped, ...args) {
function isVisible() {
if (this.hidden) return this.isOwner;
if ((setting("hide-enemies") && !this.combat.started) || (setting("hide-until-turn") && this.combat.started && getProperty(this, "flags.monks-combat-details.reveal") !== true)) {
if (this.combat && !game.user.isGM) {
let idx = this.combat.turns.findIndex((t) => t.id == this.id);
return this.hasPlayerOwner || (this.combat.started && (this.combat.round > 1 || !setting("hide-until-turn") || this.combat.turn >= idx));
}
}
return true;
}
return wrapped(...args) && isVisible.bind(this)();
}, "WRAPPER");
Describe the bug When used alongside ripper's Carousel Combat Tracker, the carousel visibility buttons don't work. lib-wrapper blames this Combat Details module.
To Reproduce Steps to reproduce the behavior:
Expected behavior Visibility update should be reflected wherever it's shown. Specifically using the one in the dock should toggle the one in the encounter as well as the token visibility.
Screenshots If applicable, add screenshots to help explain your problem.
Please complete as much of the following information as possible:
Find the Culprit
to make sure it isn't a module interaction. -- yes, libwrapper blames this moduleAdditional context Carousel tracker module -- https://wiki.theripper93.com/free/combat-tracker-dock