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

Expansion Planetary Compass

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Adds planets, suns and moons to the ASC, and gives names to them. Requires at least one name-pack to be installed Adds planets, suns and moons to the ASC, and gives names to them. Requires at least one name-pack to be installed
Identifier oolite.oxp.Thargoid.PlanetaryCompass oolite.oxp.Thargoid.PlanetaryCompass
Title Planetary Compass Planetary Compass
Category Equipment Equipment
Author Thargoid Thargoid
Version 1.02 1.02
Tags equipment, system equipment, system
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
  • oolite.oxp.Thargoid.PlanetaryCompassPackA:1.00
  • oolite.oxp.Thargoid.PlanetaryCompassPackB:1.00
  • oolite.oxp.Thargoid.PlanetaryCompassPackC:1.00
  • oolite.oxp.Thargoid.PlanetaryCompassPackD:1.00
  • oolite.oxp.Thargoid.PlanetaryCompassPackA:1.00
  • oolite.oxp.Thargoid.PlanetaryCompassPackB:1.00
  • oolite.oxp.Thargoid.PlanetaryCompassPackC:1.00
  • oolite.oxp.Thargoid.PlanetaryCompassPackD:1.00
  • Conflict Expansions
    Information URL http://wiki.alioth.net/index.php/Planetary_Compass_OXP n/a
    Download URL https://wiki.alioth.net/img_auth.php/b/b9/Planetary_Compass_1.01.oxz n/a
    License Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license with clauses - see readme file Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license with clauses - see readme file
    File Size n/a
    Upload date 1610873451

    Documentation

    Also read http://wiki.alioth.net/index.php/Planetary%20Compass

    Planetary Compass v1.02 Readme & License.txt

    Planetary Compass OXP by Thargoid.
    
    A little OXP which enables the advanced space compass to also detect planets (sub-planets) and moons. The planets appear as "P" and the moons as "M". No purchases or installation (other than the OXP) is needed, it just fills in the odd gap that has always existed in the ASC.
    
    The planets are named in order from the sun outward, using roman numeral designations after the systems name. The main planet is referred to as Prime. Moons are assigned random names, although these should be repeatable for a given system across multiple visits.
    
    The .displayName parameter will be the full name as displayed (including the planetary body type), and the .name parameter will be just the planet/moons name without any other designation.
    
    Lastly it is possible for other OXPs to introduce their own custom names to added planets or moons by setting its displayName or .name parameter (system.planets[x].displayName = "yournamehere" or equivalent .name). If both are set then displayName will be used. Built-in it will correctly name the Tianve pulsar from the Tianve OXP - if any other OXPs need such naming please let me know.
    
    This OXP uses Cim's new visual effects class. It also works best with Cim's Talkative Advanced Space Compass and one of the planet/moon adding OXPs (System Redux etc).
    
    Thus it requires Oolite version 1.80 or above to work.
    
    --------------------------------------------------------------
    License:
    
    This OXP is released under the Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license with the following clauses:
    
    * Whilst you are free (and encouraged) to re-use any of the scripting, models or texturing in this OXP, the usage must be distinct from that within this OXP. Unique identifiers such as (but not limited to) unique shipdata.plist entity keys, mission variables, script names (this.name), equipment identity strings (EQ_), description list arrays and entity roles must not be re-used without prior agreement.
    * rebundling of this OXP within another distribution is permitted as long as it is unchanged. The following derivates however are permitted and except from the above:
    	* the conversion of files between XML and openStep.
    	* the merging of files with other files of the same type from other OXPs.
    * Even though it is not compulsory, if you are re-using any sizable or recognisable piece of this OXP, please let me know :)
    
    --------------------------------------------------------------
    Instructions:
    
    Unzip the file, and then move the folder "Planetary Compass 1.01.oxp" to the AddOns directory of your Oolite installation. 
    
    --------------------------------------------------------------
    Version history:
    
    08/01/2013 - Version 1.00 - First release.
    11/02/2013 - Version 1.01 - Script tweak to also put delay on first station exit (to allow other scripts time to set up their planets and moons).
    01/07/2014 - Version 1.02 - Update for oolite 1.80 scripting.
    
    --------------------------------------------------------------
    
    Acknowledgements:
    
    Thanks to Cim for his work on the visual effects new code in Oolite 1.77, and for being so patient with my suggestions and requests for features etc. And to everyone who joined the discussion on the forum about planetary naming.
    
    And thanks to Spara for the heads-up on the first launch issue, as it depends on script run order (which is OS dependent).

    Equipment

    This expansion declares no equipment.

    Ships

    This expansion declares no ships.

    Models

    This expansion declares no models.

    Scripts

    Path
    Config/script.js
    this.name           = "planetaryCompass_worldScript.js";
    this.author         = "Thargoid";
    this.copyright      = "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
    this.description    = "World script for planetary compass OXP";
    this.version        = "1.02";
    "use strict";
    
    this.startUp = function()
    	{ 
    	this.planetNames = [ "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", "XIII", "XIV", "XV", "XVI", "XVII", "XVIII", "XIX", "XX" ];
    	this.moonNames = new Array();
    	
    	if(worldScriptNames.length > 0) // scan for moon name pack scripts
    		{
    		var scriptCounter = 0 ; // reset the counter
    		for(scriptCounter = 0;scriptCounter<worldScriptNames.length;scriptCounter++)
    			{
    			if(worldScriptNames[scriptCounter] && worldScripts[worldScriptNames[scriptCounter]] && worldScripts[worldScriptNames[scriptCounter]].$planetaryCompass_addMoonNames)
    				{ worldScripts[worldScriptNames[scriptCounter]].$planetaryCompass_addMoonNames(); }
    			}
    		}
    	
    	if(this.moonNames.length === 0)
    		{
    		log("Planetary Compass", "No planetary compass moon name packs installed - please add at least one!");
    		delete this.shipWillLaunchFromStation;
    		delete this.shipExitedWitchspace;
    		delete this.$setUpNames;
    		delete this.$checkForSpecialPlanets;
    		}
    	}
    	
    this.shipWillLaunchFromStation = function(station)
    	{
    	this.shipExitedWitchspace();
    	delete this.shipWillLaunchFromStation;
    	}	
    
    this.shipExitedWitchspace = function()
    	{ this.scriptDelay = new Timer(this, this.$setUpNames, 0.25); }
    	
    this.$setUpNames = function()
    	{
    	this.$checkForSpecialPlanets();
    	if(system.isInterstellarSpace || !system.sun || system.sun.isGoingNova || system.sun.hasGoneNova) { return; }
    
    	function allPlanets(entity) {return entity.isPlanet}; 
    	this.stellarArray = system.filteredEntities(this, allPlanets, system.sun); // use this instead of system.planets array to get order correct
    		
    	var moonRow = Math.floor(this.moonNames.length * system.scrambledPseudoRandomNumber(system.ID * galaxyNumber)); // chose a row from the name grid
    	this.shuffleCount = 0;
    	function shuffleMoons() 
    		{
    		this.shuffleCount++;
    		return 0.5 - system.scrambledPseudoRandomNumber(system.ID + this.shuffleCount);
    		}
    	var systemMoons = this.moonNames[moonRow].sort(shuffleMoons); // shuffle the list of names in the row
    	
    	var moonCount = 0;
    	var planetCount = 0;
    	var loopCounter = 0;
    	
    	for(loopCounter = 0;loopCounter<this.stellarArray.length;loopCounter++)
    		{
    		planetCount %= this.planetNames.length; // as a fallback in case there are more entities than name row items
    		moonCount %= systemMoons.length;
    
    		if(this.stellarArray[loopCounter].isMainPlanet)
    			{
     			if(this.stellarArray[loopCounter].hasOwnProperty("isGasGiant") && this.stellarArray[loopCounter].isGasGiant)
    				{ this.planetType = "Gas Giant"; }
    			else
    				{ this.planetType = "Planet"; }
    			system.mainPlanet.name = system.name + " Prime";
    			system.mainPlanet.displayName = system.name + " Prime (" + this.planetType + ")";  
    			planetCount++;
    			continue; 
    			}
    		
    		if(this.stellarArray[loopCounter].name !== system.name || this.stellarArray[loopCounter].name === undefined || this.stellarArray[loopCounter].displayName !== undefined) // if it's an OXP-added planet/moon entity which is already named
    			{ continue; }
    
    		if(this.stellarArray[loopCounter].hasAtmosphere)
    			{ 
    			this.beacon = system.addVisualEffect("planetaryCompass_planet", this.stellarArray[loopCounter].position); 
    			if(this.stellarArray[loopCounter].hasOwnProperty("isGasGiant") && this.stellarArray[loopCounter].isGasGiant)
    				{ this.planetType = "Gas Giant"; }
    			else
    				{ this.planetType = "Planet"; }
    
    			this.beacon.beaconCode = system.name + " " + this.planetNames[planetCount];
    			this.beacon.beaconLabel = system.name + " " + this.planetNames[planetCount] + " (" + this.planetType + ")";
    			planetCount++;
    			}
    		else
    			{ 
    			this.beacon = system.addVisualEffect("planetaryCompass_moon", this.stellarArray[loopCounter].position);
    			this.beacon.beaconCode = systemMoons[moonCount];
    			this.beacon.beaconLabel = systemMoons[moonCount] + " (Moon)";
    			moonCount++;
    			}
    		}
    	}
    
    this.$checkForSpecialPlanets = function()
    	{	
    	if(galaxyNumber === 0 && system.ID === 246) // if we're at Tianve (G0, S227), name the pulsar
    		{
    		for (let i=0; i<system.planets.length; i++) 
    			{ 
    			if(system.planets[i].texture === "tianve_pulsar.png") 
    				{ system.planets[i].displayName = "Tianve Pulsar"; } 
    			}
    		return;	
    		}
    	}