[4202] | 1 | -- Create the trigger |
---|
| 2 | trigger = ScriptTrigger() |
---|
| 3 | trigger:setName("floorguytrigger") |
---|
| 4 | trigger:setScript("floorguy.lua") |
---|
| 5 | trigger:setFunction("tick") |
---|
| 6 | trigger:setAbsCoor(576.753357, 19, 508.746613) |
---|
| 7 | trigger:setTarget("Player") |
---|
| 8 | trigger:setRadius(100) |
---|
| 9 | |
---|
[4080] | 10 | -- Get objects from orxonox |
---|
| 11 | thisscript:addObject("GenericNPC", "floorguy") |
---|
| 12 | thisscript:addObject("FPSPlayer", "Player") |
---|
[4178] | 13 | thisscript:addObject("SpaceShip", "flyby") |
---|
[3965] | 14 | |
---|
| 15 | programRoute = true |
---|
[4080] | 16 | height = -10 |
---|
[4195] | 17 | time = 3 |
---|
[3965] | 18 | |
---|
[4161] | 19 | |
---|
[4178] | 20 | function fly(timestep) |
---|
| 21 | |
---|
| 22 | dx = 0 * timestep |
---|
| 23 | dy = 0 * timestep |
---|
| 24 | dz = -500* timestep |
---|
| 25 | |
---|
| 26 | flybyX = flyby:getAbsCoorX() |
---|
| 27 | flybyY = flyby:getAbsCoorY() |
---|
| 28 | flybyZ = flyby:getAbsCoorZ() |
---|
| 29 | |
---|
[4190] | 30 | if time < 0 and time > -0.4 then |
---|
[4178] | 31 | flyby:fire(true) |
---|
[4202] | 32 | else |
---|
| 33 | flyby:fire(false) |
---|
[4178] | 34 | end |
---|
| 35 | |
---|
| 36 | if flybyZ < 600 then |
---|
[4202] | 37 | --flyby:setAbsCoor(flybyX + dx, flybyY + dy, flybyZ + dz) |
---|
[4178] | 38 | end |
---|
| 39 | |
---|
| 40 | end |
---|
| 41 | |
---|
[3965] | 42 | function tick(timestep) |
---|
| 43 | |
---|
[4178] | 44 | time = time - timestep |
---|
| 45 | |
---|
| 46 | if time < 0 then |
---|
| 47 | fly(timestep) |
---|
| 48 | end |
---|
| 49 | |
---|
| 50 | |
---|
[3965] | 51 | if programRoute then |
---|
| 52 | floorguy:runTo( 800.634338, height, -340.454163) |
---|
| 53 | floorguy:runTo( 800.965149, height, -317.040039) |
---|
| 54 | floorguy:runTo( 801.330627, height, -291.156891) |
---|
| 55 | floorguy:runTo( 801.922913, height, -274.193085) |
---|
| 56 | floorguy:runTo( 802.959045, height, -258.950653) |
---|
| 57 | floorguy:runTo( 803.812805, height, -246.390198) |
---|
| 58 | floorguy:runTo( 804.034180, height, -232.661407) |
---|
| 59 | floorguy:runTo( 816.056702, height, 407.114502) |
---|
| 60 | floorguy:runTo( 817.066284, height, 439.783112) |
---|
| 61 | floorguy:runTo( 817.734314, height, 461.401306) |
---|
| 62 | floorguy:runTo( 818.361816, height, 481.702789) |
---|
| 63 | floorguy:runTo( 820.161621, height, 540.826538) |
---|
| 64 | floorguy:runTo( 820.825195, height, 579.028748) |
---|
| 65 | floorguy:runTo( 821.907410, height, 641.302673) |
---|
| 66 | floorguy:runTo( 823.706055, height, 744.863098) |
---|
| 67 | floorguy:runTo( 820.552490, height, 761.699585) |
---|
| 68 | floorguy:runTo( 809.810425, height, 771.055420) |
---|
| 69 | floorguy:runTo( 794.455383, height, 779.180725) |
---|
[4161] | 70 | --floorguy:runTo( 779.520386, height, 773.730957) |
---|
| 71 | --floorguy:runTo( 769.395630, height, 762.138306) |
---|
| 72 | --floorguy:runTo( 761.172668, height, 749.739258) |
---|
| 73 | --floorguy:runTo( 756.049500, height, 736.094116) |
---|
| 74 | --floorguy:runTo( 755.904297, height, 648.224854) |
---|
| 75 | --floorguy:runTo( 742.674744, height, -243.343140) |
---|
| 76 | --floorguy:runTo( 742.312805, height, -273.083893) |
---|
| 77 | --floorguy:runTo( 741.927856, height, -304.735474) |
---|
| 78 | --floorguy:runTo( 741.548035, height, -335.971069) |
---|
| 79 | --floorguy:runTo( 741.181824, height, -366.028503) |
---|
[3965] | 80 | programRoute = false |
---|
| 81 | end |
---|
| 82 | |
---|
[4161] | 83 | |
---|
[3965] | 84 | if floorguy:finalGoalReached() then |
---|
| 85 | programRoute = true |
---|
| 86 | end |
---|
| 87 | |
---|
| 88 | |
---|
| 89 | return false |
---|
| 90 | end |
---|