Difference between revisions of "Oolite JavaScript Reference: System"

From Elite Wiki
m (Generalized legacy_addShipsAt/legacy_addShipsAtPrecisely/legacy_addShipsWithinRadius to take vectorExpressions.)
(Properties: Added mainStation.)
Line 52: Line 52:
 
inhabitantsDescription [read/write string]
 
inhabitantsDescription [read/write string]
 
The description of the inhabitants of the current system, such as “Slimy Blue Frogs”.
 
The description of the inhabitants of the current system, such as “Slimy Blue Frogs”.
  +
  +
=== <code>mainStation</code> ===
  +
mainStation [read-only [[Oolite/Development/Scripting/Class/Station|Station]]]
  +
The system’s main station, or <code>null</code> if there is none.
   
 
=== <code>population</code> ===
 
=== <code>population</code> ===
Line 64: Line 68:
 
techLevel [read/write int]
 
techLevel [read/write int]
 
The technology level of the current system, ranging from 0 to 15.
 
The technology level of the current system, ranging from 0 to 15.
 
   
 
== Methods ==
 
== Methods ==

Revision as of 16:51, 4 August 2007

Prototype: Object
Subtypes: none

The System class represents the current system. There is always one System object, available through the global propery system.

Attempts to change system properties are ignored in interstellar space (i.e., the place you end up in after a witchspace malfunction).

Properties

description

description [read/write string]

The description of the current system, as seen on the planet info screen.

economy

economy [read/write int]

The type of economy in the current system, ranging from 0 (Rich Industrial) to 7 (Poor Agricultural). (See also: economyDescription)

economyDescription

economyDescription [read-only string]

A description of the economy type, for example, “Mostly Industrial”. (See also: economy)

ID

ID [read-only integer]

A number identifying the system. 0 to 255, or -1 for interstellar space. Equivalent to planet_number in plist scripts.

inhabitantsDescription

inhabitantsDescription [read/write string]

The description of the inhabitants of the current system, such as “Slimy Blue Frogs”.

isInterstellarSpace

isInterstellarSpace [read-only boolean]

true if the current system is in interstellar space, false otherwise.

goingNova

goingNova [read-only boolean]

true if the system’s sun is in the process of going nova, false otherwise. (To do: this should be a propery of the sun.) (See also: goneNova, setSunNova())

goneNova

goneNova [read-only boolean]

true if the system’s sun hase gone nova, false otherwise. (To do: this should be a propery of the sun.) (See also: goingNova, setSunNova())

government

government [read/write int]

The type of government in the current system, ranging from 0 (Anarchy) to 7 (Corporate State). (See also: governmentDescription)

governmentDescription

governmentDescription [read-only string]

A description of the government type, for example, “Democracy”. (See also: government)

inhabitantsDescription

inhabitantsDescription [read/write string]

The description of the inhabitants of the current system, such as “Slimy Blue Frogs”.

mainStation

mainStation [read-only Station]

The system’s main station, or null if there is none.

population

population [read/write int]

The population of the current system.

productivity

productivity [read/write int]

The productivity of the current system.

techLevel

techLevel [read/write int]

The technology level of the current system, ranging from 0 to 15.

Methods

addMoon

void addMoon(planetInfoKey)

Adds a moon to the system, using the specified entry in planetinfo.plist. A moon is the same as a planet, except that it has no atmosphere. (See also: addPlanet())

addPlanet

void addPlanet(planetInfoKey)

Adds a planet to the system, using the specified entry in planetinfo.plist. (See also: addMoon())

countShipsWithRole

integer countShipsWithRole(role)

Returns the number of ships with the specified role in the system; equivalent to checkForShips: in plist scripts. (To do: array shipsWithRole(role))

legacy_addShips etc.

void legacy_addShips(role, number)
void legacy_addSystemShips(role, number, position)
void legacy_addShipsAt(role, number, coordscheme, vectorExpression)
void legacy_addShipsAtPrecisely(role, number, coordscheme, vectorExpression)
void legacy_addShipsWithinRadius(role, number, coordScheme, vectorExpression, radius)
void legacy_spawn(role, number)
void legacy_spawnShip(shipDataKey)

Various ways of causing ships to appear. Each of these corresponds to a legacy scripting method. A new, more flexible addShips() function will supersede all of them.

sendAllShipsAway

void sendAllShipsAway()

Makes all ships hyperspace out of the system.

setSunNova

void setSunNova(secondsUntilNova)

Sets the system’s sun to go nova after the specified time interval. Time is specified in game real time.