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

Expansion Teleportation Drive

Content

Warnings

  1. http://wiki.alioth.net/index.php/Teleportation%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 FE Shipyards will link your ASC and Injector circuitry to the Hyperspace motor, allowing the formation of a miniature wormhole between the ship and its destination station. With a tap of the 'i' button, space is folded and transport is instantaneous. We call it the T-drive (or the Tau-drive, or the Mu-drive, or the Ooh-drive, or the Moolah-drive...) FE Shipyards will link your ASC and Injector circuitry to the Hyperspace motor, allowing the formation of a miniature wormhole between the ship and its destination station. With a tap of the 'i' button, space is folded and transport is instantaneous. We call it the T-drive (or the Tau-drive, or the Mu-drive, or the Ooh-drive, or the Moolah-drive...)
Identifier oolite.oxp.Reval.Teleportation_Drive oolite.oxp.Reval.Teleportation_Drive
Title Teleportation Drive Teleportation Drive
Category Equipment Equipment
Author Reval Reval
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/5/5e/Teleportation_Drive.oxz n/a
License CC-BY-NC-SA 4.0 CC-BY-NC-SA 4.0
File Size n/a
Upload date 1670918749

Documentation

Equipment

Name Visible Cost [deci-credits] Tech-Level
Teleportation Drive yes 50000 5+
Remove Teleportation Drive yes 0 5+

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/tp_conditions.js
// conditions for award of Teleportation Drive
"use strict";
this.name = "TP Conditions";
this.author = "Reval";
this.licence = "CC BY-NC-SA 4.0";
this.version = "1.0";

this.allowAwardEquipment = function(equipment, ship, context) {
	
	if (equipment == "EQ_TP_DRIVE")
		if ((player.ship.equipmentStatus ("EQ_ADVANCED_COMPASS") === "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_FUEL_INJECTION") === "EQUIPMENT_OK"))
			return true; else return false;
	
	if (equipment == "EQ_TP_DRIVE_REM")
		if (player.ship.equipmentStatus ("EQ_TP_DRIVE") === "EQUIPMENT_OK")
			return true; else return false;

	return true;
}
Scripts/tp_script.js
"use strict"
this.name = "Teleportation Drive";
this.author = "Reval";
this.license = "CC-BY-NC-SA 4.0";
this.version = "1.2";
this.description = "FE Shipyards will link your ASC and Injector circuitry to the Hyperspace motor, allowing the formation of a miniature wormhole between the ship and its destination station. With a tap of the 'i' button, space is folded and transport is instantaneous. We call it the T-drive.";


this.startUp = function() {
	this.$tpLastDest = player.ship.position;
	// is T-drive installed?
	this.$tpHasEq = false;
	// has compass target changed?
	this.$tpChanged = false;
	// drive name (changeable via 'poll')
	this.$tpDriveName = "T-drive";
}


this.playerWillSaveGame = function() {
	// save preferred drive name
	missionVariables.tpDriveName = this.$tpDriveName;
}


this.startUPComplete = function() {
	// load preferred drive name
	if (missionVariables.tpDriveName != null) 
		this.$tpDriveName = missionVariables.tpDriveName;	
		// prepare name poll options 
		var sta = player.ship.dockedStation;			
		if (ps.equipmentStatus ("EQ_TP_DRIVE") === "EQUIPMENT_OK") 
			this._tpPrepPoll(sta);
}


this.shipDockedWithStation = function(station) {
	// prepare Name Poll Interface
	var ps=player.ship;
	if (ps.equipmentStatus ("EQ_TP_DRIVE") === "EQUIPMENT_OK") 
		this._tpPrepPoll(station);
}


this.shipWillLaunchFromStation = function() {
	// establish once whether ship has the T-drive
	this.$tpHasEq = (player.ship.equipmentStatus ("EQ_TP_DRIVE") === "EQUIPMENT_OK");
	if (this.$tpHasEq) {
		// set up 'destination monitor'
		if(!this.$tpTimer) this.$tpTimer=new Timer(this,this._tpMonitorDestination.bind(this),0,0.25);
		// set up 'injectors' monitor
		if(!this.$tpTimer2) this.$tpTimer2=new Timer(this,this._tpMonitorInjectors.bind(this),0,0.25);
		this.$tpChanged = false;
	}
}


this.playerBoughtEquipment = function(equipment, paid) {
	var pc = player.consoleMessage;
	var ps = player.ship;
	if (equipment == "EQ_TP_DRIVE") {
		pc("Re-routing H-circuits for T-drive.",9);
		pc("Teleportation Drive is operative.",9);
		// decicredits, so convert
		this.$tpCost = paid/10;
		// prepare name poll options 
		var sta = player.ship.dockedStation;			
		if (ps.equipmentStatus ("EQ_TP_DRIVE") === "EQUIPMENT_OK") 
			this._tpPrepPoll(sta);
	}
	if (equipment == "EQ_TP_DRIVE_REM") {
		ps.removeEquipment("EQ_TP_DRIVE");
		ps.removeEquipment("EQ_TP_DRIVE_REM");
		pc("Teleportation Drive removed.",9);
		player.credits += this.$tpCost;
		pc(this.$tpCost + "cr refunded.",9);
	}
}


// ASC compass target monitor
this._tpMonitorDestination = function() {
	if (this.$tpHasEq) {	
		try {
			var pc = player.consoleMessage;
			var ps = player.ship;
			if (ps.compassTarget != null)
				var psd = ps.compassTarget;
			else var psd = this.$tpLastDest;
			var psdn = psd.displayName;
			var last = this.$tpLastDest;
			// if destination changed, note it
			if ((last != psd) && (psd)) {
				this.$tpChanged = true;
				var c = ps.messageGuiTextColor;
				ps.messageGuiTextColor = "purpleColor";
				pc("TP: "+psdn,7);
				this.$tpLastDest = psd;
				ps.messageGuiTextColor = c;
		}
		} finally {}
	}
}


// injectors status monitor
this._tpMonitorInjectors = function() {
	if (this.$tpHasEq) {
		var ps = player.ship;
		var pc = player.consoleMessage;
		if (this.$tpChanged) 
			if (ps.injectorsEngaged) {
				this.$tpChanged = false;
				// report drive start
				var c = ps.messageGuiTextColor;
				ps.messageGuiTextColor = "purpleColor";
				pc(this.$tpDriveName+" engaged.",9);
				// Teleport
				ps.position = ps.compassTarget.position;
				// report arrival
				pc("Arrived at "+ps.compassTarget.displayName,9);
				ps.messageGuiTextColor = c;
			}
	}
}



// create Teleportation Drive name poll
this._tpPrepPoll = function(station) {
	station.setInterface("tpPoll",{
	title: "FE Shipyards Teleportation Drive name poll",
	category: "Your FE Shipyards",
	summary: "FE Shipyards gives you the option of changing the short name of your Teleportation Drive." ,
	callback: this._tpShowPoll.bind(this)
	});	
}


// show Teleportation Drive name poll 
this._tpShowPoll = function() {
	
	var parameters = new Object();
	
	parameters.title = "FE Shipyards Customer Survey";
	
	parameters.message = "\n\nWhat would you like the short utility name for the Teleportation Drive to be? \n\n";
	
	parameters.choicesKey = "tpChoice";
	
	mission.runScreen(parameters, callback);	

	function callback(choice) {
		if (choice === "1. T-drive") this.$tpDriveName = "T-drive"; else
		if (choice === "2. Tau-drive") this.$tpDriveName = "Tau-drive"; else
		if (choice === "3. Mu-drive") this.$tpDriveName = "Mu-drive"; else
		if (choice === "4. GET-drive") this.$tpDriveName = "GET-drive"; else
		if (choice === "5. Ooh-drive") this.$tpDriveName = "Ooh-drive"; else
		if (choice === "6. Moolah-drive") this.$tpDriveName = "Moolah-drive";
		player.commsMessage("Thank you for your input. "+this.$tpDriveName+" it is!",7);
	}	
}