"use strict";
this.name = "IR_krait.js";
this.author = "Ramirez";
this.copyright = "February 2010";
this.description = "Iron Raven convo test";
this.version = "2.0";

this._engaged = false;

//-------------------------------------------------------------------------------------------------------------
this.shipSpawned = function () {
	missionVariables.IR_cargoCount = 10;
	if (missionVariables.IR_SDF_quest == "JUMPED") {
		missionVariables.IR_cargoCount = 10;
	}
}

//-------------------------------------------------------------------------------------------------------------
this.shipDied = function () {
	if (missionVariables.IR_SDF_quest == "CONTAMINATED")
		this.ship.spawn("IR-damaged-escape-pod", 1);
}

//-------------------------------------------------------------------------------------------------------------
this.performJump = function () {
	missionVariables.IR_SDF_quest = "JUMPED";
}

//-------------------------------------------------------------------------------------------------------------
this.ejectCargo = function () {
	if (missionVariables.IR_cargoCount > 1) {
		this.ship.ejectItem("IR-fuel-waste");
		--missionVariables.IR_cargoCount
		//this.ship.commsMessage("count is "+[missionVariables.cargoCount]);
		this.ship.reactToAIMessage("ENTER");
	}

	if (missionVariables.IR_cargoCount == 1) {
		//this.ship.commsMessage("count is "+[missionVariables.cargoCount]);
		this.ship.reactToAIMessage("EJECTION_COMPLETE");
		worldScripts["IR-mfd.js"].$updateMFD("IR_krait_examine_cargo");
	}
}

this.following = function() {
	worldScripts["IR-mfd.js"].$updateMFD("IR-following-get-him", null, this.ship);
}

this.hyperspace = function() {
	worldScripts["IR-mfd.js"].$updateMFD("IR-prepare-hyperspace", null, this.ship);
}

this.engaging = function() {
	if (this._engaged == true) return;
	this._engaged = true;
	worldScripts["IR-mfd.js"].$updateMFD("IR-engaging", null, this.ship);
}

this.jettison = function() {
	worldScripts["IR-mfd.js"].$updateMFD("IR-standby-jettison", null, this.ship);
}