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