From 812c8147a7022aa4c7afc54913f8cc71038375e7 Mon Sep 17 00:00:00 2001 From: Eligarf Date: Tue, 2 Jul 2024 08:04:46 -0700 Subject: [PATCH] Handle darkness sources --- ChangeLog.md | 4 ++++ scripts/engine.js | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 284f80b..9e8365e 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,3 +1,7 @@ +# v4.4.1 +* Update pt-BR.json (thanks Kharmans) +* Handle darkness sources properly + # v4.4.0 * dnd5e: *Hiding* Status Effect can be used to bank stealth results (Foundry v12/dnd5e v3.2 only) * dnd5e: Handle vision-5e's "undefined" detection mode diff --git a/scripts/engine.js b/scripts/engine.js index ddd30cb..1b42d84 100644 --- a/scripts/engine.js +++ b/scripts/engine.js @@ -606,8 +606,9 @@ export default class Engine { // } let lights = scene.lights - .map(light => light._object?.source) + .map(light => beforeV12 ? light._object?.source : light._object?.lightSource) .concat(scene.tokens.filter(t => t.object?.light?.active).map(t => t.object.light)) + .filter(light => !((beforeV12) ? light.isDarkness : light instanceof foundry.canvas.sources.PointDarknessSource)) .filter(light => light?.shape?.contains(center.x, center.y)); // .filter(light => distSquared(center, light, token.document.elevation, light.elevation) < light.data.dim * light.data.dim);