[Feature] Active Party (#1803)

This commit is contained in:
WBHarry 2026-04-16 02:26:39 +02:00 committed by GitHub
parent 8808e4646d
commit 7d5cdeb09d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 179 additions and 71 deletions

View file

@ -117,7 +117,9 @@ export default class DhpActor extends Actor {
}
}
async _preDelete() {
async _preDelete(options, user) {
if ((await super._preDelete(options, user)) === false) return false;
if (this.prototypeToken.actorLink) {
game.system.registeredTriggers.unregisterItemTriggers(this.items);
} else {
@ -600,6 +602,7 @@ export default class DhpActor extends Actor {
rollData.system = this.system.getRollData();
rollData.prof = this.system.proficiency ?? 1;
rollData.cast = this.system.spellcastModifier ?? 1;
return rollData;
}

View file

@ -1,4 +1,11 @@
export default class DhActorCollection extends foundry.documents.collections.Actors {
/** @returns the active party */
get party() {
const id = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.ActiveParty);
const actor = game.actors.get(id);
return actor?.type === "party" ? actor : null;
}
/** Ensure companions are initialized after all other subtypes. */
_initialize() {
super._initialize();