Skip to content

Commit

Permalink
Fixes to Chat Estimates #147
Browse files Browse the repository at this point in the history
Fix #147
  • Loading branch information
mclemente committed Apr 10, 2023
1 parent 8b4e502 commit 2c2dca8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions module/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ export async function renderTokenConfigHandler(tokenConfig, html) {
tab: {
name: "healthEstimate",
label: "Health Estimate",
icon: "fas fa-hand-pointer fa-fw",
icon: "fas fa-hand-pointer",
},
},
tokenConfig.object
Expand Down Expand Up @@ -581,10 +581,13 @@ export async function renderTokenConfigHandler(tokenConfig, html) {
}

export function onUpdateActor(actor, data, options, userId) {
if (!game.user.isGM || !canvas.scene) return;
let token = canvas.tokens?.placeables.find((e) => e.actor && e.actor.id == actor.id);
if (token && !game.healthEstimate.breakOverlayRender(token) && !game.healthEstimate.hideEstimate(token) && token.id in game.healthEstimate.actorsCurrentHP)
outputStageChange(token);
if (!game.user.isGM || !canvas.scene || !options?.diff) return;
let tokens = canvas.tokens?.placeables.filter((e) => e.actor && e.actor.id == actor.id);
for (let token of tokens) {
if (token && !game.healthEstimate.breakOverlayRender(token) && !game.healthEstimate.hideEstimate(token) && token.id in game.healthEstimate.actorsCurrentHP) {
outputStageChange(token);
}
}
}

// Starting in V11, this no longer works for changing a token's HP
Expand Down

0 comments on commit 2c2dca8

Please sign in to comment.