mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 03:31:07 +01:00
Re-render party when members update
This commit is contained in:
parent
ff752bfaf2
commit
e19d97db68
2 changed files with 37 additions and 0 deletions
|
|
@ -24,4 +24,25 @@ export default class DhParty extends BaseDataActor {
|
|||
static DEFAULT_ICON = 'systems/daggerheart/assets/icons/documents/actors/dark-squad.svg';
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
prepareBaseData() {
|
||||
super.prepareBaseData();
|
||||
this.partyMembers = this.partyMembers.filter((p) => !!p);
|
||||
|
||||
// Register this party to all members
|
||||
if (fromUuidSync(this.parent.uuid) === this.parent) {
|
||||
for (const member of this.partyMembers) {
|
||||
member.parties?.add(this.parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_onDelete(options, userId) {
|
||||
super._onDelete(options, userId);
|
||||
|
||||
// Clear this party from all members that aren't deleted
|
||||
for (const member of this.partyMembers) {
|
||||
member.parties?.delete(this.parent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import { createScrollText, damageKeyToNumber } from '../helpers/utils.mjs';
|
|||
import DhCompanionLevelUp from '../applications/levelup/companionLevelup.mjs';
|
||||
|
||||
export default class DhpActor extends Actor {
|
||||
parties = new Set();
|
||||
|
||||
#scrollTextQueue = [];
|
||||
#scrollTextInterval;
|
||||
|
||||
|
|
@ -83,6 +85,20 @@ export default class DhpActor extends Actor {
|
|||
this.updateSource({ prototypeToken });
|
||||
}
|
||||
|
||||
_onUpdate(changes, options, userId) {
|
||||
super._onUpdate(changes, options, userId);
|
||||
for (const party of this.parties) {
|
||||
party.render();
|
||||
}
|
||||
}
|
||||
|
||||
_onDelete(options, userId) {
|
||||
super._onDelete(options, userId);
|
||||
for (const party of this.parties) {
|
||||
party.render();
|
||||
}
|
||||
}
|
||||
|
||||
async updateLevel(newLevel) {
|
||||
if (!['character', 'companion'].includes(this.type) || newLevel === this.system.levelData.level.changed) return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue