Config/script.js |
/*
script.js
Script for telling the tale of the Flying Dutchman.
Oolite
Copyright © 2003-2011 Giles C Williams and contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
Flying_Dutchman.oxp
Copyright © 2008-2011 "Commander McLane"
This work is licensed under the Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License.
To view a copy of this license, visit
http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter
to Creative Commons, 171 Second Street, Suite 300, San Francisco,
California, 94105, USA.
*/
"use strict";
this.name = "Flying Dutchman";
this.description = "Script for telling the tale of the Flying Dutchman";
this.author = "Commander McLane";
this.copyright = "© 2011 Commander McLane";
this.license = "CC-by-nc-sa 3.0";
this.version = "1.7";
this.missionOffers = function()
{
if (guiScreen == "GUI_SCREEN_MISSION") return;
if (player.ship.dockedStation.isMainStation)
{
if (!missionVariables.flying_dutchman && Math.random() > 0.92)
{
mission.runScreen({titleKey:"flying_dutchman_newstitle", messageKey:"flying_dutchman_newsflash", background:"iNews.png"});
missionVariables.flying_dutchman = "NEWS";
missionVariables.flying_dutchman_jumpcounter = 0;
}
if (missionVariables.flying_dutchman == "NEWS" && system.government > 4 && missionVariables.flying_dutchman_jumpcounter >= 3)
{
mission.runScreen({titleKey:"flying_dutchman_encountertitle", messageKey:"flying_dutchman_encounter"});
missionVariables.flying_dutchman = "ENCOUNTER";
delete missionVariables.flying_dutchman_jumpcounter;
}
}
}
this.missionScreenOpportunity = function()
{
this.missionOffers();
}
this.shipWillExitWitchspace = function()
{
if (system.isInterstellarSpace) return;
if (missionVariables.flying_dutchman == "NEWS") missionVariables.flying_dutchman_jumpcounter ++;
if (missionVariables.flying_dutchman == "ENCOUNTER") system.addShipsToRoute("flying_dutchman_runner", 1, 0.25, "wp");
if (missionVariables.flying_dutchman == "SEE_YOU_AGAIN" && Math.random() > 0.95) system.addShipsToRoute("flying_dutchman_runner", 1, 0.25, "wp");
}
|
Scripts/flying-dutchman-cobra.js |
/*
flying-dutchman-cobra.js
Script for the Flying Dutchman.
Oolite
Copyright © 2003-2011 Giles C Williams and contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
Flying_Dutchman.oxp
Copyright © 2008-2011 "Commander McLane"
This work is licensed under the Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License.
To view a copy of this license, visit
http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter
to Creative Commons, 171 Second Street, Suite 300, San Francisco,
California, 94105, USA.
*/
"use strict";
this.name = "flying-dutchman-cobra";
this.description = "Script for the Flying Dutchman";
this.author = "Commander McLane";
this.copyright = "© 2011 Commander McLane";
this.license = "CC-by-nc-sa 3.0";
this.version = "1.7";
var equipment_key = new Array(
"EQ_ECM",
"EQ_FUEL_SCOOPS",
"EQ_ESCAPE_POD",
"EQ_ENERGY_BOMB",
"EQ_ENERGY_UNIT",
"EQ_NAVAL_ENERGY_UNIT",
"EQ_DOCK_COMP",
"EQ_GAL_DRIVE",
"EQ_FUEL_INJECTION",
"EQ_ADVANCED_COMPASS",
"EQ_SHIELD_BOOSTER",
"EQ_NAVAL_SHIELD_BOOSTER",
"EQ_HEAT_SHIELD",
"EQ_WORMHOLE_SCANNER"
);
var equipment_name = new Array(
"E.C.M. System",
"Fuel Scoops",
"Escape Pod",
"Energy Bomb",
"Extra Energy Unit",
"Naval Energy Unit",
"Docking Computers",
"Galactic Hyperdrive",
"Witchdrive Fuel Injectors",
"Advanced Space Compass",
"Shield Boosters",
"Military Shield Enhancement",
"External Heat Shielding",
"Wormhole Scanner"
);
this.$checkTemperature = function()
{
if(player.ship.temperature > 1.2)
{
removeFrameCallback(this.raiseTemperature);
this.temperatureCheck.stop();
player.consoleMessage("Phew, that was critical. A/C back online.", 3);
return;
}
}
this.$tumble = function()
{
this.ship.reactToAIMessage("LET_HIM_TUMBLE");
if(this.tumbleCounter++ > 10) this.tumbleTimer.stop();
}
this.$playerBadLuck = function()
{
missionVariables.flying_dutchman = "SEE_YOU_AGAIN";
var badLuck = Math.ceil(Math.random()*12);
switch(badLuck)
{
case 1:
if(player.ship.fuel > 0)
{
player.ship.fuelLeakRate = 8;
player.consoleMessage("Bad luck! Fuel leak detected.", 6);
}
break;
case 2:
var equip = Math.floor(Math.random()*14);
if(player.ship.equipmentStatus(equipment_key[equip]) == "EQUIPMENT_OK")
{
player.consoleMessage("Oops! Your " + equipment_name[equip] + " mysteriously broke.", 6);
player.ship.setEquipmentStatus(equipment_key[equip], "EQUIPMENT_DAMAGED");
}
break;
case 3:
var pirateGroup = system.addGroup("pirate", 5, player.ship.position, 8000);
for(i=0; i<pirateGroup.count; i++)
{
pirateGroup.ships[i].target = player.ship;
pirateGroup.ships[i].AIState = ("ATTACK_SHIP");
}
player.consoleMessage("Bad luck! Some pirates materialized out of nowhere.", 6);
break;
case 4:
this.ship.ejectSpecificItem("qbomb");
break;
case 5:
if(player.ship.dumpCargo()) player.consoleMessage("Oops! Lost some cargo.", 6);
break;
case 6:
player.consoleMessage("Bad luck! A/C broken. Temperature rising.", 6);
this.raiseTemperature = addFrameCallback(function(){player.ship.temperature += 0.016;})
if(this.temperatureCheck) this.temperatureCheck.start();
else this.temperatureCheck = new Timer(this, this.$checkTemperature, 0, 0.25);
break;
case 7:
player.consoleMessage("Bad luck! A Trumble somehow materialized right in front of you.", 6);
player.ship.awardEquipment("EQ_TRUMBLE");
break;
case 8:
system.addShips("asteroid", 1, player.ship.position.add(player.ship.orientation.vectorForward().multiply(2000)), 0);
player.consoleMessage("Oops! Where did that asteroid come from?", 6);
break;
case 9:
player.consoleMessage("Oops! What's happening with your controls?", 6);
this.tumbleCounter = 0;
if(this.tumbleTimer) this.tumbleTimer.start();
else this.tumbleTimer = new Timer(this, this.$tumble, 0, 0.5);
break;
case 10:
player.consoleMessage("Oops! Where are these missiles coming from?", 6);
var dutchmanMissiles = system.addShips("missile", 6, player.ship.position, 7000);
for (var i=0; i<dutchmanMissiles.length; i++)
{
dutchmanMissiles[i].target = player.ship;
}
break;
case 11:
if(player.bounty < 51)
{
player.consoleMessage("Oops! It seems you have become a fugitive! And where do the cops come from so suddenly?!", 6);
player.bounty += 120;
system.addShips("police", 3, player.ship.position, 10000);
}
break;
case 12:
{
player.consoleMessage("What?!? A major bank just all of a sudden went bancrupt! You lost 5 per cent of all your credits!", 6);
player.credits = player.credits * 0.95;
}
}
}
this.playerWillEnterWitchspace = this.shipDied = function()
{
if(this.tempRaise) delete this.tempRaise;
if(this.tumbleTimer) delete this.tumbleTimer;
} |
Scripts/flying-dutchman-runner.js |
/*
flying-dutchman-runner.js
Script for spawning the Flying Dutchman.
Oolite
Copyright © 2003-2011 Giles C Williams and contributors
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
Flying_Dutchman.oxp
Copyright © 2008-2011 "Commander McLane"
This work is licensed under the Creative Commons
Attribution-Noncommercial-Share Alike 3.0 Unported License.
To view a copy of this license, visit
http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter
to Creative Commons, 171 Second Street, Suite 300, San Francisco,
California, 94105, USA.
*/
"use strict";
this.name = "flying-dutchman-runner";
this.description = "Script for spawning the Flying Dutchman";
this.author = "Commander McLane";
this.copyright = "© 2011 Commander McLane";
this.license = "CC-by-nc-sa 3.0";
this.version = "1.7";
this.$spawnFlyingDutchman = function()
{
system.addShips("flying_dutchman", 1, player.ship.position.add(player.ship.orientation.vectorForward().multiply(27000)), 500);
}
|