AggregateResource

A ship can have many parts that contain resources (i.e. fuel, electric charge, etc). kOS has several tools for getting the summation of each resource.

This is the type returned as the elements of the list from LIST RESOURCES.

IN MyList <list command>

PRINT "THESE ARE ALL THE RESOURCES ON THE SHIP:".
LIST RESOURCES IN RESLIST.
FOR RES IN RESLIST {
    PRINT "Resource " + RES:NAME.
    PRINT "    value = " + RES:AMOUNT.
    PRINT "    which is "
          + ROUND(100*RES:AMOUNT/RES:CAPACITY)
          + "% full.".
}.

This is also the type returned by STAGE:RESOURCES

PRINT "THESE ARE ALL THE RESOURCES active in this stage:".
SET RESLIST TO STAGE:RESOURCES.
FOR RES IN RESLIST {
    PRINT "Resource " + RES:NAME.
    PRINT "    value = " + RES:AMOUNT.
    PRINT "    which is "
          + ROUND(100*RES:AMOUNT/RES:CAPACITY)
          + "% full.".
}.
structure AggregateResource

Suffix

Type

Description

NAME

String

Resource name

AMOUNT

Scalar

Total amount remaining

CAPACITY

Scalar

Total amount when full

DENSITY

Scalar

Density of this resource

PARTS

List

Parts containing this resource

AggregateResource:NAME
Access

Get only

Type

String

The name of the resource, i.e. “LIQUIDFUEL”, “ELECTRICCHARGE”, “MONOPROP”.

AggregateResource:AMOUNT
Access

Get only

Type

Scalar

The value of how much resource is left.

AggregateResource:CAPACITY
Access

Get only

Type

Scalar

What AMOUNT would be if the resource was filled to the top.

AggregateResource:DENSITY
Access

Get only

Type

Scalar

The density value of this resource, expressed in Megagrams f mass per Unit of resource. (i.e. a value of 0.005 would mean that each unit of this resource is 5 kilograms. Megagrams [metric tonnes] is the usual unit that most mass in the game is represented in.)

AggregateResource:PARTS
Access

Get only

Type

List

Because this is a summation of the resources from many parts. kOS gives you the list of all parts that do or could contain the resource.