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

Expansion APRIL Pylon Loader

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description An in-flight pylon reloading system, the Automated Pylon Re-arm In-flight Loader An in-flight pylon reloading system, the Automated Pylon Re-arm In-flight Loader
Identifier oolite.oxp.Thargoid.APRIL oolite.oxp.Thargoid.APRIL
Title APRIL Pylon Loader APRIL Pylon Loader
Category Equipment Equipment
Author Thargoid Thargoid
Version 1.03 1.03
Tags equipment, weapons equipment, weapons
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://wiki.alioth.net/index.php/APRIL_OXP n/a
Download URL https://wiki.alioth.net/img_auth.php/6/68/APRIL_1.03.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 1610873324

Documentation

Also read http://wiki.alioth.net/index.php/APRIL%20Pylon%20Loader

APRIL v1.03 Readme & License.txt

APRIL OXP by Thargoid.

From the ship equipment department, we introduce the Automated Pylon Re-arm In-flight Loader, AKA the APRIL system.

As its name suggests, this retrofittable technology allows storage and in-flight re-arming of extra pylon mounted weaponry and equipment. It is compatible with all current armaments except the Aquarian Missile Machine unit, which is automatically excluded from storage. It is also incompatible with the pylon-switching mechanism on Vortex and Maelstrom craft, on which it is based.

The standard system is available from tech level 12 systems for 40,000 credits. This doubles the fitted ships pylon capacity via reloading. For an additional 25,000 credits, the system can be upgraded to a military specification, adding an additional bank of storage (overall tripling the capacity).

Note that this OXP also makes the APRIL system available to NPCs (at a 0.2 weighted role as a missile), inducing a full missile reload to their pylons. Just to maintain balance :)

--------------------------------------------------------------
Instructions for use:

After purchase, the current pylon load can be transferred into the system by selecting the appropriate option on the equipment (3/F3) screen (only available if there is at least one loaded pylon). Similar options are available to view and unload the system from the equipment screen.

When in-flight, the system will automatically reload the ships pylons when empty if the last item used was a missile (note if the last launch was a mine the automatic reload is not triggered - this is a glitch in Oolite v1.76.x and should be resolved in Oolite v1.77 and beyond). Alternatively, a manual unload can be initated at any time in flight by selecting the system (via the "shift-N" key) and then priming it (via the "n" key).

When in-flight, the system content can be viewed by selecting the status screen (5/F5) and then going to the marketplace screen (8/F8) from there. The content screen will display up to the first 20 items stored, for ships with an over-large number of pylons. It is not recommended to browse this screen in the middle of battle :)

--------------------------------------------------------------
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 "APRIL Pylon Loader 1.03.oxp" to the AddOns directory of your Oolite installation, and also the enclosed zip file of bigShips oxp on which this OXP relies. Then start the game up and the ships should be added. 

--------------------------------------------------------------
Version history:

19/04/2012 - First release, version 1.00
19/04/2012 - Minor script fix to add a missing variable definition on first purchase
03/05/2012 - Another minor script fix to prevent erroneous awarding of expansion on reloading
26/11/2012 - Tweak to replace boolean mission variables with string ones, to prevent save/restore issue. Also adds cargo space usage for 1.77.
--------------------------------------------------------------

Acknowledgements:

With thanks to Solonar for extensive beta-testing, and Capt Murphy for the 1.02 bug report.

Equipment

Name Visible Cost [deci-credits] Tech-Level
APRIL Pylon Reloader yes 400000 12+
APRIL Reloader Expansion no 250000 13+
APRIL reloader content no 0 1+
NPC Reloader yes 0 1+
Transfer pylon load to APRIL reloader no 0 1+
Unload APRIL reloader to pylons no 0 1+

Ships

Name
april_NPCReloader

Models

This expansion declares no models.

Scripts

Path
Scripts/april_NPC.js
this.name					= "april_NPC.js";
this.author					= "Thargoid";
this.copyright				= "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description			= "Script for NPC missile reload";
this.version				= "1.00";

this.shipSpawned = function()
	{
	if(!this.ship || !this.ship.owner || !this.ship.owner.isValid)	{ return; }
	
	this.pylonCount = this.ship.owner.missileCapacity - this.ship.owner.missiles.length;
	
	if(this.pylonCount > 0)
		{
		var loadCounter = 0 ; // reset the counter
		for(loadCounter = 0;loadCounter<this.pylonCount;loadCounter++)
			{ this.ship.owner.awardEquipment(this.ship.selectNewMissile()); }
		}
	}
Scripts/april_activate.js
this.name					= "april_activate.js";
this.author					= "Thargoid";
this.copyright				= "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description			= "Script for manual activation of the APRIL";
this.version				= "1.00";

this.activated = function()
	{
	if(worldScripts["april_worldScript.js"])
		{ worldScripts["april_worldScript.js"].aprilTriggered(); } 
	}
Scripts/april_worldScript.js
this.name					= "april_worldScript.js";
this.author					= "Thargoid";
this.copyright				= "Creative Commons: attribution, non-commercial, sharealike with clauses - see readme.txt";
this.description			= "Script for APRIL reloader";
this.version				= "1.03";

this.startUp = function()
	{
	if(player.ship.equipmentStatus("EQ_APRIL") === "EQUIPMENT_UNAVAILABLE") { return; }

	if(!missionVariables.aprilExpanded)	{ missionVariables.aprilExpanded = "FALSE"; }
	this.storeSpace = player.ship.missileCapacity;
	if(missionVariables.aprilExpanded === "TRUE") { this.storeSpace *= 2; }
	if(missionVariables.aprilMemory)
		{ 
		this.storeArray = missionVariables.aprilMemory.split(":");
		this.validateArray();
		}
	else
		{ this.storeArray = []; }
	this.missileArray = [];
	missionVariables.aprilLoad = this.storeArray.length;
	if(this.storeArray.length === this.storeSpace)
		{ missionVariables.aprilFull = "TRUE"; }
	else
		{ missionVariables.aprilFull = "FALSE"; }	
	}

this.validateArray = function()
	{
	if(this.storeArray.length === 0) { return; }
	var arrayCounter = this.storeArray.length - 1;
	for(arrayCounter = this.storeArray.length - 1;arrayCounter>=0;arrayCounter--)
		{
		if(EquipmentInfo.allEquipment.indexOf(EquipmentInfo.infoForKey(this.storeArray[arrayCounter])) === -1)
			{ this.storeArray.splice(arrayCounter,1); }
		}
	this.tidyArray();	
	}
	
this.playerWillSaveGame = function(type)
	{ 
	if(player.ship.equipmentStatus("EQ_APRIL") === "EQUIPMENT_UNAVAILABLE") { return; }

	this.storeMissileArray = "";
	var storeCounter = 0;
	for(storeCounter = 0;storeCounter<this.storeArray.length;storeCounter++)
		{ this.storeMissileArray = this.storeMissileArray + this.storeArray[storeCounter] + ":"; }
	this.storeMissileArray = this.storeMissileArray.slice(0,-1);	
	missionVariables.aprilMemory = this.storeMissileArray;
	}	

this.playerBoughtNewShip = function(ship)
	{
	if(player.ship.equipmentStatus("EQ_APRIL") === "EQUIPMENT_UNAVAILABLE") { return; }

	this.storeArray = [];
	this.missileArray = [];
	if(missionVariables.aprilMemory) { delete missionVariables.aprilMemory; }
	if(missionVariables.aprilFull) { delete missionVariables.aprilFull; }
	if(missionVariables.aprilLoad) { delete missionVariables.aprilLoad; }
	if(missionVariables.aprilExpanded) { delete missionVariables.aprilExpanded; }
	this.storeSpace = player.ship.missileCapacity;
	}
	
this.playerBoughtEquipment = function(equipment)
	{
	switch(equipment)
		{	
		case "EQ_APRIL":
			{
			missionVariables.aprilExpanded = "FALSE";
			missionVariables.aprilFull = "FALSE";
			this.missileArray = [];
			this.storeArray = [];
			missionVariables.aprilLoad = 0;
			this.storeSpace = player.ship.missileCapacity;
			break;
			}	
		case "EQ_APRIL_UNLOAD":
			{
			player.ship.removeEquipment("EQ_APRIL_UNLOAD");
			this.aprilTriggered();
			break;
			}
		case "EQ_APRIL_EXPANSION":
			{
			missionVariables.aprilExpanded = "TRUE";
			missionVariables.aprilFull = "FALSE";
			this.storeSpace = player.ship.missileCapacity * 2;
			break;
			}
		case "EQ_APRIL_INVENTORY":
			{
			player.ship.removeEquipment("EQ_APRIL_INVENTORY");
			this.displayInventory();
			break;
			}	
		case "EQ_APRIL_TRANSFER":
			{
			player.ship.removeEquipment("EQ_APRIL_TRANSFER");
			if(this.storeArray.length === this.storeSpace)
				{
				player.consoleMessage("APRIL capacity filled");
				missionVariables.aprilFull = "TRUE";
				}
			else
				{
				this.missileArray = [];
				this.mmLoaded = "no";
				var loopCounter = 0 ; // reset the counter
				for(loopCounter = 0;loopCounter < player.ship.missiles.length;loopCounter++)
					{
					if(player.ship.missiles[loopCounter].equipmentKey === "EQ_ARMOURY_MISSILEMACHINE_MINE")
						{ this.mmLoaded = "yes"; }
					else
						{ this.missileArray.push(player.ship.missiles[loopCounter].equipmentKey); }
					}				

				player.ship.awardEquipment("EQ_MISSILE_REMOVAL");
				if(this.mmLoaded === "yes") 
					{
					player.ship.awardEquipment("EQ_ARMOURY_MISSILEMACHINE_MINE"); 
					this.mmLoaded = "no";
					}
				
				this.availableSpace = this.storeSpace - this.storeArray.length;
				
				var listCounter = 0 ; // reset the counter
				for(listCounter = 0;listCounter<this.availableSpace;listCounter++)
					{ this.storeArray.push(this.missileArray.pop()); }
				
				this.tidyArray();
				
				if(this.storeArray.length === this.storeSpace)
					{
					player.consoleMessage("APRIL capacity filled");
					missionVariables.aprilFull = "TRUE";
					}
					
				if(this.missileArray.length > 0)	
					{
					var listCounter = 0 ; // reset the counter
					for(listCounter = 0;listCounter<this.missileArray.length;listCounter++)
						{ player.ship.awardEquipment(this.missileArray[listCounter]); }
					}
				}	
			missionVariables.aprilLoad = this.storeArray.length;
			break;
			}
		}	
	}
	
this.tidyArray = function()
	{
	var loopCounter = this.storeArray.length - 1 ; // reset the counter
	for(loopCounter = this.storeArray.length - 1;loopCounter >= 0;loopCounter--)
		{ if(this.storeArray[loopCounter] === undefined) { this.storeArray.pop(); } }				
	}

this.shipReleasedEquipment = this.shipFiredMissile = function()
	{
	if(player.ship.equipmentStatus("EQ_APRIL") === "EQUIPMENT_UNAVAILABLE") { return; }
	this.missileCheckTimer = new Timer(this, this.checkMissiles, 0.25); 
	}
	
this.checkMissiles = function()
	{
	if(player.ship.equipmentStatus("EQ_APRIL") !== "EQUIPMENT_OK" || player.ship.missiles.length > 0)
		{ return; }
	this.aprilTriggered();
	}	
	
this.aprilTriggered = function()
	{
	if(this.storeArray.length === 0)
		{
		player.consoleMessage("APRIL store empty");
		missionVariables.aprilLoad = this.storeArray.length;
		return;
		}
		
	this.freePylons = player.ship.missileCapacity - player.ship.missiles.length;
	if(this.freePylons === 0)
		{
		player.consoleMessage("All pylons are full");
		missionVariables.aprilLoad = this.storeArray.length;
		return;
		}
		
	var listCounter = 0 ; // reset the counter
	for(listCounter = 0;listCounter<this.freePylons;listCounter++)
		{
		this.transfer = this.storeArray.pop();
		if(this.transfer !== undefined) { player.ship.awardEquipment(this.transfer); }
		}
		
	this.tidyArray();	
	missionVariables.aprilFull = "FALSE";
	missionVariables.aprilLoad = this.storeArray.length;
	}
	
this.guiScreenChanged = function(to, from)
	{
	if(player.ship.docked || player.ship.equipmentStatus("EQ_APRIL") !== "EQUIPMENT_OK" || player.ship.equipmentStatus("EQ_MULTIBAY") === "EQUIPMENT_OK") { return; }
		
	if(to && from && to == "GUI_SCREEN_MARKET" && from == "GUI_SCREEN_STATUS")
			{ this.displayInventory(); }	
	}		

this.displayInventory = function()
	{
	mission.runScreen({title:"APRIL Content"});
	if(this.storeArray.length === 0)
		{
		mission.addMessageText("\n\n\nThe APRIL system is currently empty.\n\nWeaponry can be stored via the equipment screen when docked.");
		return;
		}
	else
		{
		var minShow = 0;
		if(this.storeArray.length > 20) { minShow = this.storeArray.length - 20; }
		var pylonCounter = this.storeArray.length -1; // reset the counter
		var displayCounter = 1;
		for(pylonCounter = this.storeArray.length - 1; pylonCounter >= minShow; pylonCounter--)
			{ 
			mission.addMessageText(displayCounter + " - " + EquipmentInfo.infoForKey(this.storeArray[pylonCounter]).name); 
			displayCounter++;
			}
		if(this.storeArray.length < 18) { mission.addMessageText("\nCapacity used: " + this.storeArray.length + " of " + this.storeSpace); }
		if(this.storeArray.length > 20) { mission.addMessageText("...                                                 Press Space Commander"); }
		}
	}