mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-21 23:13:39 +02:00
Removed a temporary override function in document/token. Doesn't seem needed anymore, and it was outdated, making bar2 on tokens never visualy update
This commit is contained in:
parent
e8f052faf3
commit
e2b13d6717
1 changed files with 0 additions and 58 deletions
|
|
@ -494,62 +494,4 @@ export default class DHToken extends CONFIG.Token.documentClass {
|
||||||
game.system.registeredTriggers.unregisterItemTriggers(this.actor.items);
|
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue