"use strict";
this.name = "leviathanFighter";
this.author = "eric walch";
this.copyright = "� 2008 the Oolite team.";
this.description = "ship script for the military defenders & escorts";
this.version = "1.03";

//-------------------------------------------------------------------------------------------------------------
this.shipLaunchedFromStation = function (station) {
	this.ship.switchAI("militaryFiascoInterceptAI.plist");

	// sometimes the target is already destroyd on launch. AI alone can't handle this.
	if (!this.ship.target) this.ship.reactToAIMessage("TARGET_LOST");


	if (station.speed > 0 && this.ship.equipmentStatus("EQ_FUEL_INJECTION") != "EQUIPMENT_OK") {
		this.ship.awardEquipment("EQ_FUEL_INJECTION"); // allow for a fast launch!
	}
	if (this.ship.fuel < 5) this.ship.fuel = 5;
}

//-------------------------------------------------------------------------------------------------------------
this.shipBeingAttacked = function (attacker) {
	// correcting friendly fire
	if (attacker && attacker.isShip && this.ship.group && attacker.group == this.ship.group) {
		if (this.ship.bounty) this.ship.bounty = 0;
		if (attacker.bounty) attacker.bounty = 0;
		if (attacker.target == this.ship) {
			attacker.target = null;
			attacker.reactToAIMessage("LOST_TARGET");
		}
	}
}