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

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

this.FindPlayer = function () {
	this.playerArray = system.shipsWithPrimaryRole("player");
	if (this.playerArray.length == 0) {} else {
		this.ship.target = this.playerArray[0];
		this.ship.reactToAIMessage("PLAYER_FOUND");
	}
}

this.checkDistanceToPlayer = function () {
	this.playerArray = system.shipsWithPrimaryRole("player");
	if (this.playerArray.length == 0) {} else {
		if (player.ship.position.distanceTo(this.ship.position) < 5000) {
			player.commsMessage(expandDescription("[COYOTE_START6]"), 10);
			player.commsMessage(expandDescription("[COYOTE_START7]"), 10);
			//mission.setInstructionsKey("COYOTE_MI_STAGE_10_02","Coyote-Main.js");
			system.addShips("coyoteferdiestart", 1, player.ship.position.add(player.ship.vectorForward.multiply(-25000)), 100);

			worldScripts["Coyote-Main"].setMissionInstructions("CE_MI_S_10_02");
			this.ship.reactToAIMessage("PREPARE_TO_EXIT_SYSTEM");
		}
	}
}

this.exitSystem = function () {
	this.ship.fuel = 7.0;
	this.ship.exitSystem(144);
}

this.removeMe = function () {
	this.ship.remove(true);
}