Resources

class Resources

Represents the collection of resources stored in a vessel, stage or part. Created by calling Vessel.Resources, Vessel.ResourcesInDecoupleStage or Part.Resources.

IList<Resource> All { get; }

All the individual resources that can be stored.

Game Scenes:Flight
IList<Resource> WithResource (String name)

All the individual resources with the given name that can be stored.

Parameters:
Game Scenes:Flight
IList<String> Names { get; }

A list of resource names that can be stored.

Game Scenes:Flight
Boolean HasResource (String name)

Check whether the named resource can be stored.

Parameters:
  • name – The name of the resource.
Game Scenes:

Flight

Single Amount (String name)

Returns the amount of a resource that is currently stored.

Parameters:
  • name – The name of the resource.
Game Scenes:

Flight

Single Max (String name)

Returns the amount of a resource that can be stored.

Parameters:
  • name – The name of the resource.
Game Scenes:

Flight

static Single Density (IConnection connection, String name)

Returns the density of a resource, in \(kg/l\).

Parameters:
  • name – The name of the resource.
Game Scenes:

Flight

static ResourceFlowMode FlowMode (IConnection connection, String name)

Returns the flow mode of a resource.

Parameters:
  • name – The name of the resource.
Game Scenes:

Flight

Boolean Enabled { get; set; }

Whether use of all the resources are enabled.

Game Scenes:Flight

Note

This is true if all of the resources are enabled. If any of the resources are not enabled, this is false.

class Resource

An individual resource stored within a part. Created using methods in the Resources class.

String Name { get; }

The name of the resource.

Game Scenes:All
Part Part { get; }

The part containing the resource.

Game Scenes:All
Single Amount { get; }

The amount of the resource that is currently stored in the part.

Game Scenes:All
Single Max { get; }

The total amount of the resource that can be stored in the part.

Game Scenes:All
Single Density { get; }

The density of the resource, in \(kg/l\).

Game Scenes:All
ResourceFlowMode FlowMode { get; }

The flow mode of the resource.

Game Scenes:All
Boolean Enabled { get; set; }

Whether use of this resource is enabled.

Game Scenes:All
class ResourceTransfer

Transfer resources between parts.

static ResourceTransfer Start (IConnection connection, Part fromPart, Part toPart, String resource, Single maxAmount)

Start transferring a resource transfer between a pair of parts. The transfer will move at most maxAmount units of the resource, depending on how much of the resource is available in the source part and how much storage is available in the destination part. Use ResourceTransfer.Complete to check if the transfer is complete. Use ResourceTransfer.Amount to see how much of the resource has been transferred.

Parameters:
  • fromPart – The part to transfer to.
  • toPart – The part to transfer from.
  • resource – The name of the resource to transfer.
  • maxAmount – The maximum amount of resource to transfer.
Game Scenes:

All

Single Amount { get; }

The amount of the resource that has been transferred.

Game Scenes:All
Boolean Complete { get; }

Whether the transfer has completed.

Game Scenes:All
enum ResourceFlowMode

The way in which a resource flows between parts. See Resources.FlowMode.

Vessel

The resource flows to any part in the vessel. For example, electric charge.

Stage

The resource flows from parts in the first stage, followed by the second, and so on. For example, mono-propellant.

Adjacent

The resource flows between adjacent parts within the vessel. For example, liquid fuel or oxidizer.

None

The resource does not flow. For example, solid fuel.