Fixed deletion of characters in the world locking up the party actor

This commit is contained in:
WBHarry 2025-11-13 19:24:15 +01:00
parent 63e66bd0d3
commit 013085299f
5 changed files with 36 additions and 4 deletions

View file

@ -672,9 +672,19 @@ export default class DhCharacter extends BaseDataActor {
if (this.companion) {
this.companion.updateLevel(1);
}
if (this.parent.parties) {
for (const party of this.parent.parties) {
await party.update({
'system.partyMembers': party.system.partyMembers.filter(x => x.uuid !== this.parent.uuid)
});
}
}
}
_getTags() {
return [this.class.value?.name, this.class.subclass?.name, this.community?.name, this.ancestry?.name].filter((t) => !!t);
return [this.class.value?.name, this.class.subclass?.name, this.community?.name, this.ancestry?.name].filter(
t => !!t
);
}
}

View file

@ -32,7 +32,7 @@ export default class DhParty extends BaseDataActor {
// Register this party to all members
if (game.actors.get(this.parent.id) === this.parent) {
for (const member of this.partyMembers) {
member.parties?.add(this.parent);
member?.parties?.add(this.parent);
}
}
}
@ -42,7 +42,7 @@ export default class DhParty extends BaseDataActor {
// Clear this party from all members that aren't deleted
for (const member of this.partyMembers) {
member.parties?.delete(this.parent);
member?.parties?.delete(this.parent);
}
}
}