Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
Restrict Blindsight by total cover instead of line of sight (#20)
Browse files Browse the repository at this point in the history
* Change detection type of Blindsight to OTHER

* Restrict Blindsight by total cover instead of line of sight

* Use movement-based collision test for Blindsight
  • Loading branch information
dev7355608 authored Nov 28, 2022
1 parent 707a483 commit 5225b42
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ class BlindDetectionMode extends DetectionMode {
super({
id: "blindsight",
label: "DND5E.SenseBlindsight",
type: DetectionMode.DETECTION_TYPES.SIGHT,
type: DetectionMode.DETECTION_TYPES.OTHER,
});
}

Expand All @@ -281,7 +281,17 @@ class BlindDetectionMode extends DetectionMode {

/** @override */
_canDetect(visionSource, target) {
return target instanceof Token || target instanceof DoorControl;
return true;
}

/** @override */
_testLOS(visionSource, mode, target, test) {
// Blindsight is restricted by total cover
return !CONFIG.Canvas.losBackend.testCollision(
{ x: visionSource.x, y: visionSource.y },
test.point,
{ type: "move", mode: "any", source: visionSource }
);
}
}

Expand Down

0 comments on commit 5225b42

Please sign in to comment.