Scripts/galdrive_reimagined.js |
this.name = "galdrive_reimagined";
this.author = "Redspear";
this.copyright = "2022 Redspear";
this.licence = "CC BY-NC-SA 4.0";
this.description = "More ritualistic form of galactic hyperjumping";
this.version = "1.0";
"use strict";
// render gal drive 'uncharged' by default
this.startUp = function()
{
this._statusGH = 0;
player.ship.awardEquipment("EQ_GAL_DRIVE"); // just for testing
}
// register fuel scooped and how much of it (will likely need to be from a particularly large or unusual star in future versions)
this.shipScoopedFuel = function()
{
this._statusGH = _statusGH + 0.1
//log(this.name, "gal drive charge " + _statusGH);
}
// test readiness before gal jump commences
this.playerStartedJumpCountdown = function(type)
{
if (type == "galactic")
if (_statusGH < 6.95 || player.ship.fuel < 6.95){
player.ship.cancelHyperspaceCountdown();
player.consoleMessage ("Insufficiently Ionized Fuel for Galactic Jump");
}
}
// buying fuel doesn't help
this.playerBoughtEquipment = function(eqKey)
{
if (eqKey == "EQ_FUEL"){
this._statusGH = 0;
}
}
// gal drive is no longer expendable (might need to think some more about that...)
// also spacetime reorientation wierdness adds some random time to the clock (potentially days)
// and fuel is spent
this.playerEnteredNewGalaxy = function()
{
var rand_time = Math.floor((Math.random() * (60 - 1) + 1) * (Math.random() * (60 - 1) + 1) * (Math.random() * (24 - 1) + 1) * (Math.random() * (15 - 1) + 1));
clock.addSeconds(rand_time);
this._statusGH = 0;
player.ship.fuel = 0;
player.ship.awardEquipment("EQ_GAL_DRIVE");
player.consoleMessage ("Spacetime Reorientation - ..." + rand_time);
}
//this.playerWillSaveGame = function(message : String)
//{
// // Your code here
//} |