Back to Index Page generated: Dec 20, 2024, 7:22:10 AM

Expansion Behemoth

Content

Manifest

from Expansion Manager's OXP list from Expansion Manifest
Description Adds Galactic Navy Carriers to the game. Carriers include four different types of Behemoths and a Navy Class Carrier. In total 40 uniquely named carriers escorted by navy grade Vipers, Asps and Sidewinders. Adds Galactic Navy Carriers to the game. Carriers include four different types of Behemoths and a Navy Class Carrier. In total 40 uniquely named carriers escorted by navy grade Vipers, Asps and Sidewinders.
Identifier oolite.oxp.spara.behemoth oolite.oxp.spara.behemoth
Title Behemoth Behemoth
Category Dockables Dockables
Author ADCK, Aegidian, Griff, Eric Walch, PAGroove, SimonB, spara ADCK, Aegidian, Griff, Eric Walch, PAGroove, SimonB, spara
Version 3.1.1 3.1.1
Tags
Required Oolite Version
Maximum Oolite Version
Required Expansions
Optional Expansions
Conflict Expansions
Information URL http://wiki.alioth.net/index.php/Behemoth n/a
Download URL https://wiki.alioth.net/img_auth.php/f/f8/Behemoth_3.1.1.oxz n/a
License CC-BY-NC-SA 4.0 CC-BY-NC-SA 4.0
File Size n/a
Upload date 1610873518

Documentation

Also read http://wiki.alioth.net/index.php/Behemoth

readmes_old/


        

readmes_old/Behemoth Technical stuff.rtf

{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf350
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\paperw11900\paperh16840\margl1440\margr1440\vieww24480\viewh18940\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural

\f0\b\fs48 \cf0 Behemoth.oxp
\b0\fs24 \
\
Behemoth is one of the classical additions, written by the grand master Aegidian himself. It took some hesitations to change anything on it. However Oolite evolves and it would be a shame that the Behemoth would not profit from it. With this release I try to make the behemoth a little bit stronger without really changing the ships specifications. Most changes are subtle behaviour changes.\
\
Most changes have to do with the defenders and not with the carrier itself. And a carrier by itself is a sitting duck. It needs good control over its defenders to protect their mother.\
\
Known bug in Oolite: After launch a carrier can't control its defenders. The command 
\b groupAttackTarget
\b0  never reaches the defenders. Reason was that groupID of the carrier was not set. (will be solved with oolite 1.72). By giving the behemoth escorts, the groupID becomes set and a 
\b groupAttackTarget
\b0  will be send to all defenders.\
\
Whenever a defender killed its target it was issuing a docking command, starting a receive-docking procedure  with the carrier. This disturbed good combat of the mother. Now it first heads towards the mother before asking to dock. When the mother is still busy fighting a 
\b groupAttackTarge
\b0 t command will in normal cases give the defender a new target before it asks for a docking.  (When a ship asks for docking the carrier cant refuse and will be set in a stopping mode. Only a new script command can set it back in attacking mode)\
\
Originally the carrier used a scanning mode that preferred thargoids then in interstellar space and defaulted to the route1patrolAI when in normal space. It now has a more specialised script that also is used in normal space. It still prefers thargoids in interstellar space and just offenders in normal space. Difference is that the first scan method will always find something and the second only with a chance based on the offender status. This is about the same as the old situation.\
\

\b With Oolite 1.71 new things start to happen. \

\b0 \
When attacked from large distance with a military laser the behemoth was really a sitting duck. It was large enough to hit from even just outside scanner range. When using two lasers, the carrier was killed before even a defender could reach the player. This could only solved by giving the defenders fuel and fuel-injectors. When a defender is launched under oolite 1.71+ a new ship script evaluates the distance to the target. When this is large it will send its AI a new message "HURRY_UP" that will make the defender use full injectors to go in the direction of the target before resuming attack mode. An elite player still can kill the behemoth from distance, but now he will be under attack when doing so.\
\
Same happens when a defender drifts away while pursuing an enemy. When it gets a "group attack" message and he is far away he will use fuel injectors to hurry up in direction of the target. This results in better protection of the carrier. First priority of defenders should be to kill those ships that attack their mother. Second priority is to just kill offenders.\
\
Since 1.71 Oolite recognises cloaking as such. Whenever a carrier target cloaks, the identity is stored and every few seconds it checks if it already has de-cloaked. At that moment the carrier and his defenders continue their attack on the de-cloaked ship.\
\

\b Docking problems\

\b0 Any ship can ask for docking and put the behemoth to halt. It sometimes happens with far away, strange ships that just call for docking at the nearest station. This leaves the behemoth than hanging idle for some time till the ship arrives. I tried to solve this the following way.\
Whenever a ship uses the command 
\b requestDockingCoordinates
\b0 , the receiving ship checks if it is moving. If yes, it puts itself into a 
\b performStop
\b0  mode and sends the docking ship a 
\b HOLD_POSITION
\b0  message and itself a 
\b  DOCKING_REQUESTED
\b0   message.\
\
From here on there are two options. Just accept the docking and put  the AI in en state were docking is handled. Even during an attack this would be allowable. The behemoth is to slow anyhow to follow an victim. As a carrier it better launches a few vipers to continue the attack. It just needs to track the targets and send 
\b groupAttackTarget
\b0  messages to the defenders.\
I chose to continue the attack. Using a 
\b performAttack
\b0  as immediate response on a 
\b DOCKING_REQUESTED
\b0  didn't work. It still stops. This has technical reasons. The message is a priority message that is reacted upon immediately. Only after this reaction, the main code issues the 
\b performStop
\b0  command. I bypassed this by issuing a 
\b scanForHostiles
\b0  command. When there is an attack in progress it will find something and the TARGET_FOUND message will restart the 
\b performAttack
\b0 . During testing this worked well. By also issuing an 
\b groupAttackTarget
\b0  messages the defenders that asked for docking also get a new target. I reprogrammad the code for distant defenders so the first head in direction of the behemoth and only ask for docking when already close. Only strange ships can still ask for docking. Badly programmed ships can even ask for docking from the other side of the system instead of first approaching. When they are in the 
\b dockingAI.plist,
\b0  they will continue to ask for docking every 10 seconds. \
\
Eric Walch\
July 2008\
\
-------\
\
December 2010:\
Removed all dependencies with Oolite 1.65. Added new AI commands, that are no longer compatible with this old Oolite version. Removed the turret model as this is now part of Oolite itself.}

readmes_old/Behemoth.readMe.rtf

{\rtf1\ansi\ansicpg1252\cocoartf1265
\cocoascreenfonts1{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fnil\fcharset0 Verdana;}
{\colortbl;\red255\green255\blue255;\red249\green249\blue249;\red68\green68\blue68;\red0\green104\blue153;
}
\paperw11900\paperh16840\margl1440\margr1440\vieww25400\viewh14520\viewkind0
\deftab720
\pard\pardeftab720\sl380\sa220

\f0\b\fs44 \cf0 Behemoth.oxp\

\b0\fs22 Version 2.6.1 by Aegidian
\fs38 \
Overview\
\pard\pardeftab720\sl380\sa120

\fs26 \cf0 The Behemoth-class starship is GalCop's mainstay battleship. Fitted with 8 ball turrets (usually armed with plasma cannons), and with a belly full of Viper interceptors, the ship is a formidable opponent for humans and Thargoids alike. Most Behemoth-class vessels are currently assigned to planetary patrol/search and rescue. During peacetime, the Behemoth accepts civilian traffic at its docking port, the military engineers providing the best overhaul/repair facilities to be found. Repairs, fuel and equipment are expensive at these facilities, typically twice the amount that you would pay at a civilian space station.\
\
\pard\pardeftab720\sl380\sa220

\fs38 \cf0 Notable features\
\pard\pardeftab720\sl380\sa120

\fs26 \cf0 The first impression is 
\i size
\i0 . The class is called Behemoth for good reason - the ship must be sized appropriately to carry numerous interceptors. However, for fugitives, this impression is not long lasting. If an unfortunate pirate vessel should come too close to a Behemoth, it will open up with its formidable weaponry. While plasma cannons are somewhat rare on small ships (and also fairly ineffective), the large cannons carried by a Behemoth literally fill the space around the targetted vessel with searing plasma, which quickly strips shields and tears through duralium. Many a fugitive has been caught unawares - the plasma bolts seen against the bulk of this ship look tiny and ineffective, and are paid little attention until they begin to impact.\
\pard\pardeftab720\sl380\qc

\fs22 \cf0 \cb2 \
\pard\pardeftab720\sl380\sa120

\fs26 \cf0 \cb1 If a full broadside fired by the Behemoth doesn't get a fugitive's attention, the Vipers that begin launching certainly will. The Behemoth is as well defended by Vipers as any space station in a wealthy star system.\
The Behemoth has a surprising turn of speed; large ships such as this are generally limited to very low velocities to prevent the frequent strikes of small meteorites from causing serious damage. However, the Behemoth is fitted with military shields (the shield generation plant alone accounts for a full third of the giant ship's mass), and the Behemoth can survive a high speed collision with asteroids up to three tonnes in mass without taking any damage.\
\
\pard\pardeftab720\sl380\sa120

\b \cf0 ========================================
\b0 \
\
\pard\pardeftab720\sl260

\f1\fs22 \cf3 behemoth-v2.6.1\
\
Files: \
\
behemoth.oxp \
readMe \
\
Compatibility: \
\
This OXP is by Aegidian (oolite@aegidian.org) it works with Oolite version 1.73 or higher. \
\
Install: \
\
Move the behemoth.oxp bundle (or folder if you are using GNU/Linux or windows) into the Oolite AddOns folder. \
\
Details: \
\
Behemoth Class carriers are the dreadnoughts of the Imperial Navy. There are currently sixteen in service, mostly patrolling intersystem space where their Asps and Vipers are used to counter the Thargoid threat. \
\
Half these ships are of the older INB01 class, but construction has recently been completed of the eight newer INB21 class behemoths. \
\
\
\pard\pardeftab720\sl260
\cf3 Version 2.6.1:\
Fixed a casing error inside  the behemothFighterDockingAI.plist \
\pard\pardeftab720\sl260
\cf3 \
\
Version 2.6:\
Added the new detection for launching ships that allows to shortly freeze the pitch movement during launch in combat.\
Fixed a casing bug that was ignored in older Oolite versions but will give an error report after Oolite 1.74.2\
Raised minimum Oolite to 1.73\
\
Version 2.5.4:\
Corrected bug with the "behemoth-nimrod". That role was missing since at least version 2.3.\
\
Version 2.5.3:\
Corrected error in cloaking detection script.\
\
Version 2.5.2:\
Small changes for better compatibility with groups in Oolite 1.73.\
Corrected the commodity list. (Never worked since 2.0.0 ?)\
\
Version 2.5.1:\
Turned the docking slid of the type-2 ships 90 degrees. This one has always been wrong!\
\
Version 2.5:\
Adapted to Oolite 1.72. (will work with 1.65 and 1.71+)\
Added code to make sure it also uses its new scripting when added as a hunter.\
Changed the addition script for interstellar space. More chance of having no behemoth at all in interstellar space after a miss-jump. Greater chance of getting unique named behemoth's after multiple miss-jumps.\
\
Version 2.4: \
\
Changes by Eric Walch: Implemented new features for oolite 1.71. Ships now have a script of their own. Improved AI scripting of both Behemoth and the fighters. Behemoths will now avoid obstacles when patrolling in normal space. This will make manual docking in the front side of a moving Behemoth impossible. Behemoths now have two escort ships and the defenders have fuel injectors.\
\
Version 2.3: \
\
Fixes a bug which could cause the AI stack to overflow. \
\
Version 2.2: \
\
REALLY fixes the problems with the Behemoth's docks (Behemoths were frangible and the docks were being shot away!) \
\
Version 2.1: \
\
Fixes the problems with the Behemoth's docks. \
\
License: \
\
The textures, models and plist texts are all copyright Giles Williams 2004-2006 and available for reuse under the Creative Commons Attribution-NonCommercial-ShareAlike License 2.0. \
\
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License. \
To view a copy of this license, visit {\field{\*\fldinst{HYPERLINK "http://creativecommons.org/licenses/by-nc-sa/2.0/"}}{\fldrslt \cf4 \ul \ulc4 http://creativecommons.org/licenses/by-nc-sa/2.0/}} \
or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. \
\
You are free: \
\
\'95 to copy, distribute, display, and perform the work \
\'95 to make derivative works \
\
Under the following conditions: \
\
\'95 Attribution. You must give the original author credit. \
\
\'95 Non-commercial. You may not use this work for commercial purposes. \
\
\'95 Share Alike. If you alter, transform, or build upon this work, \
you may distribute the resulting work only under a license identical to this one. \
\
For any reuse or distribution, you must make clear to others the license terms of this work. \
\
Any of these conditions can be waived if you get permission from the copyright holder. \
\
Your fair use and other rights are in no way affected by the above.}

Equipment

This expansion declares no equipment.

Ships

Name
Behemoth docking bay
behemoth-Colossus
behemoth-argus
Navy Asp Mark II
behemoth-atlas
behemoth-bolverk
behemoth-geryon
behemoth-gog
behemoth-goliath
behemoth-grid
behemoth-loki
behemoth-magog
behemoth-nimrod
behemoth-surt
behemoth-talos
behemoth-tethys
behemoth-titan
Behemoth Type 1
Behemoth Type 2
Behemoth Type 3
Behemoth Type 4
Navy Viper
behemoth-ymir
behemoth_3-akdamut
behemoth_3-oceanus
behemoth_3-olympic
behemoth_3-phoebe
behemoth_3-prometheus
behemoth_3-ramesses-ii
behemoth_3-tarasque
behemoth_3-titanic
behemoth_4-aphrodite
behemoth_4-athena
behemoth_4-demeter
behemoth_4-dionysus
Behemoth - Hera
behemoth_4-hestia
behemoth_4-poseidon
behemoth_4-zeus
photon cannon
carrier turret
Navy Class Carrier
ncc_carrier-antiphates
ncc_carrier-damasen
ncc_carrier-elatreus
ncc_carrier-geryones
ncc_carrier-mylinos
ncc_carrier-orion
ncc_carrier-steropes
ncc_carrier-typhoeus
ncc dock
ncc middle part
Sidewinder X Port Engine
Sidewinder X Starboard Engine
Navy Sidewinder
Navy Thargon Collector

Models

This expansion declares no models.

Scripts

Path
Config/script.js
"use strict";

this.name        = "behemoth"; 
this.author      = "Aegidian"; 
this.copyright   = "2008 - 2014 the Oolite team."; 
this.description = "Addition script of the Behemoth carrier in Witchspace."; 

this.behemoth  = ["behemoth-ymir", "behemoth-argus", "behemoth-atlas", "behemoth-grid", "behemoth-surt", "behemoth-talos", "behemoth-tethys", "behemoth-bolverk", "behemoth-gog", "behemoth-magog", "behemoth-titan", "behemoth-loki", "behemoth-goliath", "behemoth-colossus", "behemoth-nimrod", "behemoth-geryon","behemoth-akdamut", "behemoth-aphrodite", "behemoth-athena", "behemoth-demeter", "behemoth-dionysus", "behemoth-hera", "behemoth-hestia", "behemoth-oceanus", "behemoth-olympic", "behemoth-phoebe", "behemoth-poseidon", "behemoth-prometheus", "behemoth-ramesses-ii", "behemoth-tarasque", "behemoth-titanic","behemoth-zeus","behemoth-antiphates", "behemoth-damasen", "behemoth-elatreus", "behemoth-geryones", "behemoth-mylinos", "behemoth-orion", "behemoth-steropes", "behemoth-typhoeus"];

this.behemothList = this.behemoth.concat();

this.systemWillPopulate = function() {
	// don't add police ships in anarchies.
	if(Math.random() < 0.015 * system.government)
		system.setPopulator("behemoth", {
			callback: function(pos) {
				system.addShips(this.uniqueBehemoth(),1,pos);
			}.bind(this),
			location: "LANE_WP"
		});
}


this.interstellarSpaceWillPopulate = function() {
	//(0 to 3 ships with distribution towards 0)
	var number = Math.floor(Math.random()*Math.random()*4.5);
	system.setPopulator("behemoth", {
		callback: function(pos) {
			//spread 'em up a bit
			system.addShips(this.uniqueBehemoth(),1,pos.add(Vector3D.randomDirection(25000)));
		}.bind(this),
		groupCount: number
	});
}

this.uniqueBehemoth = function()
{
    if(this.behemothList.length === 0) this.behemothList = this.behemoth.concat(); // reset the list
    return this.behemothList.splice(Math.floor(Math.random()*this.behemothList.length), 1);
    // Make sure that every time a ship with new name is pulled of the list.
}

this.addBehemoth = function (role) 
{
    this.behemoth.push(role);
    this.behemothList.push(role);
}

/*
You can check from an other JS script if behemoth.oxp is installed with: if(worldScripts.behemoth)
Or you can get any of the behemoth names with: worldScripts.behemoth.behemoth[i]
Or an unique behemoth role with: worldScripts.behemoth.uniqueBehemoth()
this.uniqueBehemoth() is added in versio 2.5. and should stay in in future.
*/
Scripts/behemoth-carrier.js
"use strict";

this.name      = "behemoth_carrier"; 
this.author    = "eric walch"; 
this.copyright = "� 2008 the Oolite team.";
this.description = "ship script for the behemoth of aegidean";

this.shipSpawned = function() {
	this.ship.displayName = this.ship.name + ": " + this.ship.scriptInfo.name;
}

this.shipTargetCloaked = function ()
{
    this.cloakedTarget = this.ship.target;
    if(this.cloakingTimer) this.cloakingTimer.start()
    else this.cloakingTimer = new Timer(this, this.statusCheck, 1, 1);
};

this.statusCheck = function ()
{
    if (!this.ship || !this.ship.isValid) this.cloakingTimer.stop();
    if (this.cloakedTarget) 
    { 
        if (this.cloakedTarget.isCloaked) return;
        else 
        { 
            this.ship.target = this.cloakedTarget; 
            this.ship.reactToAIMessage("TARGET_DECLOAKED"); 
        } 
    } 
    if (this.cloakingTimer) 
    { 
        this.cloakingTimer.stop(); 
        delete this.cloakingTimer; 
    } 
};

this.playerWillEnterWitchspace = this.shipDied = function ()
{
    if (this.cloakingTimer) {this.cloakingTimer.stop(); delete this.cloakingTimer}
};

//6.12.14: function isCloaked moved to the toplevel of the function to follow strict js rules -spara-
this.shipBeingAttackedByCloaked = function ()
{
	function isCloaked(entity) {
		return (entity.isShip && entity.isCloaked);
	};
    if (!this.cloakedTarget)
    {
        this.cloakedTarget = system.filteredEntities(this, isCloaked, this.ship)[0];
    };
    if (this.cloakedTarget && this.cloakedTarget.isCloaked)
    {
        if (this.cloakingTimer) this.cloakingTimer.start()
        else this.cloakingTimer = new Timer(this, this.statusCheck, 1, 1);
    };
};

this.shipBeingAttacked = this.offenceCommittedNearby = function (who)
{
	if (this.ship.target && this.ship.target != who && (who.bounty * who.maxEnergy > this.ship.target.bounty * this.ship.target.maxEnergy || who.isPlayer) && who.scanClass !== "CLASS_POLICE")
    {
         this.ship.reactToAIMessage("SWITCH_TARGET");
         this.ship.target = who;
    }
};

Scripts/behemoth-fighter.js
"use strict";

this.name      = "behemoth_fighter"; 
this.author    = "eric walch"; 
this.copyright = "� 2008 the Oolite team.";
this.description = "ship script for the behemoth.oxp of aegidean";
this.version   = "1.03";

/*
Escorts added with scanClass CLASS_POLICE always start with a wingman role. However, with scanning for a formationleader they only accept a ship with role police as a mother. When not available, a wingman becomes role police. All next wingmen will now see a ship with role police and will follow him.  By this mechanisme the Behemoth itself looses all its escorts (wingmen). 
Therefor explicit set the role of these behemoth escorts as escort on spawning. spawnedAsEscort() trigers before shipSpawned().
"TARGET_LOST" is removed from its custom AI.
*/
this.spawnedAsEscort = function (mother)
{
    this.ship.switchAI("behemothEscortAI.plist")
    this.ship.primaryRole = "escort"
    this.ship.AIState ="FLYING_ESCORT"
    if (mother.group && mother.group.ships.indexOf(this.ship)<0) mother.group.addShip(this.ship);
}


this.shipLaunchedFromStation = function ()
{
    if (!this.ship.target)
    {
        this.ship.reactToAIMessage("TARGET_LOST");
        // player could be attacking cloaked, then defenders launch without target.
    }
    else
    {
        if (this.ship.target.position.distanceTo(this.ship) > 6000) this.ship.reactToAIMessage("HURRY_UP");
    }
}

this.shipBeingAttacked = function (whom)
{
    {
        if (whom && this.ship.position.distanceTo(whom) > 15000) this.ship.reactToAIMessage("HURRY_UP");
        // this event is even received when attacked out of scanner range. This will send ship
        // in direction of attacker before going in attack mode.
        this.attacker = whom;
    }
}

this.shipLostTarget = this.shipTargetLost = function (whom)  // shipLostTarget() is deprecated since 1.74
{
    if (this.attacker && this.attacker.isShip &&this.ship.AIState !== "FLYING_ESCORT")
    {
        this.ship.target = this.attacker;
        this.ship.reactToAIMessage("HURRY_UP");
    }
}

this.offenceCommittedNearby = function (who)
{
    if (this.ship.target && this.ship.target.scanClass === "CLASS_CARGO" && who.scanClass !== "CLASS_POLICE") 
    {
        this.ship.target = who;
    }
    // targetting cargo only happens with tharglets and not on police ships that accidently fired.
    // and in the heat of the fight a lof of friendly fire takes place.
}
Scripts/behemoth-market.js
"use strict";

this.name = "behemoth-market";
this.author = "spara";
this.copyright = "2015 spara";
this.license     = "CC BY-NC-SA 4.0"; 

this.$limits = {
      "food" : [48, 52],
      "textiles" : [72, 84],
      "radioactives" : [372, 400],
      "liquor_wines" : [332, 424],
      "luxuries" : [704, 764],
      "computers" : [596, 608],
      "machinery" : [468, 496],
      "alloys" : [312, 436],
      "gold" : [348, 376],
      "platinum" : [616, 740],
      "gem_stones" : [160, 220],
      "alien_items" : [780, 904]
};

this.updateLocalCommodityDefinition = function(goodDefinition) {
	var commodity = goodDefinition.key;
	var limits = this.$limits[commodity];
	//definition found for the good. calculate it with a simple rounding of a flat probability.
	if (limits) {
		goodDefinition.price = limits[0] + Math.round(Math.random() * (limits[1] - limits[0]));
		goodDefinition.quantity = 0;
		goodDefinition.capacity = 31;//not much storage
	}
	//no definition found. nullify the goods.
	else {
		goodDefinition.price = 0;
		goodDefinition.quantity = 0;
		goodDefinition.capacity = 0;
	}	
	return goodDefinition;
};
Scripts/ncc_carrier.js
"use strict";

this.name      = "ncc_carrier"; 
this.author    = "spara"; 
this.copyright = "2014 Mika Spåra, Eric Walch";
this.description = "ship script for navy class carrier";
this.licence     = "CC BY-NC-SA 3.0";

this.shipSpawned = function () {
	this.ship.displayName = this.ship.name + ": " + this.ship.scriptInfo.name;
	this.$scanTimer = new Timer(this, this.$scanForThargons, 0, 10);
}

this.$collectors = 3;

this.$scanForThargons = function () {
    function $isDeadThargon(entity)
    {
		if (entity.hasRole && (entity.hasRole("tharglet") || entity.hasRole("thargon")) && entity.isCargo) {
			return true;
		}
		return false;
    };
	if (this.$collectors > 0) {
		if (ship.AI === "nccCarrierInterceptAI.plist" && ship.AIState !== "ATTACK_SHIP") {
			if (system.filteredEntities(this, $isDeadThargon, ship, 25600).length > 0) {
				ship.launchShipWithRole("ncc-thargon-collector");
				this.$collectors--;
			}
		}
	}
};

this.otherShipDocked = function(whom)
{
     if (whom.hasRole("ncc-thargon-collector")) this.$collectors++;
}

//the rest is from behemoth-carrier.js script from behemoth oxp.

this.shipTargetCloaked = function ()
{
    this.cloakedTarget = this.ship.target;
    if(this.cloakingTimer) this.cloakingTimer.start()
    else this.cloakingTimer = new Timer(this, this.statusCheck, 1, 1);
};

this.statusCheck = function ()
{
    if (!this.ship || !this.ship.isValid) this.cloakingTimer.stop();
    if (this.cloakedTarget) 
    { 
        if (this.cloakedTarget.isCloaked) return;
        else 
        { 
            this.ship.target = this.cloakedTarget; 
            this.ship.reactToAIMessage("TARGET_DECLOAKED"); 
        } 
    } 
    if (this.cloakingTimer) 
    { 
        this.cloakingTimer.stop(); 
        delete this.cloakingTimer; 
    } 
};

this.playerWillEnterWitchspace = this.shipDied = function ()
{
    if (this.cloakingTimer) {this.cloakingTimer.stop(); delete this.cloakingTimer}
};

this.shipBeingAttackedByCloaked = function ()
{
	function isCloaked(entity) {
		return (entity.isShip && entity.isCloaked);
	};
    if (!this.cloakedTarget) {
        this.cloakedTarget = system.filteredEntities(this, isCloaked, this.ship)[0];
    };
    if (this.cloakedTarget && this.cloakedTarget.isCloaked)
    {
        if (this.cloakingTimer) this.cloakingTimer.start()
        else this.cloakingTimer = new Timer(this, this.statusCheck, 1, 1);
    };
};

this.shipBeingAttacked = this.offenceCommittedNearby = function (who)
{
	if (this.ship.target && this.ship.target != who && (who.bounty * who.maxEnergy > this.ship.target.bounty * this.ship.target.maxEnergy || who.isPlayer) && who.scanClass !== "CLASS_POLICE")
    {
         this.ship.reactToAIMessage("SWITCH_TARGET");
         this.ship.target = who;
    }
};

Scripts/ncc_collector.js
"use strict";

this.name      = "ncc_thargon_collector"; 
this.author    = "spara"; 
this.copyright = "2013 Mika Spåra";
this.description = "ship script for thargon collector";
this.licence     = "CC BY-NC-SA 3.0";
this.version   = "1.0";

this.shipSpawned = function () {
	this.$mother = system.shipsWithRole("behemoth", ship)[0];
	ship.primaryRole = "defense_ship";
};

this.shipScoopedOther = function() {
	if (!this.$mother || ship.position.distanceTo(this.$mother) > 25600)
		ship.AIState = "DOCK_WITH_STATION";
}