Back to Index Page generated: May 8, 2024, 6:16:03 AM

Expansion Station Self-Destruction Codes

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description It's incredible, the things you can buy. It's incredible, the things you can buy.
Identifier oolite.oxp.Wildeblood.Station_Self_Destruction oolite.oxp.Wildeblood.Station_Self_Destruction
Title Station Self-Destruction Codes Station Self-Destruction Codes
Category Equipment Equipment
Author Wildeblood Wildeblood
Version 1.0 1.0
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://aegidian.org/bb/viewtopic.php?f=4&t=17178 n/a
Download URL https://wiki.alioth.net/img_auth.php/f/fe/Station_Self-Destruction_Codes.oxz n/a
License Use your common sense. Use your common sense.
File Size n/a
Upload date 1610873522

Documentation

Also read http://wiki.alioth.net/index.php/Station%20Self-Destruction%20Codes

Equipment

Name Visible Cost [deci-credits] Tech-Level
Station Self-Destruction Codes no 500000 2+

Ships

This expansion declares no ships.

Models

This expansion declares no models.

Scripts

Path
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
======================================================================================= */