[4051] | 1 | -- Get objects from orxonox |
---|
| 2 | thisscript:addObject("GenericNPC", "prisoner") |
---|
| 3 | thisscript:addObject("FPSPlayer", "Player") |
---|
| 4 | thisscript:addObject("GenericNPC", "secondguard") |
---|
| 5 | |
---|
| 6 | |
---|
[3946] | 7 | cellDoorOpened = false |
---|
| 8 | walkinCellFinished = false |
---|
| 9 | cellExitReached = false |
---|
[3945] | 10 | exitReached = false |
---|
| 11 | hangarReached = false |
---|
| 12 | spaceShipReached = false |
---|
| 13 | spaceShipEntered = false |
---|
[3954] | 14 | playerInLock = false |
---|
[3945] | 15 | |
---|
[3946] | 16 | randTime = 0 |
---|
[3966] | 17 | height = 80 |
---|
[3945] | 18 | |
---|
[3962] | 19 | |
---|
| 20 | function dist( x1,x2,x3, y1,y2,y3 ) |
---|
| 21 | |
---|
| 22 | return math.sqrt( (x1-y1)^2 + (x2-y2)^2 + (x3-y3)^2 ) |
---|
| 23 | |
---|
| 24 | end |
---|
| 25 | |
---|
[3954] | 26 | function observeGuard() |
---|
[3965] | 27 | guardX = secondguard:getAbsCoorX() |
---|
| 28 | guardY = secondguard:getAbsCoorY() |
---|
| 29 | guardZ = secondguard:getAbsCoorZ() |
---|
[3954] | 30 | |
---|
[3965] | 31 | if dist( guardX,guardY,guardZ, 43.406876, 29, 179.517303) < 60 then |
---|
[3945] | 32 | cellDoorOpened = true |
---|
| 33 | end |
---|
| 34 | |
---|
[3954] | 35 | end |
---|
[3945] | 36 | |
---|
[3954] | 37 | function observePlayer() |
---|
| 38 | playerX = Player:getAbsCoorX() |
---|
| 39 | playerY = Player:getAbsCoorY() |
---|
| 40 | playerZ = Player:getAbsCoorZ() |
---|
| 41 | |
---|
| 42 | if dist( playerX,playerY,playerZ,161.76,49,358.87 ) < 60 then |
---|
| 43 | playerInLock = true |
---|
| 44 | end |
---|
| 45 | |
---|
[3962] | 46 | end |
---|
| 47 | |
---|
[3965] | 48 | |
---|
| 49 | |
---|
[3954] | 50 | walkProgrammed = false |
---|
| 51 | exitProgrammed = false |
---|
[3945] | 52 | function walkInCell(timestep) |
---|
| 53 | |
---|
[3965] | 54 | |
---|
[3954] | 55 | if not walkProgrammed then |
---|
[3964] | 56 | prisoner:walkTo( -66.454849, height, 62.363449) |
---|
| 57 | prisoner:walkTo( -66.454849, height, 62.363449) |
---|
| 58 | prisoner:walkTo( -63.214821, height, 62.429710) |
---|
| 59 | prisoner:walkTo( -56.661182, height, 62.563740) |
---|
| 60 | prisoner:walkTo( -46.779755, height, 62.765827) |
---|
| 61 | prisoner:walkTo( -41.634224, height, 71.319214) |
---|
| 62 | prisoner:walkTo( -38.168526, height, 79.655807) |
---|
| 63 | prisoner:walkTo( -40.782196, height, 101.285233) |
---|
| 64 | prisoner:walkTo( -47.722874, height, 114.314980) |
---|
| 65 | prisoner:walkTo( -54.593349, height, 118.605423) |
---|
| 66 | prisoner:walkTo( -62.802982, height, 117.947144) |
---|
| 67 | prisoner:walkTo( -73.180130, height, 116.720863) |
---|
| 68 | prisoner:walkTo( -85.028603, height, 114.952316) |
---|
| 69 | prisoner:walkTo( -113.125824, height, 96.362946) |
---|
| 70 | prisoner:walkTo( -118.218887, height, 87.702599) |
---|
| 71 | prisoner:walkTo( -120.596275, height, 80.304184) |
---|
| 72 | prisoner:walkTo( -114.928169, height, 68.971840) |
---|
| 73 | prisoner:walkTo( -108.606766, height, 62.085098) |
---|
| 74 | prisoner:walkTo( -90.078171, height, 59.558804) |
---|
| 75 | prisoner:walkTo( -83.558510, height, 60.516567) |
---|
| 76 | prisoner:walkTo( -71.352402, height, 63.920750) |
---|
[3954] | 77 | walkProgrammed = true |
---|
[3945] | 78 | end |
---|
| 79 | |
---|
[3964] | 80 | |
---|
| 81 | if prisoner:finalGoalReached() and not cellDoorOpened then |
---|
[3965] | 82 | walkProgrammed = false |
---|
| 83 | end |
---|
[3964] | 84 | |
---|
[3965] | 85 | |
---|
[3954] | 86 | if cellDoorOpened then |
---|
[3945] | 87 | |
---|
[3954] | 88 | if not exitProgrammed then |
---|
[3964] | 89 | prisoner:walkTo( -61.875267, height, 158.254517) |
---|
| 90 | prisoner:walkTo( -62.335995, height, 170.318756) |
---|
| 91 | prisoner:walkTo( -62.358681, height, 179.232559) |
---|
| 92 | prisoner:walkTo( -55.998741, height, 189.289749) |
---|
| 93 | prisoner:walkTo( -49.237957, height, 195.076263) |
---|
| 94 | prisoner:walkTo( -39.007496, height, 195.889221) |
---|
| 95 | prisoner:walkTo( -24.234095, height, 195.547043) |
---|
| 96 | prisoner:walkTo( -11.409116, height, 196.236069) |
---|
| 97 | prisoner:walkTo( 2.545602, height, 196.805954) |
---|
| 98 | prisoner:walkTo( 13.875313, height, 196.377563) |
---|
| 99 | prisoner:walkTo( 28.379402, height, 195.829132) |
---|
| 100 | prisoner:walkTo( 41.672989, height, 195.326477) |
---|
| 101 | prisoner:walkTo( 57.125935, height, 194.742126) |
---|
| 102 | prisoner:walkTo( 70.114609, height, 194.251007) |
---|
| 103 | prisoner:walkTo( 81.857407, height, 193.806961) |
---|
| 104 | prisoner:walkTo( 97.840607, height, 193.974030) |
---|
| 105 | prisoner:walkTo( 107.569641, height, 196.299652) |
---|
| 106 | prisoner:walkTo( 120.975266, height, 202.754532) |
---|
| 107 | prisoner:walkTo( 129.063812, height, 207.099640) |
---|
| 108 | prisoner:walkTo( 140.468765, height, 214.389191) |
---|
| 109 | prisoner:walkTo( 145.902267, height, 224.194229) |
---|
| 110 | prisoner:walkTo( 148.106079, height, 233.095215) |
---|
| 111 | prisoner:walkTo( 150.907532, height, 244.410049) |
---|
| 112 | prisoner:walkTo( 153.191757, height, 253.635788) |
---|
| 113 | prisoner:walkTo( 153.191757, height, 253.635788) |
---|
[3954] | 114 | exitProgrammed = true |
---|
| 115 | end |
---|
| 116 | |
---|
[3964] | 117 | if prisoner:finalGoalReached() then |
---|
[3954] | 118 | return true |
---|
| 119 | end |
---|
| 120 | |
---|
[3965] | 121 | end |
---|
[3954] | 122 | |
---|
| 123 | return false |
---|
[3964] | 124 | |
---|
[3946] | 125 | end |
---|
[3945] | 126 | |
---|
[3946] | 127 | |
---|
[3954] | 128 | hangarRouteProgrammed = false |
---|
[3945] | 129 | function goToHangar(timestep) |
---|
| 130 | |
---|
[3965] | 131 | if not hangarRouteProgrammed and playerInLock then |
---|
| 132 | prisoner:walkTo( 149.255554, height, 253.358582) |
---|
| 133 | prisoner:walkTo( 155.679886, height, 274.126282) |
---|
| 134 | prisoner:walkTo( 157.556641, height, 285.543640) |
---|
| 135 | prisoner:walkTo( 159.016068, height, 294.552338) |
---|
| 136 | prisoner:walkTo( 160.234924, height, 303.494812) |
---|
| 137 | prisoner:walkTo( 161.399475, height, 313.532013) |
---|
| 138 | prisoner:walkTo( 162.218994, height, 323.290924) |
---|
| 139 | prisoner:walkTo( 162.030823, height, 335.226715) |
---|
| 140 | prisoner:walkTo( 161.351410, height, 378.328094) |
---|
| 141 | prisoner:walkTo( 161.183487, height, 388.983093) |
---|
| 142 | prisoner:walkTo( 160.590225, height, 426.615540) |
---|
| 143 | prisoner:walkTo( 160.313049, height, 444.198425) |
---|
| 144 | prisoner:walkTo( 160.410721, height, 454.192413) |
---|
| 145 | prisoner:walkTo( 161.796692, height, 465.085663) |
---|
| 146 | prisoner:walkTo( 163.096069, height, 474.038086) |
---|
| 147 | prisoner:walkTo( 165.596329, height, 485.415924) |
---|
| 148 | prisoner:walkTo( 167.407303, height, 493.229279) |
---|
| 149 | prisoner:walkTo( 169.595749, height, 499.048309) |
---|
| 150 | prisoner:walkTo( 173.485214, height, 504.383026) |
---|
| 151 | prisoner:walkTo( 182.131546, height, 510.774567) |
---|
| 152 | prisoner:walkTo( 187.788422, height, 512.870789) |
---|
| 153 | prisoner:walkTo( 196.524994, height, 514.751892) |
---|
| 154 | prisoner:walkTo( 205.403473, height, 515.840271) |
---|
| 155 | prisoner:walkTo( 205.403473, height, 515.840271) |
---|
| 156 | prisoner:walkTo( 220.813049, height, 515.886658) |
---|
| 157 | prisoner:walkTo( 392.501221, height, 516.405579) |
---|
| 158 | prisoner:walkTo( 441.405975, height, 516.502502) |
---|
| 159 | prisoner:walkTo( 513.379517, height, 515.572266) |
---|
| 160 | prisoner:walkTo( 586.638611, height, 514.625244) |
---|
| 161 | prisoner:walkTo( 651.319214, height, 513.789246) |
---|
| 162 | prisoner:walkTo( 680.890869, height, 513.406982) |
---|
| 163 | prisoner:walkTo( 701.035828, height, 512.568359) |
---|
| 164 | prisoner:walkTo( 716.025879, height, 510.741150) |
---|
| 165 | prisoner:walkTo( 723.756042, height, 509.009583) |
---|
| 166 | prisoner:walkTo( 733.522095, height, 504.761475) |
---|
| 167 | prisoner:walkTo( 738.782104, height, 501.529327) |
---|
| 168 | prisoner:walkTo( 744.840637, height, 496.154846) |
---|
| 169 | prisoner:walkTo( 750.059875, height, 487.892670) |
---|
| 170 | prisoner:walkTo( 753.419373, height, 477.053894) |
---|
| 171 | prisoner:walkTo( 754.661743, height, 470.759735) |
---|
| 172 | prisoner:walkTo( 765.877319, height, 397.575897) |
---|
| 173 | prisoner:walkTo( 768.522522, height, 360.462250) |
---|
| 174 | prisoner:walkTo( 769.531250, height, 326.195801) |
---|
| 175 | prisoner:walkTo( 770.420532, height, 286.531830) |
---|
| 176 | prisoner:walkTo( 769.840393, height, 238.220535) |
---|
| 177 | prisoner:walkTo( 771.094543, height, 172.138474) |
---|
| 178 | prisoner:walkTo( 772.765137, height, 94.427673) |
---|
| 179 | prisoner:walkTo( 771.779175, height, 62.094421) |
---|
| 180 | prisoner:walkTo( 771.069336, height, 35.182930) |
---|
| 181 | prisoner:walkTo( 769.679199, height, 4.657598) |
---|
| 182 | prisoner:walkTo( 768.049377, height, -23.208313) |
---|
| 183 | prisoner:walkTo( 766.691711, height, -54.609066) |
---|
| 184 | prisoner:walkTo( 765.022156, height, -85.732277) |
---|
| 185 | prisoner:walkTo( 763.538635, height, -110.417847) |
---|
| 186 | prisoner:walkTo( 761.547485, height, -143.547577) |
---|
| 187 | prisoner:walkTo( 760.982483, height, -147.543091) |
---|
| 188 | prisoner:walkTo( 756.619934, height, -163.474457) |
---|
| 189 | prisoner:walkTo( 751.651611, height, -180.926727) |
---|
| 190 | prisoner:walkTo( 739.842041, height, -216.826782) |
---|
| 191 | prisoner:walkTo( 716.715149, height, -294.878693) |
---|
| 192 | prisoner:walkTo( 698.400146, height, -365.404541) |
---|
| 193 | prisoner:walkTo( 692.199890, height, -396.395386) |
---|
| 194 | prisoner:walkTo( 685.157593, height, -437.489929) |
---|
| 195 | prisoner:walkTo( 678.175537, height, -475.680817) |
---|
| 196 | prisoner:walkTo( 674.907837, height, -505.428314) |
---|
| 197 | prisoner:walkTo( 674.588501, height, -531.477478) |
---|
| 198 | prisoner:walkTo( 674.703308, height, -550.883789) |
---|
| 199 | prisoner:walkTo( 675.315063, height, -567.361206) |
---|
| 200 | prisoner:walkTo( 676.178345, height, -583.178772) |
---|
| 201 | prisoner:walkTo( 678.579407, height, -638.655518) |
---|
| 202 | prisoner:walkTo( 689.508118, height, -884.296448) |
---|
| 203 | prisoner:walkTo( 690.749084, height, -917.750366) |
---|
| 204 | prisoner:walkTo( 691.617676, height, -933.357056) |
---|
| 205 | prisoner:walkTo( 696.260742, height, -972.685669) |
---|
| 206 | prisoner:walkTo( 698.526550, height, -990.077209) |
---|
| 207 | prisoner:walkTo( 705.576599, height, -1033.587646) |
---|
| 208 | prisoner:walkTo( 719.388611, height, -1111.123657) |
---|
| 209 | prisoner:walkTo( 724.847229, height, -1137.902832) |
---|
| 210 | prisoner:walkTo( 729.118652, height, -1159.426514) |
---|
| 211 | prisoner:walkTo( 733.152161, height, -1179.577393) |
---|
| 212 | prisoner:walkTo( 737.474365, height, -1200.200684) |
---|
| 213 | prisoner:walkTo( 740.808777, height, -1216.996216) |
---|
| 214 | prisoner:walkTo( 748.261108, height, -1252.447021) |
---|
| 215 | prisoner:walkTo( 748.648682, height, -1254.182983) |
---|
| 216 | prisoner:walkTo( 752.690430, height, -1272.386719) |
---|
| 217 | prisoner:walkTo( 755.726562, height, -1286.795532) |
---|
| 218 | prisoner:walkTo( 758.134705, height, -1302.620117) |
---|
| 219 | prisoner:walkTo( 759.900879, height, -1317.258911) |
---|
| 220 | prisoner:walkTo( 760.405212, height, -1357.575195) |
---|
| 221 | prisoner:walkTo( 760.203979, height, -1396.744385) |
---|
| 222 | prisoner:walkTo( 759.262085, height, -1433.674316) |
---|
| 223 | prisoner:walkTo( 758.916016, height, -1447.247437) |
---|
| 224 | prisoner:walkTo( 757.844910, height, -1474.596558) |
---|
| 225 | prisoner:walkTo( 756.331238, height, -1484.150269) |
---|
| 226 | prisoner:walkTo( 754.152283, height, -1491.574585) |
---|
| 227 | prisoner:walkTo( 750.549561, height, -1497.667236) |
---|
| 228 | prisoner:walkTo( 741.115356, height, -1509.581177) |
---|
| 229 | prisoner:walkTo( 733.292236, height, -1516.592407) |
---|
| 230 | prisoner:walkTo( 724.755798, height, -1522.380615) |
---|
| 231 | prisoner:walkTo( 712.188721, height, -1528.557495) |
---|
| 232 | prisoner:walkTo( 707.279907, height, -1530.261841) |
---|
| 233 | prisoner:walkTo( 698.749390, height, -1532.002563) |
---|
| 234 | prisoner:walkTo( 681.891785, height, -1532.067871) |
---|
| 235 | prisoner:walkTo( 625.072388, height, -1531.572266) |
---|
| 236 | prisoner:walkTo( 501.572601, height, -1533.919922) |
---|
| 237 | prisoner:walkTo( 237.189667, height, -1538.984985) |
---|
| 238 | prisoner:walkTo( 146.071304, height, -1540.965820) |
---|
| 239 | prisoner:walkTo( 88.186996, height, -1549.110962) |
---|
| 240 | prisoner:walkTo( 85.715096, height, -1549.537842) |
---|
| 241 | prisoner:walkTo( 66.997787, height, -1552.770264) |
---|
| 242 | prisoner:walkTo( 52.632504, height, -1555.359009) |
---|
| 243 | prisoner:walkTo( 38.350941, height, -1560.845459) |
---|
| 244 | prisoner:walkTo( 26.315248, height, -1568.211060) |
---|
| 245 | prisoner:walkTo( 15.210221, height, -1580.474121) |
---|
| 246 | prisoner:walkTo( 6.527347, height, -1594.483398) |
---|
| 247 | prisoner:walkTo( 3.175952, height, -1610.220093) |
---|
[3945] | 248 | |
---|
[3954] | 249 | hangarRouteProgrammed = true |
---|
| 250 | end |
---|
| 251 | |
---|
[3965] | 252 | thisX = prisoner:getAbsCoorX() |
---|
| 253 | thisY = prisoner:getAbsCoorY() |
---|
| 254 | thisZ = prisoner:getAbsCoorZ() |
---|
| 255 | |
---|
| 256 | if dist( thisX,thisY,thisZ, 3.175952, 29, -1610.220093) < 60 then |
---|
| 257 | return true |
---|
[3954] | 258 | end |
---|
| 259 | |
---|
[3965] | 260 | |
---|
[3945] | 261 | return false |
---|
| 262 | |
---|
| 263 | end |
---|
| 264 | |
---|
[3954] | 265 | spaceshipRouteProgrammed = false |
---|
[3945] | 266 | function goToSpaceship(timestep) |
---|
| 267 | |
---|
[3954] | 268 | if not spaceshipRouteProgrammed then |
---|
| 269 | |
---|
[3964] | 270 | |
---|
[3954] | 271 | spaceshipRouteProgrammed = true |
---|
| 272 | end |
---|
| 273 | |
---|
| 274 | if prisoner:finalGoalReached() then |
---|
| 275 | return true |
---|
| 276 | end |
---|
| 277 | |
---|
[3945] | 278 | return false |
---|
| 279 | |
---|
| 280 | end |
---|
| 281 | |
---|
| 282 | |
---|
| 283 | function enterSpaceship(timestep) |
---|
| 284 | |
---|
| 285 | return false |
---|
| 286 | end |
---|
| 287 | |
---|
| 288 | |
---|
| 289 | |
---|
| 290 | function tick(timestep) |
---|
| 291 | |
---|
[3954] | 292 | observeGuard() |
---|
| 293 | observePlayer() |
---|
| 294 | |
---|
| 295 | |
---|
[3965] | 296 | if not walkinCellFinished then |
---|
[3946] | 297 | walkinCellFinished = walkInCell(timestep) |
---|
[3945] | 298 | end |
---|
| 299 | |
---|
| 300 | |
---|
[3965] | 301 | if walkinCellFinished and not hangarReached then |
---|
[3945] | 302 | hangarReached = goToHangar(timestep) |
---|
| 303 | end |
---|
| 304 | |
---|
| 305 | if hangarReached and not spaceShipReached then |
---|
| 306 | spaceShipReached = goToSpaceship(timestep) |
---|
| 307 | end |
---|
| 308 | |
---|
| 309 | if spaceShipReached and not spaceShipEntered then |
---|
| 310 | spaceShipEntered = enterSpaceship(timestep) |
---|
| 311 | end |
---|
| 312 | |
---|
| 313 | if spaceShipEntered then |
---|
| 314 | return true |
---|
| 315 | end |
---|
| 316 | |
---|
| 317 | return false |
---|
| 318 | end |
---|