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

Expansion Cargo Pods

Content

Warnings

  1. http://wiki.alioth.net/index.php/Cargo%20Pods -> 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 Special goods pods with downworld frame adaptors, for attachment to the auxiliary pylon only. Capacities 10-60 TC. Pods are fully detachable and replaceable and now gain a 60 TC class variant. Special goods pods with downworld frame adaptors, for attachment to the auxiliary pylon only. Capacities 10-60 TC. Pods are fully detachable and replaceable and now gain a 60 TC class variant.
Identifier oolite.oxp.Reval.Cargo_Pods oolite.oxp.Reval.Cargo_Pods
Title Cargo Pods Cargo Pods
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/7/7e/Cargo_Pods_1.2.oxz n/a
License CC-BY-NC-SA 4.0 CC-BY-NC-SA 4.0
File Size n/a
Upload date 1705899312

Documentation

Equipment

Name Visible Cost [deci-credits] Tech-Level
Cargo Pod 10 TC yes 100000 5+
Remove Cargo Pod 10 TC yes 0 5+
Cargo Pod 20 TC yes 200000 5+
Remove Cargo Pod 20 TC yes 0 5+
Cargo Pod 30 TC yes 300000 5+
Remove Cargo Pod 30 TC yes 0 5+
Cargo Pod 40 TC yes 400000 5+
Remove Cargo Pod 40 TC yes 0 5+
Cargo Pod 50 TC yes 500000 5+
Remove Cargo Pod 50 TC yes 0 5+
Cargo Pod 60 TC yes 600000 5+
Remove Cargo Pod 60 TC 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/cp1_conditions.js
// conditions for award of 10 TC Cargo Pod
"use strict";
this.name = "CP10 Conditions";
this.author = "Reval";
this.licence = "CC BY-NC-SA 4.0";
this.version = "1.0";

this.allowAwardEquipment = function(equipment, ship, context) {
	var pc = player.consoleMessage;
	if (equipment == "EQ_10TC_POD") {
		// fittable only if auxiliary pylon is installed
		if (player.ship.equipmentStatus ("EQ_AUX_PYLON") === "EQUIPMENT_OK") {
			// and not displayed if any pod is already fitted
			if ((player.ship.equipmentStatus ("EQ_10TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_20TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_30TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_40TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_50TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_60TC_POD") !== "EQUIPMENT_OK"))
				return true; else return false;
		} else return false;
	}	
	// pod removal conditions
	if (equipment == "EQ_10TC_POD_REM") 
		if (player.ship.equipmentStatus ("EQ_10TC_POD") === "EQUIPMENT_OK")
			return true; else return false;
	
	return true;
}
Scripts/cp1_script.js
"use strict";
this.name = "Cargo Pod 10 TC";
this.author = "Reval";
this.licence = "CC BY-NC-SA 4.0";
this.version = "1.1";


this.playerBoughtEquipment = function(equipment, paid) {
	var pc = player.consoleMessage;
	if (equipment == "EQ_10TC_POD") {		
		pc("Attaching one 10 TC Pod to auxiliary pylon.",9);
		player.ship.cargoSpaceCapacity += 10;
		pc("Ship's total capacity = "+player.ship.cargoSpaceCapacity+" TC.",9);
		// always 1 because only one pod can be fitted
		this.$cp1Pods=1;
	} else
	// pod removal and refund
	if (equipment == "EQ_10TC_POD_REM") {
		player.ship.removeEquipment("EQ_10TC_POD");
		player.ship.removeEquipment("EQ_10TC_POD_REM");
		pc("Detaching 10 TC Pod from auxiliary pylon.",9);
		player.ship.cargoSpaceCapacity -= 10;
		pc("Ship's total capacity = "+player.ship.cargoSpaceCapacity+" TC.",9);
		this.$cp1Pods=0;
		player.credits += this.$cp1Cost;
		pc("Amount refunded: "+ this.$cp1Cost,9);
	}
}


this.startUpComplete = function () {
	var pc = player.consoleMessage;
	if (missionVariables.cp1Pods != null) 
		this.$cp1Pods = missionVariables.cp1Pods;
	// Load total fees taken
	if (missionVariables.cp1HandlingFeeTotal != null)
		this.$cp1HandlingFeeTotal = missionVariables.cp1HandlingFeeTotal;
	if (missionVariables.cp1HandlingPaid != null)
		this.$cp1HandlingPaid = missionVariables.cp1HandlingPaid;
	if (missionVariables.cp1MaintenanceFeeTotal != null)
		this.$cp1MaintenanceFeeTotal = missionVariables.cp1MaintenanceFeeTotal;
	if (missionVariables.cp1DismantlingFeeTotal != null)
		this.$cp1DismantlingFeeTotal = missionVariables.cp1DismantlingFeeTotal; 
    // Load system-to-system runs w/pod
	if (missionVariables.cp1Runs != null)
		this.$cp1Runs = missionVariables.cp1Runs;
	// Load Handling fee count
	if (missionVariables.cp1HandlingCount != null)
		this.$cp1HandlingCount = missionVariables.cp1HandlingCount;
	// Load handling fee exemption status
	if (missionVariables.cp1HFExempt != null)
		this.$cp1HFExempt = missionVariables.cp1HFExempt;
	// Load Maintenance fee count
	if (missionVariables.cp1MaintenanceCount != null)
		this.$cp1MaintenanceCount = missionVariables.cp1MaintenanceCount;
	// CHECK
	log(this.name, this.name+" startup complete.");
	// prepare pod Account screen
	var sta = player.ship.dockedStation;
	if (this.$cp1Pods>0) this._cp1PrepAcc(sta);
	// optionally, prepare handling fee waiver request
	if (this.$cp1Pods>0) this._cp1PrepEx(sta);
}


this.startUp = function() {
    log(this.name, "Initialising OXP " + this.name);
	// check for G.E.T. presence
	this.$cp1ET = false;
	if (worldScripts["Elite Trader"]) 
		this.$cp1ET = true;
	// TEST	
	if (this.$cp1ET) log(this.name, "Finds Elite Trader present");
	// check for FE Ships Player
	this.$cp1FES = false;
	if (worldScripts["FE Ships Player"]) 
		this.$cp1FES = true;
	// TEST	
	if (this.$cp1ET) log(this.name, "Finds FE Ships Player present");
	// number of pods - when fitted, always 1
	this.$cp1Pods = 0;
	// purchase cost of pod in cr
	this.$cp1Cost = 10000;
	// handling fee
	this.$cp1HandlingFee = 0.005*this.$cp1Cost; // 0.005 of cost
	this.$cp1HandlingFeeTotal = 0;
	this.$cp1HandlingPaid = "yes"; // or "no" - easier than boolean
	this.$cp1HandlingCount = 0;
	this.$cp1HFExempt = "no";
	// maintenance fee
	this.$cp1MaintenanceFee = 0.05*this.$cp1Cost; // 0.05 of cost
	this.$cp1MaintenanceFeeTotal = 0;
	this.$cp1MaintenancePaid = "no" // or "yes"
	this.$cp1MaintenanceInterval = 10; // in runs (according to cost)
	this.$cp1MaintenanceCount = 0;
	// dismantling fee
	this.$cp1DismantlingFee = 0.1*this.$cp1Cost; // 0.1 of cost
	this.$cp1DismantlingFeeTotal = 0.0;
	// system-to-system runs w/pod
	this.$cp1Runs = 0;
}


this.playerWillSaveGame = function(message) {
	missionVariables.cp1Pods = this.$cp1Pods;
	// save total fees taken
	missionVariables.cp1HandlingFeeTotal = this.$cp1HandlingFeeTotal;
	missionVariables.cp1MaintenanceFeeTotal = this.$cp1MaintenanceFeeTotal;
	missionVariables.cp1DismantlingFeeTotal = this.$cp1DismantlingFeeTotal;
	missionVariables.cp1HandlingPaid = this.$cp1HandlingPaid;
	// system-to-system runs w/pod
	missionVariables.cp1Runs =this.$cp1Runs;
	// handling fee count
	missionVariables.cp1HandlingCount = this.$cp1HandlingCount;
	// handling fee exemption (G.E.T.)
	missionVariables.cp1HFExempt = this.$cp1HFExempt;
	// maintenance fee count
	missionVariables.cp1MaintenanceCount = this.$cp1MaintenanceCount;
}


this.shipDockedWithStation = function(station) {
	// take handling fee (if not exempt)
	var pc = player.consoleMessage;
	var ex = this.$cp1HFExempt;
	// check we have pods, the fee is not paid, and we're not exempt
	if ((this.$cp1Pods>0) && (this.$cp1HandlingPaid==="no") && (ex==="no")) {
		var fee = 0;
		for (var x=1; x<= this.$cp1Pods; x++)
			fee += this.$cp1HandlingFee;
		// record fee and debit trader's account
		this.$cp1HandlingFeeTotal += fee;
		player.credits -= fee;
		this.$cp1HandlingPaid = "yes";
		pc("10 TC Pod handling fees: "+fee+" cr",9);
		this.$cp1HandlingCount++;
	}

	// conditionally take maintenance fee
	if (this.$cp1Pods>0) this._cp1DoMaintenance();
	
	// prepare pod Account and Licence page
	if (this.$cp1Pods>0) this._cp1PrepAcc(station);
	
	// prepare handling fee waiver request if ET or FESP is present
	if (this.$cp1Pods>0) this._cp1PrepEx(station);
}



this.shipExitedWitchspace = function() {
	// set handling paid to 'no'
	this.$cp1HandlingPaid = "no";
	this.$cp1Runs ++;
}


/* Common helper functions */


// assess and take maintenance fee
this._cp1DoMaintenance = function() {
	var pc = player.consoleMessage;
	var runs = this.$cp1Runs;
	var intv = this.$cp1MaintenanceInterval;
	var mfee = this.$cp1MaintenanceFee;
	// take maintenance fee after y runs
	if ( (runs > 0) && ((runs % intv)==0) ) {
		// maintenance for x pods
		var fee = 0;
		for (var x=1; x<= this.$cp1Pods; x++)
			fee += mfee;
		// maintenance fee tally & debit
		this.$cp1MaintenanceFeeTotal += fee;
		player.credits -= fee;
		pc("10 TC Pod Maintenance fees: "+fee+" cr",9);
		// update Maintenance count
		this.$cp1MaintenanceCount++;
	}
}


/* F4 Interfaces */


// create F.E.S. 'Licence & Account' page 
this._cp1PrepAcc = function(station) {
	station.setInterface("cp1Acc",{
	title: "Your FE Shipyards 10 TC Pod Class Licence",
	category: "Your FE Shipyards",
	summary: "Your FE Shipyards 10 TC Pod account screen shows terms, fees paid, load, and other useful information.",
	callback: this._cp1ShowAcc.bind(this)
	});	
}


// show F.E.S. 'Licence & Account' page
this._cp1ShowAcc = function() {
	var hfc = this.$cp1HandlingCount;
	var mfc = this.$cp1MaintenanceCount;
	var mfi = this.$cp1MaintenanceInterval;
	var hft = this.$cp1HandlingFeeTotal;
	var mft = this.$cp1MaintenanceFeeTotal;
	var dft = this.$cp1DismantlingFeeTotal;
		
	var parameters = new Object();
	
	parameters.title = "FE Shipyards";
	
	parameters.message = "Dear customer, \n\n";
	
	if (this.$cp1Pods>0) 
		parameters.message +="Your Account and Licence for 10 TC Class Goods Pods x "+this.$cp1Pods+": \n\n"; 
	 else
		parameters.message +="You have no 10 TC Class Pods licensed with us at this time. \n\n";
	
	parameters.message +="Handling fees paid: "+hft+" cr ("+hfc+") \n";
	parameters.message +="Maintenance fees paid: "+mft+" cr ("+mfc+") \n";
	parameters.message +="Dismantling fees paid: "+dft+" cr \n\n";
	
	parameters.message += "Our pods are re-used many times per cycle, often many times per day. Maintaining them in clean and serviceable condition for their maximum useful lifetime is our prime concern at FE Shipyards, and we trust that you, our valued customer, understand the need for your own participation in this costly and ongoing process. \n\n";
	
	parameters.message += "The handling charge (0.005 of cost) is levied upon docking, the maintenance fee (0.05 of cost) every "+mfi+" system-to-system trading runs. \n\n"
	
	parameters.message += "If you cancel your Pod account with us at any time, we must charge the dismantling fee (0.1 of cost) to re-modify and restore your vessel's pylon for weapons-use. \n";
	
	parameters.choicesKey = "cp1Acknowlege";
	
	mission.runScreen(parameters, callback);	

	function callback(choice) {
		if (choice === "1_YES")  player.commsMessage("FE Shipyards thanks you for your custom.");
	}
}



// create F.E.S. handling fee waiver/restoration request  
this._cp1PrepEx = function(station) {
	station.setInterface("cp1Ex",{
	title: "Your FE Shipyards Pod Handling Fee Waiver Request",
	category: "Your FE Shipyards",
	summary: "FE Shipyards grants Guilders and FE shipowners the privileged option to waive our handling and dismantling fees for the 10-ton pod class." ,
	callback: this._cp1ShowEx.bind(this)
	});	
}


// show F.E.S. handling & dismantling fee waiver/restoration request
this._cp1ShowEx = function() {
	var priv = ((this.$cp1ET)||(this.$cp1FES));
	var privo = "";
	if (this.$cp1FES) privo="FE shipowner";
	if (this.$cp1ET) privo="Guilder";
	
	var parameters = new Object();
	
	parameters.title = "FE Shipyards";
	
	parameters.message = "Dear customer, \n\n";
	
	parameters.message += "Re: your request to waive your 10 TC pod fees.\n\n"
	
	parameters.message += "The handling fee (0.005 of cost) is taken from your account upon docking, and is merely to cover our attachment/detachment & loading/unloading services. The dismantling fee (0.1 of cost) is charged when re-modifying your pylons for weapons-use after Licence cancellation. \n\n";
	
	if (priv)
		parameters.message += "FE Shipyards grants you, as a "+privo+", the privileged option to waive our handling and dismantling fees, although you are free - and encouraged - to continue supporting our efforts to provide the efficient service you as an Elite Trader deserve. \n\n";
	else
		parameters.message += "FE Shipyards regrets that we are unable at this time to grant you an exemption from fees, which is a privilege of Guilders and FE shipowners exclusively. \n\n";
	
	parameters.message += "Yours attentively,\n\n";
	
	parameters.message += "Siri Chodrum, for Dor Reval (Technical Director)\n";
	

	parameters.choicesKey = "cp1YesNoEx";
	
	mission.runScreen(parameters, callback);	

	function callback(choice) {
		if (choice === "1_AYE")  {
			if (priv) this.$cp1HFExempt = "yes"; else this.$cp1HFExempt = "no";
		} else this.$cp1HFExempt = "no";
		player.commsMessage("FE Shipyards thanks you for your attention.");
	}	
}
Scripts/cp2_conditions.js
// conditions for award of 20 TC Cargo Pod
"use strict";
this.name = "CP20 Conditions";
this.author = "Reval";
this.licence = "CC BY-NC-SA 4.0";
this.version = "1.0";

this.allowAwardEquipment = function(equipment, ship, context) {
	var pc = player.consoleMessage;
	if (equipment == "EQ_20TC_POD") {
		// fittable only if auxiliary pylon is installed
		if (player.ship.equipmentStatus ("EQ_AUX_PYLON") === "EQUIPMENT_OK") {
			// and not displayed if any pod is already fitted
			if ((player.ship.equipmentStatus ("EQ_10TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_20TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_30TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_40TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_50TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_60TC_POD") !== "EQUIPMENT_OK"))
				return true; else return false;
		} else return false;
	}	
	// pod removal conditions
	if (equipment == "EQ_20TC_POD_REM") 
		if (player.ship.equipmentStatus ("EQ_20TC_POD") === "EQUIPMENT_OK")
			return true; else return false;
	
	return true;
}
Scripts/cp2_script.js
"use strict";
this.name = "Cargo Pod 20 TC";
this.author = "Reval";
this.licence = "CC BY-NC-SA 4.0";
this.version = "1.1";


this.playerBoughtEquipment = function(equipment, paid) {
	var pc = player.consoleMessage;
	if (equipment == "EQ_20TC_POD") {		
		pc("Attaching one 20 TC Pod to auxiliary pylon.",9);
		player.ship.cargoSpaceCapacity += 20;
		pc("Ship's total capacity = "+player.ship.cargoSpaceCapacity+" TC.",9);
		// always 1 because only one pod can be fitted
		this.$cp2Pods=1;
	} else
	// pod removal and refund
	if (equipment == "EQ_20TC_POD_REM") {
		player.ship.removeEquipment("EQ_20TC_POD");
		player.ship.removeEquipment("EQ_20TC_POD_REM");
		pc("Detaching 20 TC Pod from auxiliary pylon.",9);
		player.ship.cargoSpaceCapacity -= 20;
		pc("Ship's total capacity = "+player.ship.cargoSpaceCapacity+" TC.",9);
		this.$cp2Pods=0;
		player.credits += this.$cp2Cost;
		pc("Amount refunded: "+ this.$cp2Cost,9);
	}
}


this.startUpComplete = function () {
	var pc = player.consoleMessage;
	if (missionVariables.cp2Pods != null) 
		this.$cp2Pods = missionVariables.cp2Pods;
	// Load total fees taken
	if (missionVariables.cp2HandlingFeeTotal != null)
		this.$cp2HandlingFeeTotal = missionVariables.cp2HandlingFeeTotal;
	if (missionVariables.cp2HandlingPaid != null)
		this.$cp2HandlingPaid = missionVariables.cp2HandlingPaid;
	if (missionVariables.cp2MaintenanceFeeTotal != null)
		this.$cp2MaintenanceFeeTotal = missionVariables.cp2MaintenanceFeeTotal;
	if (missionVariables.cp2DismantlingFeeTotal != null)
		this.$cp2DismantlingFeeTotal = missionVariables.cp2DismantlingFeeTotal; 
    // Load system-to-system runs w/pod
	if (missionVariables.cp2Runs != null)
		this.$cp2Runs = missionVariables.cp2Runs;
	// Load Handling fee count
	if (missionVariables.cp2HandlingCount != null)
		this.$cp2HandlingCount = missionVariables.cp2HandlingCount;
	// Load handling fee exemption status
	if (missionVariables.cp2HFExempt != null)
		this.$cp2HFExempt = missionVariables.cp2HFExempt;
	// Load Maintenance fee count
	if (missionVariables.cp2MaintenanceCount != null)
		this.$cp2MaintenanceCount = missionVariables.cp2MaintenanceCount;
	// CHECK
	log(this.name, this.name+" startup complete.");
	// prepare pod Account screen
	var sta = player.ship.dockedStation;
	if (this.$cp2Pods>0) this._cp2PrepAcc(sta);
	// optionally, prepare handling fee waiver request
	if (this.$cp2Pods>0) this._cp2PrepEx(sta);
}


this.startUp = function() {
    log(this.name, "Initialising OXP " + this.name);
	// check for G.E.T. presence
	this.$cp2ET = false;
	if (worldScripts["Elite Trader"]) 
		this.$cp2ET = true;
	// TEST	
	if (this.$cp2ET) log(this.name, "Finds Elite Trader present");
	// check for FE Ships Player
	this.$cp2FES = false;
	if (worldScripts["FE Ships Player"]) 
		this.$cp2FES = true;
	// TEST	
	if (this.$cp2ET) log(this.name, "Finds FE Ships Player present");
	// number of pods - when fitted, always 1
	this.$cp2Pods = 0;
	// purchase cost of pod in cr
	this.$cp2Cost = 20000;
	// handling fee
	this.$cp2HandlingFee = 0.005*this.$cp2Cost; // 0.005 of cost
	this.$cp2HandlingFeeTotal = 0;
	this.$cp2HandlingPaid = "yes"; // or "no" - easier than boolean
	this.$cp2HandlingCount = 0;
	this.$cp2HFExempt = "no";
	// maintenance fee
	this.$cp2MaintenanceFee = 0.05*this.$cp2Cost; // 0.05 of cost
	this.$cp2MaintenanceFeeTotal = 0;
	this.$cp2MaintenancePaid = "no" // or "yes"
	this.$cp2MaintenanceInterval = 20; // in runs (according to cost)
	this.$cp2MaintenanceCount = 0;
	// dismantling fee
	this.$cp2DismantlingFee = 0.1*this.$cp2Cost; // 0.1 of cost
	this.$cp2DismantlingFeeTotal = 0.0;
	// system-to-system runs w/pod
	this.$cp2Runs = 0;
}


this.playerWillSaveGame = function(message) {
	missionVariables.cp2Pods = this.$cp2Pods;
	// save total fees taken
	missionVariables.cp2HandlingFeeTotal = this.$cp2HandlingFeeTotal;
	missionVariables.cp2MaintenanceFeeTotal = this.$cp2MaintenanceFeeTotal;
	missionVariables.cp2DismantlingFeeTotal = this.$cp2DismantlingFeeTotal;
	missionVariables.cp2HandlingPaid = this.$cp2HandlingPaid;
	// system-to-system runs w/pod
	missionVariables.cp2Runs =this.$cp2Runs;
	// handling fee count
	missionVariables.cp2HandlingCount = this.$cp2HandlingCount;
	// handling fee exemption (G.E.T.)
	missionVariables.cp2HFExempt = this.$cp2HFExempt;
	// maintenance fee count
	missionVariables.cp2MaintenanceCount = this.$cp2MaintenanceCount;
}


this.shipDockedWithStation = function(station) {
	// take handling fee (if not exempt)
	var pc = player.consoleMessage;
	var ex = this.$cp2HFExempt;
	// check we have pods, the fee is not paid, and we're not exempt
	if ((this.$cp2Pods>0) && (this.$cp2HandlingPaid==="no") && (ex==="no")) {
		var fee = 0;
		for (var x=1; x<= this.$cp2Pods; x++)
			fee += this.$cp2HandlingFee;
		// record fee and debit trader's account
		this.$cp2HandlingFeeTotal += fee;
		player.credits -= fee;
		this.$cp2HandlingPaid = "yes";
		pc("20 TC Pod handling fees: "+fee+" cr",9);
		this.$cp2HandlingCount++;
	}

	// conditionally take maintenance fee
	if (this.$cp2Pods>0) this._cp2DoMaintenance();
	
	// prepare pod Account and Licence page
	if (this.$cp2Pods>0) this._cp2PrepAcc(station);
	
	// prepare handling fee waiver request if ET or FESP is present
	if (this.$cp2Pods>0) this._cp2PrepEx(station);
}



this.shipExitedWitchspace = function() {
	// set handling paid to 'no'
	this.$cp2HandlingPaid = "no";
	this.$cp2Runs ++;
}


/* Common helper functions */


// assess and take maintenance fee
this._cp2DoMaintenance = function() {
	var pc = player.consoleMessage;
	var runs = this.$cp2Runs;
	var intv = this.$cp2MaintenanceInterval;
	var mfee = this.$cp2MaintenanceFee;
	// take maintenance fee after y runs
	if ( (runs > 0) && ((runs % intv)==0) ) {
		// maintenance for x pods
		var fee = 0;
		for (var x=1; x<= this.$cp2Pods; x++)
			fee += mfee;
		// maintenance fee tally & debit
		this.$cp2MaintenanceFeeTotal += fee;
		player.credits -= fee;
		pc("20 TC Pod Maintenance fees: "+fee+" cr",9);
		// update Maintenance count
		this.$cp2MaintenanceCount++;
	}
}


/* F4 Interfaces */


// create F.E.S. 'Licence & Account' page 
this._cp2PrepAcc = function(station) {
	station.setInterface("cp2Acc",{
	title: "Your FE Shipyards 20 TC Pod Class Licence",
	category: "Your FE Shipyards",
	summary: "Your FE Shipyards 20 TC Pod account screen shows terms, fees paid, load, and other useful information.",
	callback: this._cp2ShowAcc.bind(this)
	});	
}


// show F.E.S. 'Licence & Account' page
this._cp2ShowAcc = function() {
	var hfc = this.$cp2HandlingCount;
	var mfc = this.$cp2MaintenanceCount;
	var mfi = this.$cp2MaintenanceInterval;
	var hft = this.$cp2HandlingFeeTotal;
	var mft = this.$cp2MaintenanceFeeTotal;
	var dft = this.$cp2DismantlingFeeTotal;
		
	var parameters = new Object();
	
	parameters.title = "FE Shipyards";
	
	parameters.message = "Dear customer, \n\n";
	
	if (this.$cp2Pods>0) 
		parameters.message +="Your Account and Licence for 20 TC Class Goods Pods x "+this.$cp2Pods+": \n\n"; 
	 else
		parameters.message +="You have no 20 TC Class Pods licensed with us at this time. \n\n";
	
	parameters.message +="Handling fees paid: "+hft+" cr ("+hfc+") \n";
	parameters.message +="Maintenance fees paid: "+mft+" cr ("+mfc+") \n";
	parameters.message +="Dismantling fees paid: "+dft+" cr \n\n";
	
	parameters.message += "Our pods are re-used many times per cycle, often many times per day. Maintaining them in clean and serviceable condition for their maximum useful lifetime is our prime concern at FE Shipyards, and we trust that you, our valued customer, understand the need for your own participation in this costly and ongoing process. \n\n";
	
	parameters.message += "The handling charge (0.005 of cost) is levied upon docking, the maintenance fee (0.05 of cost) every "+mfi+" system-to-system trading runs. \n\n"
	
	parameters.message += "If you cancel your Pod account with us at any time, we must charge the dismantling fee (0.1 of cost) to re-modify and restore your vessel's pylon for weapons-use. \n";
	
	parameters.choicesKey = "cp2Acknowlege";
	
	mission.runScreen(parameters, callback);	

	function callback(choice) {
		if (choice === "1_YES")  player.commsMessage("FE Shipyards thanks you for your custom.");
	}
}



// create F.E.S. handling fee waiver/restoration request  
this._cp2PrepEx = function(station) {
	station.setInterface("cp2Ex",{
	title: "Your FE Shipyards Pod Handling Fee Waiver Request",
	category: "Your FE Shipyards",
	summary: "FE Shipyards grants Guilders and FE shipowners the privileged option to waive our handling and dismantling fees for the 20-ton pod class." ,
	callback: this._cp2ShowEx.bind(this)
	});	
}


// show F.E.S. handling & dismantling fee waiver/restoration request
this._cp2ShowEx = function() {
	var priv = ((this.$cp2ET)||(this.$cp2FES));
	var privo = "";
	if (this.$cp2FES) privo="FE shipowner";
	if (this.$cp2ET) privo="Guilder";
	
	var parameters = new Object();
	
	parameters.title = "FE Shipyards";
	
	parameters.message = "Dear customer, \n\n";
	
	parameters.message += "Re: your request to waive your 20 TC pod fees.\n\n"
	
	parameters.message += "The handling fee (0.005 of cost) is taken from your account upon docking, and is merely to cover our attachment/detachment & loading/unloading services. The dismantling fee (0.1 of cost) is charged when re-modifying your pylons for weapons-use after Licence cancellation. \n\n";
	
	if (priv)
		parameters.message += "FE Shipyards grants you, as a "+privo+", the privileged option to waive our handling and dismantling fees, although you are free - and encouraged - to continue supporting our efforts to provide the efficient service you as an Elite Trader deserve. \n\n";
	else
		parameters.message += "FE Shipyards regrets that we are unable at this time to grant you an exemption from fees, which is a privilege of Guilders and FE shipowners exclusively. \n\n";
	
	parameters.message += "Yours attentively,\n\n";
	
	parameters.message += "Siri Chodrum, for Dor Reval (Technical Director)\n";
	

	parameters.choicesKey = "cp2YesNoEx";
	
	mission.runScreen(parameters, callback);	

	function callback(choice) {
		if (choice === "1_AYE")  {
			if (priv) this.$cp2HFExempt = "yes"; else this.$cp2HFExempt = "no";
		} else this.$cp2HFExempt = "no";
		player.commsMessage("FE Shipyards thanks you for your attention.");
	}	
}
Scripts/cp3_conditions.js
// conditions for award of 30 TC Cargo Pod
"use strict";
this.name = "CP30 Conditions";
this.author = "Reval";
this.licence = "CC BY-NC-SA 4.0";
this.version = "1.0";

this.allowAwardEquipment = function(equipment, ship, context) {
	var pc = player.consoleMessage;
	if (equipment == "EQ_30TC_POD") {
		// fittable only if auxiliary pylon is installed
		if (player.ship.equipmentStatus ("EQ_AUX_PYLON") === "EQUIPMENT_OK") {
			// and not displayed if any pod is already fitted
			if ((player.ship.equipmentStatus ("EQ_10TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_20TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_30TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_40TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_50TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_60TC_POD") !== "EQUIPMENT_OK"))
				return true; else return false;
		} else return false;
	}	
	// pod removal conditions
	if (equipment == "EQ_30TC_POD_REM") 
		if (player.ship.equipmentStatus ("EQ_30TC_POD") === "EQUIPMENT_OK")
			return true; else return false;
	
	return true;
}
Scripts/cp3_script.js
"use strict";
this.name = "Cargo Pod 30 TC";
this.author = "Reval";
this.licence = "CC BY-NC-SA 4.0";
this.version = "1.1";


this.playerBoughtEquipment = function(equipment, paid) {
	var pc = player.consoleMessage;
	if (equipment == "EQ_30TC_POD") {		
		pc("Attaching one 30 TC Pod to auxiliary pylon.",9);
		player.ship.cargoSpaceCapacity += 30;
		pc("Ship's total capacity = "+player.ship.cargoSpaceCapacity+" TC.",9);
		// always 1 because only one pod can be fitted
		this.$cp3Pods=1;
	} else
	// pod removal and refund
	if (equipment == "EQ_30TC_POD_REM") {
		player.ship.removeEquipment("EQ_30TC_POD");
		player.ship.removeEquipment("EQ_30TC_POD_REM");
		pc("Detaching 30 TC Pod from auxiliary pylon.",9);
		player.ship.cargoSpaceCapacity -= 30;
		pc("Ship's total capacity = "+player.ship.cargoSpaceCapacity+" TC.",9);
		this.$cp3Pods=0;
		player.credits += this.$cp3Cost;
		pc("Amount refunded: "+ this.$cp3Cost,9);
	}
}


this.startUpComplete = function () {
	var pc = player.consoleMessage;
	if (missionVariables.cp3Pods != null) 
		this.$cp3Pods = missionVariables.cp3Pods;
	// Load total fees taken
	if (missionVariables.cp3HandlingFeeTotal != null)
		this.$cp3HandlingFeeTotal = missionVariables.cp3HandlingFeeTotal;
	if (missionVariables.cp3HandlingPaid != null)
		this.$cp3HandlingPaid = missionVariables.cp3HandlingPaid;
	if (missionVariables.cp3MaintenanceFeeTotal != null)
		this.$cp3MaintenanceFeeTotal = missionVariables.cp3MaintenanceFeeTotal;
	if (missionVariables.cp3DismantlingFeeTotal != null)
		this.$cp3DismantlingFeeTotal = missionVariables.cp3DismantlingFeeTotal; 
    // Load system-to-system runs w/pod
	if (missionVariables.cp3Runs != null)
		this.$cp3Runs = missionVariables.cp3Runs;
	// Load Handling fee count
	if (missionVariables.cp3HandlingCount != null)
		this.$cp3HandlingCount = missionVariables.cp3HandlingCount;
	// Load handling fee exemption status
	if (missionVariables.cp3HFExempt != null)
		this.$cp3HFExempt = missionVariables.cp3HFExempt;
	// Load Maintenance fee count
	if (missionVariables.cp3MaintenanceCount != null)
		this.$cp3MaintenanceCount = missionVariables.cp3MaintenanceCount;
	// CHECK
	log(this.name, this.name+" startup complete.");
	// prepare pod Account screen
	var sta = player.ship.dockedStation;
	if (this.$cp3Pods>0) this._cp3PrepAcc(sta);
	// optionally, prepare handling fee waiver request
	if (this.$cp3Pods>0) this._cp3PrepEx(sta);
}


this.startUp = function() {
    log(this.name, "Initialising OXP " + this.name);
	// check for G.E.T. presence
	this.$cp3ET = false;
	if (worldScripts["Elite Trader"]) 
		this.$cp3ET = true;
	// TEST	
	if (this.$cp3ET) log(this.name, "Finds Elite Trader present");
	// check for FE Ships Player
	this.$cp3FES = false;
	if (worldScripts["FE Ships Player"]) 
		this.$cp3FES = true;
	// TEST	
	if (this.$cp3ET) log(this.name, "Finds FE Ships Player present");
	// number of pods - when fitted, always 1
	this.$cp3Pods = 0;
	// purchase cost of pod in cr
	this.$cp3Cost = 30000;
	// handling fee
	this.$cp3HandlingFee = 0.005*this.$cp3Cost; // 0.005 of cost
	this.$cp3HandlingFeeTotal = 0;
	this.$cp3HandlingPaid = "yes"; // or "no" - easier than boolean
	this.$cp3HandlingCount = 0;
	this.$cp3HFExempt = "no";
	// maintenance fee
	this.$cp3MaintenanceFee = 0.05*this.$cp3Cost; // 0.05 of cost
	this.$cp3MaintenanceFeeTotal = 0;
	this.$cp3MaintenancePaid = "no" // or "yes"
	this.$cp3MaintenanceInterval = 30; // in runs (according to cost)
	this.$cp3MaintenanceCount = 0;
	// dismantling fee
	this.$cp3DismantlingFee = 0.1*this.$cp3Cost; // 0.1 of cost
	this.$cp3DismantlingFeeTotal = 0.0;
	// system-to-system runs w/pod
	this.$cp3Runs = 0;
}


this.playerWillSaveGame = function(message) {
	missionVariables.cp3Pods = this.$cp3Pods;
	// save total fees taken
	missionVariables.cp3HandlingFeeTotal = this.$cp3HandlingFeeTotal;
	missionVariables.cp3MaintenanceFeeTotal = this.$cp3MaintenanceFeeTotal;
	missionVariables.cp3DismantlingFeeTotal = this.$cp3DismantlingFeeTotal;
	missionVariables.cp3HandlingPaid = this.$cp3HandlingPaid;
	// system-to-system runs w/pod
	missionVariables.cp3Runs =this.$cp3Runs;
	// handling fee count
	missionVariables.cp3HandlingCount = this.$cp3HandlingCount;
	// handling fee exemption (G.E.T.)
	missionVariables.cp3HFExempt = this.$cp3HFExempt;
	// maintenance fee count
	missionVariables.cp3MaintenanceCount = this.$cp3MaintenanceCount;
}


this.shipDockedWithStation = function(station) {
	// take handling fee (if not exempt)
	var pc = player.consoleMessage;
	var ex = this.$cp3HFExempt;
	// check we have pods, the fee is not paid, and we're not exempt
	if ((this.$cp3Pods>0) && (this.$cp3HandlingPaid==="no") && (ex==="no")) {
		var fee = 0;
		for (var x=1; x<= this.$cp3Pods; x++)
			fee += this.$cp3HandlingFee;
		// record fee and debit trader's account
		this.$cp3HandlingFeeTotal += fee;
		player.credits -= fee;
		this.$cp3HandlingPaid = "yes";
		pc("30 TC Pod handling fees: "+fee+" cr",9);
		this.$cp3HandlingCount++;
	}

	// conditionally take maintenance fee
	if (this.$cp3Pods>0) this._cp3DoMaintenance();
	
	// prepare pod Account and Licence page
	if (this.$cp3Pods>0) this._cp3PrepAcc(station);
	
	// prepare handling fee waiver request if ET or FESP is present
	if (this.$cp3Pods>0) this._cp3PrepEx(station);
}



this.shipExitedWitchspace = function() {
	// set handling paid to 'no'
	this.$cp3HandlingPaid = "no";
	this.$cp3Runs ++;
}


/* Common helper functions */


// assess and take maintenance fee
this._cp3DoMaintenance = function() {
	var pc = player.consoleMessage;
	var runs = this.$cp3Runs;
	var intv = this.$cp3MaintenanceInterval;
	var mfee = this.$cp3MaintenanceFee;
	// take maintenance fee after y runs
	if ( (runs > 0) && ((runs % intv)==0) ) {
		// maintenance for x pods
		var fee = 0;
		for (var x=1; x<= this.$cp3Pods; x++)
			fee += mfee;
		// maintenance fee tally & debit
		this.$cp3MaintenanceFeeTotal += fee;
		player.credits -= fee;
		pc("30 TC Pod Maintenance fees: "+fee+" cr",9);
		// update Maintenance count
		this.$cp3MaintenanceCount++;
	}
}


/* F4 Interfaces */


// create F.E.S. 'Licence & Account' page 
this._cp3PrepAcc = function(station) {
	station.setInterface("cp3Acc",{
	title: "Your FE Shipyards 30 TC Pod Class Licence",
	category: "Your FE Shipyards",
	summary: "Your FE Shipyards 30 TC Pod account screen shows terms, fees paid, load, and other useful information.",
	callback: this._cp3ShowAcc.bind(this)
	});	
}


// show F.E.S. 'Licence & Account' page
this._cp3ShowAcc = function() {
	var hfc = this.$cp3HandlingCount;
	var mfc = this.$cp3MaintenanceCount;
	var mfi = this.$cp3MaintenanceInterval;
	var hft = this.$cp3HandlingFeeTotal;
	var mft = this.$cp3MaintenanceFeeTotal;
	var dft = this.$cp3DismantlingFeeTotal;
		
	var parameters = new Object();
	
	parameters.title = "FE Shipyards";
	
	parameters.message = "Dear customer, \n\n";
	
	if (this.$cp3Pods>0) 
		parameters.message +="Your Account and Licence for 30 TC Class Goods Pods x "+this.$cp3Pods+": \n\n"; 
	 else
		parameters.message +="You have no 30 TC Class Pods licensed with us at this time. \n\n";
	
	parameters.message +="Handling fees paid: "+hft+" cr ("+hfc+") \n";
	parameters.message +="Maintenance fees paid: "+mft+" cr ("+mfc+") \n";
	parameters.message +="Dismantling fees paid: "+dft+" cr \n\n";
	
	parameters.message += "Our pods are re-used many times per cycle, often many times per day. Maintaining them in clean and serviceable condition for their maximum useful lifetime is our prime concern at FE Shipyards, and we trust that you, our valued customer, understand the need for your own participation in this costly and ongoing process. \n\n";
	
	parameters.message += "The handling charge (0.005 of cost) is levied upon docking, the maintenance fee (0.05 of cost) every "+mfi+" system-to-system trading runs. \n\n"
	
	parameters.message += "If you cancel your Pod account with us at any time, we must charge the dismantling fee (0.1 of cost) to re-modify and restore your vessel's pylon for weapons-use. \n";
	
	parameters.choicesKey = "cp3Acknowlege";
	
	mission.runScreen(parameters, callback);	

	function callback(choice) {
		if (choice === "1_YES")  player.commsMessage("FE Shipyards thanks you for your custom.");
	}
}



// create F.E.S. handling fee waiver/restoration request  
this._cp3PrepEx = function(station) {
	station.setInterface("cp3Ex",{
	title: "Your FE Shipyards Pod Handling Fee Waiver Request",
	category: "Your FE Shipyards",
	summary: "FE Shipyards grants Guilders and FE shipowners the privileged option to waive our handling and dismantling fees for the 30-ton pod class." ,
	callback: this._cp3ShowEx.bind(this)
	});	
}


// show F.E.S. handling & dismantling fee waiver/restoration request
this._cp3ShowEx = function() {
	var priv = ((this.$cp3ET)||(this.$cp3FES));
	var privo = "";
	if (this.$cp3FES) privo="FE shipowner";
	if (this.$cp3ET) privo="Guilder";
	
	var parameters = new Object();
	
	parameters.title = "FE Shipyards";
	
	parameters.message = "Dear customer, \n\n";
	
	parameters.message += "Re: your request to waive your 30 TC pod fees.\n\n"
	
	parameters.message += "The handling fee (0.005 of cost) is taken from your account upon docking, and is merely to cover our attachment/detachment & loading/unloading services. The dismantling fee (0.1 of cost) is charged when re-modifying your pylons for weapons-use after Licence cancellation. \n\n";
	
	if (priv)
		parameters.message += "FE Shipyards grants you, as a "+privo+", the privileged option to waive our handling and dismantling fees, although you are free - and encouraged - to continue supporting our efforts to provide the efficient service you as an Elite Trader deserve. \n\n";
	else
		parameters.message += "FE Shipyards regrets that we are unable at this time to grant you an exemption from fees, which is a privilege of Guilders and FE shipowners exclusively. \n\n";
	
	parameters.message += "Yours attentively,\n\n";
	
	parameters.message += "Siri Chodrum, for Dor Reval (Technical Director)\n";
	

	parameters.choicesKey = "cp3YesNoEx";
	
	mission.runScreen(parameters, callback);	

	function callback(choice) {
		if (choice === "1_AYE")  {
			if (priv) this.$cp3HFExempt = "yes"; else this.$cp3HFExempt = "no";
		} else this.$cp3HFExempt = "no";
		player.commsMessage("FE Shipyards thanks you for your attention.");
	}	
}
Scripts/cp4_conditions.js
// conditions for award of 40 TC Cargo Pod
"use strict";
this.name = "CP40 Conditions";
this.author = "Reval";
this.licence = "CC BY-NC-SA 4.0";
this.version = "1.0";

this.allowAwardEquipment = function(equipment, ship, context) {
	var pc = player.consoleMessage;
	if (equipment == "EQ_40TC_POD") {
		// fittable only if auxiliary pylon is installed
		if (player.ship.equipmentStatus ("EQ_AUX_PYLON") === "EQUIPMENT_OK") {
			// and not displayed if any pod is already fitted
			if ((player.ship.equipmentStatus ("EQ_10TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_20TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_30TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_40TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_50TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_60TC_POD") !== "EQUIPMENT_OK"))
				return true; else return false;
		} else return false;
	}	
	// pod removal conditions
	if (equipment == "EQ_40TC_POD_REM") 
		if (player.ship.equipmentStatus ("EQ_40TC_POD") === "EQUIPMENT_OK")
			return true; else return false;
	
	return true;
}
Scripts/cp4_script.js
"use strict";
this.name = "Cargo Pod 40 TC";
this.author = "Reval";
this.licence = "CC BY-NC-SA 4.0";
this.version = "1.1";


this.playerBoughtEquipment = function(equipment, paid) {
	var pc = player.consoleMessage;
	if (equipment == "EQ_40TC_POD") {		
		pc("Attaching one 40 TC Pod to auxiliary pylon.",9);
		player.ship.cargoSpaceCapacity += 40;
		pc("Ship's total capacity = "+player.ship.cargoSpaceCapacity+" TC.",9);
		// always 1 because only one pod can be fitted
		this.$cp4Pods=1;
	} else
	// pod removal and refund
	if (equipment == "EQ_40TC_POD_REM") {
		player.ship.removeEquipment("EQ_40TC_POD");
		player.ship.removeEquipment("EQ_40TC_POD_REM");
		pc("Detaching 40 TC Pod from auxiliary pylon.",9);
		player.ship.cargoSpaceCapacity -= 40;
		pc("Ship's total capacity = "+player.ship.cargoSpaceCapacity+" TC.",9);
		this.$cp4Pods=0;
		player.credits += this.$cp4Cost;
		pc("Amount refunded: "+ this.$cp4Cost,9);
	}
}



this.startUpComplete = function () {
	var pc = player.consoleMessage;
	if (missionVariables.cp4Pods != null) 
		this.$cp4Pods = missionVariables.cp4Pods;
	// Load total fees taken
	if (missionVariables.cp4HandlingFeeTotal != null)
		this.$cp4HandlingFeeTotal = missionVariables.cp4HandlingFeeTotal;
	if (missionVariables.cp4HandlingPaid != null)
		this.$cp4HandlingPaid = missionVariables.cp4HandlingPaid;
	if (missionVariables.cp4MaintenanceFeeTotal != null)
		this.$cp4MaintenanceFeeTotal = missionVariables.cp4MaintenanceFeeTotal;
	if (missionVariables.cp4DismantlingFeeTotal != null)
		this.$cp4DismantlingFeeTotal = missionVariables.cp4DismantlingFeeTotal; 
    // Load system-to-system runs w/pod
	if (missionVariables.cp4Runs != null)
		this.$cp4Runs = missionVariables.cp4Runs;
	// Load Handling fee count
	if (missionVariables.cp4HandlingCount != null)
		this.$cp4HandlingCount = missionVariables.cp4HandlingCount;
	// Load handling fee exemption status
	if (missionVariables.cp4HFExempt != null)
		this.$cp4HFExempt = missionVariables.cp4HFExempt;
	// Load Maintenance fee count
	if (missionVariables.cp4MaintenanceCount != null)
		this.$cp4MaintenanceCount = missionVariables.cp4MaintenanceCount;
	// CHECK
	log(this.name, this.name+" startup complete.");
	// prepare pod Account screen
	var sta = player.ship.dockedStation;
	if (this.$cp4Pods>0) this._cp4PrepAcc(sta);
	// optionally, prepare handling fee waiver request
	if (this.$cp4Pods>0) this._cp4PrepEx(sta);
}


this.startUp = function() {
    log(this.name, "Initialising OXP " + this.name);
	// check for G.E.T. presence
	this.$cp4ET = false;
	if (worldScripts["Elite Trader"]) 
		this.$cp4ET = true;
	// TEST	
	if (this.$cp4ET) log(this.name, "Finds Elite Trader present");
	// check for FE Ships Player
	this.$cp4FES = false;
	if (worldScripts["FE Ships Player"]) 
		this.$cp4FES = true;
	// TEST	
	if (this.$cp4ET) log(this.name, "Finds FE Ships Player present");
	// number of pods - when fitted, always 1
	this.$cp4Pods = 0;
	// purchase cost of pod in cr
	this.$cp4Cost = 40000;
	// handling fee
	this.$cp4HandlingFee = 0.005*this.$cp4Cost; // 0.005 of cost
	this.$cp4HandlingFeeTotal = 0;
	this.$cp4HandlingPaid = "yes"; // or "no" - easier than boolean
	this.$cp4HandlingCount = 0;
	this.$cp4HFExempt = "no";
	// maintenance fee
	this.$cp4MaintenanceFee = 0.05*this.$cp4Cost; // 0.05 of cost
	this.$cp4MaintenanceFeeTotal = 0;
	this.$cp4MaintenancePaid = "no" // or "yes"
	this.$cp4MaintenanceInterval = 40; // in runs (according to cost)
	this.$cp4MaintenanceCount = 0;
	// dismantling fee
	this.$cp4DismantlingFee = 0.1*this.$cp4Cost; // 0.1 of cost
	this.$cp4DismantlingFeeTotal = 0.0;
	// system-to-system runs w/pod
	this.$cp4Runs = 0;
}


this.playerWillSaveGame = function(message) {
	missionVariables.cp4Pods = this.$cp4Pods;
	// save total fees taken
	missionVariables.cp4HandlingFeeTotal = this.$cp4HandlingFeeTotal;
	missionVariables.cp4MaintenanceFeeTotal = this.$cp4MaintenanceFeeTotal;
	missionVariables.cp4DismantlingFeeTotal = this.$cp4DismantlingFeeTotal;
	missionVariables.cp4HandlingPaid = this.$cp4HandlingPaid;
	// system-to-system runs w/pod
	missionVariables.cp4Runs =this.$cp4Runs;
	// handling fee count
	missionVariables.cp4HandlingCount = this.$cp4HandlingCount;
	// handling fee exemption (G.E.T.)
	missionVariables.cp4HFExempt = this.$cp4HFExempt;
	// maintenance fee count
	missionVariables.cp4MaintenanceCount = this.$cp4MaintenanceCount;
}


this.shipDockedWithStation = function(station) {
	// take handling fee (if not exempt)
	var pc = player.consoleMessage;
	var ex = this.$cp4HFExempt;
	// check we have pods, the fee is not paid, and we're not exempt
	if ((this.$cp4Pods>0) && (this.$cp4HandlingPaid==="no") && (ex==="no")) {
		var fee = 0;
		for (var x=1; x<= this.$cp4Pods; x++)
			fee += this.$cp4HandlingFee;
		// record fee and debit trader's account
		this.$cp4HandlingFeeTotal += fee;
		player.credits -= fee;
		this.$cp4HandlingPaid = "yes";
		pc("40 TC Pod handling fees: "+fee+" cr",9);
		this.$cp4HandlingCount++;
	}

	// conditionally take maintenance fee
	if (this.$cp4Pods>0) this._cp4DoMaintenance();
	
	// prepare pod Account and Licence page
	if (this.$cp4Pods>0) this._cp4PrepAcc(station);
	
	// prepare handling fee waiver request if ET or FESP is present
	if (this.$cp4Pods>0) this._cp4PrepEx(station);
}



this.shipExitedWitchspace = function() {
	// set handling paid to 'no'
	this.$cp4HandlingPaid = "no";
	this.$cp4Runs ++;
}


/* Common helper functions */


// assess and take maintenance fee
this._cp4DoMaintenance = function() {
	var pc = player.consoleMessage;
	var runs = this.$cp4Runs;
	var intv = this.$cp4MaintenanceInterval;
	var mfee = this.$cp4MaintenanceFee;
	// take maintenance fee after y runs
	if ( (runs > 0) && ((runs % intv)==0) ) {
		// maintenance for x pods
		var fee = 0;
		for (var x=1; x<= this.$cp4Pods; x++)
			fee += mfee;
		// maintenance fee tally & debit
		this.$cp4MaintenanceFeeTotal += fee;
		player.credits -= fee;
		pc("40 TC Pod Maintenance fees: "+fee+" cr",9);
		// update Maintenance count
		this.$cp4MaintenanceCount++;
	}
}


/* F4 Interfaces */


// create F.E.S. 'Licence & Account' page 
this._cp4PrepAcc = function(station) {
	station.setInterface("cp4Acc",{
	title: "Your FE Shipyards 40 TC Pod Class Licence",
	category: "Your FE Shipyards",
	summary: "Your FE Shipyards 40 TC Pod account screen shows terms, fees paid, load, and other useful information.",
	callback: this._cp4ShowAcc.bind(this)
	});	
}


// show F.E.S. 'Licence & Account' page
this._cp4ShowAcc = function() {
	var hfc = this.$cp4HandlingCount;
	var mfc = this.$cp4MaintenanceCount;
	var mfi = this.$cp4MaintenanceInterval;
	var hft = this.$cp4HandlingFeeTotal;
	var mft = this.$cp4MaintenanceFeeTotal;
	var dft = this.$cp4DismantlingFeeTotal;
		
	var parameters = new Object();
	
	parameters.title = "FE Shipyards";
	
	parameters.message = "Dear customer, \n\n";
	
	if (this.$cp4Pods>0) 
		parameters.message +="Your Account and Licence for 40 TC Class Goods Pods x "+this.$cp4Pods+": \n\n"; 
	 else
		parameters.message +="You have no 40 TC Class Pods licensed with us at this time. \n\n";
	
	parameters.message +="Handling fees paid: "+hft+" cr ("+hfc+") \n";
	parameters.message +="Maintenance fees paid: "+mft+" cr ("+mfc+") \n";
	parameters.message +="Dismantling fees paid: "+dft+" cr \n\n";
	
	parameters.message += "Our pods are re-used many times per cycle, often many times per day. Maintaining them in clean and serviceable condition for their maximum useful lifetime is our prime concern at FE Shipyards, and we trust that you, our valued customer, understand the need for your own participation in this costly and ongoing process. \n\n";
	
	parameters.message += "The handling charge (0.005 of cost) is levied upon docking, the maintenance fee (0.05 of cost) every "+mfi+" system-to-system trading runs. \n\n"
	
	parameters.message += "If you cancel your Pod account with us at any time, we must charge the dismantling fee (0.1 of cost) to re-modify and restore your vessel's pylon for weapons-use. \n";
	
	parameters.choicesKey = "cp4Acknowlege";
	
	mission.runScreen(parameters, callback);	

	function callback(choice) {
		if (choice === "1_YES")  player.commsMessage("FE Shipyards thanks you for your custom.");
	}
}



// create F.E.S. handling fee waiver/restoration request  
this._cp4PrepEx = function(station) {
	station.setInterface("cp4Ex",{
	title: "Your FE Shipyards Pod Handling Fee Waiver Request",
	category: "Your FE Shipyards",
	summary: "FE Shipyards grants Guilders and FE shipowners the privileged option to waive our handling and dismantling fees for the 40-ton pod class." ,
	callback: this._cp4ShowEx.bind(this)
	});	
}


// show F.E.S. handling & dismantling fee waiver/restoration request
this._cp4ShowEx = function() {
	var priv = ((this.$cp4ET)||(this.$cp4FES));
	var privo = "";
	if (this.$cp4FES) privo="FE shipowner";
	if (this.$cp4ET) privo="Guilder";
	
	var parameters = new Object();
	
	parameters.title = "FE Shipyards";
	
	parameters.message = "Dear customer, \n\n";
	
	parameters.message += "Re: your request to waive your 40 TC pod fees.\n\n"
	
	parameters.message += "The handling fee (0.005 of cost) is taken from your account upon docking, and is merely to cover our attachment/detachment & loading/unloading services. The dismantling fee (0.1 of cost) is charged when re-modifying your pylons for weapons-use after Licence cancellation. \n\n";
	
	if (priv)
		parameters.message += "FE Shipyards grants you, as a "+privo+", the privileged option to waive our handling and dismantling fees, although you are free - and encouraged - to continue supporting our efforts to provide the efficient service you as an Elite Trader deserve. \n\n";
	else
		parameters.message += "FE Shipyards regrets that we are unable at this time to grant you an exemption from fees, which is a privilege of Guilders and FE shipowners exclusively. \n\n";
	
	parameters.message += "Yours attentively,\n\n";
	
	parameters.message += "Siri Chodrum, for Dor Reval (Technical Director)\n";
	

	parameters.choicesKey = "cp4YesNoEx";
	
	mission.runScreen(parameters, callback);	

	function callback(choice) {
		if (choice === "1_AYE")  {
			if (priv) this.$cp4HFExempt = "yes"; else this.$cp4HFExempt = "no";
		} else this.$cp4HFExempt = "no";
		player.commsMessage("FE Shipyards thanks you for your attention.");
	}	
}
Scripts/cp5_conditions.js
// conditions for award of 50 TC Cargo Pod
"use strict";
this.name = "CP50 Conditions";
this.author = "Reval";
this.licence = "CC BY-NC-SA 4.0";
this.version = "1.0";

this.allowAwardEquipment = function(equipment, ship, context) {
	var pc = player.consoleMessage;
	if (equipment == "EQ_50TC_POD") {
		// fittable only if auxiliary pylon is installed
		if (player.ship.equipmentStatus ("EQ_AUX_PYLON") === "EQUIPMENT_OK") {
			// and not displayed if any pod is already fitted
			if ((player.ship.equipmentStatus ("EQ_10TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_20TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_30TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_40TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_50TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_60TC_POD") !== "EQUIPMENT_OK"))
				return true; else return false;
		} else return false;
	}	
	// pod removal conditions
	if (equipment == "EQ_50TC_POD_REM") 
		if (player.ship.equipmentStatus ("EQ_50TC_POD") === "EQUIPMENT_OK")
			return true; else return false;
	return true;
}
Scripts/cp5_script.js
"use strict";
this.name = "Cargo Pod 50 TC";
this.author = "Reval";
this.licence = "CC BY-NC-SA 4.0";
this.version = "1.1";


this.playerBoughtEquipment = function(equipment, paid) {
	var pc = player.consoleMessage;
	if (equipment == "EQ_50TC_POD") {		
		pc("Attaching one 50 TC Pod to auxiliary pylon.",9);
		player.ship.cargoSpaceCapacity += 50;
		pc("Ship's total capacity = "+player.ship.cargoSpaceCapacity+" TC.",9);
		// always 1 because only one pod can be fitted
		this.$cp5Pods=1;
	} else
	// pod removal and refund
	if (equipment == "EQ_50TC_POD_REM") {
		player.ship.removeEquipment("EQ_50TC_POD");
		player.ship.removeEquipment("EQ_50TC_POD_REM");
		pc("Detaching 50 TC Pod from auxiliary pylon.",9);
		player.ship.cargoSpaceCapacity -= 50;
		pc("Ship's total capacity = "+player.ship.cargoSpaceCapacity+" TC.",9);
		this.$cp5Pods=0;
		player.credits += this.$cp5Cost;
		pc("Amount refunded: "+ this.$cp5Cost,9);
	}
}



this.startUpComplete = function () {
	var pc = player.consoleMessage;
	if (missionVariables.cp5Pods != null) 
		this.$cp5Pods = missionVariables.cp5Pods;
	// Load total fees taken
	if (missionVariables.cp5HandlingFeeTotal != null)
		this.$cp5HandlingFeeTotal = missionVariables.cp5HandlingFeeTotal;
	if (missionVariables.cp5HandlingPaid != null)
		this.$cp5HandlingPaid = missionVariables.cp5HandlingPaid;
	if (missionVariables.cp5MaintenanceFeeTotal != null)
		this.$cp5MaintenanceFeeTotal = missionVariables.cp5MaintenanceFeeTotal;
	if (missionVariables.cp5DismantlingFeeTotal != null)
		this.$cp5DismantlingFeeTotal = missionVariables.cp5DismantlingFeeTotal; 
    // Load system-to-system runs w/pod
	if (missionVariables.cp5Runs != null)
		this.$cp5Runs = missionVariables.cp5Runs;
	// Load Handling fee count
	if (missionVariables.cp5HandlingCount != null)
		this.$cp5HandlingCount = missionVariables.cp5HandlingCount;
	// Load handling fee exemption status
	if (missionVariables.cp5HFExempt != null)
		this.$cp5HFExempt = missionVariables.cp5HFExempt;
	// Load Maintenance fee count
	if (missionVariables.cp5MaintenanceCount != null)
		this.$cp5MaintenanceCount = missionVariables.cp5MaintenanceCount;
	// CHECK
	log(this.name, this.name+" startup complete.");
	// prepare pod Account screen
	var sta = player.ship.dockedStation;
	if (this.$cp5Pods>0) this._cp5PrepAcc(sta);
	// optionally, prepare handling fee waiver request
	if (this.$cp5Pods>0) this._cp5PrepEx(sta);
}


this.startUp = function() {
    log(this.name, "Initialising OXP " + this.name);
	// check for G.E.T. presence
	this.$cp5ET = false;
	if (worldScripts["Elite Trader"]) 
		this.$cp5ET = true;
	// TEST	
	if (this.$cp5ET) log(this.name, "Finds Elite Trader present");
	// check for FE Ships Player
	this.$cp5FES = false;
	if (worldScripts["FE Ships Player"]) 
		this.$cp5FES = true;
	// TEST	
	if (this.$cp5ET) log(this.name, "Finds FE Ships Player present");
	// number of pods - when fitted, always 1
	this.$cp5Pods = 0;
	// purchase cost of pod in cr
	this.$cp5Cost = 50000;
	// handling fee
	this.$cp5HandlingFee = 0.005*this.$cp5Cost; // 0.005 of cost
	this.$cp5HandlingFeeTotal = 0;
	this.$cp5HandlingPaid = "yes"; // or "no" - easier than boolean
	this.$cp5HandlingCount = 0;
	this.$cp5HFExempt = "no";
	// maintenance fee
	this.$cp5MaintenanceFee = 0.05*this.$cp5Cost; // 0.05 of cost
	this.$cp5MaintenanceFeeTotal = 0;
	this.$cp5MaintenancePaid = "no" // or "yes"
	this.$cp5MaintenanceInterval = 50; // in runs (according to cost)
	this.$cp5MaintenanceCount = 0;
	// dismantling fee
	this.$cp5DismantlingFee = 0.1*this.$cp5Cost; // 0.1 of cost
	this.$cp5DismantlingFeeTotal = 0.0;
	// system-to-system runs w/pod
	this.$cp5Runs = 0;
}


this.playerWillSaveGame = function(message) {
	missionVariables.cp5Pods = this.$cp5Pods;
	// save total fees taken
	missionVariables.cp5HandlingFeeTotal = this.$cp5HandlingFeeTotal;
	missionVariables.cp5MaintenanceFeeTotal = this.$cp5MaintenanceFeeTotal;
	missionVariables.cp5DismantlingFeeTotal = this.$cp5DismantlingFeeTotal;
	missionVariables.cp5HandlingPaid = this.$cp5HandlingPaid;
	// system-to-system runs w/pod
	missionVariables.cp5Runs =this.$cp5Runs;
	// handling fee count
	missionVariables.cp5HandlingCount = this.$cp5HandlingCount;
	// handling fee exemption (G.E.T.)
	missionVariables.cp5HFExempt = this.$cp5HFExempt;
	// maintenance fee count
	missionVariables.cp5MaintenanceCount = this.$cp5MaintenanceCount;
}


this.shipDockedWithStation = function(station) {
	// take handling fee (if not exempt)
	var pc = player.consoleMessage;
	var ex = this.$cp5HFExempt;
	// check we have pods, the fee is not paid, and we're not exempt
	if ((this.$cp5Pods>0) && (this.$cp5HandlingPaid==="no") && (ex==="no")) {
		var fee = 0;
		for (var x=1; x<= this.$cp5Pods; x++)
			fee += this.$cp5HandlingFee;
		// record fee and debit trader's account
		this.$cp5HandlingFeeTotal += fee;
		player.credits -= fee;
		this.$cp5HandlingPaid = "yes";
		pc("50 TC Pod handling fees: "+fee+" cr",9);
		this.$cp5HandlingCount++;
	}

	// conditionally take maintenance fee
	if (this.$cp5Pods>0) this._cp5DoMaintenance();
	
	// prepare pod Account and Licence page
	if (this.$cp5Pods>0) this._cp5PrepAcc(station);
	
	// prepare handling fee waiver request if ET or FESP is present
	if (this.$cp5Pods>0) this._cp5PrepEx(station);
}



this.shipExitedWitchspace = function() {
	// set handling paid to 'no'
	this.$cp5HandlingPaid = "no";
	this.$cp5Runs ++;
}


/* Common helper functions */


// assess and take maintenance fee
this._cp5DoMaintenance = function() {
	var pc = player.consoleMessage;
	var runs = this.$cp5Runs;
	var intv = this.$cp5MaintenanceInterval;
	var mfee = this.$cp5MaintenanceFee;
	// take maintenance fee after y runs
	if ( (runs > 0) && ((runs % intv)==0) ) {
		// maintenance for x pods
		var fee = 0;
		for (var x=1; x<= this.$cp5Pods; x++)
			fee += mfee;
		// maintenance fee tally & debit
		this.$cp5MaintenanceFeeTotal += fee;
		player.credits -= fee;
		pc("50 TC Pod Maintenance fees: "+fee+" cr",9);
		// update Maintenance count
		this.$cp5MaintenanceCount++;
	}
}


/* F4 Interfaces */


// create F.E.S. 'Licence & Account' page 
this._cp5PrepAcc = function(station) {
	station.setInterface("cp5Acc",{
	title: "Your FE Shipyards 50 TC Pod Class Licence",
	category: "Your FE Shipyards",
	summary: "Your FE Shipyards 50 TC Pod account screen shows terms, fees paid, load, and other useful information.",
	callback: this._cp5ShowAcc.bind(this)
	});	
}


// show F.E.S. 'Licence & Account' page
this._cp5ShowAcc = function() {
	var hfc = this.$cp5HandlingCount;
	var mfc = this.$cp5MaintenanceCount;
	var mfi = this.$cp5MaintenanceInterval;
	var hft = this.$cp5HandlingFeeTotal;
	var mft = this.$cp5MaintenanceFeeTotal;
	var dft = this.$cp5DismantlingFeeTotal;
		
	var parameters = new Object();
	
	parameters.title = "FE Shipyards";
	
	parameters.message = "Dear customer, \n\n";
	
	if (this.$cp5Pods>0) 
		parameters.message +="Your Account and Licence for 50 TC Class Goods Pods x "+this.$cp5Pods+": \n\n"; 
	 else
		parameters.message +="You have no 50 TC Class Pods licensed with us at this time. \n\n";
	
	parameters.message +="Handling fees paid: "+hft+" cr ("+hfc+") \n";
	parameters.message +="Maintenance fees paid: "+mft+" cr ("+mfc+") \n";
	parameters.message +="Dismantling fees paid: "+dft+" cr \n\n";
	
	parameters.message += "Our pods are re-used many times per cycle, often many times per day. Maintaining them in clean and serviceable condition for their maximum useful lifetime is our prime concern at FE Shipyards, and we trust that you, our valued customer, understand the need for your own participation in this costly and ongoing process. \n\n";
	
	parameters.message += "The handling charge (0.005 of cost) is levied upon docking, the maintenance fee (0.05 of cost) every "+mfi+" system-to-system trading runs. \n\n"
	
	parameters.message += "If you cancel your Pod account with us at any time, we must charge the dismantling fee (0.1 of cost) to re-modify and restore your vessel's pylon for weapons-use. \n";
	
	parameters.choicesKey = "cp5Acknowlege";
	
	mission.runScreen(parameters, callback);	

	function callback(choice) {
		if (choice === "1_YES")  player.commsMessage("FE Shipyards thanks you for your custom.");
	}
}



// create F.E.S. handling fee waiver/restoration request  
this._cp5PrepEx = function(station) {
	station.setInterface("cp5Ex",{
	title: "Your FE Shipyards Pod Handling Fee Waiver Request",
	category: "Your FE Shipyards",
	summary: "FE Shipyards grants Guilders and FE shipowners the privileged option to waive our handling and dismantling fees for the 50-ton pod class." ,
	callback: this._cp5ShowEx.bind(this)
	});	
}


// show F.E.S. handling & dismantling fee waiver/restoration request
this._cp5ShowEx = function() {
	var priv = ((this.$cp5ET)||(this.$cp5FES));
	var privo = "";
	if (this.$cp5FES) privo="FE shipowner";
	if (this.$cp5ET) privo="Guilder";
	
	var parameters = new Object();
	
	parameters.title = "FE Shipyards";
	
	parameters.message = "Dear customer, \n\n";
	
	parameters.message += "Re: your request to waive your 50 TC pod fees.\n\n"
	
	parameters.message += "The handling fee (0.005 of cost) is taken from your account upon docking, and is merely to cover our attachment/detachment & loading/unloading services. The dismantling fee (0.1 of cost) is charged when re-modifying your pylons for weapons-use after Licence cancellation. \n\n";
	
	if (priv)
		parameters.message += "FE Shipyards grants you, as a "+privo+", the privileged option to waive our handling and dismantling fees, although you are free - and encouraged - to continue supporting our efforts to provide the efficient service you as an Elite Trader deserve. \n\n";
	else
		parameters.message += "FE Shipyards regrets that we are unable at this time to grant you an exemption from fees, which is a privilege of Guilders and FE shipowners exclusively. \n\n";
	
	parameters.message += "Yours attentively,\n\n";
	
	parameters.message += "Siri Chodrum, for Dor Reval (Technical Director)\n";
	

	parameters.choicesKey = "cp5YesNoEx";
	
	mission.runScreen(parameters, callback);	

	function callback(choice) {
		if (choice === "1_AYE")  {
			if (priv) this.$cp5HFExempt = "yes"; else this.$cp5HFExempt = "no";
		} else this.$cp5HFExempt = "no";
		player.commsMessage("FE Shipyards thanks you for your attention.");
	}	
}
Scripts/cp6_conditions.js
// conditions for award of 60 TC Cargo Pod
"use strict";
this.name = "CP60 Conditions";
this.author = "Reval";
this.licence = "CC BY-NC-SA 4.0";
this.version = "1.0";

this.allowAwardEquipment = function(equipment, ship, context) {
	var pc = player.consoleMessage;
	if (equipment == "EQ_60TC_POD") {
		// fittable only if auxiliary pylon is installed
		if (player.ship.equipmentStatus ("EQ_AUX_PYLON") === "EQUIPMENT_OK") {
			// and not displayed if any pod is already fitted
			if ((player.ship.equipmentStatus ("EQ_10TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_20TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_30TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_40TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_50TC_POD") !== "EQUIPMENT_OK") && (player.ship.equipmentStatus ("EQ_60TC_POD") !== "EQUIPMENT_OK"))
				return true; else return false;
		} else return false;
	}	
	// pod removal conditions
	if (equipment == "EQ_60TC_POD_REM") 
		if (player.ship.equipmentStatus ("EQ_60TC_POD") === "EQUIPMENT_OK")
			return true; else return false;
	return true;
}
Scripts/cp6_script.js
"use strict";
this.name = "Cargo Pod 60 TC";
this.author = "Reval";
this.licence = "CC BY-NC-SA 4.0";
this.version = "1.1";


this.playerBoughtEquipment = function(equipment, paid) {
	var pc = player.consoleMessage;
	if (equipment == "EQ_60TC_POD") {		
		pc("Attaching one 60 TC Pod to auxiliary pylon.",9);
		player.ship.cargoSpaceCapacity += 60;
		pc("Ship's total capacity = "+player.ship.cargoSpaceCapacity+" TC.",9);
		// always 1 because only one pod can be fitted
		this.$cp6Pods=1;
	} else
	// pod removal and refund
	if (equipment == "EQ_60TC_POD_REM") {
		player.ship.removeEquipment("EQ_60TC_POD");
		player.ship.removeEquipment("EQ_60TC_POD_REM");
		pc("Detaching 60 TC Pod from auxiliary pylon.",9);
		player.ship.cargoSpaceCapacity -= 60;
		pc("Ship's total capacity = "+player.ship.cargoSpaceCapacity+" TC.",9);
		this.$cp6Pods=0;
		player.credits += this.$cp6Cost;
		pc("Amount refunded: "+ this.$cp6Cost,9);
	}
}



this.startUpComplete = function () {
	var pc = player.consoleMessage;
	if (missionVariables.cp6Pods != null) 
		this.$cp6Pods = missionVariables.cp6Pods;
	// Load total fees taken
	if (missionVariables.cp6HandlingFeeTotal != null)
		this.$cp6HandlingFeeTotal = missionVariables.cp6HandlingFeeTotal;
	if (missionVariables.cp6HandlingPaid != null)
		this.$cp6HandlingPaid = missionVariables.cp6HandlingPaid;
	if (missionVariables.cp6MaintenanceFeeTotal != null)
		this.$cp6MaintenanceFeeTotal = missionVariables.cp6MaintenanceFeeTotal;
	if (missionVariables.cp6DismantlingFeeTotal != null)
		this.$cp6DismantlingFeeTotal = missionVariables.cp6DismantlingFeeTotal; 
    // Load system-to-system runs w/pod
	if (missionVariables.cp6Runs != null)
		this.$cp6Runs = missionVariables.cp6Runs;
	// Load Handling fee count
	if (missionVariables.cp6HandlingCount != null)
		this.$cp6HandlingCount = missionVariables.cp6HandlingCount;
	// Load handling fee exemption status
	if (missionVariables.cp6HFExempt != null)
		this.$cp6HFExempt = missionVariables.cp6HFExempt;
	// Load Maintenance fee count
	if (missionVariables.cp6MaintenanceCount != null)
		this.$cp6MaintenanceCount = missionVariables.cp6MaintenanceCount;
	// CHECK
	log(this.name, this.name+" startup complete.");
	// prepare pod Account screen
	var sta = player.ship.dockedStation;
	if (this.$cp6Pods>0) this._cp6PrepAcc(sta);
	// optionally, prepare handling fee waiver request
	if (this.$cp6Pods>0) this._cp6PrepEx(sta);
}


this.startUp = function() {
    log(this.name, "Initialising OXP " + this.name);
	// check for G.E.T. presence
	this.$cp6ET = false;
	if (worldScripts["Elite Trader"]) 
		this.$cp6ET = true;
	// TEST	
	if (this.$cp6ET) log(this.name, "Finds Elite Trader present");
	// check for FE Ships Player
	this.$cp6FES = false;
	if (worldScripts["FE Ships Player"]) 
		this.$cp6FES = true;
	// TEST	
	if (this.$cp6ET) log(this.name, "Finds FE Ships Player present");
	// number of pods - when fitted, always 1
	this.$cp6Pods = 0;
	// purchase cost of pod in cr
	this.$cp6Cost = 60000;
	// handling fee
	this.$cp6HandlingFee = 0.005*this.$cp6Cost; // 0.005 of cost
	this.$cp6HandlingFeeTotal = 0;
	this.$cp6HandlingPaid = "yes"; // or "no" - easier than boolean
	this.$cp6HandlingCount = 0;
	this.$cp6HFExempt = "no";
	// maintenance fee
	this.$cp6MaintenanceFee = 0.05*this.$cp6Cost; // 0.05 of cost
	this.$cp6MaintenanceFeeTotal = 0;
	this.$cp6MaintenancePaid = "no" // or "yes"
	this.$cp6MaintenanceInterval = 60; // in runs (according to cost)
	this.$cp6MaintenanceCount = 0;
	// dismantling fee
	this.$cp6DismantlingFee = 0.1*this.$cp6Cost; // 0.1 of cost
	this.$cp6DismantlingFeeTotal = 0.0;
	// system-to-system runs w/pod
	this.$cp6Runs = 0;
}


this.playerWillSaveGame = function(message) {
	missionVariables.cp6Pods = this.$cp6Pods;
	// save total fees taken
	missionVariables.cp6HandlingFeeTotal = this.$cp6HandlingFeeTotal;
	missionVariables.cp6MaintenanceFeeTotal = this.$cp6MaintenanceFeeTotal;
	missionVariables.cp6DismantlingFeeTotal = this.$cp6DismantlingFeeTotal;
	missionVariables.cp6HandlingPaid = this.$cp6HandlingPaid;
	// system-to-system runs w/pod
	missionVariables.cp6Runs =this.$cp6Runs;
	// handling fee count
	missionVariables.cp6HandlingCount = this.$cp6HandlingCount;
	// handling fee exemption (G.E.T.)
	missionVariables.cp6HFExempt = this.$cp6HFExempt;
	// maintenance fee count
	missionVariables.cp6MaintenanceCount = this.$cp6MaintenanceCount;
}


this.shipDockedWithStation = function(station) {
	// take handling fee (if not exempt)
	var pc = player.consoleMessage;
	var ex = this.$cp6HFExempt;
	// check we have pods, the fee is not paid, and we're not exempt
	if ((this.$cp6Pods>0) && (this.$cp6HandlingPaid==="no") && (ex==="no")) {
		var fee = 0;
		for (var x=1; x<= this.$cp6Pods; x++)
			fee += this.$cp6HandlingFee;
		// record fee and debit trader's account
		this.$cp6HandlingFeeTotal += fee;
		player.credits -= fee;
		this.$cp6HandlingPaid = "yes";
		pc("60 TC Pod handling fees: "+fee+" cr",9);
		this.$cp6HandlingCount++;
	}

	// conditionally take maintenance fee
	if (this.$cp6Pods>0) this._cp6DoMaintenance();
	
	// prepare pod Account and Licence page
	if (this.$cp6Pods>0) this._cp6PrepAcc(station);
	
	// prepare handling fee waiver request if ET or FESP is present
	if (this.$cp6Pods>0) this._cp6PrepEx(station);
}



this.shipExitedWitchspace = function() {
	// set handling paid to 'no'
	this.$cp6HandlingPaid = "no";
	this.$cp6Runs ++;
}


/* Common helper functions */


// assess and take maintenance fee
this._cp6DoMaintenance = function() {
	var pc = player.consoleMessage;
	var runs = this.$cp6Runs;
	var intv = this.$cp6MaintenanceInterval;
	var mfee = this.$cp6MaintenanceFee;
	// take maintenance fee after y runs
	if ( (runs > 0) && ((runs % intv)==0) ) {
		// maintenance for x pods
		var fee = 0;
		for (var x=1; x<= this.$cp6Pods; x++)
			fee += mfee;
		// maintenance fee tally & debit
		this.$cp6MaintenanceFeeTotal += fee;
		player.credits -= fee;
		pc("60 TC Pod Maintenance fees: "+fee+" cr",9);
		// update Maintenance count
		this.$cp6MaintenanceCount++;
	}
}


/* F4 Interfaces */


// create F.E.S. 'Licence & Account' page 
this._cp6PrepAcc = function(station) {
	station.setInterface("cp6Acc",{
	title: "Your FE Shipyards 60 TC Pod Class Licence",
	category: "Your FE Shipyards",
	summary: "Your FE Shipyards 60 TC Pod account screen shows terms, fees paid, load, and other useful information.",
	callback: this._cp6ShowAcc.bind(this)
	});	
}


// show F.E.S. 'Licence & Account' page
this._cp6ShowAcc = function() {
	var hfc = this.$cp6HandlingCount;
	var mfc = this.$cp6MaintenanceCount;
	var mfi = this.$cp6MaintenanceInterval;
	var hft = this.$cp6HandlingFeeTotal;
	var mft = this.$cp6MaintenanceFeeTotal;
	var dft = this.$cp6DismantlingFeeTotal;
		
	var parameters = new Object();
	
	parameters.title = "FE Shipyards";
	
	parameters.message = "Dear customer, \n\n";
	
	if (this.$cp6Pods>0) 
		parameters.message +="Your Account and Licence for 60 TC Class Goods Pods x "+this.$cp6Pods+": \n\n"; 
	 else
		parameters.message +="You have no 60 TC Class Pods licensed with us at this time. \n\n";
	
	parameters.message +="Handling fees paid: "+hft+" cr ("+hfc+") \n";
	parameters.message +="Maintenance fees paid: "+mft+" cr ("+mfc+") \n";
	parameters.message +="Dismantling fees paid: "+dft+" cr \n\n";
	
	parameters.message += "Our pods are re-used many times per cycle, often many times per day. Maintaining them in clean and serviceable condition for their maximum useful lifetime is our prime concern at FE Shipyards, and we trust that you, our valued customer, understand the need for your own participation in this costly and ongoing process. \n\n";
	
	parameters.message += "The handling charge (0.005 of cost) is levied upon docking, the maintenance fee (0.05 of cost) every "+mfi+" system-to-system trading runs. \n\n"
	
	parameters.message += "If you cancel your Pod account with us at any time, we must charge the dismantling fee (0.1 of cost) to re-modify and restore your vessel's pylon for weapons-use. \n";
	
	parameters.choicesKey = "cp6Acknowlege";
	
	mission.runScreen(parameters, callback);	

	function callback(choice) {
		if (choice === "1_YES")  player.commsMessage("FE Shipyards thanks you for your custom.");
	}
}



// create F.E.S. handling fee waiver/restoration request  
this._cp6PrepEx = function(station) {
	station.setInterface("cp6Ex",{
	title: "Your FE Shipyards Pod Handling Fee Waiver Request",
	category: "Your FE Shipyards",
	summary: "FE Shipyards grants Guilders and FE shipowners the privileged option to waive our handling and dismantling fees for the 60-ton pod class." ,
	callback: this._cp6ShowEx.bind(this)
	});	
}


// show F.E.S. handling & dismantling fee waiver/restoration request
this._cp6ShowEx = function() {
	var priv = ((this.$cp6ET)||(this.$cp6FES));
	var privo = "";
	if (this.$cp6FES) privo="FE shipowner";
	if (this.$cp6ET) privo="Guilder";
	
	var parameters = new Object();
	
	parameters.title = "FE Shipyards";
	
	parameters.message = "Dear customer, \n\n";
	
	parameters.message += "Re: your request to waive your 60 TC pod fees.\n\n"
	
	parameters.message += "The handling fee (0.005 of cost) is taken from your account upon docking, and is merely to cover our attachment/detachment & loading/unloading services. The dismantling fee (0.1 of cost) is charged when re-modifying your pylons for weapons-use after Licence cancellation. \n\n";
	
	if (priv)
		parameters.message += "FE Shipyards grants you, as a "+privo+", the privileged option to waive our handling and dismantling fees, although you are free - and encouraged - to continue supporting our efforts to provide the efficient service you as an Elite Trader deserve. \n\n";
	else
		parameters.message += "FE Shipyards regrets that we are unable at this time to grant you an exemption from fees, which is a privilege of Guilders and FE shipowners exclusively. \n\n";
	
	parameters.message += "Yours attentively,\n\n";
	
	parameters.message += "Siri Chodrum, for Dor Reval (Technical Director)\n";
	

	parameters.choicesKey = "cp6YesNoEx";
	
	mission.runScreen(parameters, callback);	

	function callback(choice) {
		if (choice === "1_AYE")  {
			if (priv) this.$cp6HFExempt = "yes"; else this.$cp6HFExempt = "no";
		} else this.$cp6HFExempt = "no";
		player.commsMessage("FE Shipyards thanks you for your attention.");
	}	
}