Difference between revisions of "Oolite JavaScript Reference: Sun"

From Elite Wiki
(Propertie goNova added)
(Name property)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
<small>'''Prototype:''' <code>[[Oolite JavaScript Reference: Entity|Entity]]</code></small><br />
 
<small>'''Prototype:''' <code>[[Oolite JavaScript Reference: Entity|Entity]]</code></small><br />
<small>'''Subtypes:''' none
+
<small>'''Subtypes:''' none</small>
 
{{Oolite-class-added|1.70}}
 
   
 
The '''<code>Sun</code>''' class is an <code>[[Oolite JavaScript Reference: Entity|Entity]]</code> representing a sun. A <code>Sun</code> has all the properties and methods of a <code>Entity</code>, and several others. Currently, Oolite supports at most one sun per system, accessible via the <code>[[Oolite JavaScript Reference: System|system]].[[Oolite JavaScript Reference: System#sun|sun]]</code> property.
 
The '''<code>Sun</code>''' class is an <code>[[Oolite JavaScript Reference: Entity|Entity]]</code> representing a sun. A <code>Sun</code> has all the properties and methods of a <code>Entity</code>, and several others. Currently, Oolite supports at most one sun per system, accessible via the <code>[[Oolite JavaScript Reference: System|system]].[[Oolite JavaScript Reference: System#sun|sun]]</code> property.
Line 6: Line 6:
 
== Properties ==
 
== Properties ==
 
=== <code>hasGoneNova</code> ===
 
=== <code>hasGoneNova</code> ===
{{Oolite-prop-added|1.72}}
 
 
'''hasGoneNova''' : Boolean (read-only)
 
'''hasGoneNova''' : Boolean (read-only)
 
True if the sun has gone nova.
 
True if the sun has gone nova.
Line 13: Line 12:
   
 
=== <code>isGoingNova</code> ===
 
=== <code>isGoingNova</code> ===
{{Oolite-prop-added|1.72}}
 
 
'''isGoingNova''' : Boolean (read-only)
 
'''isGoingNova''' : Boolean (read-only)
 
True if the sun is scheduled to go nova.
 
True if the sun is scheduled to go nova.
   
 
'''See Also:''' <code>[[#hasGoneNova|hasGoneNova]]</code>, <code>[[#goNova|goNova]]()</code>, <code>[[#cancelNova|cancelNova]]()</code>
 
'''See Also:''' <code>[[#hasGoneNova|hasGoneNova]]</code>, <code>[[#goNova|goNova]]()</code>, <code>[[#cancelNova|cancelNova]]()</code>
  +
  +
=== <code>name</code> ===
  +
{{oolite-prop-added|1.79}}
  +
'''name''' : String (read-only)
  +
The name of the sun, as set by the <code>sun_name</code> property in [[planetinfo.plist]]
   
 
=== <code>radius</code> ===
 
=== <code>radius</code> ===
Line 23: Line 26:
 
The equatorial radius of the sun, in metres.
 
The equatorial radius of the sun, in metres.
   
=== <code>goNova</code> ===
 
  +
function '''setSunNova'''(secondsUntilNova : Number)
 
Sets the system’s sun to go nova after the specified time interval. Time is specified in [[Time scales in Oolite#Game real time|game real time]]. Added in 1.72
 
   
 
== Methods ==
 
== Methods ==
 
=== <code>cancelNova</code> ===
 
=== <code>cancelNova</code> ===
{{Oolite-method-added|1.72}}
 
 
function '''cancelNova'''()
 
function '''cancelNova'''()
 
Cancels a scheduled nova, if a nova has been scheduled but not yet occurred.
 
Cancels a scheduled nova, if a nova has been scheduled but not yet occurred.
Line 36: Line 36:
   
 
=== <code>goNova</code> ===
 
=== <code>goNova</code> ===
{{Oolite-method-added|1.72}}
 
 
function '''goNova'''([delay : Number])
 
function '''goNova'''([delay : Number])
 
Causes the sun to explode. The optional <code>delay</code> parameter causes the nova to happen after a specified delay (specified in seconds in [[Time scales in Oolite#Game real time|game real time]]).
 
Causes the sun to explode. The optional <code>delay</code> parameter causes the nova to happen after a specified delay (specified in seconds in [[Time scales in Oolite#Game real time|game real time]]).
Line 42: Line 41:
 
'''See Also:''' <code>[[#hasGoneNova|hasGoneNova]]</code>, <code>[[#isGoingNova|isGoingNova]]</code>, <code>[[#cancelNova|cancelNova]]()</code>
 
'''See Also:''' <code>[[#hasGoneNova|hasGoneNova]]</code>, <code>[[#isGoingNova|isGoingNova]]</code>, <code>[[#cancelNova|cancelNova]]()</code>
   
[[Category:Oolite scripting]]
+
[[Category:Oolite JavaScript Reference]]

Latest revision as of 22:25, 6 April 2014

Prototype: Entity
Subtypes: none

The Sun class is an Entity representing a sun. A Sun has all the properties and methods of a Entity, and several others. Currently, Oolite supports at most one sun per system, accessible via the system.sun property.

Properties

hasGoneNova

hasGoneNova : Boolean (read-only)

True if the sun has gone nova.

See Also: isGoingNova, goNova()

isGoingNova

isGoingNova : Boolean (read-only)

True if the sun is scheduled to go nova.

See Also: hasGoneNova, goNova(), cancelNova()

name

This property was added in Oolite test release 1.79.

name : String (read-only)

The name of the sun, as set by the sun_name property in planetinfo.plist

radius

radius : Number (read-only)

The equatorial radius of the sun, in metres.


Methods

cancelNova

function cancelNova()

Cancels a scheduled nova, if a nova has been scheduled but not yet occurred.

See Also: hasGoneNova, isGoingNova, goNova()

goNova

function goNova([delay : Number])

Causes the sun to explode. The optional delay parameter causes the nova to happen after a specified delay (specified in seconds in game real time).

See Also: hasGoneNova, isGoingNova, cancelNova()