From e2b13d671785eddc618273ca3101cc1b5bc56996 Mon Sep 17 00:00:00 2001 From: WBHarry Date: Sun, 29 Mar 2026 12:50:34 +0200 Subject: [PATCH] Removed a temporary override function in document/token. Doesn't seem needed anymore, and it was outdated, making bar2 on tokens never visualy update --- module/documents/token.mjs | 58 -------------------------------------- 1 file changed, 58 deletions(-) diff --git a/module/documents/token.mjs b/module/documents/token.mjs index 8e810689..4ee7ce05 100644 --- a/module/documents/token.mjs +++ b/module/documents/token.mjs @@ -494,62 +494,4 @@ export default class DHToken extends CONFIG.Token.documentClass { game.system.registeredTriggers.unregisterItemTriggers(this.actor.items); } } - - /* V14 TEMP until foundry fixes: https://discord.com/channels/170995199584108546/1421197211194228907/1467296028700049566 */ - _onRelatedUpdate(update = {}, operation = {}) { - this.#refreshOverrides(operation); - this._prepareBars(); - - // Update tracked Combat resource - const combatant = this.combatant; - if (combatant) { - const isActorUpdate = [this, null, undefined].includes(operation.parent); - const resource = game.combat.settings.resource; - const updates = Array.isArray(update) ? update : [update]; - if (isActorUpdate && resource && updates.some(u => foundry.utils.hasProperty(u.system ?? {}, resource))) { - combatant.updateResource(); - } - ui.combat.render(); - } - - // Trigger redraws on the token - if (this.parent.isView) { - if (this.object?.hasActiveHUD) canvas.tokens.hud.render(); - this.object?.renderFlags.set({ redrawEffects: true }); - for (const key of ['bar1', 'bar2']) { - const name = `${this.object?.objectId}.animate${key.capitalize()}`; - const easing = foundry.canvas.animation.CanvasAnimation.easeInOutCosine; - this.object?.animate({ [key]: this[key] }, { name, easing }); - } - for (const app of foundry.applications.sheets.TokenConfig.instances()) { - app._preview?.updateSource({ delta: this.toObject().delta }, { diff: false, recursive: false }); - app._preview?.object?.renderFlags.set({ refreshBars: true, redrawEffects: true }); - } - } - } - - /* V14 TEMP until foundry fixes: https://discord.com/channels/170995199584108546/1421197211194228907/1467296028700049566 */ - #refreshOverrides(operation) { - if (!this.actor) return; - - const { deepClone, mergeObject, equals, isEmpty } = foundry.utils; - const oldOverrides = deepClone(this._overrides) ?? {}; - const newOverrides = deepClone(this.actor?.tokenOverrides ?? {}, { prune: true }); - if (!equals(oldOverrides, newOverrides)) { - this._overrides = newOverrides; - this.reset(); - - // Send emulated update data to the PlaceableObject - if (!canvas.ready || canvas.scene !== this.scene) return; - const { width, height, depth, ...changes } = mergeObject( - mergeObject(oldOverrides, this, { insertKeys: false, insertValues: false }), - this._overrides - ); - this.object?._onUpdate(changes, {}, game.user.id); - - // Hand off size changes to a secondary handler requiring downstream implementation. - const sizeChanges = deepClone({ width, height, depth }, { prune: true }); - if (!isEmpty(sizeChanges)) this._onOverrideSize(sizeChanges, operation); - } - } }