Config/script.js |
"use strict";
this.name = "countdown_to_zero";
this.author = "spara";
this.copyright = "2015 Spara";
this.description = "Make hypercount go to 0";
this.licence = "CC BY-NC-SA 4.0";
this.shipLaunchedFromStation = function() {
missionVariables["countdown_to_zero"] = player.ship.hyperspaceSpinTime - 1;
}
this.shipDockedWithStation = function() {
delete missionVariables["countdown_to_zero"];
}
//start countdown
this.playerStartedJumpCountdown = function(type, seconds) {
if (type === "standard") {
missionVariables["countdown_to_zero"] = seconds;
this.$hyperTimer = new Timer(this,this._hyperDriveCountdown,0,1);
}
else if (type === "galactic") {
missionVariables["countdown_to_zero"] = seconds - 1;
this.$hyperTimer = new Timer(this,this._hyperDriveCountdown,1,1);
}
}
//stop countdown
this.playerCancelledJumpCountdown = this.shipWillEnterWitchspace = this.playerJumpFailed = function() {
if (this.$hyperTimer) {
this.$hyperTimer.stop();
delete this.$hyperTimer;
}
missionVariables["countdown_to_zero"] = player.ship.hyperspaceSpinTime - 1;
}
//hyper countdown timer function
this._hyperDriveCountdown = function() {
missionVariables["countdown_to_zero"]--;
}
|