# 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
PARTS List Parts containing this resource
AggregateResource:NAME
Access: Get only string

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

AggregateResource:AMOUNT
Access: Get only scalar

The value of how much resource is left.

AggregateResource:CAPACITY
Access: Get only scalar

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

AggregateResource:PARTS
Access: Get only 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.