updated walls
This commit is contained in:
51
ddimport.js
51
ddimport.js
@@ -101,6 +101,7 @@ class DDImporter {
|
||||
let wallSet = []
|
||||
let ddPointString = ddWalls.points;
|
||||
let points = ddPointString.substring(18, ddPointString.length-2).split(", ").map(a => Number(a))
|
||||
points = points.concat(points.slice(0,2))
|
||||
|
||||
let offsetX = canvas.dimensions.paddingX;
|
||||
let offsetY = canvas.dimensions.paddingY;
|
||||
@@ -122,39 +123,43 @@ class DDImporter {
|
||||
console.log(portalPoint2)
|
||||
let portalPoint1FVTT = this.convertPointFromDDtoFVTT(portalPoint1);
|
||||
let portalPoint2FVTT = this.convertPointFromDDtoFVTT(portalPoint2);
|
||||
let wall = new Wall({
|
||||
c : [portalPoint1FVTT[0], portalPoint1FVTT[1], portalPoint2FVTT[0], portalPoint2FVTT[1]],
|
||||
});
|
||||
wall.data.door = CONST.WALL_DOOR_TYPES.DOOR
|
||||
walls.push(wall.data)
|
||||
if(i == 0){
|
||||
let wall = new Wall({
|
||||
c : [portalPoint1FVTT[0], portalPoint1FVTT[1], portalPoint2FVTT[0], portalPoint2FVTT[1]],
|
||||
});
|
||||
wall.data.door = CONST.WALL_DOOR_TYPES.DOOR
|
||||
walls.push(wall.data)
|
||||
}
|
||||
let point1 = [points[i], points[i+1]]
|
||||
let point2 = [points[i+2], points[i+3]]
|
||||
let line = [point1,point2]
|
||||
if (this.pointIsOnLine(portalCenterPoint,line))
|
||||
{
|
||||
console.log('yes');
|
||||
console.log(this.getNearerPoint(point1, [portalPoint1, portalPoint2]));
|
||||
console.log(this.getNearerPoint(point2, [portalPoint1, portalPoint2]));
|
||||
let topoint1 = this.convertPointFromDDtoFVTT(this.getNearerPoint(point1, [portalPoint1, portalPoint2]));
|
||||
let topoint2 = this.convertPointFromDDtoFVTT(this.getNearerPoint(point2, [portalPoint1, portalPoint2]));
|
||||
let point1fctt = this.convertPointFromDDtoFVTT(point1);
|
||||
let point2fctt = this.convertPointFromDDtoFVTT(point2);
|
||||
let wall1 = new Wall({
|
||||
c : [
|
||||
point1fctt[0],
|
||||
point1fctt[1],
|
||||
topoint1[0],
|
||||
topoint1[1]]
|
||||
});
|
||||
wallSet.push(wall1.data)
|
||||
let wall2 = new Wall({
|
||||
c : [
|
||||
point2fctt[0],
|
||||
point2fctt[1],
|
||||
topoint2[0],
|
||||
topoint2[1]]
|
||||
});
|
||||
wallSet.push(wall2.data)
|
||||
if (JSON.stringify(point1fctt)!==JSON.stringify(topoint1)){
|
||||
let wall1 = new Wall({
|
||||
c : [
|
||||
point1fctt[0],
|
||||
point1fctt[1],
|
||||
topoint1[0],
|
||||
topoint1[1]]
|
||||
});
|
||||
wallSet.push(wall1.data)
|
||||
}
|
||||
if (JSON.stringify(point2fctt)!==JSON.stringify(topoint2)){
|
||||
let wall2 = new Wall({
|
||||
c : [
|
||||
point2fctt[0],
|
||||
point2fctt[1],
|
||||
topoint2[0],
|
||||
topoint2[1]]
|
||||
});
|
||||
wallSet.push(wall2.data)
|
||||
}
|
||||
}
|
||||
else{
|
||||
let wall = new Wall({
|
||||
|
||||
Reference in New Issue
Block a user