Difference between revisions of "Oolite JavaScript Reference: Station"
(Update for 1.75.) |
(Removed Oolite 1.75 change notes.) |
||
Line 10: | Line 10: | ||
=== <code>allowsAutoDocking</code> === | === <code>allowsAutoDocking</code> === | ||
− | |||
'''allowsAutoDocking''' : Boolean (read/write) | '''allowsAutoDocking''' : Boolean (read/write) | ||
If <code>true</code>, the player may dock with this station using autopilot (assuming it isn’t hostile). The corresponding ''[[shipdata.plist]]'' key is <code>allows_auto_docking</code> (default: <code>true</code>). | If <code>true</code>, the player may dock with this station using autopilot (assuming it isn’t hostile). The corresponding ''[[shipdata.plist]]'' key is <code>allows_auto_docking</code> (default: <code>true</code>). | ||
=== <code>allowsFastDocking</code> === | === <code>allowsFastDocking</code> === | ||
− | |||
'''allowsFastDocking''' : Boolean (read/write) | '''allowsFastDocking''' : Boolean (read/write) | ||
If <code>true</code>, the player may dock with this station instantaneously (assuming it isn’t hostile). The corresponding ''[[shipdata.plist]]'' key is <code>allows_fast_docking</code> (default: <code>false</code>, but set to <code>true</code> when setting up the main station). | If <code>true</code>, the player may dock with this station instantaneously (assuming it isn’t hostile). The corresponding ''[[shipdata.plist]]'' key is <code>allows_fast_docking</code> (default: <code>false</code>, but set to <code>true</code> when setting up the main station). |
Revision as of 21:40, 16 December 2011
Prototype: Ship
Subtypes: none
The Station
class is an Entity
representing a station or carrier (i.e., a ship with a docking port). A Station
has all the properties and methods of a Ship
, and some others.
Contents
Properties
alertCondition
alertCondition : Number (read/write, integer)
Returns the current alert condition. 1 = Green, 2 = Yellow, 3 = Red.
allowsAutoDocking
allowsAutoDocking : Boolean (read/write)
If true
, the player may dock with this station using autopilot (assuming it isn’t hostile). The corresponding shipdata.plist key is allows_auto_docking
(default: true
).
allowsFastDocking
allowsFastDocking : Boolean (read/write)
If true
, the player may dock with this station instantaneously (assuming it isn’t hostile). The corresponding shipdata.plist key is allows_fast_docking
(default: false
, but set to true
when setting up the main station).
dockedContractors
dockedContractors : Number (read-only, integer)
Returns the number of docked contractors ships that can launch as miner or scavenger.
There is only one counter for miners and scavengers. The maximum that can launch as miner/scavenger is determined by the shipdata-key max_scavengers. However, miners can only launch when there is no other miner in the stations scanner range, even when contractor ships are docked.
dockedDefenders
dockedDefenders : Number (read-only, integer)
Returns the number of docked defence ships that can launch as defence ships.
There is only one counter for defence and police ships. However, the maximum that can launch as defenders is determined by the shipdata-key max_defense_ships.
dockedPolice
dockedPolice : Number (read-only, integer)
Returns the number of docked defence ships that can launch as police or patrol ships.
There is only one counter for defence and police ships. However, the maximum that can launch as police/patrol is determined by the shipdata-key max_police.
equipmentPriceFactor
equipmentPriceFactor : Number (read-only, float)
Returns the equipment_price_factor for the station as defined in shipdata.plist.
equivalentTechLevel
equivalentTechLevel : Number (read-only, Integer)
Returns the equivalent_tech_level for the station as defined in shipdata.plist.
hasNPCTraffic
hasNPCTraffic : Boolean (read/write)
If true
, the station has associated non-player traffic, such as shuttles, patrol ships and scavengers. Corresponds to the has_npc_traffic
shipdata.plist key.
isMainStation
isMainStation : Boolean (read-only)
true
if the station is the main station of the system, false
otherwise.
requiresDockingClearance
requiresDockingClearance : Boolean (read/write)
true
if the station requires docking clearance, false
otherwise.
suppressArrivalReports
suppressArrivalReports : Boolean (read/write)
If set to true
, arrival reports are not shown when the player docks with the station.
Methods
dockPlayer
dockPlayer() : Boolean
This method docks the player at the specified station. Returns false
if docking fails, otherwise true
.
launchDefenseShip
launchDefenseShip() : Ship
This method adds a ship with a role defined in the ship key "defense_ship_role" or a specific ship defined with a ship key "defense_ship", to the launching queue at the specified station. When no defense ships are defined it selects one from the police or interceptors. All ships launch with a primary role of "defense_ship". Returns the entity of the chosen ship. This method aborts all dockings for an immediate launch.
launchMiner
launchMiner() : Ship
This method adds a ship with a miner role to the launching queue at the specified station. Returns the entity of the chosen ship.
launchPatrol
launchPatrol() : Ship
This method adds a ship with a police role and planetPatrolAI.plist to the launching queue at the specified station. Returns the entity of the chosen ship.
launchPirateShip
launchPirateShip() : Ship
This method adds a ship with a pirate role to the launching queue at the specified station. All ships launch with a primary role of "defense_ship" and pirateAI.plist. These pirate ships are counted as defense_ship. Returns the entity of the chosen ship.
launchPolice
launchPolice() : Array
This method adds up to 4 police ships to the launching queue at the specified station. Returns an array of chosen police ships. Depending on the system it selects ships with role police or interceptor, but on launch all primary roles will be police
It will only launch a ship if the station has a target and there are police ships left. This method aborts all dockings for an immediate launch.
launchScavenger
launchScavenger() : Ship
This method adds a ship with a scavenger role to the launching queue at the specified station. Launches only a scavenger when there is a contractor ship at the station and when the number of scavengers around the station is less than the maximum number of scavengers. Returns the entity of the chosen ship.
launchShipWithRole
launchShipWithRole(role : String, [abortAllDockings : Boolean]) : Ship
This method adds a ship with given role to the launching queue at the specified station. Launches only a miner when there is a contractor ship at the station and when the number of miners around the station is zero. (there can only be one!) Returns the entity of the chosen ship.
When abortAllDockings
is true
(default: false
), all ships in the docking process get an abort message and launching of ships starts immediately. Don't use this parameter when not strictly necessary for your launching ship.
launchShuttle
launchShuttle() : Ship
This method adds a ship with a shuttle role to the launching queue at the specified station. Returns the entity of the chosen ship.