Back to Index Page generated: Nov 12, 2024, 11:02:04 PM

Expansion Andromeda

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description The famous Andromeda spaceship is a strong mobile base with huge cargo capacity. The famous Andromeda spaceship is a strong mobile base with huge cargo capacity.
Identifier oolite.oxp.Norby.Andromeda oolite.oxp.Norby.Andromeda
Title Andromeda Andromeda
Category Ships Ships
Author Norby Norby
Version 1.5 1.5
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
  • oolite.oxp.Thargoid.Bigships:1.02
  • oolite.oxp.Thargoid.Bigships:1.02
  • Conflict Expansions
    Information URL http://wiki.alioth.net/index.php/Andromeda n/a
    Download URL https://wiki.alioth.net/img_auth.php/8/8f/Andromeda_1.5.oxz n/a
    License CC BY-NC-SA 4 CC BY-NC-SA 4
    File Size n/a
    Upload date 1610873369

    Documentation

    Also read http://wiki.alioth.net/index.php/Andromeda

    Andromeda_readme.txt

    Andromeda OXP
    
    The Andromeda spaceship (http://en.wikipedia.org/wiki/Andromeda_Ascendant) is arrived into the Ooniverse.
    
    This hull is as large as a station (795 x 358 x 1368m) due to the huge crew and cargo capacity. Can not fit into standard docking ports, you must use Shift+C to connect into a Station or target the station and await until your automatically launched CargoShip is arrive into the dock.
    
    Has additional 50ly fuel in reserves. The main tank can not store more than 7ly but will be refilled after every consumed 1 ly when a message display the remaining reserve fuel.
    
    Reserves will be refilled when you put a target lock on a station and stop within 5 km.
    Refill costs 3 credits for each ly fuel.
    
    Due to the large reserves this ship is ideal to reach very far planets with FTL drives (need FarPlanets OXP) to avoid many refuel stops during a long trip (for example to Sedna in Lave).
    
    
    Instructions:
    
    In Oolite v1.79 or later do not unzip the .oxz file, just move into the AddOns folder of your Oolite installation.
    In Oolite v1.77 make an Andromeda.oxp subfolder in your AddOns folder and unzip the .oxz file into the newly created subfolder.
    
    There is a savegame in the package, copy into your oolite-saves directory if you want a test flight.
    
    
    Recommended OXPs:
    
    You should install BigShips OXP to see trader Andromedas.
    
    If you install HardShips OXP and Shield Equalizer and Capacitors OXP then this ship will get exceptionally huge shield capacitors.
    
    Gravity Scanner with Large Dish in Telescope OXP can detect targets from huge distances if you turn off your weapons and works far from bases also due to this ship is as large as a station.
    
    Also capable to hold a powerful weapon with OMGLaser OXP.
    
    FarPlanets OXP give good reasons to use the fuel reserves.
    
    
    License:
    
    The 3D model comes from the andromedamod of Sins of a Solar Empire:
    http://andromedamod.webs.com
    http://www.moddb.com/mods/andromedamod
    http://www.mediafire.com/download.php?jzzdnk04mfz
    
    CargoShip is equal with Hammerhead's cargoSled made by Thargoid in Aquatics OXP.
    
    This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License version 4.0.
    If you are re-using any piece of this OXP, please let me know by sending an e-mail to norbylite@gmail.com.
    
    
    Changelog:
     2015.01.03. v1.5  Fixed a harmless error message in the log, thanks to heir.
     2014.12.23. v1.4  Docking via CargoShip.
     2014.12.23. v1.3  Ship chance is reduced in shipyard and in space.
     2014.06.09. v1.2  Fuel reserves added.
                       Test code removed which awarded an Andromeda to the player.
     2014.06.06. v1.1  Normal map and BigTrader role added, stats tweaked.
     2014.06.05. v1.0  First release.
    

    Equipment

    This expansion declares no equipment.

    Ships

    Name
    andromeda
    CargoShip
    andromeda-acepirate
    andromeda-bigtrader
    andromeda-pirate
    andromeda-player
    Andromeda

    Models

    This expansion declares no models.

    Scripts

    Path
    Config/script.js
    "use strict";
    this.name        = "andromeda";
    this.author      = "Norby";
    this.copyright   = "2014 Norbert Nagy";
    this.licence     = "CC BY-NC-SA 4.0";
    this.description = "Create an Andromeda spaceship next to main station.";
    this.version     = "1.4";
    
    //customizable properties
    this.$AndromedaMaxFuelReserve = 50; //in light years
    this.$AndromedaFuelCost = 3; //credits for each light year fuel
    this.$AndromedaReFuelDistance = 5000; //m far from the main station
    
    //internal properties, should not touch
    this.$AndromedaCargoShip = null; //store the created CargoShip ship during docking
    this.$AndromedaFuelReserve = 0;
    this.$AndromedaShip = null; //store the created sunskimmer ship to prevent recreates
    this.$AndromedaTimer = null;
    
    //world script events
    
    this.startUp = function() {	
    //	player.replaceShip("andromeda-player", 0); //debug: player will start in an Andromeda
    	this.$AndromedaFuelReserve = missionVariables.$AndromedaFuelReserve;
    	if( !this.$AndromedaFuelReserve ) this.$AndromedaFuelReserve = this.$AndromedaMaxFuelReserve;
    	this.$AndromedaSoundRefuel = new SoundSource;
    	this.$AndromedaSoundRefuel.sound = "buy.ogg"; //refuel sound
    	this.$AndromedaSoundRefuel.loop = false;
    	this.$AndromedaSoundRefuel.repeatCount = 1;	
    	this.$AndromedaTimer = new Timer(this, this.$Andromeda_Timed.bind(this), 2, 2);
    }
    
    this.playerWillSaveGame = function(message) {
            missionVariables.$AndromedaFuelReserve = this.$AndromedaFuelReserve;
    }
    
    this.shipCollided = this.shipScoopedOther = function(otherShip) {
    	if(player.ship.dataKey == "andromeda-player" && otherShip
    		&& otherShip == this.$AndromedaCargoShip ) { //scoop back
    		player.consoleMessage("CargoShip is scooped back", 5);
    		this.$AndromedaCargoShip = null;
    		otherShip.remove(true);
    	}
    }
    
    //Andromeda functions
    this.$Andromeda_GetStation = function(p) {
    	var s = null;
    	if( this.$Andromeda_isStation(p.target) ) {
    		s = p.target;
    	} else if( p.checkScanner ) { //much faster than filteredEntities, need Oolite 1.79
    		var targets = p.checkScanner(true);
    		if( targets && targets.length > 0 )
    			for( var i = 0; !s && i < targets.length; i++ ) {
    				var t = targets[i];
    				if( this.$Andromeda_isStation( t ) ) s = t;
    			}
    	} else { //before Oolite 1.79
    		var targets = system.filteredEntities(this,
    			this.$Andromeda_isStation, p, p.scannerRange);
    		if( targets.length > 0 ) s = targets[0];
    	}
    	return(s);
    }
    
    this.$Andromeda_isStation = function(entity) {
    	return (entity && entity.isValid && entity.isStation
    		&& entity.target != player.ship
    		&& entity.dataKey.indexOf("carrier") == -1 );
    }
    
    this.$Andromeda_LaunchCargoShip = function(p) {
    	var s = p.spawnOne("[andromeda-CargoShip]");
    	if( s && s.isValid ) {
    		this.$AndromedaCargoShip = s;
    		s.target = this.$Andromeda_GetStation(p);
    		var msg = "";
    		if( !s.target ) {
    			msg = "CargoShip is not launched due to no friendly station nearby";
    			s.remove(true);
    		} else {
    			msg = "CargoShip is going to "+s.target.name;
    			s.position = p.position.add(p.vectorForward.multiply(600))
    				.add(p.vectorUp.multiply(-100)); //starting position
    			s.orientation = p.orientation;
    			s.velocity = p.velocity.add(p.vectorForward.multiply(200)); //initial push
    			p.target = s;
    		}
    		if(p == player.ship) player.consoleMessage(msg, 5);
    	}
    }
    
    this.$Andromeda_Timed = function() {
    	var p = player.ship;
    	if( !p || !p.isValid ) return;
    	
    	var m = system.mainStation;
    	if( m && m.isValid && ( !this.$AndromedaShip || !this.$AndromedaShip.isValid ) ) { //delayed create
    		this.$AndromedaShip = system.addShips("andromeda", 1, m.position, 500000)[0]; //sunskimmer
    //		this.$AndromedaShip.setAI("nullAI.plist");//debug
    	}
    
    	if(p.dataKey == "andromeda-player") {
    		if( p.fuel <= 6 ) { //refuel from reserves
    			if( this.$AndromedaFuelReserve > 0 ) {
    				p.fuel += 1;
    				this.$AndromedaFuelReserve -= 1;
    				if( this.$AndromedaFuelReserve <= 0 ) {
    					player.consoleMessage("Your fuel reserves are empty, "
    						+"you should target a station and stop within "
    						+(this.$AndromedaReFuelDistance/1000)
    						+"km for refuel.", 10);
    				} else player.consoleMessage(this.$AndromedaFuelReserve
    					+" ly fuel left in reserves.", 10);
    			}
    		}
    		var t = p.target;
    		var c = this.$AndromedaCargoShip;
    //		log(this.name, "station:"+this.$Andromeda_isStation( t )+t+c);//debug
    		if( c && c.isValid ) {
    			if( !this.$Andromeda_isStation(c.target) )
    				c.target = this.$Andromeda_GetStation(p);
    			if( c.position.distanceTo(p.position) > p.scannerRange )
    				c = this.$AndromedaCargoShip = null;
    		}
    		if( this.$Andromeda_isStation( t ) ) {
    			m = t; //else main station
    			if( c && c.target != t ) c.target = t;
    			if( !p.missilesOnline && !c )
    				this.$Andromeda_LaunchCargoShip(p);
    		}
    //		log(this.name, "station:"+this.$Andromeda_isStation( t )+t+c+" ct"+c.target);//debug
    		
    		if( m && m.isValid && p.speed < 0.1 //stop near a main station for refuel
    			&& this.$AndromedaFuelReserve < this.$AndromedaMaxFuelReserve ) {
    			var mdist = m.position.distanceTo(p.position) - m.collisionRadius;
    
    			//player.consoleMessage(mdist,1);//debug
    			if( mdist < this.$AndromedaReFuelDistance ) {
    				var maxcost = this.$AndromedaMaxFuelReserve * this.$AndromedaFuelCost;
    				if( player.credits >= maxcost ) {
    					var f = this.$AndromedaMaxFuelReserve - this.$AndromedaFuelReserve;
    					var cr = f * this.$AndromedaFuelCost;
    					this.$AndromedaFuelReserve = this.$AndromedaMaxFuelReserve; //up to full
    					player.credits -= cr; //cost of the refill
    					this.$AndromedaSoundRefuel.play(); //refuel sound
    					player.consoleMessage("Payed "+cr+" credits for "+f+" ly reserve fuel.", 10);
    				} else {
    					player.consoleMessage("You must have at least "+maxcost
    						+" credits before you can get reserve fuel.", 10);
    				}
    			}
    		}
    	}
    }
    
    Scripts/andromeda-CargoShip.js
    "use strict";
    this.name	= "andromeda-CargoShip";
    this.author	= "Norby";
    this.copyright	= "2014 Norby";
    this.description= "Ship script for andromeda-CargoShip";
    this.version	= "1.4";
    this.licence	= "CC BY-NC-SA 4.0";
    
    //ship script events
    this.shipCollided = function(otherShip) {
    	//prevent destruction during scooping back to andromeda
    	if(otherShip = player.ship) this.ship.energy = this.ship.maxEnergy;
    }
    
    this.shipDied = function() {
    	var w = worldScripts.andromeda;
    	if(this.ship == w.$AndromedaCargoShip)
    		w.$AndromedaCargoShip = null;
    }
    
    this.shipWasScooped = function(scooper) {
    	var w = worldScripts.andromeda;
    	if(this.ship == w.$AndromedaCargoShip)
    		w.$AndromedaCargoShip = null;
    }
    
    this.shipWillDockWithStation = function(station) {
    	var w = worldScripts.andromeda;
    	if(this.ship == w.$AndromedaCargoShip) {
    		w.$AndromedaCargoShip = null;
    		player.ship.target = null;
    		station.dockPlayer();
    	}
    }