Difference between revisions of "Oolite JavaScript Reference: EquipmentInfo"
(Update for 1.75.) |
(Removed Oolite 1.75 change notes.) |
||
Line 10: | Line 10: | ||
== Properties == | == Properties == | ||
=== <code>canBeDamaged</code> === | === <code>canBeDamaged</code> === | ||
− | |||
'''canBeDamaged''' : Boolean (read-only) | '''canBeDamaged''' : Boolean (read-only) | ||
<code>true</code> if the equipment type can be damaged (either in combat or using <code>[[Oolite JavaScript Reference: Ship#setEquipmentStatus|Ship.setEquipmentStatus()]]</code>), <code>false</code> otherwise. Currently, this is hard-coded: trumbles, passenger berths, cargo bays and external stores are invulnerable. | <code>true</code> if the equipment type can be damaged (either in combat or using <code>[[Oolite JavaScript Reference: Ship#setEquipmentStatus|Ship.setEquipmentStatus()]]</code>), <code>false</code> otherwise. Currently, this is hard-coded: trumbles, passenger berths, cargo bays and external stores are invulnerable. | ||
=== <code>canCarryMultiple</code> === | === <code>canCarryMultiple</code> === | ||
− | |||
'''canCarryMultiple''' : Boolean (read-only) | '''canCarryMultiple''' : Boolean (read-only) | ||
<code>true</code> if multiple instances of the equipment type can be used at once, <code>false</code> otherwise. Currently, this is hard-coded to trumbles, passenger berths and external stores. | <code>true</code> if multiple instances of the equipment type can be used at once, <code>false</code> otherwise. Currently, this is hard-coded to trumbles, passenger berths and external stores. | ||
Line 45: | Line 43: | ||
=== <code>isAvailableToNPCs</code> === | === <code>isAvailableToNPCs</code> === | ||
− | |||
'''isAvailableToNPCs''' : Boolean (read-only) | '''isAvailableToNPCs''' : Boolean (read-only) | ||
<code>true</code> if the equipment type can be used by non-player ships (<code>available_to_player</code> in [[equipment.plist]], default <code>true</code>). | <code>true</code> if the equipment type can be used by non-player ships (<code>available_to_player</code> in [[equipment.plist]], default <code>true</code>). | ||
=== <code>isAvailableToPlayer</code> === | === <code>isAvailableToPlayer</code> === | ||
− | |||
'''isAvailableToPlayer''' : Boolean (read-only) | '''isAvailableToPlayer''' : Boolean (read-only) | ||
<code>true</code> if the equipment type can be used by player ships (<code>available_to_player</code> in [[equipment.plist]], default <code>true</code>). | <code>true</code> if the equipment type can be used by player ships (<code>available_to_player</code> in [[equipment.plist]], default <code>true</code>). | ||
Line 63: | Line 59: | ||
=== <code>isVisible</code> === | === <code>isVisible</code> === | ||
− | |||
'''isVisible''' : Boolean (read-only) | '''isVisible''' : Boolean (read-only) | ||
<code>true</code> if the equipment type is visible on the ship info screen (<code>visible</code> in [[equipment.plist]], default: <code>true</code>). | <code>true</code> if the equipment type is visible on the ship info screen (<code>visible</code> in [[equipment.plist]], default: <code>true</code>). | ||
Line 130: | Line 125: | ||
=== <code>scriptName</code> === | === <code>scriptName</code> === | ||
− | |||
'''scriptName''' : String (read-only) | '''scriptName''' : String (read-only) | ||
The name of an attached script. | The name of an attached script. |
Revision as of 21:38, 16 December 2011
Prototype: Object
Subtypes: none
EquipmentInfo
objects provide information about a type of equipment. To acquire an EquipmentInfo
object, use the infoForKey()
method, as in:
var missileInfo = EquipmentInfo.infoForKey("EQ_MISSILE");
Contents
- 1 Equipment Expressions
- 2 Properties
- 2.1 canBeDamaged
- 2.2 canCarryMultiple
- 2.3 description
- 2.4 effectiveTechLevel
- 2.5 equipmentKey
- 2.6 incompatibleEquipment
- 2.7 isAvailableToAll
- 2.8 isAvailableToNPCs
- 2.9 isAvailableToPlayer
- 2.10 isExternalStore
- 2.11 isPortableBetweenShips
- 2.12 isVisible
- 2.13 name
- 2.14 price
- 2.15 requiredCargoSpace
- 2.16 requiresAnyEquipment
- 2.17 requiresCleanLegalRecord
- 2.18 requiresEmptyPylon
- 2.19 requiresEquipment
- 2.20 requiresFreePassengerBerth
- 2.21 requiresFullFuel
- 2.22 requiresMountedPylon
- 2.23 requiresNonCleanLegalRecord
- 2.24 requiresNonFullFuel
- 2.25 scriptInfo
- 2.26 scriptName
- 2.27 techLevel
- 3 Static properties
- 4 Static methods
Equipment Expressions
Many methods can take either an EquipmentInfo
or an equipment key. For instance, ship.hasEquipment("EQ_ECM")
is equivalent to ship.hasEquipment(EquipmentInfo.infoForKey("EQ_ECM"))
. In specifications, this is represented by arguments typed equipmentInfoExpression
.
Properties
canBeDamaged
canBeDamaged : Boolean (read-only)
true
if the equipment type can be damaged (either in combat or using Ship.setEquipmentStatus()
), false
otherwise. Currently, this is hard-coded: trumbles, passenger berths, cargo bays and external stores are invulnerable.
canCarryMultiple
canCarryMultiple : Boolean (read-only)
true
if multiple instances of the equipment type can be used at once, false
otherwise. Currently, this is hard-coded to trumbles, passenger berths and external stores.
description
description : String (read-only)
A short description of the equipment, as seen on the Ship Outfitting screen.
effectiveTechLevel
effectiveTechLevel : Number (read/write nonnegative integer)
The effective tech level required to purchase this item. Unlike techLevel
, this takes the special meaning of 99 and TL_FOR_EQ_WHATEVER
mission variables into account. If the raw tech level is 99, changing the value of effectiveTechLevel
is equivalent to setting the appropriate TL_FOR_EQ_WHATEVER
mission variable. If the raw tech level is not 99, changes to effectiveTechLevel
are ignored.
Setting effectiveTechLevel
to null
, will remove the corresponding TL_FOR_EQ_WHATEVER
mission variable.
See also: techLevel
equipmentKey
equipmentKey : String (read-only)
The equipment key for the equipment described by this EquipmentInfo
object. For EQ_MISSILE, this is "EQ_MISSILE".
incompatibleEquipment
incompatibleEquipment : Array (read-only)
An array of equipment keys (in arbitrary order). In order to be installed, no item in this array may already be installed.
See also: requiresAnyEquipment
, requiresEquipment
isAvailableToAll
isAvailableToAll : Boolean (read-only)
true
if the equipment type can be used with any ship, regardless of its shipyard settings.
isAvailableToNPCs
isAvailableToNPCs : Boolean (read-only)
true
if the equipment type can be used by non-player ships (available_to_player
in equipment.plist, default true
).
isAvailableToPlayer
isAvailableToPlayer : Boolean (read-only)
true
if the equipment type can be used by player ships (available_to_player
in equipment.plist, default true
).
isExternalStore
isExternalStore : Boolean (read-only)
true
for _MISSILE and _MINE equipment types.
isPortableBetweenShips
isPortableBetweenShips : Boolean (read-only)
true
if equipment of this type is kept when buying a new ship.
isVisible
isVisible : Boolean (read-only)
true
if the equipment type is visible on the ship info screen (visible
in equipment.plist, default: true
).
name
name : String (read-only)
The display name for the equipment described by this EquipmentInfo
object. This string is localized. For EQ_MISSILE in English, this is "Missile".
price
price : Number (read-only nonnegative integer)
This is the value as used in the equipment.plist. Divide this by ten for the real value in credits.
requiredCargoSpace
requiredCargoSpace : Number (read-only nonnegative integer)
requiresAnyEquipment
requiresAnyEquipment : Array (read-only)
An array of equipment keys (in arbitrary order). In order to be installed, at least one item in this array must already be installed.
See also: incompatibleEquipment
, requiresEquipment
requiresCleanLegalRecord
requiresCleanLegalRecord : Boolean (read-only)
See also: requiresNonCleanLegalRecord
requiresEmptyPylon
requiresEmptyPylon : Boolean (read-only)
True for equipment that requires at least one pylon to have nothing on it.
See also: requiresMountedPylon
requiresEquipment
requiresEquipment : Array (read-only)
An array of equipment keys (in arbitrary order). In order to be installed, all items in this array must already be installed.
See also: incompatibleEquipment
, requiresAnyEquipment
requiresFreePassengerBerth
requiresFreePassengerBerth : Boolean (read-only)
requiresFullFuel
requiresFullFuel : Boolean (read-only)
See also: requiresNonFullFuel
requiresMountedPylon
requiresMountedPylon : Boolean (read-only)
True for equipment that requires at least one pylon to have a store (missile, mine or equipment) on it.
See also: requiresEmptyPylon
requiresNonCleanLegalRecord
requiresNonCleanLegalRecord : Boolean (read-only)
See also: requiresCleanLegalRecord
requiresNonFullFuel
requiresNonFullFuel : Boolean (read-only)
See also: requiresFullFuel
scriptInfo
scriptInfo : Object (read-only)
The contents of the script_info
key in the equipments’s equipment.plist entry, if any. This may be any property list object, but the reccomended approach is to use a dictionary whose keys have a unique prefix (such as you should be using for file names, ship names etc.). A property list dictionary is converted to a JavaScript object with properties corresponding to the dictionary’s keys. All other property list types used with Oolite have directly corresponding JavaScript types.
scriptName
scriptName : String (read-only)
The name of an attached script.
techLevel
techLevel : Number (read-only nonnegative integer)
The raw tech level required to purchase this item. Unlike effectiveTechLevel
, this does not take the special meaning of 99 and TL_FOR_EQ_WHATEVER
mission variables into account.
See also: effectiveTechLevel
Static properties
allEquipment
allEquipment : Array (EquipmentInfos, read-only)
Returns a list of all known equipment types.
Static methods
infoForKey
function infoForKey(equipmentKey : String) : EquipmentInfo
Returns the equipment info object for a given type of equipment, or null
for an unrecognised key. Example: var missileInfo = EquipmentInfo.infoForKey("EQ_MISSILE");