Merge branch 'tutorial-scenario': lesson 3 and some bug fixes
This commit is contained in:
commit
344bd47efd
@ -270,11 +270,35 @@
|
||||
|
||||
"oolite-tutorial-2-10" = "View controls: 2/x\nYour ship can also simulate an external view for you. Press '[oolite_key_custom_view]' to switch to external view mode and to cycle through the available external views. Any of the internal view keys will return you to internal viewing.";
|
||||
|
||||
"oolite-tutorial-3-0" = "Lesson 3: Flight Training\nThis lesson gives you opportunity to practice basic piloting skills in a relatively safe environment.";
|
||||
"oolite-tutorial-3-0" = "Lesson 3: Flight Training\nThis lesson gives you opportunity to practice basic piloting skills. Your ship has been disarmed temporarily to focus on movement over weapon use.";
|
||||
|
||||
"oolite-tutorial-3-1" = "To refresh your memory, the basic flight controls are:\n[oolite_key_roll_left]: roll left\n[oolite_key_roll_right]: roll right\n[oolite_key_pitch_forward]: pitch forward\n[oolite_key_pitch_back]: pitch back\n[oolite_key_increase_speed]: increase speed\n[oolite_key_decrease_speed]: decrease speed";
|
||||
|
||||
"oolite-tutorial-3-2" = "We have added a dense asteroid cluster nearby. Use your scanner to locate the buoy within it, then fly within 500m of the buoy and come to a complete stop.";
|
||||
|
||||
"oolite-tutorial-3-3-error" = "To continue, come to a stop near the buoy.";
|
||||
|
||||
"oolite-tutorial-3-3" = "Some of the asteroids will now start moving towards you. Staying within 5000m of the buoy, use your scanner to spot the moving asteroids, and the movement controls to avoid them.\nTo help you, the asteroids will be highlighted red on your scanner. Keep moving!\nIf it gets too much, just fly further from the buoy.";
|
||||
|
||||
"oolite-tutorial-3-3-toofar" = "You moved too far from the buoy";
|
||||
|
||||
"oolite-tutorial-3-3-win" = "That's enough practice for now";
|
||||
|
||||
"oolite-tutorial-3-4" = "You survived [mission_oolite_tutorial_asteroids] seconds.\n\nIf you would like to try this challenge again, press '[oolite_key_activate_equipment]'. Otherwise, press '[oolite_key_mode_equipment]' to go to the next stage of the course.\nTip: use the '[key_scanner_zoom]' key to magnify your scanner.";
|
||||
|
||||
"oolite-tutorial-3-4a" = "You survived [mission_oolite_tutorial_asteroids] seconds.\n\nIf you would like to try this challenge again, this time without the scanner highlighting, press '[oolite_key_activate_equipment]'. Otherwise, press '[oolite_key_mode_equipment]' to go to the next stage of the course.";
|
||||
|
||||
"oolite-tutorial-3-4b" = "You survived [mission_oolite_tutorial_asteroids] seconds without scanner assistance.\nIt's probably time to press '[oolite_key_mode_equipment]' to go to the next stage of the course, but you can have another go with '[oolite_key_activate_equipment]' if you want.";
|
||||
|
||||
"oolite-tutorial-4-0" = "Lesson 4: ???";
|
||||
|
||||
"oolite-tutorial-end-title" = "Course Complete";
|
||||
"oolite-tutorial-end-message" = "You have now completed the Pilot's Training Course.";
|
||||
"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)\n";
|
||||
"oolite-tutorial-end-choices" = { "1" = "Exit Simulator"; };
|
||||
|
||||
"oolite-tutorial-end-notry" = "Incomplete";
|
||||
"oolite-tutorial-end-try" = "Completed";
|
||||
"oolite-tutorial-end-win" = "Gold qualification";
|
||||
"oolite-tutorial-end-bonus" = "Platinum qualification";
|
||||
|
||||
}
|
||||
|
@ -993,8 +993,11 @@
|
||||
is_template = 1;
|
||||
beacon = "Buoy (training)";
|
||||
beacon_label = "Training Buoy";
|
||||
density = 10000;
|
||||
max_energy = 100000;
|
||||
name = "Training Buoy";
|
||||
roles = "oolite-tutorial-buoy";
|
||||
thrust = 100000;
|
||||
};
|
||||
"oolite_template_buoy-witchpoint" =
|
||||
{
|
||||
|
@ -50,6 +50,8 @@ this.startUp = function()
|
||||
this.$tutorialSound = new SoundSource;
|
||||
this.$tutorialSpeech = new SoundSource;
|
||||
|
||||
this.$fcb = null;
|
||||
|
||||
this.$tutorialStage = 0;
|
||||
this.$tutorialSubstage = 0;
|
||||
|
||||
@ -58,11 +60,17 @@ this.startUp = function()
|
||||
3, // stage 0: mission screen, post-launch cleanup, intro message
|
||||
25, // stage 1: HUD displays
|
||||
11, // stage 2: scanner and views
|
||||
1, // stage 3: basic flight (not yet started)
|
||||
6, // stage 3: basic flight challenge
|
||||
0, // stage 4: (not yet started)
|
||||
];
|
||||
|
||||
this.$shipList = [];
|
||||
|
||||
missionVariables.oolite_tutorial_deaths = 0;
|
||||
missionVariables.oolite_tutorial_asteroids = 0;
|
||||
missionVariables.oolite_tutorial_asteroids_win = 0;
|
||||
missionVariables.oolite_tutorial_asteroids_result = expandMissionText("oolite-tutorial-end-notry");
|
||||
|
||||
// alternative populator
|
||||
this.ooliteTutorialWillPopulate = function()
|
||||
{
|
||||
@ -74,8 +82,10 @@ this.startUp = function()
|
||||
system.setPopulator("oolite-tutorial-station",
|
||||
{
|
||||
priority: 5,
|
||||
location: "OUTER_SYSTEM_OFFPLANE",
|
||||
locationSeed: 600,
|
||||
/* location: "OUTER_SYSTEM_OFFPLANE",
|
||||
locationSeed: 600, */
|
||||
location: "COORDINATES",
|
||||
coordinates: new Vector3D(-1294672.125,-7577498,3605521.5),
|
||||
callback: addTutorialStation,
|
||||
deterministic: true
|
||||
});
|
||||
@ -113,6 +123,7 @@ this.startUp = function()
|
||||
{
|
||||
if (this.$tutorialStage == 0 && this.$tutorialSubstage == 1)
|
||||
{
|
||||
station.position = station.position.add([0,0,1E7]);
|
||||
station.remove();
|
||||
this._nextItem();
|
||||
}
|
||||
@ -129,6 +140,7 @@ this.startUp = function()
|
||||
player.ship.dealEnergyDamage(1,10000,0);
|
||||
this._playSound("bigbang.ogg");
|
||||
player.consoleMessage(expandMissionText("oolite-tutorial-no-death"));
|
||||
missionVariables.oolite_tutorial_deaths++;
|
||||
this._nextItem(); // will call nextSection, which will reset energy
|
||||
}
|
||||
}
|
||||
@ -184,6 +196,20 @@ this.startUp = function()
|
||||
}
|
||||
|
||||
|
||||
this._setFrameCallback = function(fn)
|
||||
{
|
||||
if (this.$fcb)
|
||||
{
|
||||
removeFrameCallback(this.$fcb);
|
||||
this.$fcb = null;
|
||||
}
|
||||
if (fn)
|
||||
{
|
||||
this.$fcb = addFrameCallback(fn.bind(this));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this._setInstructions = function(key)
|
||||
{
|
||||
if (player.ship.multiFunctionDisplays == 0)
|
||||
@ -200,6 +226,21 @@ this.startUp = function()
|
||||
}
|
||||
}
|
||||
|
||||
this._scoreTry = function(key)
|
||||
{
|
||||
missionVariables["oolite_tutorial_"+key] = expandMissionText("oolite-tutorial-end-try");
|
||||
}
|
||||
|
||||
this._scoreWin = function(key)
|
||||
{
|
||||
missionVariables["oolite_tutorial_"+key] = expandMissionText("oolite-tutorial-end-win");
|
||||
}
|
||||
|
||||
this._scoreBonus = function(key)
|
||||
{
|
||||
missionVariables["oolite_tutorial_"+key] = expandMissionText("oolite-tutorial-end-bonus");
|
||||
}
|
||||
|
||||
|
||||
this.$HUDSelectors = ["drawEnergyGauge:","drawForwardShieldBar:","drawAftShieldBar:","drawSpeedBar:","drawRollBar:","drawPitchBar:","drawYellowSurround:","drawFuelBar:","drawCabinTempBar:","drawWeaponTempBar:","drawAltitudeBar:","drawMissileDisplay:","drawStatusLight:","drawClock:","drawCompass:","drawScanner:","drawScannerZoomIndicator:"];
|
||||
this.$HUDHighlighter = null;
|
||||
@ -277,6 +318,7 @@ this.startUp = function()
|
||||
player.ship.awardEquipment("EQ_MISSILE");
|
||||
}
|
||||
this._resetHUDItems();
|
||||
this._setFrameCallback(null);
|
||||
player.ship.hudHidden = false;
|
||||
for (i=this.$shipList.length-1;i>=0;i--)
|
||||
{
|
||||
@ -285,6 +327,12 @@ this.startUp = function()
|
||||
this.$shipList[i].remove();
|
||||
}
|
||||
}
|
||||
var fc = addFrameCallback(function(delta)
|
||||
{
|
||||
player.ship.velocity = player.ship.thrustVector;
|
||||
removeFrameCallback(fc);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
this._addShips = function(role,num,pos,rad)
|
||||
@ -545,10 +593,189 @@ this.startUp = function()
|
||||
|
||||
this.__stage3sub0 = function()
|
||||
{
|
||||
// restart;
|
||||
var rocks = system.entitiesWithScanClass("CLASS_ROCK");
|
||||
for (var i=rocks.length-1;i>=0;--i)
|
||||
{
|
||||
rocks[i].remove();
|
||||
}
|
||||
rocks = system.entitiesWithScanClass("CLASS_CARGO");
|
||||
for (i=rocks.length-1;i>=0;--i)
|
||||
{
|
||||
rocks[i].remove();
|
||||
}
|
||||
player.ship.forwardWeapon = "EQ_WEAPON_NONE";
|
||||
for (i=0;i<3;i++) {
|
||||
player.ship.removeEquipment("EQ_MISSILE");
|
||||
}
|
||||
this._setInstructions("oolite-tutorial-3-0");
|
||||
}
|
||||
|
||||
this.__stage3sub1 = function()
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-3-1");
|
||||
}
|
||||
|
||||
this.__stage3sub2 = function()
|
||||
{
|
||||
var centre = player.ship.position;
|
||||
centre.z += 15000;
|
||||
var buoy = this._addShips("oolite-tutorial-buoy",1,centre,0)[0];
|
||||
this._addShips("asteroid",50,centre,7500);
|
||||
this._setInstructions("oolite-tutorial-3-2");
|
||||
this._setFrameCallback(function()
|
||||
{
|
||||
if (player.ship.speed < 1 && centre.distanceTo(player.ship) <= 500)
|
||||
{
|
||||
this._nextItem();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.__stage3sub3 = function()
|
||||
{
|
||||
var buoy = system.shipsWithPrimaryRole("oolite-tutorial-buoy")[0];
|
||||
if (!buoy)
|
||||
{
|
||||
buoy = this._addShips("oolite-tutorial-buoy",1,player.ship.position.add([0,0,500]),0)[0];
|
||||
}
|
||||
if (player.ship.speed > 1 || buoy.position.distanceTo(player.ship) > 500)
|
||||
{
|
||||
player.consoleMessage(expandMissionText("oolite-tutorial-3-3-error"));
|
||||
this._setInstructions("oolite-tutorial-3-2");
|
||||
--this.$tutorialSubstage;
|
||||
return;
|
||||
}
|
||||
|
||||
this._setInstructions("oolite-tutorial-3-3");
|
||||
var time = 0;
|
||||
var nexttime = 5;
|
||||
var atonce = 1;
|
||||
buoy.script.shipTakingDamage = function(amount,whom,type)
|
||||
{
|
||||
buoy.energy = 100000;
|
||||
if (!whom.isPlayer)
|
||||
{
|
||||
whom.explode();
|
||||
}
|
||||
};
|
||||
this._setFrameCallback(function(delta)
|
||||
{
|
||||
time += delta;
|
||||
if (time > nexttime)
|
||||
{
|
||||
nexttime += 15;
|
||||
var asteroids = system.shipsWithPrimaryRole("asteroid",player.ship,10000);
|
||||
for (var i=0;i<atonce;++i)
|
||||
{
|
||||
var asteroid = asteroids[Math.floor(Math.random()*asteroids.length)];
|
||||
if (asteroid)
|
||||
{
|
||||
asteroid.velocity = player.ship.position.subtract(asteroid.position).direction().multiply(200+(20*atonce));
|
||||
// not on the hard difficulty
|
||||
if (missionVariables.oolite_tutorial_asteroids_win == 0)
|
||||
{
|
||||
asteroid.scannerDisplayColor1 = "whiteColor";
|
||||
asteroid.scannerDisplayColor2 = "redColor";
|
||||
}
|
||||
}
|
||||
}
|
||||
++atonce;
|
||||
if (buoy.position.distanceTo(player.ship) > 5000)
|
||||
{
|
||||
player.consoleMessage(expandMissionText("oolite-tutorial-3-3-toofar"),5);
|
||||
missionVariables.oolite_tutorial_asteroids = Math.floor(time);
|
||||
this._nextItem();
|
||||
}
|
||||
}
|
||||
if (Math.random() < delta)
|
||||
{
|
||||
var boulders = system.shipsWithPrimaryRole("boulder",player.ship,10000);
|
||||
if (boulders.length > 1)
|
||||
{
|
||||
boulders[0].explode();
|
||||
if (boulders.length > 5)
|
||||
{
|
||||
boulders[2].explode();
|
||||
boulders[1].explode();
|
||||
}
|
||||
}
|
||||
var splinters = system.shipsWithPrimaryRole("splinter",player.ship,10000);
|
||||
if (splinters.length > 1)
|
||||
{
|
||||
splinters[0].explode();
|
||||
if (splinters.length > 5)
|
||||
{
|
||||
splinters[2].explode();
|
||||
splinters[1].explode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (time > 150)
|
||||
{
|
||||
player.consoleMessage(expandMissionText("oolite-tutorial-3-3-win"),5);
|
||||
missionVariables.oolite_tutorial_asteroids = Math.floor(time);
|
||||
this._nextItem();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.__stage3sub4 = function()
|
||||
{
|
||||
this._setFrameCallback("");
|
||||
if (missionVariables.oolite_tutorial_asteroids >= 150)
|
||||
{
|
||||
if (missionVariables.oolite_tutorial_asteroids_win >= 1)
|
||||
{
|
||||
missionVariables.oolite_tutorial_asteroids_win = 2;
|
||||
this._setInstructions("oolite-tutorial-3-4b");
|
||||
}
|
||||
else
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-3-4a");
|
||||
missionVariables.oolite_tutorial_asteroids_win = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this._setInstructions("oolite-tutorial-3-4");
|
||||
}
|
||||
}
|
||||
|
||||
this.__stage3sub5 = function()
|
||||
{
|
||||
this.$tutorialStage--;
|
||||
this._nextSection();
|
||||
}
|
||||
|
||||
|
||||
this.__stage4sub0 = function()
|
||||
{
|
||||
if (missionVariables.oolite_tutorial_asteroids_win == 1)
|
||||
{
|
||||
this._scoreWin("asteroids_result");
|
||||
}
|
||||
else if (missionVariables.oolite_tutorial_asteroids_win >= 2)
|
||||
{
|
||||
this._scoreBonus("asteroids_result");
|
||||
}
|
||||
else if (missionVariables.oolite_tutorial_asteroids > 0)
|
||||
{
|
||||
this._scoreTry("asteroids_result");
|
||||
}
|
||||
var rocks = system.entitiesWithScanClass("CLASS_ROCK");
|
||||
for (var i=rocks.length-1;i>=0;--i)
|
||||
{
|
||||
rocks[i].remove();
|
||||
}
|
||||
rocks = system.entitiesWithScanClass("CLASS_CARGO");
|
||||
for (i=rocks.length-1;i>=0;--i)
|
||||
{
|
||||
rocks[i].remove();
|
||||
}
|
||||
//...
|
||||
}
|
||||
|
||||
this._endTutorial = function()
|
||||
{
|
||||
|
@ -5750,7 +5750,7 @@ static GLfloat sBaseMass = 0.0;
|
||||
{
|
||||
if (scenarioKey != nil && [key isEqualToString:scenarioKey])
|
||||
{
|
||||
[UNIVERSE reinitAndShowDemo:YES];
|
||||
[self setStatus:STATUS_RESTART_GAME];
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
@ -10388,6 +10388,7 @@ else _dockTarget = NO_TARGET;
|
||||
case STATUS_START_GAME:
|
||||
isDockedStatus = YES;
|
||||
break;
|
||||
case STATUS_RESTART_GAME:
|
||||
case STATUS_EFFECT:
|
||||
case STATUS_ACTIVE:
|
||||
case STATUS_COCKPIT_DISPLAY:
|
||||
|
@ -391,7 +391,7 @@ static uint16_t PersonalityForCommanderDict(NSDictionary *dict);
|
||||
{
|
||||
int guiSelectedRow=[gui selectedRow];
|
||||
idx=(guiSelectedRow - STARTROW) + (currentPage * NUMROWS);
|
||||
if (guiSelectedRow != MOREROW && guiSelectedRow != BACKROW)
|
||||
if (guiSelectedRow != MOREROW && guiSelectedRow != BACKROW && guiSelectedRow != EXITROW)
|
||||
{
|
||||
[self showCommanderShip: idx];
|
||||
}
|
||||
|
@ -340,6 +340,10 @@ static GameController *sSharedController = nil;
|
||||
}
|
||||
|
||||
[UNIVERSE update:delta_t];
|
||||
if (EXPECT_NOT([PLAYER status] == STATUS_RESTART_GAME))
|
||||
{
|
||||
[UNIVERSE reinitAndShowDemo:YES];
|
||||
}
|
||||
if (!gameIsPaused)
|
||||
{
|
||||
[OOSound update];
|
||||
|
@ -656,21 +656,24 @@ static BOOL _refreshStarChart = NO;
|
||||
{
|
||||
NSMutableArray *words = ScanTokensFromString(line);
|
||||
NSMutableString *accum = [NSMutableString stringWithCapacity:64];
|
||||
while ([words count] > 1)
|
||||
if ([words count] > 0)
|
||||
{
|
||||
[accum appendString:[words oo_stringAtIndex:0]];
|
||||
[accum appendString:@" "];
|
||||
if (OORectFromString(accum, 0.0f, 0.0f,chSize).size.width + OORectFromString([words oo_stringAtIndex:1], 0.0f, 0.0f,chSize).size.width > limit)
|
||||
while ([words count] > 1)
|
||||
{
|
||||
// can't fit next word on this line
|
||||
[output appendString:[accum stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]];
|
||||
[output appendString:@"\n"];
|
||||
[accum setString:@""];
|
||||
[accum appendString:[words oo_stringAtIndex:0]];
|
||||
[accum appendString:@" "];
|
||||
if (OORectFromString(accum, 0.0f, 0.0f,chSize).size.width + OORectFromString([words oo_stringAtIndex:1], 0.0f, 0.0f,chSize).size.width > limit)
|
||||
{
|
||||
// can't fit next word on this line
|
||||
[output appendString:[accum stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]];
|
||||
[output appendString:@"\n"];
|
||||
[accum setString:@""];
|
||||
}
|
||||
[words removeObjectAtIndex:0];
|
||||
}
|
||||
[words removeObjectAtIndex:0];
|
||||
[output appendString:accum];
|
||||
[output appendString:[words oo_stringAtIndex:0]];
|
||||
}
|
||||
[output appendString:accum];
|
||||
[output appendString:[words oo_stringAtIndex:0]];
|
||||
[output appendString:@"\n"];
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
ENTRY(STATUS_START_GAME, -10)
|
||||
ENTRY(STATUS_RESTART_GAME, -2)
|
||||
ENTRY(STATUS_DEAD, -1)
|
||||
ENTRY(STATUS_INACTIVE, 0)
|
||||
ENTRY(STATUS_TEST, 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user