Difference between revisions of "Oolite JavaScript Reference: Planet"

From Elite Wiki
m
(Removed bits about the sun being a planet, because it now isn’t.)
Line 4: Line 4:
 
{{Oolite-future-scripting}}
 
{{Oolite-future-scripting}}
   
The '''<code>Planet</code>''' class is an <code>[[Oolite/Development/Scripting/Class/Entity|Entity]]</code> representing a celestial body. Just as a <code>[[Oolite/Development/Scripting/Class/Ship|Ship]]</code> may in fact be an asteroid, a <code>Planet</code> may be the sun. A <code>Planet</code> has all the properties and methods of a <code>Entity</code>, and several others.
+
The '''<code>Planet</code>''' class is an <code>[[Oolite/Development/Scripting/Class/Entity|Entity]]</code> representing a planet or moon. A <code>Planet</code> has all the properties and methods of a <code>Entity</code>, and several others.
   
 
== Properties ==
 
== Properties ==
Line 10: Line 10:
 
'''isMainPlanet''' : Boolean (read-only)
 
'''isMainPlanet''' : Boolean (read-only)
 
<code>true</code> if the entity is the main planet of the current system, <code>false</code> otherwise.
 
<code>true</code> if the entity is the main planet of the current system, <code>false</code> otherwise.
 
=== isSun ===
 
'''isSun''' : Boolean (read-only)
 
<code>true</code> if the entity is the sun of the current system, <code>false</code> otherwise.
 
   
 
=== hasAtmosphere ===
 
=== hasAtmosphere ===
 
'''hasAtmosphere''' : Boolean (read-only)
 
'''hasAtmosphere''' : Boolean (read-only)
<code>true</code> if the entity has an atmosphere, <code>false</code> otherwise. The sun and planets created with the <code>System.[[Oolite/Development/Scripting/Class/System#addMoon|addMoon]]()</code> method (or corresponding legacy scripting method) have no atmosphere, other planets do.
+
<code>true</code> if the entity has an atmosphere, <code>false</code> otherwise. Planets created with the <code>System.[[Oolite/Development/Scripting/Class/System#addMoon|addMoon]]()</code> method (or corresponding legacy scripting method) have no atmosphere, other planets do.
   
 
=== radius ===
 
=== radius ===

Revision as of 14:22, 15 October 2007

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

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.