Commented on importance of correct ordering in mission response scripts. (Oh, and r1479 _is_ a fix for the nova problem, I wasn't reading it right.)
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@1481 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
e1bdfc8924
commit
2709fd910f
@ -45,7 +45,6 @@ this.missionOffers = function ()
|
|||||||
if (missionVariables.nova == "TWO_HRS_TO_ZERO")
|
if (missionVariables.nova == "TWO_HRS_TO_ZERO")
|
||||||
{
|
{
|
||||||
mission.runMissionScreen("nova_1", "solar.png", "nova_yesno");
|
mission.runMissionScreen("nova_1", "solar.png", "nova_yesno");
|
||||||
log("nova.missionOffers", "Setting this.novaOffer to \"NOVA_CHOICE\"");
|
|
||||||
this.novaOffer = "NOVA_CHOICE"; // use a temporary variable for the offering.
|
this.novaOffer = "NOVA_CHOICE"; // use a temporary variable for the offering.
|
||||||
this.novaMissionTimer.stop();
|
this.novaMissionTimer.stop();
|
||||||
}
|
}
|
||||||
@ -77,18 +76,10 @@ this.missionOffers = function ()
|
|||||||
|
|
||||||
this.choiceEvaluation = function()
|
this.choiceEvaluation = function()
|
||||||
{
|
{
|
||||||
if (!this.novaOffer)
|
if (this.novaOffer && this.novaOffer == "NOVA_CHOICE")
|
||||||
{
|
{
|
||||||
log("nova.choicesEvaluation", "Exiting early because !this.novaOffer.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.novaOffer == "NOVA_CHOICE")
|
|
||||||
{
|
|
||||||
log("nova.choicesEvaluation", "Evaluating this.novaOffer == \"NOVA_CHOICE\"");
|
|
||||||
if (mission.choice == "YES")
|
if (mission.choice == "YES")
|
||||||
{
|
{
|
||||||
log("nova.choicesEvaluation", "mission.choice == YES, player loaded refugees.");
|
|
||||||
player.useSpecialCargo(expandDescription("[oolite-nova-refugees]"));
|
player.useSpecialCargo(expandDescription("[oolite-nova-refugees]"));
|
||||||
mission.setInstructionsKey("nova_missiondesc");
|
mission.setInstructionsKey("nova_missiondesc");
|
||||||
missionVariables.nova = "NOVA_ESCAPE_HERO";
|
missionVariables.nova = "NOVA_ESCAPE_HERO";
|
||||||
@ -99,7 +90,6 @@ this.choiceEvaluation = function()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log("nova.choicesEvaluation", "mission.choice == " + mission.choice + ", player refused to help.");
|
|
||||||
// mission.choice = "NO", or null when player launched without a choice.
|
// mission.choice = "NO", or null when player launched without a choice.
|
||||||
missionVariables.nova = "NOVA_ESCAPE_COWARD";
|
missionVariables.nova = "NOVA_ESCAPE_COWARD";
|
||||||
player.commsMessage(expandDescription("[oolite-nova-coward]"), 4.5);
|
player.commsMessage(expandDescription("[oolite-nova-coward]"), 4.5);
|
||||||
@ -107,9 +97,15 @@ this.choiceEvaluation = function()
|
|||||||
missionVariables.novacount = null;
|
missionVariables.novacount = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* IMPORTANT
|
||||||
|
The line "mission.choice = null" causes a missionChoiceWasReset()
|
||||||
|
event to occur. Our missionChoiceWasReset() handler calls back into
|
||||||
|
choiceEvaluation(). It is therefore imperative that this.novaOffer
|
||||||
|
is cleared _before_ mission.choice, or we end up in the else branch
|
||||||
|
above.
|
||||||
|
*/
|
||||||
delete this.novaOffer;
|
delete this.novaOffer;
|
||||||
mission.choice = null; //reset mission choice now
|
mission.choice = null;
|
||||||
log("nova.choicesEvaluation", "deleted this.novaOffer, this.novaOffer is now " + (this.novaOffer ? this.novaOffer : 'undefined'));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,16 +87,16 @@ this.missionScreenEnded = function ()
|
|||||||
if (mission.choice == "OOLITE_TRUMBLE_YES")
|
if (mission.choice == "OOLITE_TRUMBLE_YES")
|
||||||
{
|
{
|
||||||
// Trumble bought.
|
// Trumble bought.
|
||||||
mission.choice = null;
|
|
||||||
missionVariables.trumbles = "TRUMBLE_BOUGHT";
|
missionVariables.trumbles = "TRUMBLE_BOUGHT";
|
||||||
|
mission.choice = null;
|
||||||
player.credits -= 30;
|
player.credits -= 30;
|
||||||
player.awardEquipment("EQ_TRUMBLE");
|
player.awardEquipment("EQ_TRUMBLE");
|
||||||
}
|
}
|
||||||
else if (mission.choice == "OOLITE_TRUMBLE_NO")
|
else if (mission.choice == "OOLITE_TRUMBLE_NO")
|
||||||
{
|
{
|
||||||
// Trumble bought.
|
// Trumble bought.
|
||||||
mission.choice = null;
|
|
||||||
missionVariables.trumbles = "NOT_NOW";
|
missionVariables.trumbles = "NOT_NOW";
|
||||||
|
mission.choice = null;
|
||||||
}
|
}
|
||||||
// else it was someone else's mission screen, so we do nothing.
|
// else it was someone else's mission screen, so we do nothing.
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user