"use strict";
this.name      = "workcom"; 
this.author    = "eric walch"; 
this.copyright = "� 2008 eric walch."; 
this.description = "Code for a workcom"; 
this.version   = "1.00";

this.shipLaunchedFromStation = function ()
{
    // keep ship in system
	if (this.ship.primaryRole === "trader") 
    {
        this.comfactory = system.shipsWithPrimaryRole("comczgf")[0];
        if (!this.comfactory) this.comfactory = system.shipsWithPrimaryRole("comslapu")[0];
        if (!this.comfactory) this.comfactory = system.shipsWithRole("astromine")[0];
        if (!this.comfactory) this.ship.switchAI("route2sunskimAI.plist")
        else this.ship.switchAI("workcomAI.plist")
    }
}

this.findComfactory = function ()
{
    if (this.comfactory && this.comfactory.isValid) this.ship.target = this.comfactory
    else this.ship.target = system.mainStation
}

