Skip to content

Commit

Permalink
Make Light Perception detect burning tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
dev7355608 committed Sep 10, 2024
1 parent 353c9a1 commit 17151e5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ The automation detects relevant feats and effects that affect the creatures sens
- Is not restricted by walls or blocked by darkness sources.
- Configured automatically for NPC actors that have the `Life Sense`[\*](#translations) feat.
- **Light Perception**
- Detects tokens, notes, and door controls that are illuminated a light source.
- Detects tokens, notes, and door controls that are illuminated a light source or are _burning_.
- Cannot detect actors that are _burrowing_, _ethereal_ (from the the material plane unless the `Etherealness`[\*](#translations) _(Monster Feature, e.g. SRD / MM 147)_ NPC feat says otherwise), or _invisible_.
- Disabled while _blinded_, _burrowing_, _defeated_ (_dead_), _petrified_, _sleeping_, or _unconscious_.
- Is restricted by sight-blocking walls and is blocked by darkness sources.
Expand Down
6 changes: 3 additions & 3 deletions module.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"email": "[email protected]"
}
],
"version": "2.4.1",
"version": "2.4.2",
"compatibility": {
"minimum": "12",
"verified": "12"
Expand Down Expand Up @@ -60,8 +60,8 @@
},
"url": "https://github.com/dev7355608/vision-5e",
"manifest": "https://github.com/dev7355608/vision-5e/releases/latest/download/module.json",
"download": "https://github.com/dev7355608/vision-5e/releases/download/v2.4.1/module.zip",
"changelog": "https://github.com/dev7355608/vision-5e/releases/tag/v2.4.1",
"download": "https://github.com/dev7355608/vision-5e/releases/download/v2.4.2/module.zip",
"changelog": "https://github.com/dev7355608/vision-5e/releases/tag/v2.4.2",
"bugs": "https://github.com/dev7355608/vision-5e/issues",
"readme": "https://raw.githubusercontent.com/dev7355608/vision-5e/main/README.md",
"license": "https://raw.githubusercontent.com/dev7355608/vision-5e/main/LICENSE"
Expand Down
8 changes: 5 additions & 3 deletions scripts/detection-modes/light-perception.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ export default class DetectionModeLightPerception extends DetectionMode {
}

/** @override */
static getDetectionFilter(visionSource) {
if (visionSource?.visionMode.perceivesLight) {
static getDetectionFilter(visionSource, object) {
if (visionSource?.visionMode.perceivesLight && (!object.document.hasStatusEffect(CONFIG.specialStatusEffects.BURNING)
|| canvas.effects.testInsideLight(object.center, object.document.elevation))) {
return;
}

Expand Down Expand Up @@ -52,6 +53,7 @@ export default class DetectionModeLightPerception extends DetectionMode {
/** @override */
_testPoint(visionSource, mode, target, test) {
return super._testPoint(visionSource, mode, target, test)
&& canvas.effects.testInsideLight(test.point, test.elevation);
&& (canvas.effects.testInsideLight(test.point, test.elevation)
|| target instanceof Token && target.document.hasStatusEffect(CONFIG.specialStatusEffects.BURNING));
}
}
1 change: 1 addition & 0 deletions scripts/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Hooks.once("init", () => {
CONFIG.specialStatusEffects.BLEEDING = "bleeding";
CONFIG.specialStatusEffects.BLIND_SENSES = "blindSenses";
CONFIG.specialStatusEffects.BLINDED = "blinded";
CONFIG.specialStatusEffects.BURNING = "burning";
CONFIG.specialStatusEffects.BURROWING = "burrowing";
CONFIG.specialStatusEffects.DEAFENED = "deafened";
CONFIG.specialStatusEffects.DEVILS_SIGHT = "devilsSight";
Expand Down

0 comments on commit 17151e5

Please sign in to comment.