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

Expansion Galactic SatNav

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description A navigation aid for long journeys A navigation aid for long journeys
Identifier tws_satnav tws_satnav
Title Galactic SatNav Galactic SatNav
Category Equipment Equipment
Author Wyn Sleeman Wyn Sleeman
Version 0.0.2 0.0.2
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://wiki.alioth.net/index.php/GalacticSatNav n/a
Download URL https://wiki.alioth.net/img_auth.php/a/ac/Tws_satnav.oxz http://wiki.alioth.net/img_auth.php/a/ac/Tws_satnav.oxz
License CC-BY-NC-SA 4.0 CC-BY-NC-SA 4.0
File Size n/a
Upload date 1610873407

Documentation

Also read http://wiki.alioth.net/index.php/Galactic%20SatNav

tws_satnav_readme.txt

---------------------------------
Galactic Sat Nav  ver. 0.0.2
---------------------------------
      Date: October, 2014
    Author: Wyn Sleeman


-------------
Instructions:
-------------

The Galactic Sat Nav is a software upgrade to the Advanced Navigational Array
Simply set a destination in either the Local or long range Chart, then Activate the Sat Nav (shift-N to prime, then n to activate)
Every time you enter the local chart the Sat Nav will prompt which local system you should travel to for either the shortest or quickest journey.
When you reach your destination the Sat Nav will automatically switch off.
---------------
Recent changes:
---------------
0.0.2 Changed required tech level, price
0.0.1 Changed the messages a bit to show distance, no of jumps, time.  Made it non-damageable - It is a software update !
0.0.0 This is the initial pre-release

Equipment

Name Visible Cost [deci-credits] Tech-Level
Galactic Sat Nav yes 5000 8+

Ships

This expansion declares no ships.

Models

This expansion declares no models.

Scripts

Path
Config/script.js
this.name           = "tws_satnav_main";
this.author         = "Wyn Sleeman";
this.copyright      = "(C) 2014 Wyn Sleeman";
this.licence        = "CC-NC-by-SA 3.0";
this.description    = "Navigation aid for long journeys";
this.version        = "0.01";
this.equipmentName  = "EQ_TWS_GALACTICSATNAV";
"use strict";

//WorldSpace Handlers
this.startUp = function()
{
	this._finalDestination = -1;
	if(missionVariables.tws_satnav_finalDestination === null) return;
	
	this._finalDestination = missionVariables.tws_satnav_finalDestination;
}

this.playerWillSaveGame = function(message)
{
	if(this._okToContinue() == true)
	{
		missionVariables.tws_satnav_finalDestination = this._finalDestination;
	}
	else
	{
		missionVariables.tws_satnav_finalDestination = null;
	}
}

this.guiScreenChanged = function(to, from)
{
	if(guiScreen != "GUI_SCREEN_SHORT_RANGE_CHART") return;
	if(this._okToContinue() == false) return;
	if(this._finalDestination == system.ID) 
	{
		this._finalDestination = -1;
		return;
	}
    player.consoleMessage("Routes to " + System.systemNameForID(this._finalDestination), 10);

	this._destinationInfo = System.infoForSystem(system.info.galaxyID, this._finalDestination);

	this._route = system.info.routeToSystem(this._destinationInfo,"OPTIMIZED_BY_JUMPS");
	if(! this._route) return;
	this._showRouteDescription("Shortest");

	this._route = system.info.routeToSystem(this._destinationInfo,"OPTIMIZED_BY_TIME");
	if(! this._route) return;

	this._showRouteDescription("Quickest");
}

this.playerEnteredNewGalaxy = function(galaxyNumber)
{
	this._finalDestination = -1;
}

this.shipExitedWitchspace = function()
{
	if(this._okToContinue()==false) return;
	if(this._finalDestination == system.ID) 
	{
		player.consoleMessage("SatNav OFF: You have arrived at " + System.systemNameForID(this._finalDestination) , 6);
		this._finalDestination = -1;
		return;
	}
}


//Internal Functions
this._setDestination = function()
{
	if(player.ship.targetSystem >= 0)
	{
		this._finalDestination = player.ship.targetSystem;
		player.consoleMessage("SatNav ON. Destination: " + System.systemNameForID(player.ship.targetSystem), 6);
	}
}
this._okToContinue = function()
{
	if(player.ship.equipmentStatus("EQ_ADVANCED_NAVIGATIONAL_ARRAY") != "EQUIPMENT_OK") return false;
	if(player.ship.equipmentStatus(this.equipmentName) != "EQUIPMENT_OK") return false;
	if(this._finalDestination == -1) return false;
	return true;
}
this._showRouteDescription = function(routeType)
{
	let _result = routeType;
	if(this._route.route.length <= 2)
	{
		_result += ": Direct to " + System.systemNameForID(this._finalDestination) + " (";
	}
	else 
	{
		_result += ": via " + System.systemNameForID(this._route.route[1]) + " ("+ formatInteger(this._route.route.length -1) + " J, ";
	}
	_result += formatCredits(this._route.distance, true, false) + " LY, " + formatCredits(this._route.time, true, false) +" hrs)";
	
	player.consoleMessage( _result, 10);
	delete _result;
}
Scripts/tws_satnav_activation.js
this.name           = "tws_satnav_activation";
this.description    = "Activation Handler for TWS Satnav"
this.author         = "Wyn Sleeman";
this.copyright      = "© 2014 Wyn Sleeman";
this.license		= "CC-BY-NC-SA 4.0";
this.version        = "0.0";

"use strict";
this.activated = function ()
{
	worldScripts["tws_satnav_main"]._setDestination();
}