Difference between revisions of "Oolite JavaScript Reference: ShipGroup"
From Elite Wiki
(Stylistic homogenization.) |
m |
||
Line 12: | Line 12: | ||
== Properties == | == Properties == | ||
=== <code>count</code> === | === <code>count</code> === | ||
− | '''count''' : | + | '''count''' : Number (integer, read-only) |
Number of ships in the group, including leader. | Number of ships in the group, including leader. | ||
=== <code>leader</code> === | === <code>leader</code> === | ||
− | '''leader''' : | + | '''leader''' : Ship (read/write) |
Defines a leader for the group. If the ship is not a member of the group, it is added. | Defines a leader for the group. If the ship is not a member of the group, it is added. | ||
Line 24: | Line 24: | ||
=== <code>ships</code> === | === <code>ships</code> === | ||
− | '''ships''' : Array | + | '''ships''' : Array ([[Oolite JavaScript Reference: Ship|Ship]]s, read-only) |
Revision as of 14:36, 20 June 2010
The ShipGroup
class is used to manage groups of ships.
Contents
Constructor
new ShipGroup() : ShipGroup
Creates a new group
Example:
var myGroup = new ShipGroup(); myGroup.name = "My group"; myShip.group = myGroup;
Properties
count
count : Number (integer, read-only)
Number of ships in the group, including leader.
leader
leader : Ship (read/write)
Defines a leader for the group. If the ship is not a member of the group, it is added.
name
name : String (read/write)
Name of the ship group.
ships
ships : Array (Ships, read-only)
Methods
addShip
function addShip(ship : Ship)
Add a ship to the group.
containsShip
function containsShip(ship : Ship) : Boolean
Returns true
if ship
is a member of the group, false
otherwise.
removeShip
function removeShip(ship : Ship)
Remove a ship from the group.