Oolite JavaScript Reference: Planet

From Elite Wiki
Revision as of 10:53, 20 February 2011 by Thargoid (talk | contribs) (PFNoLand and PFNoLandQuiet)

Prototype: Entity
Subtypes: none

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

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.

isMainPlanet

isMainPlanet : Boolean (read-only)

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

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 planet information screen as: 2816 km to 6911 km. (Note the discrepancy of a factor 100.)

rotationalVelocity

This property was added in Oolite test release 1.75.

rotationalVelocity : Number (read/write)

The rotation speed of a planet. A value of x means: x/Math.PI rotations per second. The main planet default value is pseudorandom and varies between 0.0 until 0.01

texture

texture : String (read/write)

The name of the texture file (diffuse map) used by the planet. This may only be assigned to during the shipWillExitWitchspace and shipWillLaunchFromStation events.

Non-standard 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. Important: the use of custom properties without a unique OXP-specific prefix is strongly discouraged and may cause conflicts with future versions of Oolite.

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 for the Solar System OXP and used by the Planetfall OXP.

PFNoLand and PFNoLandQuiet

PFNoLand : Boolean (read/write)
PFNoLandQuiet : Boolean (read/write)

true if landing will be prevented on the planet's surface (with and without a warning message), false otherwise. Created and used by the Planetfall OXP from version 1.40 onwards.

isGasGiant

isGasGiant : Boolean (read/write)

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