Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/trunk/scripts/prisoner.lua @ 4008

Last change on this file since 4008 was 3991, checked in by bensch, 18 years ago

data/trunk: merged the single_player_map branche back.
merged with command:
svn merge -r523:HEAD https://svn.orxonox.net/data/branches/single_player_map .

conflicts resolved in all sp_levels in favour of the branche

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