"use strict"; 

this.name					= "liners_drone.js";
this.author					= "Thargoid & Eric Walch";
this.copyright				= "Creative Commons Attribution - Non-Commercial - Share Alike 3.0 license with clauses - see readme.txt.";
this.description			= "Pickup of a drone after combat, and check if it's reusable (T). New JS Scanning routine (EW).";
this.version				= "1.6.s";


this.findMastersHostiles = function()
	{
	function isHostile(entity) 
		{ 
		return (entity.isShip && entity.target && (entity.target == this.ship.owner || entity.target == this.ship) && entity.hasHostileTarget);
		}
	if(!this.ship.owner)
		{
		this.ship.reactToAIMessage("NOTHING_FOUND");
		}
	else
		{
		let targets = system.filteredEntities(this, isHostile, this.ship, 25600);
		if(targets.length > 0)
			{
			this.ship.target = targets[0];
			this.ship.reactToAIMessage("NEW_DRONE_TARGET");
			}
		else 
			{
			this.ship.reactToAIMessage("NOTHING_FOUND");
			}
		}
	}
