"use strict";
this.name = "coyotepython2";
this.author = "Okti";
this.copyright = "(C) Okti";
this.licence = "Creative Commons Attribution - Non-Commercial - Share Alike 3.0";
this.description = "Ship script for coyotepython2.";

this.shipSpawned = function () {
	//this.ship.reportAIMessages = true;
	this.damaged = 0;
}

this.checkFerdie = function () {
	if (missionVariables.CoyoteFerdie_status == "FLEE" || missionVariables.CoyoteFerdie_status == "KILLED") {
		this.ship.target = player.ship;
		this.ship.reactToAIMessage("FERDIE_FLEED");
	}
}

this.eject = function () {
	if (this.ship.equipmentStatus("EQ_ESCAPE_POD") == "EQUIPMENT_OK") {
		player.commsMessage(expandDescription("[COYOTE_S_01]"), 10);
		player.commsMessage(expandDescription("[COYOTE_S_02]"), 10);
		worldScripts["Coyote-Main"].setMissionInstructions("CE_MI_S_20_03");
		this.ship.abandonShip();
	} else {
		this.ship.awardEquipment("EQ_ESCAPE_POD");
		player.commsMessage(expandDescription("[COYOTE_S_01]"), 10);
		player.commsMessage(expandDescription("[COYOTE_S_02]"), 10);
		worldScripts["Coyote-Main"].setMissionInstructions("CE_MI_S_20_03");
		this.ship.abandonShip();
	}
}

this.checkEnergy = function () {
	if (this.damaged > 500) {
		this.ship.reactToAIMessage("ENERGY_LOW");
	} else {
		this.ship.target = player.ship;
	}
}

this.shipTakingDamage = function (amount, whom, type) {
	this.damaged += amount;
}