Skip to content

Commit d8a2c20

Browse files
committed
sim editor bug fix
1 parent 0f93c1d commit d8a2c20

File tree

1 file changed

+20
-45
lines changed

1 file changed

+20
-45
lines changed

public/javascripts/sim_editor.2021.js

Lines changed: 20 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ app.controller('SimEditorController', ['$scope', '$uibModal', '$log', '$http','$
10781078
let floorColor = '0.635 0.635 0.635';
10791079
let halfWallOutVar = [0, 0, 0, 0];
10801080
let halfWallInVar = [0, 0, 0, 0];
1081-
let curveWallVar = '[0, 0, 0, 0]';
1081+
let curveWallVar = [0, 0, 0, 0];
10821082
//stores shortening, lengthing of outer half walls
10831083
let halfWallOutInfo = [1, 1, 1, 1];
10841084

@@ -1087,10 +1087,6 @@ app.controller('SimEditorController', ['$scope', '$uibModal', '$log', '$http','$
10871087
switch(thisCell.tile.victims.top){
10881088
case 'None':
10891089
break;
1090-
case 'Heated':
1091-
humanType = 4;
1092-
humanPlace = 0;
1093-
break;
10941090
case 'H':
10951091
humanType = 1;
10961092
humanPlace = 0;
@@ -1125,10 +1121,6 @@ app.controller('SimEditorController', ['$scope', '$uibModal', '$log', '$http','$
11251121
switch(thisCell.tile.victims.right){
11261122
case 'None':
11271123
break;
1128-
case 'Heated':
1129-
humanType = 4;
1130-
humanPlace = 1;
1131-
break;
11321124
case 'H':
11331125
humanType = 1;
11341126
humanPlace = 1;
@@ -1162,10 +1154,6 @@ app.controller('SimEditorController', ['$scope', '$uibModal', '$log', '$http','$
11621154
switch(thisCell.tile.victims.bottom){
11631155
case 'None':
11641156
break;
1165-
case 'Heated':
1166-
humanType = 4;
1167-
humanPlace = 2;
1168-
break;
11691157
case 'H':
11701158
humanType = 1;
11711159
humanPlace = 2;
@@ -1178,16 +1166,28 @@ app.controller('SimEditorController', ['$scope', '$uibModal', '$log', '$http','$
11781166
humanType = 2;
11791167
humanPlace = 2;
11801168
break;
1169+
case 'F':
1170+
humanType = 5;
1171+
humanPlace = 2;
1172+
break;
1173+
case 'P':
1174+
humanType = 6;
1175+
humanPlace = 2;
1176+
break;
1177+
case 'C':
1178+
humanType = 7;
1179+
humanPlace = 2;
1180+
break;
1181+
case 'O':
1182+
humanType = 8;
1183+
humanPlace = 2;
1184+
break;
11811185

11821186
}
11831187
}else if(thisCell.tile.victims.left){
11841188
switch(thisCell.tile.victims.left){
11851189
case 'None':
11861190
break;
1187-
case 'Heated':
1188-
humanType = 4;
1189-
humanPlace = 3;
1190-
break;
11911191
case 'H':
11921192
humanType = 1;
11931193
humanPlace = 3;
@@ -1341,15 +1341,6 @@ app.controller('SimEditorController', ['$scope', '$uibModal', '$log', '$http','$
13411341
}
13421342
`;
13431343

1344-
const thermalHumanPart = ({x, z, rot, id, score}) => `
1345-
HeatVictim {
1346-
translation ${x} 0 ${z}
1347-
rotation 0 1 0 ${rot}
1348-
name "HeatVictim${id}"
1349-
scoreWorth ${score}
1350-
}
1351-
`;
1352-
13531344
const visualHumanPart = ({x, z, rot, id, type, score}) => `
13541345
Victim {
13551346
translation ${x} 0 ${z}
@@ -1644,16 +1635,8 @@ app.controller('SimEditorController', ['$scope', '$uibModal', '$log', '$http','$
16441635
//Z offset for left and right
16451636
randomOffset = [0, orgRound(getRandomArbitrary(-0.1 * tileScale[2], 0.1 * tileScale[2]), 0.001)]
16461637
}
1647-
//Thermal
1648-
if(walls[z][x][6] == 4){
1649-
humanPos[0] = humanPos[0] + humanOffsetThermal[walls[z][x][7]][0] + randomOffset[0]
1650-
humanPos[1] = humanPos[1] + humanOffsetThermal[walls[z][x][7]][1] + randomOffset[1]
1651-
let score = 15
1652-
if(walls[z][x][8]) score = 5
1653-
allHumans = allHumans + thermalHumanPart({x: humanPos[0], z: humanPos[1], rot: humanRot, id: humanId, score: score})
1654-
humanId = humanId + 1
1655-
}
1656-
else if (walls[z][x][6] >= 5 && walls[z][x][6] <= 8){ //hazards
1638+
1639+
if (walls[z][x][6] >= 5 && walls[z][x][6] <= 8){ //hazards
16571640
humanPos[0] = humanPos[0] + humanOffsetThermal[walls[z][x][7]][0] + randomOffset[0]
16581641
humanPos[1] = humanPos[1] + humanOffsetThermal[walls[z][x][7]][1] + randomOffset[1]
16591642
let score = 30
@@ -1677,15 +1660,7 @@ app.controller('SimEditorController', ['$scope', '$uibModal', '$log', '$http','$
16771660
let score = 30
16781661
let j = 0
16791662
if(walls[z][x][8]) score = 10
1680-
if (walls[z][x][13][i] == 4) {
1681-
score = score / 2;
1682-
if (Math.abs(halfWallVicPos[i][0]) == 0.075)
1683-
j = 1;
1684-
humanPos[j] *= (Math.abs(halfWallVicPos[i][0]) < 0.1) ? 1 : 1;
1685-
allHumans = allHumans + thermalHumanPart({x: humanPos[0] + halfWallVicPos[i][0] * tileScale[0], z: humanPos[1] + halfWallVicPos[i][1] * tileScale[2], rot: humanRotation[i % 4], id: humanId, score: score})
1686-
humanId = humanId + 1
1687-
}
1688-
else if (walls[z][x][13][i] >= 0 && walls[z][x][13][i] <= 3) {
1663+
if (walls[z][x][13][i] >= 0 && walls[z][x][13][i] <= 3) {
16891664
score = score / 2;
16901665
allHumans = allHumans + visualHumanPart({x: humanPos[0] + halfWallVicPos[i][0] * tileScale[0], z: humanPos[1] + halfWallVicPos[i][1] * tileScale[2], rot: humanRotation[i % 4], id: humanId, type: humanTypesVisual[walls[z][x][13][i] - 1], score: score})
16911666
humanId = humanId + 1

0 commit comments

Comments
 (0)