Skip to content

Commit

Permalink
Merge branch 'release/0.3.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
caewok committed Jan 26, 2023
2 parents 49573fc + f45449a commit 1134786
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.3.5
Fix for enhanced LOS when limited walls or walls with defined heights are present.

## 0.3.4
Update to geometry lib v0.1.3.

Expand Down
24 changes: 12 additions & 12 deletions scripts/WallTracer.js
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,8 @@ export class WallTracer extends Graph {
move: CONST.WALL_SENSE_TYPES.NORMAL
};
const height = {
min: Number.NEGATIVE_INFINITY,
max: Number.POSITIVE_INFINITY
min: Number.POSITIVE_INFINITY,
max: Number.NEGATIVE_INFINITY
};
let hasOneWay = false;

Expand All @@ -583,9 +583,8 @@ export class WallTracer extends Graph {
restrictionTypes.sound = Math.min(restrictionTypes.sound, doc.sound);
restrictionTypes.move = Math.min(restrictionTypes.move, doc.move);

const minmax = Math.minMax(height.min, height.max, wall.topZ, wall.bottomZ);
height.min = minmax.min;
height.max = minmax.max;
height.min = Math.min(height.min, wall.bottomZ)
height.max = Math.max(height.max, wall.topZ)

hasOneWay ||= doc.dir;

Expand Down Expand Up @@ -629,7 +628,6 @@ export class WallTracer extends Graph {
encompassingPolygons(origin, type) {
origin.z ??= 0;


// Find those polygons that actually contain the origin.
// Start by using the bounds, then test containment.
const bounds = new PIXI.Rectangle(origin.x - 1, origin.y -1, 2, 2);
Expand Down Expand Up @@ -807,14 +805,16 @@ Hooks.on("createWall", function(document, _options, _userId) {
Hooks.on("updateWall", function(document, changes, _options, _userId) {
log("updateWall");

// Only update the edges if the coordinates have changed.
if ( !(Object.hasOwn(changes, "c") || Object.hasOwn(changes, "ds")) ) return;
// Only update the edges if the coordinates have changed or the door setting has changed.
if ( Object.hasOwn(changes, "c") || Object.hasOwn(changes, "ds") ) {
// Easiest approach is to trash the edges for the wall and re-create them.
SCENE_GRAPH.removeWall(document.id);

// Easiest approach is to trash the edges for the wall and re-create them.
SCENE_GRAPH.removeWall(document.id);
// Only add the wall back if it is not open
if ( !document.object.isOpen) SCENE_GRAPH.addWall(document.object);
}

// Only add the wall if it is not open
if ( !document.object.isOpen) SCENE_GRAPH.addWall(document.object);
// Update the polygons regardless, in case a wall limitation or wall height has changed.
SCENE_GRAPH.updateCyclePolygons();
});

Expand Down
3 changes: 2 additions & 1 deletion scripts/clockwise_sweep.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,8 @@ function filterPotentialBlockingWalls(wallPoints, wallArr, sourceOrigin) {
* @param {object} config
*/
export function initializeClockwiseSweepPolygon(wrapper, origin, config) {
const encompassingPolygon = SCENE_GRAPH.encompassingPolygon(origin, this.config.type);
const sourceOrigin = config.source ? Point3d.fromPointSource(config.source) : new Point3d(origin.x, origin.y, 0);
const encompassingPolygon = SCENE_GRAPH.encompassingPolygon(sourceOrigin, config.type);
if ( encompassingPolygon ) {
config.boundaryShapes ||= [];
config.boundaryShapes.push(encompassingPolygon);
Expand Down

0 comments on commit 1134786

Please sign in to comment.