Difference between revisions of "Oolite JavaScript Reference: Ship"
(→Properties: Added isPirate, isPolice, isThargoid and isTrader.) |
m (Stylistic normalization.) |
||
Line 10: | Line 10: | ||
== Properties == | == Properties == | ||
=== <code>AI</code> === | === <code>AI</code> === | ||
− | AI | + | '''AI''' : String (read-only) |
The name of the ship’s current AI. (See also: <code>[[#AIState|AIState]]</code>, <code>[[#setAI|setAI()]]</code>, <code>[[#switchAI|switchAI()]]</code>, <code>[[#exitAI|exitAI()]]</code>) | The name of the ship’s current AI. (See also: <code>[[#AIState|AIState]]</code>, <code>[[#setAI|setAI()]]</code>, <code>[[#switchAI|switchAI()]]</code>, <code>[[#exitAI|exitAI()]]</code>) | ||
=== <code>AIState</code> === | === <code>AIState</code> === | ||
− | AIState | + | '''AIState''' : String (read/write, read-only for player) |
The ship’s AI’s current state. (See also: <code>[[#AI|AI]]</code>, <code>[[#reactToAIMessage|reactToAIMessage()]]</code>, <code>[[#hasSuspendedAI|hasSuspendedAI]]</code>) | The ship’s AI’s current state. (See also: <code>[[#AI|AI]]</code>, <code>[[#reactToAIMessage|reactToAIMessage()]]</code>, <code>[[#hasSuspendedAI|hasSuspendedAI]]</code>) | ||
=== <code>beaconCode</code> === | === <code>beaconCode</code> === | ||
− | beaconCode | + | '''beaconCode''' : String (read-only) |
If the ship is a beacon, an identifying string. The first character is used for identification on the [[Advanced Space Compass]]. For non-beacons, this property is <code>null</code>. (See also: <code>[[#isBeacon|isBeacon]]</code>) | If the ship is a beacon, an identifying string. The first character is used for identification on the [[Advanced Space Compass]]. For non-beacons, this property is <code>null</code>. (See also: <code>[[#isBeacon|isBeacon]]</code>) | ||
=== <code>bounty</code> === | === <code>bounty</code> === | ||
− | bounty | + | '''bounty''' : Number (read-only integer) |
The bounty on the ship. This also determines its legal status. In the case of the player, it is halved at each witchspace jump. | The bounty on the ship. This also determines its legal status. In the case of the player, it is halved at each witchspace jump. | ||
=== <code>entityPersonality</code> === | === <code>entityPersonality</code> === | ||
− | entityPersonality | + | '''entityPersonality''' : Number (read-only integer) |
A random number in the range 0..32767 which is generated when the ship is created. Equivalent to the <code>entityPersonalityInt</code> [[Shaders in Oolite: uniforms#Ship|uniform binding]]</code>. | A random number in the range 0..32767 which is generated when the ship is created. Equivalent to the <code>entityPersonalityInt</code> [[Shaders in Oolite: uniforms#Ship|uniform binding]]</code>. | ||
=== <code>escorts</code> === | === <code>escorts</code> === | ||
− | + | '''escorts''' : Array (read-only array of [[Oolite/Development/Scripting/Class/Entity|Entity]]s) | |
− | The ship’s deployed | + | The ship’s deployed escorts. |
=== <code>fuel</code> === | === <code>fuel</code> === | ||
− | fuel | + | '''fuel''' : Number (read/write) |
The ship’s current fuel capacity, in LY. The game will limit this to the range 0..7, and round it off to the nearest tenth. (See also: <code>[[Oolite/Development/Scripting/Class/Player#fuelLeakRate|Player.fuelLeakRate]]</code>) | The ship’s current fuel capacity, in LY. The game will limit this to the range 0..7, and round it off to the nearest tenth. (See also: <code>[[Oolite/Development/Scripting/Class/Player#fuelLeakRate|Player.fuelLeakRate]]</code>) | ||
=== <code>groupID</code> === | === <code>groupID</code> === | ||
− | groupID | + | '''groupID''' : Number (read-only) |
The ID of the group to which this ship belongs. 0 for no group. An example of a group is a ship with escorts and the escorts. | The ID of the group to which this ship belongs. 0 for no group. An example of a group is a ship with escorts and the escorts. | ||
=== <code>hasHostileTarget</code> === | === <code>hasHostileTarget</code> === | ||
− | hasHostileTarget | + | '''hasHostileTarget''' : Boolean (read-only) |
<code>true</code> if the ship’s AI is trying to kill something, <code>false</code> otherwise. Always <code>false</code> for the player. | <code>true</code> if the ship’s AI is trying to kill something, <code>false</code> otherwise. Always <code>false</code> for the player. | ||
=== <code>hasSuspendedAI</code> === | === <code>hasSuspendedAI</code> === | ||
− | hasSuspendedAI | + | '''hasSuspendedAI''' : Boolean (read-only) |
<code>true</code> if the ship has suspended AIs, <code>false</code> otherwise. | <code>true</code> if the ship has suspended AIs, <code>false</code> otherwise. | ||
=== <code>heatInsulation</code> === | === <code>heatInsulation</code> === | ||
− | heatInsulation | + | '''heatInsulation''' : Number (read/write) |
The ship’s heat insulation factor. 1.0 is normal, higher values mean more resistance to heat. | The ship’s heat insulation factor. 1.0 is normal, higher values mean more resistance to heat. | ||
=== <code>isBeacon</code> === | === <code>isBeacon</code> === | ||
− | isBeacon | + | '''isBeacon''' : Boolean (read-only) |
<code>true</code> if the ship is a beacon (i.e., can show up on the [[Advanced Space Compass]] with a character indicating its identity), <code>false</code> otherwise. (See also: <code>[[#beaconCode|beaconCode]]</code>) | <code>true</code> if the ship is a beacon (i.e., can show up on the [[Advanced Space Compass]] with a character indicating its identity), <code>false</code> otherwise. (See also: <code>[[#beaconCode|beaconCode]]</code>) | ||
=== <code>isCloaked</code> === | === <code>isCloaked</code> === | ||
− | isCloaked | + | '''isCloaked''' : Boolean (read-only) |
<code>true</code> if the ship has a cloaking device which is currently active <code>false</code> otherwise. If the ship has a cloaking device and sufficient energy to use it, you can activate it by setting <code>isCloaked</code> to <code>true</code>. | <code>true</code> if the ship has a cloaking device which is currently active <code>false</code> otherwise. If the ship has a cloaking device and sufficient energy to use it, you can activate it by setting <code>isCloaked</code> to <code>true</code>. | ||
=== <code>isFrangible</code> === | === <code>isFrangible</code> === | ||
− | isFrangible | + | '''isFrangible''' : Boolean (read-only) |
<code>true</code> if the ship is frangible (i.e., its subentities can be destroyed separately from the main ship), <code>false</code> otherwise. (See also: <code>[[#subEntities|subEntities]]</code>) | <code>true</code> if the ship is frangible (i.e., its subentities can be destroyed separately from the main ship), <code>false</code> otherwise. (See also: <code>[[#subEntities|subEntities]]</code>) | ||
=== <code>isJamming</code> === | === <code>isJamming</code> === | ||
− | isJamming | + | '''isJamming''' : Boolean (read-only) |
<code>true</code> if the ship has a military scanner jammer which is currently active <code>false</code> otherwise. | <code>true</code> if the ship has a military scanner jammer which is currently active <code>false</code> otherwise. | ||
=== <code>isPirate</code> === | === <code>isPirate</code> === | ||
− | isPirate | + | '''isPirate''' : Boolean (read-only) |
<code>true</code> if the ship is a pirate vessel, <code>false</code> otherwise. Currently equivalent to <code>[[#primaryRole|primaryRole]] == "pirate"</code>. | <code>true</code> if the ship is a pirate vessel, <code>false</code> otherwise. Currently equivalent to <code>[[#primaryRole|primaryRole]] == "pirate"</code>. | ||
=== <code>isPolice</code> === | === <code>isPolice</code> === | ||
− | isPolice | + | '''isPolice''' : Boolean (read-only) |
<code>true</code> if the ship is a police vessel, <code>false</code> otherwise. Currently equivalent to <code>[[Oolite/Development/Scripting/Class/Entity#scanClass|scanClass]] == "CLASS_POLICE"</code>. | <code>true</code> if the ship is a police vessel, <code>false</code> otherwise. Currently equivalent to <code>[[Oolite/Development/Scripting/Class/Entity#scanClass|scanClass]] == "CLASS_POLICE"</code>. | ||
=== <code>isThargoid</code> === | === <code>isThargoid</code> === | ||
− | isThargoid | + | '''isThargoid''' : Boolean (read-only) |
<code>true</code> if the ship is a Thargoid vessel, <code>false</code> otherwise. Currently equivalent to <code>[[Oolite/Development/Scripting/Class/Entity#scanClass|scanClass]] == "CLASS_THARGOID"</code>. | <code>true</code> if the ship is a Thargoid vessel, <code>false</code> otherwise. Currently equivalent to <code>[[Oolite/Development/Scripting/Class/Entity#scanClass|scanClass]] == "CLASS_THARGOID"</code>. | ||
=== <code>isTrader</code> === | === <code>isTrader</code> === | ||
− | isTrader | + | '''isTrader''' : Boolean (read-only) |
<code>true</code> if the ship is a merchant vessel, <code>false</code> otherwise. Currently equivalent to <code>[[#primaryRole|primaryRole]] == "trader"</code>. | <code>true</code> if the ship is a merchant vessel, <code>false</code> otherwise. Currently equivalent to <code>[[#primaryRole|primaryRole]] == "trader"</code>. | ||
=== <code>maxCargo</code> === | === <code>maxCargo</code> === | ||
− | maxCargo | + | '''maxCargo''' : Number (read-only integer) |
The ship’s cargo capacity. | The ship’s cargo capacity. | ||
=== <code>maxSpeed</code> === | === <code>maxSpeed</code> === | ||
− | maxSpeed | + | '''maxSpeed''' : Number (read-only) |
The ship’s maximum speed under normal power. Note that <code>[[#speed|speed]]</code> may exceed this when [[witch fuel injectors]] or [[hyperspeed]] are in use. (See also: <code>[[#speed|speed]]</code>) | The ship’s maximum speed under normal power. Note that <code>[[#speed|speed]]</code> may exceed this when [[witch fuel injectors]] or [[hyperspeed]] are in use. (See also: <code>[[#speed|speed]]</code>) | ||
=== <code>potentialCollider</code> === | === <code>potentialCollider</code> === | ||
− | potentialCollider [read-only | + | '''potentialCollider''' : [[Oolite/Development/Scripting/Class/Entity|Entity]] (read-only) |
The entity the ship is currently trying not to crash into, if any. | The entity the ship is currently trying not to crash into, if any. | ||
=== <code>primaryRole</code> === | === <code>primaryRole</code> === | ||
− | primaryRole | + | '''primaryRole''' : String (read/write, read-only for player) |
The main role of the ship; the role for which it was created. For instance, if a ship’s ''shipdata.plist'' entry specifies the roles “pirate trader(0.5) escort”, and a ship of that type is spawned to be a trader, its <code>primaryRole</code> is <code>"trader"</code>, its <code>roles</code> is <code>["escort", "pirate", "trader"]</code> and its <code>roleProbabilities</code> is <code> { "escort":1, "pirate":1, "trader":0.5}</code>. | The main role of the ship; the role for which it was created. For instance, if a ship’s ''shipdata.plist'' entry specifies the roles “pirate trader(0.5) escort”, and a ship of that type is spawned to be a trader, its <code>primaryRole</code> is <code>"trader"</code>, its <code>roles</code> is <code>["escort", "pirate", "trader"]</code> and its <code>roleProbabilities</code> is <code> { "escort":1, "pirate":1, "trader":0.5}</code>. | ||
Line 104: | Line 104: | ||
=== <code>reportAIMessages</code> === | === <code>reportAIMessages</code> === | ||
− | reportAIMessages | + | '''reportAIMessages''' : Boolean (read/write) |
Debugging facility: set to <code>true</code> to dump information about AI activity to the log. | Debugging facility: set to <code>true</code> to dump information about AI activity to the log. | ||
=== <code>roleProbabilities</code> === | === <code>roleProbabilities</code> === | ||
− | roles | + | '''roles''' : Object (read-only) |
The probabilities for each role in <code>[[#roles|roles]]</code>. Example: | The probabilities for each role in <code>[[#roles|roles]]</code>. Example: | ||
this.pirateProb = ship.roleProbabilities["pirate"] | this.pirateProb = ship.roleProbabilities["pirate"] | ||
Line 114: | Line 114: | ||
=== <code>roles</code> === | === <code>roles</code> === | ||
− | roles | + | '''roles''' : Array (read-only array of Strings) |
The roles of the ship. This consists of the roles specified in the ship’s ''shipdata.plist'' entry, as well as the <code>[[#primaryRole|primaryRole]]</code> if it is not among those. | The roles of the ship. This consists of the roles specified in the ship’s ''shipdata.plist'' entry, as well as the <code>[[#primaryRole|primaryRole]]</code> if it is not among those. | ||
Line 120: | Line 120: | ||
=== <code>scannerRange</code> === | === <code>scannerRange</code> === | ||
− | scannerRange | + | '''scannerRange''' : Number (read-only) |
The range of the ship’s scanner. | The range of the ship’s scanner. | ||
=== <code>script</code> === | === <code>script</code> === | ||
− | script | + | '''script''' : [[Oolite/Development/Scripting/Class/Script|Script]] (read-only) |
The ship’s script. | The ship’s script. | ||
=== <code>speed</code> === | === <code>speed</code> === | ||
− | speed | + | '''speed''' : Number (read-only) |
The ship’s current speed. (See also: <code>[[#maxSpeed|maxSpeed]]</code>) | The ship’s current speed. (See also: <code>[[#maxSpeed|maxSpeed]]</code>) | ||
=== <code>shipDescription</code> === | === <code>shipDescription</code> === | ||
− | shipDescription | + | '''shipDescription''' : String (read-only) |
The name of the ship type (<code>name</code> key in [[shipdata.plist]]). | The name of the ship type (<code>name</code> key in [[shipdata.plist]]). | ||
=== <code>subEntities</code> === | === <code>subEntities</code> === | ||
− | subEntities | + | '''subEntities''' : Array (read-only array of Ships) |
The ships subentities, or <code>null</code> if it has none. Special subentities such as flashers and exhaust plumes are not included. (See also: <code>[[#isFrangible|isFrangible]]</code>) | The ships subentities, or <code>null</code> if it has none. Special subentities such as flashers and exhaust plumes are not included. (See also: <code>[[#isFrangible|isFrangible]]</code>) | ||
=== <code>target</code> === | === <code>target</code> === | ||
− | target | + | '''target''' : Ship (read-write) |
The ship’s primary target, i.e. the entity it will attempt to shoot at. This value is automatically co-ordinated between a ship and its subentities. | The ship’s primary target, i.e. the entity it will attempt to shoot at. This value is automatically co-ordinated between a ship and its subentities. | ||
=== <code>temperature</code> === | === <code>temperature</code> === | ||
− | temperature | + | '''temperature''' : Number (read/write) |
The ship’s temperature, normalized such that a temperature of 1.0 is the level at which a ship starts taking heat damage. | The ship’s temperature, normalized such that a temperature of 1.0 is the level at which a ship starts taking heat damage. | ||
=== <code>weaponRange</code> === | === <code>weaponRange</code> === | ||
− | weaponRange | + | '''weaponRange''' : Number (read/write) |
The maximum range of the ship’s primary weapon. | The maximum range of the ship’s primary weapon. | ||
=== <code>withinStationAegis</code> === | === <code>withinStationAegis</code> === | ||
− | withinStationAegis | + | '''withinStationAegis''' : Boolean (read-only) |
<code>true</code> if the ship is within the aegis of the system’s main station (i.e., no more than 51 200 game metres from the station, or twice scanner range). | <code>true</code> if the ship is within the aegis of the system’s main station (i.e., no more than 51 200 game metres from the station, or twice scanner range). | ||
== Methods == | == Methods == | ||
=== <code>deployEscorts</code> === | === <code>deployEscorts</code> === | ||
− | deployEscorts() | + | '''deployEscorts'''() |
Launch the ship’s escorts, if any. | Launch the ship’s escorts, if any. | ||
=== <code>dockEscorts</code> === | === <code>dockEscorts</code> === | ||
− | dockEscorts() | + | '''dockEscorts'''() |
Dock the ship’s deployed escorts, if any. | Dock the ship’s deployed escorts, if any. | ||
=== <code>exitAI</code> === | === <code>exitAI</code> === | ||
− | exitAI() | + | '''exitAI'''() |
Exit the current AI, restoring the previous one. Equivalent to the <code>[[AI_methods|exitAI]]:</code> AI method. May not be used on player. Will generate a warning if there are no suspended AI states. (See also: <code>[[#AI|AI]]</code>, <code>[[#setAI|setAI()]]</code>, <code>[[#hasSuspendedAI|hasSuspendedAI]]</code>) | Exit the current AI, restoring the previous one. Equivalent to the <code>[[AI_methods|exitAI]]:</code> AI method. May not be used on player. Will generate a warning if there are no suspended AI states. (See also: <code>[[#AI|AI]]</code>, <code>[[#setAI|setAI()]]</code>, <code>[[#hasSuspendedAI|hasSuspendedAI]]</code>) | ||
=== <code>reactToAIMessage</code> === | === <code>reactToAIMessage</code> === | ||
− | reactToAIMessage(AIState) | + | '''reactToAIMessage'''(AIState : String) |
Immediately execute the ship’s AI in the specified state. | Immediately execute the ship’s AI in the specified state. | ||
=== <code>setAI</code> === | === <code>setAI</code> === | ||
− | setAI(AIName) | + | '''setAI'''(AIName : String) |
Set the current AI, leaving the old one suspended. Equivalent to the <code>[[AI_methods|setAITo]]:</code> AI method. May not be used on player. (See also: <code>[[#AI|AI]]</code>, <code>[[#switchAI|switchAI()]]</code>, <code>[[#exitAI|exitAI()]]</code>) | Set the current AI, leaving the old one suspended. Equivalent to the <code>[[AI_methods|setAITo]]:</code> AI method. May not be used on player. (See also: <code>[[#AI|AI]]</code>, <code>[[#switchAI|switchAI()]]</code>, <code>[[#exitAI|exitAI()]]</code>) | ||
=== <code>switchAI</code> === | === <code>switchAI</code> === | ||
− | + | '''switchAI'''(AIName : String) | |
Set the current AI, exiting the old one. Equivalent to the <code>[[AI_methods|switchAITo]]:</code> AI method. May not be used on player. (See also: <code>[[#AI|AI]]</code>, <code>[[#setAI|setAI()]]</code>, <code>[[#exitAI|exitAI()]]</code>) | Set the current AI, exiting the old one. Equivalent to the <code>[[AI_methods|switchAITo]]:</code> AI method. May not be used on player. (See also: <code>[[#AI|AI]]</code>, <code>[[#setAI|setAI()]]</code>, <code>[[#exitAI|exitAI()]]</code>) |
Revision as of 17:06, 7 September 2007
Prototype: Entity
Subtypes: Station
, Player
The Ship
class is an Entity
representing a ship, station, missile, cargo pod or other flying item – anything that can be specified in shipdata.plist. A Ship
has all the properties and methods of a Entity
, and several others.
Station
s and the Player
are types of ship. Note that these more specific types have additional properties and methods.
Contents
- 1 Properties
- 1.1 AI
- 1.2 AIState
- 1.3 beaconCode
- 1.4 bounty
- 1.5 entityPersonality
- 1.6 escorts
- 1.7 fuel
- 1.8 groupID
- 1.9 hasHostileTarget
- 1.10 hasSuspendedAI
- 1.11 heatInsulation
- 1.12 isBeacon
- 1.13 isCloaked
- 1.14 isFrangible
- 1.15 isJamming
- 1.16 isPirate
- 1.17 isPolice
- 1.18 isThargoid
- 1.19 isTrader
- 1.20 maxCargo
- 1.21 maxSpeed
- 1.22 potentialCollider
- 1.23 primaryRole
- 1.24 reportAIMessages
- 1.25 roleProbabilities
- 1.26 roles
- 1.27 scannerRange
- 1.28 script
- 1.29 speed
- 1.30 shipDescription
- 1.31 subEntities
- 1.32 target
- 1.33 temperature
- 1.34 weaponRange
- 1.35 withinStationAegis
- 2 Methods
Properties
AI
AI : String (read-only)
The name of the ship’s current AI. (See also: AIState
, setAI()
, switchAI()
, exitAI()
)
AIState
AIState : String (read/write, read-only for player)
The ship’s AI’s current state. (See also: AI
, reactToAIMessage()
, hasSuspendedAI
)
beaconCode
beaconCode : String (read-only)
If the ship is a beacon, an identifying string. The first character is used for identification on the Advanced Space Compass. For non-beacons, this property is null
. (See also: isBeacon
)
bounty
bounty : Number (read-only integer)
The bounty on the ship. This also determines its legal status. In the case of the player, it is halved at each witchspace jump.
entityPersonality
entityPersonality : Number (read-only integer)
A random number in the range 0..32767 which is generated when the ship is created. Equivalent to the entityPersonalityInt
uniform binding.
escorts
escorts : Array (read-only array of Entitys)
The ship’s deployed escorts.
fuel
fuel : Number (read/write)
The ship’s current fuel capacity, in LY. The game will limit this to the range 0..7, and round it off to the nearest tenth. (See also: Player.fuelLeakRate
)
groupID
groupID : Number (read-only)
The ID of the group to which this ship belongs. 0 for no group. An example of a group is a ship with escorts and the escorts.
hasHostileTarget
hasHostileTarget : Boolean (read-only)
true
if the ship’s AI is trying to kill something, false
otherwise. Always false
for the player.
hasSuspendedAI
hasSuspendedAI : Boolean (read-only)
true
if the ship has suspended AIs, false
otherwise.
heatInsulation
heatInsulation : Number (read/write)
The ship’s heat insulation factor. 1.0 is normal, higher values mean more resistance to heat.
isBeacon
isBeacon : Boolean (read-only)
true
if the ship is a beacon (i.e., can show up on the Advanced Space Compass with a character indicating its identity), false
otherwise. (See also: beaconCode
)
isCloaked
isCloaked : Boolean (read-only)
true
if the ship has a cloaking device which is currently active false
otherwise. If the ship has a cloaking device and sufficient energy to use it, you can activate it by setting isCloaked
to true
.
isFrangible
isFrangible : Boolean (read-only)
true
if the ship is frangible (i.e., its subentities can be destroyed separately from the main ship), false
otherwise. (See also: subEntities
)
isJamming
isJamming : Boolean (read-only)
true
if the ship has a military scanner jammer which is currently active false
otherwise.
isPirate
isPirate : Boolean (read-only)
true
if the ship is a pirate vessel, false
otherwise. Currently equivalent to primaryRole == "pirate"
.
isPolice
isPolice : Boolean (read-only)
true
if the ship is a police vessel, false
otherwise. Currently equivalent to scanClass == "CLASS_POLICE"
.
isThargoid
isThargoid : Boolean (read-only)
true
if the ship is a Thargoid vessel, false
otherwise. Currently equivalent to scanClass == "CLASS_THARGOID"
.
isTrader
isTrader : Boolean (read-only)
true
if the ship is a merchant vessel, false
otherwise. Currently equivalent to primaryRole == "trader"
.
maxCargo
maxCargo : Number (read-only integer)
The ship’s cargo capacity.
maxSpeed
maxSpeed : Number (read-only)
The ship’s maximum speed under normal power. Note that speed
may exceed this when witch fuel injectors or hyperspeed are in use. (See also: speed
)
potentialCollider
potentialCollider : Entity (read-only)
The entity the ship is currently trying not to crash into, if any.
primaryRole
primaryRole : String (read/write, read-only for player)
The main role of the ship; the role for which it was created. For instance, if a ship’s shipdata.plist entry specifies the roles “pirate trader(0.5) escort”, and a ship of that type is spawned to be a trader, its primaryRole
is "trader"
, its roles
is ["escort", "pirate", "trader"]
and its roleProbabilities
is { "escort":1, "pirate":1, "trader":0.5}
.
See also: roles
, roleProbabilities
.
reportAIMessages
reportAIMessages : Boolean (read/write)
Debugging facility: set to true
to dump information about AI activity to the log.
roleProbabilities
roles : Object (read-only)
The probabilities for each role in roles
. Example:
this.pirateProb = ship.roleProbabilities["pirate"]
See also: primaryRole
, roles
.
roles
roles : Array (read-only array of Strings)
The roles of the ship. This consists of the roles specified in the ship’s shipdata.plist entry, as well as the primaryRole
if it is not among those.
See also: primaryRole
, roleProbabilities
.
scannerRange
scannerRange : Number (read-only)
The range of the ship’s scanner.
script
script : Script (read-only)
The ship’s script.
speed
speed : Number (read-only)
The ship’s current speed. (See also: maxSpeed
)
shipDescription
shipDescription : String (read-only)
The name of the ship type (name
key in shipdata.plist).
subEntities
subEntities : Array (read-only array of Ships)
The ships subentities, or null
if it has none. Special subentities such as flashers and exhaust plumes are not included. (See also: isFrangible
)
target
target : Ship (read-write)
The ship’s primary target, i.e. the entity it will attempt to shoot at. This value is automatically co-ordinated between a ship and its subentities.
temperature
temperature : Number (read/write)
The ship’s temperature, normalized such that a temperature of 1.0 is the level at which a ship starts taking heat damage.
weaponRange
weaponRange : Number (read/write)
The maximum range of the ship’s primary weapon.
withinStationAegis
withinStationAegis : Boolean (read-only)
true
if the ship is within the aegis of the system’s main station (i.e., no more than 51 200 game metres from the station, or twice scanner range).
Methods
deployEscorts
deployEscorts()
Launch the ship’s escorts, if any.
dockEscorts
dockEscorts()
Dock the ship’s deployed escorts, if any.
exitAI
exitAI()
Exit the current AI, restoring the previous one. Equivalent to the exitAI:
AI method. May not be used on player. Will generate a warning if there are no suspended AI states. (See also: AI
, setAI()
, hasSuspendedAI
)
reactToAIMessage
reactToAIMessage(AIState : String)
Immediately execute the ship’s AI in the specified state.
setAI
setAI(AIName : String)
Set the current AI, leaving the old one suspended. Equivalent to the setAITo:
AI method. May not be used on player. (See also: AI
, switchAI()
, exitAI()
)
switchAI
switchAI(AIName : String)
Set the current AI, exiting the old one. Equivalent to the switchAITo:
AI method. May not be used on player. (See also: AI
, setAI()
, exitAI()
)