Oolite JavaScript Reference: System

From Elite Wiki
Revision as of 15:32, 4 August 2007 by Ahruman (talk | contribs) (New page: <small>'''Prototype:''' <code>Object</code></small><br /> <small>'''Subtypes:''' none {{Oolite-future-scripting}} The '''<code>System</code>''' class represents the current system. There...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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”.

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, x, y, z)
void legacy_addShipsAtPrecisely(role, number, coordscheme, x, y, z)
void legacy_addShipsWithinRadius(role, number, coordScheme, x, y, z, 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.