Difference between revisions of "Oolite JavaScript Reference: Station"

From Elite Wiki
m (corrected the added-templates)
(Added new launch methods)
Line 28: Line 28:
 
  '''dockPlayer()''' : Boolean  
 
  '''dockPlayer()''' : Boolean  
 
This method docks the player at the specified station. Returns false if docking fails, otherwise true.
 
This method docks the player at the specified station. Returns false if docking fails, otherwise true.
 +
 +
=== <code>launchDefenseShip</code> ===
 +
{{Oolite-method-added|1.74}}
 +
'''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.
 +
 +
=== <code>launchMiner</code> ===
 +
{{Oolite-method-added|1.74}}
 +
'''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.
 +
 +
=== <code>launchPatrol</code> ===
 +
{{Oolite-method-added|1.74}}
 +
'''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.
 +
 +
=== <code>launchPirateShip</code> ===
 +
{{Oolite-method-added|1.74}}
 +
'''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.
 +
 +
=== <code>launchPolice</code> ===
 +
{{Oolite-method-added|1.74}}
 +
'''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<br>
 +
It will only launch a ship if the station has a target and there are police ships left.
 +
 +
=== <code>launchScavenger</code> ===
 +
{{Oolite-method-added|1.74}}
 +
'''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.
  
 
=== <code>launchShipWithRole</code> ===
 
=== <code>launchShipWithRole</code> ===
 
{{Oolite-method-added|1.74}}
 
{{Oolite-method-added|1.74}}
 
  '''launchShipWithRole(role : string)''' : Ship  
 
  '''launchShipWithRole(role : string)''' : Ship  
This method adds a ship with given role to the launching queue at the specified station. Returns the entity of the chosen 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.
 +
 
 +
=== <code>launchShuttle</code> ===
 +
{{Oolite-method-added|1.74}}
 +
'''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.
  
 
[[Category:Oolite scripting]]
 
[[Category:Oolite scripting]]

Revision as of 22:55, 2 December 2009

Prototype: Ship

This class was added in Oolite test release 1.70.

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.

Properties

alertCondition

This property was added in Oolite test release 1.72.

alertCondition : Number (read/write, integer)

Returns the current alert condition. 1 = Green, 2 = Yellow, 3 = Red.

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.

Methods

dockPlayer

This method was added in Oolite test release 1.73.

dockPlayer() : Boolean 

This method docks the player at the specified station. Returns false if docking fails, otherwise true.

launchDefenseShip

This method was added in Oolite test release 1.74.

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.

launchMiner

This method was added in Oolite test release 1.74.

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

This method was added in Oolite test release 1.74.

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

This method was added in Oolite test release 1.74.

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

This method was added in Oolite test release 1.74.

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.

launchScavenger

This method was added in Oolite test release 1.74.

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

This method was added in Oolite test release 1.74.

launchShipWithRole(role : string) : 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.

launchShuttle

This method was added in Oolite test release 1.74.

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.