| Config/script.js | "use strict";
this.name    = "Station Self-Destruction";
this.version = "1.0";
/* ====================================================================================
			EVENT HANDLERS
======================================================================================= */
    this.startUpComplete = function () {
        "use strict";
        if (player.ship.equipmentStatus("EQ_STATION_DESTRUCTION_CODES") === "EQUIPMENT_OK") {
            this._applyCode();
        }
        delete this.startUpComplete;
    }
    this.playerBoughtEquipment = function (equipment) {
        "use strict";
        if (equipment === "EQ_STATION_DESTRUCTION_CODES") {
            this._applyCode();
        }
        delete this.playerBoughtEquipment;
    }
    this.shipDockedWithStation = function () {
        "use strict";
        if (player.ship.equipmentStatus("EQ_STATION_DESTRUCTION_CODES") === "EQUIPMENT_OK") {
            this._applyCode();
        }
    }
    this.shipWillLaunchFromStation = function () {
        "use strict";
        player.ship.dockedStation.setInterface("self_destruct", null);
    }
/* ====================================================================================
			STATION SELF-DESTRUCT ACTIVATION CODES
======================================================================================= */
    this._applyCode = function () {
        "use strict";
        if (player.ship.dockedStation) {
            player.ship.dockedStation.setInterface("self_destruct", {
                title: "Station self-destruct",
                category: "DANGER",
                summary: "Activate this to cause the complete destruction of this station in 60 seconds. WARNING: there is no option to change your mind.",
                callback: this._destructionSequence.bind(this)
            });
        }
    }
    this._destructionSequence = function (callback) {
        "use strict";
        if (callback === "self_destruct") {
            this.$victim = player.ship.dockedStation;
            this.$destructTimer = new Timer(this, function () {this._destroyStation();}, 60);
            this.$warning3Timer = new Timer(this, function () {player.consoleMessage("STATION DESTRUCTION MECHANISM ACTIVATED.\nStation will be completely destroyed in 20 seconds.", 5);}, 40);
            this.$warning2Timer = new Timer(this, function () {player.consoleMessage("STATION DESTRUCTION MECHANISM ACTIVATED.\nStation will be completely destroyed in 40 seconds.", 5);}, 20);
            player.consoleMessage("STATION DESTRUCTION MECHANISM ACTIVATED.\nThis station will be completely destroyed in 60 seconds.", 5);
        }
    }
    this._destroyStation = function () {
        "use strict";
        if (this.$victim) {
            this.$victim.explode();
        }
    }
/* ====================================================================================
			THE END
======================================================================================= */
 |