Added support for adversary actor sizes

This commit is contained in:
WBHarry 2025-12-15 19:58:23 +01:00
parent 9b4249b100
commit d38b924cad
15 changed files with 180 additions and 5 deletions

View file

@ -100,4 +100,18 @@ export default class DHToken extends TokenDocument {
}
super.deleteCombatants(tokens, combat ?? {});
}
/**@inheritdoc */
_onRelatedUpdate(update = {}, operation = {}) {
super._onRelatedUpdate(update, operation);
if (!this.actor?.isOwner) return;
const activeGM = game.users.activeGM; // Let the active GM take care of updates if available
if (this.actor.system.metadata.usesSize && activeGM && game.user.id === activeGM.id) {
const dimensions = { height: this.actor.system.size, width: this.actor.system.size };
if (dimensions.width !== this.width || dimensions.height !== this.height) {
this.parent?.syncTokenDimensions(this, dimensions);
}
}
}
}