[3945] | 1 | -- Global Variables |
---|
[3947] | 2 | walkingRouteOne = true -- True if thestranger is walking route one |
---|
[3945] | 3 | exitPositionReached = false |
---|
| 4 | playerInLock = false |
---|
| 5 | hangarReached = false |
---|
| 6 | |
---|
[3946] | 7 | -- Returns the distance between (x1,x2,x3) and (y1,y2,y3) |
---|
| 8 | function dist( x1,x2,x3, y1,y2,y3 ) |
---|
[3945] | 9 | |
---|
[3946] | 10 | return math.sqrt( (x1-y1)^2 + (x2-y2)^2 + (x3-y3)^2 ) |
---|
| 11 | |
---|
| 12 | end |
---|
| 13 | |
---|
[3945] | 14 | function stopWalkRouteOne(timestep) |
---|
| 15 | walkRouteOne = false |
---|
| 16 | return true |
---|
| 17 | end |
---|
| 18 | |
---|
[3946] | 19 | function observePlayer() |
---|
| 20 | playerX = Player:getAbsCoorX() |
---|
| 21 | playerY = Player:getAbsCoorY() |
---|
| 22 | playerZ = Player:getAbsCoorZ() |
---|
| 23 | |
---|
[3947] | 24 | if dist( playerX,playerY,playerZ,161.76,49,358.87 ) < 60 then |
---|
| 25 | playerInLock = true |
---|
[3945] | 26 | end |
---|
| 27 | |
---|
[3947] | 28 | end |
---|
| 29 | |
---|
| 30 | routeOneProgrammed = false |
---|
[3945] | 31 | function walkRouteOne(timestep) |
---|
| 32 | |
---|
[3947] | 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 |
---|
[3945] | 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) |
---|
[3946] | 59 | --io.write("Guard called \n") |
---|
| 60 | observePlayer() |
---|
[3945] | 61 | |
---|
| 62 | if walkingRouteOne then |
---|
[3947] | 63 | walkRouteOne(timestep) |
---|
[3945] | 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 | |
---|