Skip to content

Commit

Permalink
Added check for token hidden to show only to GM
Browse files Browse the repository at this point in the history
  • Loading branch information
ChasarooniZ authored Aug 13, 2023
1 parent c967c61 commit e07ff84
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion scripts/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export function generateDamageScroll(dmg_list, targets) {
const tok = game.canvas.tokens.get(target_id);
const size = tok.document.texture.scaleY * tok.document.width;
const topOffset = size * (game.settings.get("pf2e-rpg-numbers", 'top-offset') / 100);
const usersToPlayFor = getVisibleUsers(tok);

const dmg_list_filtered = dmg_list.filter(d => d.value > 0);
const seq = new Sequence();
Expand All @@ -108,11 +109,25 @@ export function generateDamageScroll(dmg_list, targets) {
.waitUntilFinished(wait_time)
.scaleIn(0.5, duration / 3)
.fadeOut(duration / 3)
.forUsers(usersToPlayFor)
}
seq.play();
}
}

export function getVisibleUsers(tok) {
let list = game.users.filter(u => u.isGM).map(u => u.id);
if (!tok.document.hidden) {
// check vision if pf2e perception active
// if (game.modules.get("pf2e-perception").active) {

// } else {
list = game.users.map(u => u.id);
// }
}
return list;
}

/**
* Extracts the list of damage info from pf2e chat message, only breaks it up between the overarching damage types
* @param {any} rolls Roll value from pf2e chat message
Expand Down Expand Up @@ -226,4 +241,4 @@ export function getFontScale(scaleType, dmg, tok) {
export function debugLog(data, context = "") {
if (game.settings.get("pf2e-rpg-numbers", 'debug-mode'))
console.log(`PF2E-RPG-#s: ${context}`, data);
}
}

0 comments on commit e07ff84

Please sign in to comment.