Oolite JavaScript Reference: Planet

From Elite Wiki
Revision as of 15:05, 19 June 2010 by Ahruman (talk | contribs) (Moving Oolite JS reference into a *correctly-named* subcategory of Oolite scripting.)

Prototype: Entity
Subtypes: none

This class was added in Oolite test release 1.70.

The Planet class is an Entity representing a planet or moon. A Planet has all the properties and methods of a Entity, and several others.

Properties

isMainPlanet

isMainPlanet : Boolean (read-only)

true if the entity is the main planet of the current system, false otherwise.

hasAtmosphere

hasAtmosphere : Boolean (read-only)

true if the entity has an atmosphere, false otherwise. Planets created with the System.addMoon() method (or corresponding legacy scripting method) have no atmosphere, other planets do.

radius

radius : Number (read-only)

The equatorial radius of the planet, in metres.
For reference: Radii of main planets generated by Oolite vary between 28160 and 69110 meters. This value is shown on the F7 screen as: 2816 km to 6911 km. (note the discrepancy of a factor 100)

Extended Properties

These are not part of the official object model, but are used in various OXPs by the authors to allow manipulation of the OXP by other scripts and expansions.

solarGasGiant

solarGasGiant : Boolean (read/write)

true if the entity is a gas giant and should therefore prevent attempts to land on the planet's surface, false otherwise. Created and used by the Planetfall OXP.

isGasGiant

isGasGiant : Boolean (read/write)

true if the entity is a gas giant, false otherwise. Created and used by the System Redux 2 OXP.

Methods

setTexture

function setTexture(texture: String)

This method was added in Oolite test release 1.71.

Uses the texture file (must be a .png) as texture for the planet. This function only works when called during the shipWillExitWitchspace and shipWillLaunchFromStation events.