Oolite JavaScript Reference: SystemInfo

From Elite Wiki
Revision as of 15:01, 30 January 2010 by Eric Walch (talk | contribs) (Added the systemInfo object)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Prototype: Object

This class was added in Oolite test release 1.74.

SystemInfo objects provide information about a specific system.

Properties

coordinates

coordinates : Vector (read-only)

The coordinates of the system in light years. e.g. for Lave: (8, 69.2, 0). The z component is always zero.

galaxyID

galaxyID : Number (read/write nonnegative integer)

The ID number of the galaxy.

systemID

systemID : Number (read/write nonnegative integer)

The ID number of the system.


Methods

distanceToSystem

function distanceToSystem(SystenInfo) : Number

Returns the distance in light year to the other SystemInfo.


Static methods

filteredSystems

function filteredSystems(this : Object, predicate : Function ) : Array of SystemInfo

A list of the SystemInfos for which predicate returns true. Example:

SystemInfo.systemsInRange = function(range) 
{ 
   if (range === undefined) 
   { 
       range = 7; 
   } 
   
   var thisSystem = system.info; 
   return SystemInfo.filteredSystems(this, function(other) 
   { 
       return (other !== thisSystem) && (thisSystem.distanceToSystem(other) <= range); 
   }); 
}