Skip to content

Commit 210c71f

Browse files
committed
a
1 parent e6b406e commit 210c71f

File tree

11 files changed

+33
-31
lines changed

11 files changed

+33
-31
lines changed
File renamed without changes.

packs/levels-samples/CURRENT

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
MANIFEST-003090
1+
MANIFEST-003104

packs/levels-samples/LOG

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
2024/08/30-17:14:41.720 41cc Recovering log #3088
2-
2024/08/30-17:14:41.723 41cc Delete type=0 #3088
3-
2024/08/30-17:14:41.724 41cc Delete type=3 #3086
1+
2024/09/01-13:03:46.666 3030 Recovering log #3102
2+
2024/09/01-13:03:46.670 3030 Delete type=0 #3102
3+
2024/09/01-13:03:46.670 3030 Delete type=3 #3100

packs/levels-samples/LOG.old

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
2024/08/30-13:56:32.007 2ef4 Recovering log #3085
2-
2024/08/30-13:56:32.010 2ef4 Delete type=0 #3085
3-
2024/08/30-13:56:32.010 2ef4 Delete type=3 #3084
4-
2024/08/30-13:56:40.835 6ba4 Level-0 table #3089: started
5-
2024/08/30-13:56:40.835 6ba4 Level-0 table #3089: 0 bytes OK
6-
2024/08/30-13:56:40.836 6ba4 Delete type=0 #3087
7-
2024/08/30-13:56:40.836 6ba4 Manual compaction at level-0 from '!scenes!i1noRqT20RD5stIK' @ 72057594037927935 : 1 .. '!scenes.walls!zksLSgRdh6f8jiUO.z5ptMNOLPqAgK6MH' @ 0 : 0; will stop at (end)
8-
2024/08/30-13:56:40.836 6ba4 Manual compaction at level-1 from '!scenes!i1noRqT20RD5stIK' @ 72057594037927935 : 1 .. '!scenes.walls!zksLSgRdh6f8jiUO.z5ptMNOLPqAgK6MH' @ 0 : 0; will stop at (end)
1+
2024/09/01-13:02:36.698 3578 Recovering log #3098
2+
2024/09/01-13:02:36.702 3578 Delete type=0 #3098
3+
2024/09/01-13:02:36.702 3578 Delete type=3 #3096
4+
2024/09/01-13:03:34.008 6e18 Level-0 table #3103: started
5+
2024/09/01-13:03:34.008 6e18 Level-0 table #3103: 0 bytes OK
6+
2024/09/01-13:03:34.009 6e18 Delete type=0 #3101
7+
2024/09/01-13:03:34.009 6e18 Manual compaction at level-0 from '!scenes!i1noRqT20RD5stIK' @ 72057594037927935 : 1 .. '!scenes.walls!zksLSgRdh6f8jiUO.z5ptMNOLPqAgK6MH' @ 0 : 0; will stop at (end)
8+
2024/09/01-13:03:34.009 6e18 Manual compaction at level-1 from '!scenes!i1noRqT20RD5stIK' @ 72057594037927935 : 1 .. '!scenes.walls!zksLSgRdh6f8jiUO.z5ptMNOLPqAgK6MH' @ 0 : 0; will stop at (end)
Binary file not shown.
File renamed without changes.

packs/macros/CURRENT

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
MANIFEST-003085
1+
MANIFEST-003099

packs/macros/LOG

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
2024/08/30-17:14:41.713 73a0 Recovering log #3083
2-
2024/08/30-17:14:41.715 73a0 Delete type=0 #3083
3-
2024/08/30-17:14:41.716 73a0 Delete type=3 #3081
1+
2024/09/01-13:03:46.660 3578 Recovering log #3097
2+
2024/09/01-13:03:46.663 3578 Delete type=0 #3097
3+
2024/09/01-13:03:46.663 3578 Delete type=3 #3095

packs/macros/LOG.old

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
2024/08/30-13:56:31.998 48a8 Recovering log #3080
2-
2024/08/30-13:56:32.003 48a8 Delete type=0 #3080
3-
2024/08/30-13:56:32.003 48a8 Delete type=3 #3079
4-
2024/08/30-13:56:40.830 6ba4 Level-0 table #3084: started
5-
2024/08/30-13:56:40.830 6ba4 Level-0 table #3084: 0 bytes OK
6-
2024/08/30-13:56:40.832 6ba4 Delete type=0 #3082
7-
2024/08/30-13:56:40.832 6ba4 Manual compaction at level-0 from '!macros!2LfY4Ky5rRDkK7h8' @ 72057594037927935 : 1 .. '!macros!yx7Eb76rfzjh0LEO' @ 0 : 0; will stop at (end)
8-
2024/08/30-13:56:40.832 6ba4 Manual compaction at level-1 from '!macros!2LfY4Ky5rRDkK7h8' @ 72057594037927935 : 1 .. '!macros!yx7Eb76rfzjh0LEO' @ 0 : 0; will stop at (end)
1+
2024/09/01-13:02:36.683 85bc Recovering log #3093
2+
2024/09/01-13:02:36.688 85bc Delete type=0 #3093
3+
2024/09/01-13:02:36.688 85bc Delete type=3 #3091
4+
2024/09/01-13:03:34.003 6e18 Level-0 table #3098: started
5+
2024/09/01-13:03:34.003 6e18 Level-0 table #3098: 0 bytes OK
6+
2024/09/01-13:03:34.004 6e18 Delete type=0 #3096
7+
2024/09/01-13:03:34.005 6e18 Manual compaction at level-0 from '!macros!2LfY4Ky5rRDkK7h8' @ 72057594037927935 : 1 .. '!macros!yx7Eb76rfzjh0LEO' @ 0 : 0; will stop at (end)
8+
2024/09/01-13:03:34.005 6e18 Manual compaction at level-1 from '!macros!2LfY4Ky5rRDkK7h8' @ 72057594037927935 : 1 .. '!macros!yx7Eb76rfzjh0LEO' @ 0 : 0; will stop at (end)
Binary file not shown.

scripts/handlers/sightHandler.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class SightHandler {
1818
static advancedLosTestVisibility(sourceToken, tokenOrPoint, source, type = "sight") {
1919
const angleTest = this.testInAngle(sourceToken, tokenOrPoint, source);
2020
if (!angleTest) return false;
21-
return !this.advancedLosTestInLos(sourceToken, tokenOrPoint, type);
21+
return !this.advancedLosTestInLos(sourceToken, tokenOrPoint, type, source);
2222
const inLOS = !this.advancedLosTestInLos(sourceToken, tokenOrPoint, type);
2323
if (sourceToken.vision.los === source) return inLOS;
2424
const inRange = this.tokenInRange(sourceToken, tokenOrPoint);
@@ -58,15 +58,15 @@ export class SightHandler {
5858
return tokenCorners;
5959
}
6060

61-
static advancedLosTestInLos(sourceToken, tokenOrPoint, type = "sight") {
62-
if (!(tokenOrPoint instanceof Token) || CONFIG.Levels.settings.get("preciseTokenVisibility") === false) return this.checkCollision(sourceToken, tokenOrPoint, type);
61+
static advancedLosTestInLos(sourceToken, tokenOrPoint, type = "sight", source) {
62+
if (!(tokenOrPoint instanceof Token) || CONFIG.Levels.settings.get("preciseTokenVisibility") === false) return this.checkCollision(sourceToken, tokenOrPoint, type, { sourcePolygon: source });
6363
const sourceCenter = {
6464
x: sourceToken.vision.x,
6565
y: sourceToken.vision.y,
6666
z: sourceToken.losHeight,
6767
};
6868
for (let point of this.getTestPoints(tokenOrPoint)) {
69-
let collision = this.testCollision(sourceCenter, point, type, { source: sourceToken, target: tokenOrPoint });
69+
let collision = this.testCollision(sourceCenter, point, type, { source: sourceToken, target: tokenOrPoint, sourcePolygon: source });
7070
if (!collision) return collision;
7171
}
7272
return true;
@@ -319,6 +319,7 @@ export class SightHandler {
319319
**/
320320

321321
static testCollision(p0, p1, type = "sight", options = {}) {
322+
debugger
322323
if (canvas?.scene?.flags["levels-3d-preview"]?.object3dSight) {
323324
if (!game.Levels3DPreview?._active) return true;
324325
return game.Levels3DPreview.interactionManager.computeSightCollision(p0, p1, type);
@@ -337,6 +338,7 @@ export class SightHandler {
337338

338339
const TYPE = type == "sight" ? 0 : type == "sound" ? 2 : type == "light" ? 3 : 1;
339340
const ALPHATTHRESHOLD = type == "sight" ? 0.99 : 0.1;
341+
const IGNOREDARKNESS = !options?.sourcePolygon?.config?.includeDarkness;
340342
//If the point are on the same Z axis return the 3d wall test
341343
if (z0 == z1) {
342344
return walls3dTest.bind(this)();
@@ -417,7 +419,7 @@ export class SightHandler {
417419
let terrainWalls = 0;
418420
for (const [k, edge] of canvas.edges) {
419421
if (this.shouldIgnoreWall(edge.object, TYPE, options)) continue;
420-
422+
if (IGNOREDARKNESS && edge.type === "darkness") continue;
421423
let isTerrain = (TYPE === 0 && edge.sight === CONST.WALL_SENSE_TYPES.LIMITED) || (TYPE === 1 && edge.move === CONST.WALL_MOVEMENT_TYPES.LIMITED) || (TYPE === 2 && edge.sound === CONST.WALL_MOVEMENT_TYPES.LIMITED) || (TYPE === 3 && edge.light === CONST.WALL_MOVEMENT_TYPES.LIMITED);
422424

423425
//declare points in 3d space of the rectangle created by the wall
@@ -481,7 +483,7 @@ export class SightHandler {
481483
* @param {String} type - "sight" or "move"/"collision" or "sound" or "light" (defaults to "sight")
482484
* @returns {Boolean} returns the collision point if a collision is detected, flase if it's not
483485
**/
484-
static checkCollision(tokenOrPoint1, tokenOrPoint2, type = "sight") {
486+
static checkCollision(tokenOrPoint1, tokenOrPoint2, type = "sight", options = {}) {
485487
const p0 =
486488
tokenOrPoint1 instanceof Token
487489
? {
@@ -498,6 +500,6 @@ export class SightHandler {
498500
z: tokenOrPoint2.losHeight,
499501
}
500502
: tokenOrPoint2;
501-
return this.testCollision(p0, p1, type, { source: tokenOrPoint1, target: tokenOrPoint2 });
503+
return this.testCollision(p0, p1, type, { source: tokenOrPoint1, target: tokenOrPoint2, ...options });
502504
}
503505
}

0 commit comments

Comments
 (0)