diff --git a/Resources/Config/missiontext.plist b/Resources/Config/missiontext.plist index a936821a..8726357d 100644 --- a/Resources/Config/missiontext.plist +++ b/Resources/Config/missiontext.plist @@ -443,11 +443,40 @@ "oolite-tutorial-8-24" = "Station screens: 4/4\nFinally, while docked at a station, the '[oolite_key_view_forward]' or 'F1' key is repurposed to request a launch slot, shortly after which you will be launched from the station."; + "oolite-tutorial-9-0" = "Lesson 9: System navigation\nThis lesson will cover navigation from the witchpoint to the system station."; + + "oolite-tutorial-9-1" = "We have transported your ship near to the witchpoint buoy. This buoy marks a stable exit point from witchspace, and ships entering the system will do so near this buoy."; + + "oolite-tutorial-9-2" = "The compass is used to direct you towards the planet. If you are facing the planet, the indicator will be green and centred. If you are facing directly away from the planet, it will be red and centred. Otherwise you will need to turn in the direction indicated. Turn your ship around and then use it to locate the planet it again."; + + "oolite-tutorial-9-3" = "Turn towards the planet and accelerate to maximum speed. Even at your top normal speed, it can take up to an hour to reach orbit. You can speed your flight up using the torus drive. Press '[oolite_key_jumpdrive]' to activate it."; + + "oolite-tutorial-9-4" = "The torus drive provides significant acceleration and speed. Notice how quickly you have left the witchpoint buoy behind, and how fast the planet is coming closer. The torus drive is only able to operate far from large masses and high-density energy sources (other than those on your ship it is precisely calibrated for)."; + + "oolite-tutorial-9-5" = "The drive will automatically cut out and decelerate you to conventional speeds if you near such an object, and can only be reactivated when your alert condition is Green once again. Ahead is a simulated trade ship, such as you might meet on a routine journey to the planet."; + + "oolite-tutorial-9-6" = "Not all ships will be as friendly as the trader. Pirates will attack shipping even occasionally in safe systems. If you are attacked, unable to run, and outnumbered too much to fight, then you can dump cargo to distract them. Use the '[oolite_key_rotate_cargo]' key to select the item to dump, then the '[oolite_key_dump_cargo]' key to drop it."; + + "oolite-tutorial-9-7" = "We have removed the trade ship now, so you should be back at condition Green. Re-engage the torus drive and continue approaching the planet. Watch your altitude bar - don't get too close to the surface"; + + "oolite-tutorial-9-7-sun" = "This is the sun, not the planet. Easy mistake to make, so try again."; + + "oolite-tutorial-9-7-toofar" = "Approach the planet to move to the next stage"; + + "oolite-tutorial-9-8" = "Now that you are near the planet, your compass has changed to track the main station. Stop the torus drive with the '[oolite_key_jumpdrive]' key, then use the compass to locate the station."; + + "oolite-tutorial-9-9" = "Head towards the station. If you stopped far enough from the planet, you will still be able to use your torus drive. Otherwise, travel there at conventional speeds, or temporarily head further from the planet until your condition returns to Green."; + + "oolite-tutorial-9-9-toofar" = "Approach the station to move to the next stage"; + + "oolite-tutorial-9-10" = "When you are close enough to the station, the aegis indicator - a large S - will appear. This indicates that you are within sensor range of the station and will be protected against pirate attack by the station's police ships."; + + "oolite-tutorial-9-11" = "Between the station and the planet you will see the navigation buoy. As covered in previous lessons, you should now dock with the station. Remember to ask for clearance first with the '[oolite_key_docking_clearance_request]' key."; "oolite-tutorial-end-mfd" = "You have completed the course. Press '[oolite_key_activate_equipment]' to view your test scores."; "oolite-tutorial-end-title" = "Course Complete"; - "oolite-tutorial-end-message" = "You have now completed the Pilot's Training Course. Your scores:\n\nDeaths: [mission_oolite_tutorial_deaths]\n\nAsteroid navigation: [mission_oolite_tutorial_asteroids_result] ([mission_oolite_tutorial_asteroids] seconds)\nCombat practice: [mission_oolite_tutorial_combat_result] ([mission_oolite_tutorial_combat_duration] seconds)"; + "oolite-tutorial-end-message" = "You have now completed the Pilot's Training Course. Your scores:\n\nDeaths: [mission_oolite_tutorial_deaths]\n\nAsteroid navigation: [mission_oolite_tutorial_asteroids_result] ([mission_oolite_tutorial_asteroids] seconds)\nCombat practice: [mission_oolite_tutorial_combat_result] ([mission_oolite_tutorial_combat_duration] seconds)\n\nWe wish you luck in your future career."; "oolite-tutorial-end-choices" = { "1" = "Exit Simulator"; }; "oolite-tutorial-end-notry" = "Incomplete"; diff --git a/Resources/Scripts/oolite-tutorial.js b/Resources/Scripts/oolite-tutorial.js index 58e8f712..08c06d93 100644 --- a/Resources/Scripts/oolite-tutorial.js +++ b/Resources/Scripts/oolite-tutorial.js @@ -67,7 +67,7 @@ this.startUp = function() 11, // stage 6: combat 15, // stage 7: docking 25, // stage 8: status screens - 0, // stage 9: (not yet started) + 15 // stage 9: system navigation ]; this.$shipList = []; @@ -83,6 +83,33 @@ this.startUp = function() // alternative populator this.ooliteTutorialWillPopulate = function() { + + system.setPopulator("oolite-nav-buoy", + { + priority: 5, + location: "COORDINATES", + coordinates: system.mainStation.position.add(system.mainStation.vectorForward.multiply(10E3)), + callback: function(pos) { + var nb = system.addShips("buoy",1,pos,0)[0]; + nb.scanClass = "CLASS_BUOY"; + nb.reactToAIMessage("START_TUMBLING"); + }, + deterministic: true + }); + + system.setPopulator("oolite-witch-buoy", + { + priority: 10, + location: "COORDINATES", + coordinates: [0,0,0], + callback: function(pos) { + var wb = system.addShips("buoy-witchpoint",1,pos,0)[0]; + wb.scanClass = "CLASS_BUOY"; + wb.reactToAIMessage("START_TUMBLING"); + }, + deterministic: true + }); + var addTutorialStation = function(pos) { system.addShips("oolite-tutorial-station",1,pos,0); @@ -147,6 +174,10 @@ this.startUp = function() } }); } + else if (this.$tutorialStage >= 9) + { + this._endTutorial(); + } } this.shipWillDockWithStation = function(station) @@ -195,6 +226,47 @@ this.startUp = function() } + this.shipEnteredPlanetaryVicinity = function(planet) + { + if (this.$tutorialStage < 9) + { + // you shouldn't be here + player.ship.position = system.locationFromCode("OUTER_SYSTEM_OFFPLANE"); + this._restartSection(); + } + else + { + if (planet == system.mainPlanet && this.$tutorialSubstage <= 7) + { + this.$tutorialSubstage = 7; + this._nextItem(); + } + else if (planet == system.sun) + { + player.consoleMessage("oolite-tutorial-9-7-sun"); + } + } + } + + this.shipEnteredStationAegis = function(station) + { + if (this.$tutorialStage < 9) + { + // you shouldn't be here + player.ship.position = system.locationFromCode("OUTER_SYSTEM_OFFPLANE"); + this._restartSection(); + } + else + { + if (this.$tutorialSubstage <= 9) + { + this.$tutorialSubstage = 9; + this._nextItem(); + } + } + } + + this.playerStartedJumpCountdown = function() { player.ship.cancelHyperspaceCountdown(); @@ -1404,17 +1476,117 @@ this.startUp = function() this._setInstructions("oolite-tutorial-8-24"); } - - - this.__stage9sub0 = function() { player.ship.removeEquipment("EQ_HEAT_SHIELD"); player.ship.removeEquipment("EQ_ENERGY_UNIT"); - this._setInstructions("oolite-tutorial-end-mfd"); + this._setInstructions("oolite-tutorial-9-0"); + } + + this.__stage9sub1 = function() + { + this._setInstructions("oolite-tutorial-9-1"); + this.$blockTorus = false; + player.ship.position = [0,0,-8E3]; + } + + this.__stage9sub2 = function() + { + this._setInstructions("oolite-tutorial-9-2"); + this._showHUDItem("drawCompass:"); + } + + this.__stage9sub3 = function() + { + this._setInstructions("oolite-tutorial-9-3"); + this._setFrameCallback(function(delta) + { + if (player.ship.speed > player.ship.maxSpeed * 10) + { + this._nextItem(); + } + }.bind(this)); + } + + this.__stage9sub4 = function() + { + var accum = 0; + this._setFrameCallback(function(delta) + { + accum += delta; + if (accum > 20) + { + this._nextItem(); + } + }.bind(this)); + this._setInstructions("oolite-tutorial-9-4"); + } + + this.__stage9sub5 = function() + { + this._setFrameCallback(""); + var t = this._addShips("[moray]",1,player.ship.position.add(player.ship.vectorForward.multiply(26E3)),0)[0]; + t.homeSystem = 55; + t.destinationSystem = 7; + t.setCargoType("SCARCE_GOODS"); + t.primaryRole = "trader"; + t.setAI("oolite-traderAI.js"); + this._setInstructions("oolite-tutorial-9-5"); + } + + this.__stage9sub6 = function() + { + this._setInstructions("oolite-tutorial-9-6"); + player.ship.manifest.textiles = 2; + player.ship.manifest.radioactives = 3; + } + + this.__stage9sub7 = function() + { + this._resetShips(); + this._setInstructions("oolite-tutorial-9-7"); + this._showHUDItem("drawAltitudeBar:"); + } + + this.__stage9sub8 = function() + { + if (system.mainPlanet.position.distanceTo(player.ship) > system.mainPlanet.radius * 3) + { + player.consoleMessage(expandMissionText("oolite-tutorial-9-7-toofar")); + --this.$tutorialSubstage; + } + else + { + this._setInstructions("oolite-tutorial-9-8"); + this._showHUDItem("drawCompass:"); + } + } + + this.__stage9sub9 = function() + { + this._setInstructions("oolite-tutorial-9-9"); + } + + this.__stage9sub10 = function() + { + if (system.mainStation.position.distanceTo(player.ship) > 51200) + { + player.consoleMessage(expandMissionText("oolite-tutorial-9-9-toofar")); + --this.$tutorialSubstage; + } + else + { + this._setInstructions("oolite-tutorial-9-10"); + this._showHUDItem("drawAegis"); + } } + this.__stage9sub11 = function() + { + this.$advanceByEquipment = false; + this._setInstructions("oolite-tutorial-9-11"); + } this._endTutorial = function() {