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 = 29 |
---|
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 = guard:getAbsCoorX() |
---|
22 | guardY = guard:getAbsCoorY() |
---|
23 | guardZ = guard:getAbsCoorZ() |
---|
24 | |
---|
25 | if dist( guardX,guardY,guardZ, 198.427155, 29, 243.656113 ) < 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 | walkProgrammed = false |
---|
43 | exitProgrammed = false |
---|
44 | function walkInCell(timestep) |
---|
45 | |
---|
46 | if not walkProgrammed then |
---|
47 | prisoner:walkTo( -66.454849, height, 62.363449) |
---|
48 | prisoner:walkTo( -66.454849, height, 62.363449) |
---|
49 | prisoner:walkTo( -63.214821, height, 62.429710) |
---|
50 | prisoner:walkTo( -56.661182, height, 62.563740) |
---|
51 | prisoner:walkTo( -46.779755, height, 62.765827) |
---|
52 | prisoner:walkTo( -41.634224, height, 71.319214) |
---|
53 | prisoner:walkTo( -38.168526, height, 79.655807) |
---|
54 | prisoner:walkTo( -40.782196, height, 101.285233) |
---|
55 | prisoner:walkTo( -47.722874, height, 114.314980) |
---|
56 | prisoner:walkTo( -54.593349, height, 118.605423) |
---|
57 | prisoner:walkTo( -62.802982, height, 117.947144) |
---|
58 | prisoner:walkTo( -73.180130, height, 116.720863) |
---|
59 | prisoner:walkTo( -85.028603, height, 114.952316) |
---|
60 | prisoner:walkTo( -113.125824, height, 96.362946) |
---|
61 | prisoner:walkTo( -118.218887, height, 87.702599) |
---|
62 | prisoner:walkTo( -120.596275, height, 80.304184) |
---|
63 | prisoner:walkTo( -114.928169, height, 68.971840) |
---|
64 | prisoner:walkTo( -108.606766, height, 62.085098) |
---|
65 | prisoner:walkTo( -90.078171, height, 59.558804) |
---|
66 | prisoner:walkTo( -83.558510, height, 60.516567) |
---|
67 | prisoner:walkTo( -71.352402, height, 63.920750) |
---|
68 | walkProgrammed = true |
---|
69 | end |
---|
70 | |
---|
71 | |
---|
72 | if prisoner:finalGoalReached() and not cellDoorOpened then |
---|
73 | walkProgrammed = false |
---|
74 | end |
---|
75 | |
---|
76 | if cellDoorOpened then |
---|
77 | |
---|
78 | if not exitProgrammed then |
---|
79 | prisoner:walkTo( -61.875267, height, 158.254517) |
---|
80 | prisoner:walkTo( -62.335995, height, 170.318756) |
---|
81 | prisoner:walkTo( -62.358681, height, 179.232559) |
---|
82 | prisoner:walkTo( -55.998741, height, 189.289749) |
---|
83 | prisoner:walkTo( -49.237957, height, 195.076263) |
---|
84 | prisoner:walkTo( -39.007496, height, 195.889221) |
---|
85 | prisoner:walkTo( -24.234095, height, 195.547043) |
---|
86 | prisoner:walkTo( -11.409116, height, 196.236069) |
---|
87 | prisoner:walkTo( 2.545602, height, 196.805954) |
---|
88 | prisoner:walkTo( 13.875313, height, 196.377563) |
---|
89 | prisoner:walkTo( 28.379402, height, 195.829132) |
---|
90 | prisoner:walkTo( 41.672989, height, 195.326477) |
---|
91 | prisoner:walkTo( 57.125935, height, 194.742126) |
---|
92 | prisoner:walkTo( 70.114609, height, 194.251007) |
---|
93 | prisoner:walkTo( 81.857407, height, 193.806961) |
---|
94 | prisoner:walkTo( 97.840607, height, 193.974030) |
---|
95 | prisoner:walkTo( 107.569641, height, 196.299652) |
---|
96 | prisoner:walkTo( 120.975266, height, 202.754532) |
---|
97 | prisoner:walkTo( 129.063812, height, 207.099640) |
---|
98 | prisoner:walkTo( 140.468765, height, 214.389191) |
---|
99 | prisoner:walkTo( 145.902267, height, 224.194229) |
---|
100 | prisoner:walkTo( 148.106079, height, 233.095215) |
---|
101 | prisoner:walkTo( 150.907532, height, 244.410049) |
---|
102 | prisoner:walkTo( 153.191757, height, 253.635788) |
---|
103 | prisoner:walkTo( 153.191757, height, 253.635788) |
---|
104 | exitProgrammed = true |
---|
105 | end |
---|
106 | |
---|
107 | if prisoner:finalGoalReached() then |
---|
108 | return true |
---|
109 | end |
---|
110 | |
---|
111 | end |
---|
112 | |
---|
113 | return false |
---|
114 | |
---|
115 | end |
---|
116 | |
---|
117 | |
---|
118 | return false |
---|
119 | |
---|
120 | end |
---|
121 | |
---|
122 | |
---|
123 | gotoExitProgrammed = false |
---|
124 | function goToExit(timestep) |
---|
125 | -- do not forget to make him wait until the player triggeres the trip to the hangar |
---|
126 | if not gotoExitProgrammed and playerInLock then |
---|
127 | |
---|
128 | gotoExitProgrammed = true |
---|
129 | end |
---|
130 | |
---|
131 | if prisoner:finalGoalReached() then |
---|
132 | return true |
---|
133 | end |
---|
134 | |
---|
135 | return false |
---|
136 | end |
---|
137 | |
---|
138 | hangarRouteProgrammed = false |
---|
139 | function goToHangar(timestep) |
---|
140 | |
---|
141 | if not hangarRouteProgrammed then |
---|
142 | |
---|
143 | hangarRouteProgrammed = true |
---|
144 | end |
---|
145 | |
---|
146 | if prisoner:finalGoalReached() then |
---|
147 | return true |
---|
148 | end |
---|
149 | |
---|
150 | return false |
---|
151 | |
---|
152 | end |
---|
153 | |
---|
154 | spaceshipRouteProgrammed = false |
---|
155 | function goToSpaceship(timestep) |
---|
156 | |
---|
157 | if not spaceshipRouteProgrammed then |
---|
158 | |
---|
159 | |
---|
160 | spaceshipRouteProgrammed = true |
---|
161 | end |
---|
162 | |
---|
163 | if prisoner:finalGoalReached() then |
---|
164 | return true |
---|
165 | end |
---|
166 | |
---|
167 | return false |
---|
168 | |
---|
169 | end |
---|
170 | |
---|
171 | |
---|
172 | function enterSpaceship(timestep) |
---|
173 | |
---|
174 | return false |
---|
175 | end |
---|
176 | |
---|
177 | |
---|
178 | |
---|
179 | function tick(timestep) |
---|
180 | |
---|
181 | observeGuard() |
---|
182 | observePlayer() |
---|
183 | |
---|
184 | |
---|
185 | if not cellDoorOpend then |
---|
186 | walkinCellFinished = walkInCell(timestep) |
---|
187 | end |
---|
188 | |
---|
189 | if walkinCellFinished and not exitReached then |
---|
190 | exitReached = goToExit(timestep) |
---|
191 | end |
---|
192 | |
---|
193 | if exitReached and not hangarReached then |
---|
194 | hangarReached = goToHangar(timestep) |
---|
195 | end |
---|
196 | |
---|
197 | if hangarReached and not spaceShipReached then |
---|
198 | spaceShipReached = goToSpaceship(timestep) |
---|
199 | end |
---|
200 | |
---|
201 | if spaceShipReached and not spaceShipEntered then |
---|
202 | spaceShipEntered = enterSpaceship(timestep) |
---|
203 | end |
---|
204 | |
---|
205 | if spaceShipEntered then |
---|
206 | return true |
---|
207 | end |
---|
208 | |
---|
209 | return false |
---|
210 | end |
---|