Difference between revisions of "Oolite JavaScript Reference: Entity"

From Elite Wiki
m (The things I intended to do in the previous edit. Bah.)
m (Rearranged)
Line 24: Line 24:
  
 
<code>entity.speed()</code> is equivalent to <code>entity.[[#velocity|velocity]]().[[Oolite/Development/Scripting/Class/Vector#magnitude|magnitude]]()</code>.
 
<code>entity.speed()</code> is equivalent to <code>entity.[[#velocity|velocity]]().[[Oolite/Development/Scripting/Class/Vector#magnitude|magnitude]]()</code>.
 +
 +
=== <code>orientation</code> ===
 +
orientation [read-write [[Oolite/Development/Scripting/Class/Quaternion|Quaternion]]]
 +
The spacial orientation of the entity.
 +
 +
=== <code>heading</code> ===
 +
heading [read-only [[Oolite/Development/Scripting/Class/Vector|Vector]]]
 +
The heading of the entity. This is equivalent to <code>[[#orientation|orientation]]</code>, but ignoring the axial twist component (roll in the case of a ship).
  
 
=== <code>status</code> ===
 
=== <code>status</code> ===
Line 32: Line 40:
 
  scanClass [read-only string]
 
  scanClass [read-only string]
 
The current scan class of the entity (such as “CLASS_NEUTRAL” and “CLASS_CARGO”).
 
The current scan class of the entity (such as “CLASS_NEUTRAL” and “CLASS_CARGO”).
 
=== <code>orientation</code> ===
 
orientation [read-write [[Oolite/Development/Scripting/Class/Quaternion|Quaternion]]]
 
The spacial orientation of the entity.
 
 
=== <code>heading</code> ===
 
heading [read-only [[Oolite/Development/Scripting/Class/Vector|Vector]]]
 
The heading of the entity. This is equivalent to <code>[[#orientation|orientation]]</code>, but ignoring the axial twist component (roll in the case of a ship).
 
  
 
=== <code>mass</code> ===
 
=== <code>mass</code> ===

Revision as of 12:38, 6 April 2007

The Entity class represents an object in the game universe – Vessels, Stations and CelestialBodys are common types of entity. Note that these more specific types have additional properties and methods.

Universal IDs

Every Entity has an unique universal ID. All Oolite-provided functions which take an Entity as an argument may also be passed an integer representing the Entity’s ID.

Properties

ID

ID [read-only integer]

The universal ID of the entity.

position

position [read-write Vector]

The position of the entity in system co-ordinates.

velocity

velocity [read-write Vector]

The velocity of the entity in system units (nominal metres) per second.

speed

speed [read-write double]

The speed of the entity in system units (nominal metres) per second.

entity.speed() is equivalent to entity.velocity().magnitude().

orientation

orientation [read-write Quaternion]

The spacial orientation of the entity.

heading

heading [read-only Vector]

The heading of the entity. This is equivalent to orientation, but ignoring the axial twist component (roll in the case of a ship).

status

status [read-only string]

The current status of the entity (such as “STATUS_IN_FLIGHT” and “STATUS_BEING_SCOOPED”).

scanClass

scanClass [read-only string]

The current scan class of the entity (such as “CLASS_NEUTRAL” and “CLASS_CARGO”).

mass

mass [read-only double]

The mass of the entity. Currently, this is directly proportional to the volume.

owner

owner [read-only Entity]

The entity which owns this one. In the case of a subentity, the entity to which it is attached. In the case of a defense ship, the station it belongs to. In the case of a missile, the ship that launched it. There may be other uses.

energy

energy [read-write double]

The entity’s total energy; ranges from 0 to maxEnergy.

maxEnergy

maxEnergy [read-only double]

The highest permissible value of energy.