1 | -- Global Variables |
---|
2 | walkingRouteOne = true -- True if thestranger is walking route one |
---|
3 | exitPositionReached = false |
---|
4 | playerInLock = false |
---|
5 | hangarReached = false |
---|
6 | |
---|
7 | -- Returns the distance between (x1,x2,x3) and (y1,y2,y3) |
---|
8 | function dist( x1,x2,x3, y1,y2,y3 ) |
---|
9 | |
---|
10 | return math.sqrt( (x1-y1)^2 + (x2-y2)^2 + (x3-y3)^2 ) |
---|
11 | |
---|
12 | end |
---|
13 | |
---|
14 | function stopWalkRouteOne(timestep) |
---|
15 | walkRouteOne = false |
---|
16 | return true |
---|
17 | end |
---|
18 | |
---|
19 | function observePlayer() |
---|
20 | playerX = Player:getAbsCoorX() |
---|
21 | playerY = Player:getAbsCoorY() |
---|
22 | playerZ = Player:getAbsCoorZ() |
---|
23 | |
---|
24 | if dist( playerX,playerY,playerZ,161.76,49,358.87 ) < 60 then |
---|
25 | playerInLock = true |
---|
26 | end |
---|
27 | |
---|
28 | end |
---|
29 | |
---|
30 | routeOneProgrammed = false |
---|
31 | function walkRouteOne(timestep) |
---|
32 | |
---|
33 | if not routeOneProgrammed then |
---|
34 | io.write("Guard called \n") |
---|
35 | guard:walkTo(-154.592667, 80.000000, 231.381805) |
---|
36 | routeOneProgrammed = true |
---|
37 | end |
---|
38 | |
---|
39 | end |
---|
40 | |
---|
41 | function goToExitPosition(timestep) |
---|
42 | |
---|
43 | return false |
---|
44 | end |
---|
45 | |
---|
46 | |
---|
47 | function goToHangar(timestep) |
---|
48 | |
---|
49 | return false |
---|
50 | end |
---|
51 | |
---|
52 | |
---|
53 | function waveToSpaceship(timestep) |
---|
54 | |
---|
55 | end |
---|
56 | |
---|
57 | |
---|
58 | function tick(timestep) |
---|
59 | --io.write("Guard called \n") |
---|
60 | observePlayer() |
---|
61 | |
---|
62 | if walkingRouteOne then |
---|
63 | walkRouteOne(timestep) |
---|
64 | end |
---|
65 | |
---|
66 | if not walkingRouteOne and not exitPositionReached then |
---|
67 | exitPositionReached = goToExitPosition(timestep) |
---|
68 | end |
---|
69 | |
---|
70 | if playerInLock and exitPositionReached then |
---|
71 | hangarReached = goToHangar(timestep) |
---|
72 | end |
---|
73 | |
---|
74 | if hangarReached then |
---|
75 | waveToSpaceship(timestep) |
---|
76 | end |
---|
77 | |
---|
78 | return false |
---|
79 | end |
---|
80 | |
---|