Difference between revisions of "Oolite JavaScript Reference: Manifest"
Eric Walch (talk | contribs) (Added Manifest page) |
|||
Line 3: | Line 3: | ||
{{Oolite-class-added|1.74}} |
{{Oolite-class-added|1.74}} |
||
− | '''<code>Manifest</code>''' |
+ | '''<code>Manifest</code>''' provides direct access to the cargo carried by the player. |
== Properties == |
== Properties == |
||
Line 9: | Line 9: | ||
'''food''' : Integer (read/write) |
'''food''' : Integer (read/write) |
||
Quantity of food in the players ship. |
Quantity of food in the players ship. |
||
+ | |||
+ | Awarding the player with extra 10 tons of food can be done in different ways: |
||
+ | Manifest.food += 10; |
||
+ | or |
||
+ | player.ship.manifest.food += 10; |
||
+ | or |
||
+ | Manifest["food"] += 10; |
||
+ | |||
+ | If there were less than 10 tons of cargo space available, any extra cargo is silently discarded. |
||
=== <code>textiles</code> === |
=== <code>textiles</code> === |
||
Line 22: | Line 31: | ||
Quantity of slaves in the players ship. |
Quantity of slaves in the players ship. |
||
− | === <code>liquor/wines</code> === |
+ | === <code>"liquor/wines"</code> === |
− | '''liquor/wines''' : Integer (read/write) |
+ | '''liquor/wines''' (or '''liquorWines'''): Integer (read/write) |
Quantity of liquor/wines in the players ship.<br> |
Quantity of liquor/wines in the players ship.<br> |
||
− | (Other allowed spellings for this property are: '''liquor_wines''' and '''liquorWines''' |
||
+ | Access the '''liquor/wines''' quantity on the hold via either |
||
+ | Manifest["liquor/wines"] |
||
+ | or |
||
+ | Manifest.liquorWines |
||
=== <code>luxuries</code> === |
=== <code>luxuries</code> === |
||
Line 63: | Line 75: | ||
Quantity of platinum in the players ship. |
Quantity of platinum in the players ship. |
||
− | === <code>gem-stones</code> === |
+ | === <code>"gem-stones"</code> === |
− | '''gem-stones''' : Integer (read/write) |
+ | '''gem-stones''' (or '''gemStones'''): Integer (read/write) |
Quantity of gem-stones in the players ship.<br> |
Quantity of gem-stones in the players ship.<br> |
||
− | (Other allowed spellings for this property are: '''gem_stones''' and '''gemStones''' |
||
+ | Access to the '''gem-stones''' property is via |
||
+ | Manifest["gem-stones"] |
||
+ | or |
||
+ | Manifest.gemStones |
||
− | === <code>alien items</code> === |
+ | === <code>"alien items"</code> === |
− | '''alien items''' : Integer (read/write) |
+ | '''alien items''' (alternative name '''alienItems'''): Integer (read/write) |
Quantity of alien items in the players ship.<br> |
Quantity of alien items in the players ship.<br> |
||
− | (Other allowed spellings for this property are: '''alien_items''' and '''alienItems''' |
||
+ | Access the '''alien items''' property either via |
||
+ | Manifest["alien items"] |
||
+ | or |
||
+ | Manifest.alienItems |
||
=== <code>list</code> === |
=== <code>list</code> === |
||
'''list''' : Array (read-only) |
'''list''' : Array (read-only) |
||
− | Array of |
+ | Array of objects. Each object contains the info for a commodity present in the player's hold: |
commodity : String |
commodity : String |
||
quantity : Integer |
quantity : Integer |
||
− | commodityName : String (= display |
+ | commodityName : String (= display name, can be different for different languages) |
unit : String ('t' = tons, 'kg' = kilograms, 'g' = grams) |
unit : String ('t' = tons, 'kg' = kilograms, 'g' = grams) |
||
− | |||
− | e.g. Awarding the player with 10 tons of food can be achieved with: |
||
− | Manifest.food += 10; |
||
− | or |
||
− | playerShip.manifest.food += 10; |
||
− | or |
||
− | Manifest["food"] += 10; |
||
− | |||
− | == Static methods == |
||
− | === <code>toString</code> === |
||
− | function '''toString'''() : String |
||
− | (Unfinished yet) |
||
[[Category:Oolite scripting]] |
[[Category:Oolite scripting]] |
Revision as of 23:14, 10 December 2009
Prototype: Object
This class was added in Oolite test release 1.74.
Manifest
provides direct access to the cargo carried by the player.
Contents
Properties
food
food : Integer (read/write)
Quantity of food in the players ship.
Awarding the player with extra 10 tons of food can be done in different ways:
Manifest.food += 10; or player.ship.manifest.food += 10; or Manifest["food"] += 10;
If there were less than 10 tons of cargo space available, any extra cargo is silently discarded.
textiles
textiles : Integer (read/write)
Quantity of textiles in the players ship.
radioactives
radioactives : Integer (read/write)
Quantity of radioactives in the players ship.
slaves
slaves : Integer (read/write)
Quantity of slaves in the players ship.
"liquor/wines"
liquor/wines (or liquorWines): Integer (read/write)
Quantity of liquor/wines in the players ship.
Access the liquor/wines quantity on the hold via either
Manifest["liquor/wines"] or Manifest.liquorWines
luxuries
luxuries : Integer (read/write)
Quantity of luxuries in the players ship.
narcotics
narcotics : Integer (read/write)
Quantity of narcotics in the players ship.
computers
computers : Integer (read/write)
Quantity of computers in the players ship.
alloys
alloys : Integer (read/write)
Quantity of alloys in the players ship.
firearms
firearms : Integer (read/write)
Quantity of firearms in the players ship.
furs
furs : Integer (read/write)
Quantity of furs in the players ship.
minerals
minerals : Integer (read/write)
Quantity of minerals in the players ship.
gold
gold : Integer (read/write)
Quantity of gold in the players ship.
platinum
platinum : Integer (read/write)
Quantity of platinum in the players ship.
"gem-stones"
gem-stones (or gemStones): Integer (read/write)
Quantity of gem-stones in the players ship.
Access to the gem-stones property is via
Manifest["gem-stones"] or Manifest.gemStones
"alien items"
alien items (alternative name alienItems): Integer (read/write)
Quantity of alien items in the players ship.
Access the alien items property either via
Manifest["alien items"] or Manifest.alienItems
list
list : Array (read-only)
Array of objects. Each object contains the info for a commodity present in the player's hold:
commodity : String quantity : Integer commodityName : String (= display name, can be different for different languages) unit : String ('t' = tons, 'kg' = kilograms, 'g' = grams)