Back to Index Page generated: Dec 20, 2024, 7:22:09 AM

Expansion SE-X Drive

Content

Warnings

  1. http://wiki.alioth.net/index.php/SE-X%20Drive -> 404 Not Found
  2. Information URL mismatch between OXP Manifest and Expansion Manager string length at character position 0

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Teleporter cheat script. Plays nicely with Explorers Club. Teleporter cheat script. Plays nicely with Explorers Club.
Identifier oolite.oxp.Wildeblood.SEX_Drive oolite.oxp.Wildeblood.SEX_Drive
Title SE-X Drive SE-X Drive
Category Cheats Cheats
Author Wildeblood Wildeblood
Version 1.2 1.2
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL n/a
Download URL https://wiki.alioth.net/img_auth.php/4/4c/SEX_Drive.oxz n/a
License CC-BY-NC-SA 3.0 CC-BY-NC-SA 3.0
File Size n/a
Upload date 1711661954

Documentation

Equipment

Name Visible Cost [deci-credits] Tech-Level
SE-X Drive Controller yes 10000 11+

Ships

This expansion declares no ships. This may be related to warnings.

Models

This expansion declares no models. This may be related to warnings.

Scripts

Path
Scripts/eq_sex_drive.js
"use strict";
this.name = "Control your SE-X Drive"; // Ooh, Miss, he's being a smart-Alec again.
this.version = "1.2";

/* ====================================================================================
		OVER-RIDES THE ACTIVATION SETTING FOR AN IMMEDIATE JUMP
======================================================================================= */

    this.activated = function () {
        if (player.ship.speed < player.ship.cruiseSpeed) {
            player.consoleMessage("Increase speed before engaging the SE-X drive.", 6);
            return;
        }
        let button = worldScripts.sex_drive._goButton;
        if (button !== "goNow") {
            this._backup = button;
            worldScripts.sex_drive._goButton = "goNow";
            if (!this._revertTimer) {
                this._revertTimer = new Timer(this, this._revert.bind(this), 0.7);
            }
        }
    }

    this._revert = function () {
        worldScripts.sex_drive._goButton = this._backup;
        if (this._revertTimer) {
            this._revertTimer.stop();
            delete this._revertTimer;
        }
    }

/* ====================================================================================
		THE END
======================================================================================= */
Scripts/sex_drive.js
"use strict";
this.name = "sex_drive";
this.version = "1.2";

/* ====================================================================================
			OPTION WE'LL SAVE BETWEEN GAMES

   _goButton stores the option of torus, injectors, hostiles or low energy to teleport.
======================================================================================= */

    this._goButton = "alertEnergy";

    this.startUp = function () {
        if (missionVariables.SEX_Drive_button) {
            this._goButton = missionVariables.SEX_Drive_button;
        } else {
            mission.setInstructions("Familiarise yourself with the Special Equipment (Experimental).");
            let e = worldScripts.EmailSystem;
            if (e) {
                e.$createEmail({sender: "Betty from Wildefire Systems",
                               subject: "NON-DISCLOSURE AGREEMENT",
                                  date: clock.adjustedSeconds,
                               message: "Greetings Commander, \n\nI write to remind you that the Special Equipment (Experimental) we recently installed aboard your ship is subject to a very strict Non-Disclosure Agreement (NDA). You must not, under any circumstances, allow it to be examined by anyone other than specifically authorized personnel here at the Special Equipment programme. \n\nPlease report any difficulties, and welcome to our flight testing programme. \n\nBetty,\nTeam liaison, Wildefire SE",
                              sentFrom: 100});
            }
        }
        delete this.startUp;
    }

    this.playerWillSaveGame = function () {
        missionVariables.SEX_Drive_button = this._goButton;
    }

/* ====================================================================================
			SETTING THE STATION INTERFACE
======================================================================================= */

    this.startUpComplete = function () {
        if (player.ship.docked) {
            this._applyInterface(player.ship.dockedStation);
        }
        delete this.startUpComplete;
    }

    this.shipDockedWithStation = function (station) {
        if (this._checkExClubStatus()) {
            this._applyInterface(station);
        }
    }

    this._applyInterface = function (station) {
        station.setInterface("sex_drive", {
            title: "Wildefire SE-X drive",
            category: expandDescription("[interfaces-category-ship-systems]"),
            summary: "Wildefire Systems have installed Special Equipment (experimental) aboard this vessel" + this._currentStateMessage(),
            callback: this._myScreen.bind(this)
        });
    }

    this._currentStateMessage = function (sentence) {
        if (sentence) {
            var msg = "The Special Equipment is now linked to the ";
        } else {
            var msg = ", currently linked to the ";
        }
        switch (this._goButton) {
          case "torusEngaged":
            msg += "Torus™ drive sub-system.";
            break;
          case "injectorsEngaged":
            msg += "fuel injection sub-system.";
            break;
          case "alertHostiles":
            msg += "IFF scanner.";
            break;
          case "alertEnergy":
            msg += "low energy alert system.";
            break;
          default:
            msg = ". Currently disabled.";
            break;
        }
        return msg;
    }

/* ====================================================================================
                        CHECKING FOR EXPLORERS' CLUB STATUS
======================================================================================= */

    this.shipWillLaunchFromStation = function (station) {
        station.setInterface("sex_drive", null);
        this._checkExClubStatus();
    }

    this.shipWillExitWitchspace = function () {
        this._checkExClubStatus();
    }

    this._checkExClubStatus = function () {
        let ws = worldScripts['Explorers Club'];
        if (ws) {
            if (ws._playerVisited(galaxyNumber, system.ID)) {
                this._teleportAllowed = true;
                return true;
            } else {
                this._teleportAllowed = false;
                return false;
            }
        } else {
            this._teleportAllowed = true;
            return true;
        }
    }

/* ====================================================================================
			FINALLY GETTING TO THE NITTY-GRITTY

 When entering a new system, this._usableTarget = false must be reset. The compass
 always resets to planet mode, but compassTargetChanged can take a while to occur, so
 if _usableTarget remains true, the player can teleport into a planet.

 These four functions create and delete a timer which, every half second, calls a
 function which checks whether the condition specified in _myButton has become true,
 and if so, does the teleporting. 
======================================================================================= */

    this.shipLaunchedFromStation = this.shipExitedWitchspace = function () {
        if (this._teleportAllowed) {
            if (!this._sexyTime) {
                this._sexyTime = new Timer(this, this._checkState.bind(this), 0, 0.50);
            }
        }
        this._actualTarget = null;
        this._usableTarget = false;
    }

    this.shipWillDockWithStation = this.shipWillEnterWitchspace = function () {
        if (this._sexyTime) {
            this._sexyTime.stop();
            delete this._sexyTime;
        }
        player.ship.setCustomHUDDial("sex_drive", " ");
    }

/* ====================================================================================
		THE FOLLOWING TWO FUNCTIONS ARE THE ACTUAL TELEPORTER
======================================================================================= */

    this.compassTargetChanged = function (whom, mode) {
        if (this._teleportAllowed) {
            if (mode === "COMPASS_MODE_BASIC") {
                if (whom && whom.isMainStation) {
                    mode = "COMPASS_MODE_STATION";
                } else {
                    mode = "COMPASS_MODE_PLANET";
                }
            }
            if (mode === "COMPASS_MODE_PLANET" || mode === "COMPASS_MODE_SUN") {
                return;
            }

         // Teleporting into a planet or star ends badly.
         // If we reach here, whom is a beacon or target,
         // not a celestial body. Check that whom hasn't
         // suffered a tragedy in the last few moments...

            if (whom && whom.isValid && whom != this._actualTarget) {
                this._actualTarget = whom;
                this._typeOfTarget = mode;
                this._usableTarget = true;
                player.ship.setCustomHUDDial("sex_drive", "SE-X: " + whom.displayName);
                player.consoleMessage("SE-X: " + whom.displayName, 6);
            }
        }
    }

    this._checkState = function _checkState () {
        if (this._usableTarget && this._teleportAllowed) {
            var self = player.ship;
            var goNow = false;
            switch (this._goButton) {
              case "torusEngaged":
                if (self.torusEngaged) {
                    goNow = true;
                }
                break;
              case "injectorsEngaged":
                if (self.injectorsEngaged) {
                    goNow = true;
                }
                break;
              case "alertHostiles":
                if (player.alertHostiles) {
                    goNow = true;
                }
                break;
              case "alertEnergy":
                if (player.alertEnergy) {
                    goNow = true;
                }
                break;
              case "goNow":
                goNow = true;
            }
            if (goNow) {
                var target = this._actualTarget;
                if (target && target.isValid) {
                    this._usableTarget = false;
                    if (this._typeOfTarget === "COMPASS_MODE_TARGET") {
                        self.position = target.position.add(target.heading.multiply(-1000));
                        self.orientation = target.orientation;
                     // if (target.speed > self.maxSpeed) {
                     //     self.speed = self.maxSpeed;
                     // } else {
                     //     self.speed = target.speed;
                     // }
                    } else {
                        player.consoleMessage("SE-X drive engaged.", 6);
                        self.position = target.position;
                        player.consoleMessage("Arrived at " + target.displayName, 6);
                    }
                }
                self.setCustomHUDDial("sex_drive", " ");
            }
        }
    }

/* ====================================================================================
			MISSION SCREEN FOR SELECTING OPTIONS
======================================================================================= */

    this._myScreen = function (caller) {
        mission.setInstructions(null);
        if (player.ship.hudHidden === false) {
            this._hudWasVisible = true;
            player.ship.hudHidden = true;
	}
        var parameters = {
            screenID: "SEX_DRIVE_OPTIONS_SCREEN",
            allowInterrupt: true,
            exitScreen: "GUI_SCREEN_INTERFACES",
            background: {name: "Betty_from_Wildefire_Systems.png", height: 480},
            titleKey: "sex_drive_title"};
        if (caller == "sex_drive") {
            parameters.messageKey = "sex_drive_message";
            parameters.choicesKey = "sex_drive_choices";
        } else if (caller == "hud_dial") {
            parameters.messageKey = "sex_drive_hud_message";
            parameters.choicesKey = "sex_drive_hud_choices";
        }
        mission.runScreen(parameters, callback);

        function callback(choice) {
            if (choice !== "90_exit") {
                if (choice === "70_hud") {
                    this._myScreen("hud_dial");
                } else {
                    if (choice === "10_torus") {
                        this._goButton = "torusEngaged";
                    } else if (choice === "20_injectors") {
                        this._goButton = "injectorsEngaged";
                    } else if (choice === "30_hostiles") {
                        this._goButton = "alertHostiles";
                    } else if (choice === "40_energy") {
                        this._goButton = "alertEnergy";
                    }
                    this._applyInterface(player.ship.dockedStation);
                    this._myScreen("sex_drive");
                    mission.addMessageText("\n" + this._currentStateMessage(true));
                }
            }
        }
    
    }

/* ====================================================================================
			RESTORING THE HUD AFTER MISSION SCREEN
======================================================================================= */

    this.missionScreenOpportunity = function () {
        if (this._hudWasVisible) {
            player.ship.hudHidden = false;
            delete this._hudWasVisible;
        }
    }

/* ====================================================================================
			THE END. REMEMBER, CHEATING IS WRONG, OKAY.
======================================================================================= */