[4850] | 1 | -- Get objects from orxonox |
---|
| 2 | thisscript:addObject("FPSPlayer", "Player") |
---|
| 3 | thisscript:addObject("CameraMan", "cameraManager") |
---|
| 4 | thisscript:addObject("NPC", "IntroSpaceship") |
---|
| 5 | thisscript:addObjectAsName("GameWorld", "Moon Station", "gameWorld") -- =gameTitle |
---|
| 6 | |
---|
[4867] | 7 | thisscript:registerClass("Explosion") |
---|
| 8 | explosion = Explosion() |
---|
[4904] | 9 | explosion:setExplosionSound("sounds/explosions/explosion_6_BIG.wav") |
---|
[4867] | 10 | |
---|
[4850] | 11 | -- Initialisation |
---|
| 12 | triggerInit = TickTrigger() --ScriptTrigger() |
---|
| 13 | triggerInit:setScript("intro.lua") |
---|
| 14 | triggerInit:setFunction("startIntro") |
---|
| 15 | --triggerInit:setActiveOnCreation(true) |
---|
| 16 | |
---|
| 17 | -- Camera2MoonstationCenter |
---|
| 18 | triggerMoonstation = SpaceTrigger() |
---|
| 19 | triggerMoonstation:setScript("intro.lua") |
---|
| 20 | triggerMoonstation:setFunction("showMoonstation") |
---|
| 21 | triggerMoonstation:setAbsCoor(-1253.895386, 727.938721, -268.726807) |
---|
| 22 | triggerMoonstation:setTarget("CameraIntro") |
---|
| 23 | triggerMoonstation:setRadius(150) |
---|
[4867] | 24 | --triggerMoonstation:setDebugDraw(true) |
---|
[4850] | 25 | |
---|
[4867] | 26 | -- Camera2Spaceship |
---|
[4850] | 27 | triggerShowCrash = SpaceTrigger() |
---|
| 28 | triggerShowCrash:setScript("intro.lua") |
---|
| 29 | triggerShowCrash:setFunction("showCrashingSpaceship") |
---|
| 30 | triggerShowCrash:setAbsCoor(-158.458618, 543.123169, 541.286926) |
---|
| 31 | triggerShowCrash:setTarget("CameraIntro") |
---|
| 32 | triggerShowCrash:setRadius(200) |
---|
[4867] | 33 | --triggerShowCrash:setDebugDraw(true) |
---|
[4850] | 34 | |
---|
[4867] | 35 | -- Explode |
---|
| 36 | triggerShowCrash = SpaceTrigger() |
---|
| 37 | triggerShowCrash:setScript("intro.lua") |
---|
| 38 | triggerShowCrash:setFunction("explodeSpaceship") |
---|
| 39 | triggerShowCrash:setAbsCoor(840.948486, 175.905289, -175.412460) |
---|
| 40 | triggerShowCrash:setTarget("IntroSpaceship") |
---|
| 41 | triggerShowCrash:setRadius(250) |
---|
| 42 | --triggerShowCrash:setDebugDraw(true) |
---|
| 43 | |
---|
[4850] | 44 | --hide crashing ship |
---|
| 45 | triggerShowCrash = SpaceTrigger() |
---|
| 46 | triggerShowCrash:setScript("intro.lua") |
---|
| 47 | triggerShowCrash:setFunction("hideCrashingSpaceship") |
---|
| 48 | triggerShowCrash:setAbsCoor(-100, -400, -110) |
---|
| 49 | triggerShowCrash:setTarget("IntroSpaceship") |
---|
| 50 | triggerShowCrash:setRadius(60) |
---|
[4867] | 51 | --triggerShowCrash:setDebugDraw(true) |
---|
[4850] | 52 | |
---|
| 53 | -- End of Intro |
---|
| 54 | triggerEndIntro = SpaceTrigger() |
---|
| 55 | triggerEndIntro:setScript("intro.lua") |
---|
| 56 | triggerEndIntro:setFunction("stopIntro") |
---|
| 57 | triggerEndIntro:setAbsCoor(719.431091, 79.719810, -149.023880) |
---|
| 58 | triggerEndIntro:setTarget("CameraIntro") |
---|
| 59 | triggerEndIntro:setRadius(110) |
---|
[4867] | 60 | --triggerEndIntro:setDebugDraw(true) |
---|
[4850] | 61 | |
---|
| 62 | |
---|
| 63 | -- Functions -------------------------------------------------- |
---|
| 64 | -- globals |
---|
| 65 | introRunning = false |
---|
[4901] | 66 | spaceshipCrashDelay = 3 |
---|
[4867] | 67 | boomSize = 100 |
---|
| 68 | pauseBurn = 0 |
---|
| 69 | exploded = false |
---|
[4850] | 70 | |
---|
| 71 | -- init function |
---|
| 72 | function startIntro(timestep) |
---|
| 73 | gameWorld:showText("Moon Surface 2102"); |
---|
| 74 | cameraManager:setCam("CameraIntro") |
---|
| 75 | cameraManager:jumpCurrCam(-1295.883301, 621.807922, -969.386780) |
---|
| 76 | cameraManager:changeCurrTarget("Planet", "Earth") |
---|
| 77 | cameraManager:initFadeBlack() |
---|
| 78 | cameraManager:toggleFade() |
---|
| 79 | |
---|
| 80 | IntroSpaceship:pause(true) |
---|
| 81 | --Player:pause(true) |
---|
| 82 | introRunning = true |
---|
| 83 | |
---|
| 84 | return true --just once |
---|
| 85 | end |
---|
| 86 | |
---|
| 87 | function showMoonstation(timestep) |
---|
| 88 | cameraManager:changeCurrTarget("Building", "MoonstationCenterHack") |
---|
| 89 | return true |
---|
| 90 | end |
---|
| 91 | |
---|
| 92 | function showCrashingSpaceship(timestep) |
---|
| 93 | cameraManager:changeCurrTarget("NPC", "IntroSpaceship") |
---|
| 94 | spaceshipCrashDelay = spaceshipCrashDelay - timestep |
---|
| 95 | if spaceshipCrashDelay<0 then --BUG this is a little hack cause if the target is mooving the camera switch would be imediate |
---|
| 96 | IntroSpaceship:pause(false) |
---|
[4867] | 97 | if pauseBurn==0 then |
---|
| 98 | pauseBurn = 5 |
---|
| 99 | explosion:setAbsCoor(IntroSpaceship:getAbsCoorX(),IntroSpaceship:getAbsCoorY(),IntroSpaceship:getAbsCoorZ()) |
---|
| 100 | explosion:explode(math.random()*50+50, math.random()*50+50, math.random()*50+50) |
---|
| 101 | if exploded then |
---|
[4894] | 102 | cameraManager:changeCurrTarget("ModelEntity", "destroyed fighter") |
---|
[4867] | 103 | return true |
---|
| 104 | end |
---|
| 105 | else |
---|
| 106 | pauseBurn = pauseBurn - 1 |
---|
| 107 | end |
---|
| 108 | return false |
---|
| 109 | end |
---|
| 110 | return false |
---|
| 111 | end |
---|
| 112 | |
---|
| 113 | function explodeSpaceship(timestep) |
---|
| 114 | --gameWorld:showText("BOOOOOOOOOOOOOOOOM"); |
---|
| 115 | explosion:setAbsCoor(1003, 226, -102) |
---|
| 116 | explosion:explode(boomSize,boomSize,boomSize) |
---|
| 117 | boomSize = boomSize + 10 |
---|
[4904] | 118 | if boomSize > 650 then |
---|
| 119 | --explosion:playSound() |
---|
[4850] | 120 | return true |
---|
| 121 | end |
---|
[4867] | 122 | exploded = true |
---|
[4850] | 123 | return false |
---|
| 124 | end |
---|
| 125 | |
---|
| 126 | function hideCrashingSpaceship(timestep) |
---|
| 127 | IntroSpaceship:pause(true) |
---|
[4867] | 128 | IntroSpaceship:setVisibility(false) |
---|
[4850] | 129 | return true |
---|
| 130 | end |
---|
| 131 | |
---|
| 132 | function stopIntro(timestep) |
---|
| 133 | cameraManager:setCam("GameWorldCamera") |
---|
| 134 | --Player:pause(false) |
---|
| 135 | introRunning = false |
---|
| 136 | return true |
---|
| 137 | end |
---|
| 138 | |
---|