Skip to content

Commit

Permalink
Add actor filter
Browse files Browse the repository at this point in the history
Fix #74.
  • Loading branch information
mclemente committed Sep 28, 2023
1 parent 031e187 commit c49f31e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions module/SystemProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ export class SystemProvider {
getUpdate(actors) {
return [actors, {}];
}

actorFilter(actor) {
return actor.hasPlayerOwner;
}
}

export class archmageProvider extends SystemProvider {
Expand Down Expand Up @@ -451,6 +455,10 @@ export class dnd5eProvider extends SystemProvider {
return 600;
}

actorFilter(actor) {
return super.actorFilter(actor) && actor.type !== "group";
}

getHitPoints(data) {
const hp = data.attributes.hp;
const value = parseInt(hp.value);
Expand Down Expand Up @@ -623,8 +631,8 @@ export class dnd5eProvider extends SystemProvider {
let saves = {};
for (let ability in CONFIG.DND5E.abilities) {
saves[ability] = {
short: CONFIG.DND5E.abilityAbbreviations[ability],
long: CONFIG.DND5E.abilities[ability],
short: CONFIG.DND5E.abilities[ability].abbreviation,
long: CONFIG.DND5E.abilities[ability].label,
};
}
return [
Expand Down
2 changes: 1 addition & 1 deletion module/logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class PartyOverviewApp extends Application {
}

update() {
let actors = game.actors.contents.filter((a) => a.hasPlayerOwner);
let actors = game.actors.contents.filter((a) => currentSystemProvider.actorFilter(a));
if (this.displayMode == DISPLAY_MODE.SHOW_PC_ONLY) {
let users = game.users.filter((u) => u.character).map((u) => u.character.id);
actors = actors.filter((playerActor) => users.includes(playerActor.id));
Expand Down

0 comments on commit c49f31e

Please sign in to comment.