Resources

class SpaceCenter.Resources

Represents the collection of resources stored in a vessel, stage or part. Created by calling SpaceCenter.Vessel.resources, SpaceCenter.Vessel.resources_in_decouple_stage() or SpaceCenter.Part.resources.

all: List

All the individual resources that can be stored.

Attribute:

Read-only, cannot be set

Return type:

List

with_resource(name)

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

Parameters:

name (string) –

Return type:

List

names: List

A list of resource names that can be stored.

Attribute:

Read-only, cannot be set

Return type:

List

has_resource(name)

Check whether the named resource can be stored.

Parameters:

name (string) – The name of the resource.

Return type:

boolean

amount(name)

Returns the amount of a resource that is currently stored.

Parameters:

name (string) – The name of the resource.

Return type:

number

max(name)

Returns the amount of a resource that can be stored.

Parameters:

name (string) – The name of the resource.

Return type:

number

static density(name)

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

Parameters:

name (string) – The name of the resource.

Return type:

number

static flow_mode(name)

Returns the flow mode of a resource.

Parameters:

name (string) – The name of the resource.

Return type:

SpaceCenter.ResourceFlowMode

enabled: boolean

Whether use of all the resources are enabled.

Attribute:

Can be read or written

Return type:

boolean

Note

This is True if all of the resources are enabled. If any of the resources are not enabled, this is False.

class SpaceCenter.Resource

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

name: string

The name of the resource.

Attribute:

Read-only, cannot be set

Return type:

string

part: SpaceCenter.Part

The part containing the resource.

Attribute:

Read-only, cannot be set

Return type:

SpaceCenter.Part

amount: number

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

Attribute:

Read-only, cannot be set

Return type:

number

max: number

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

Attribute:

Read-only, cannot be set

Return type:

number

density: number

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

Attribute:

Read-only, cannot be set

Return type:

number

flow_mode: SpaceCenter.ResourceFlowMode

The flow mode of the resource.

Attribute:

Read-only, cannot be set

Return type:

SpaceCenter.ResourceFlowMode

enabled: boolean

Whether use of this resource is enabled.

Attribute:

Can be read or written

Return type:

boolean

class SpaceCenter.ResourceTransfer

Transfer resources between parts.

static start(from_part, to_part, resource, max_amount)

Start transferring a resource transfer between a pair of parts. The transfer will move at most max_amount 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 SpaceCenter.ResourceTransfer.complete to check if the transfer is complete. Use SpaceCenter.ResourceTransfer.amount to see how much of the resource has been transferred.

Parameters:
  • from_part (SpaceCenter.Part) – The part to transfer to.

  • to_part (SpaceCenter.Part) – The part to transfer from.

  • resource (string) – The name of the resource to transfer.

  • max_amount (number) – The maximum amount of resource to transfer.

Return type:

SpaceCenter.ResourceTransfer

amount: number

The amount of the resource that has been transferred.

Attribute:

Read-only, cannot be set

Return type:

number

complete: boolean

Whether the transfer has completed.

Attribute:

Read-only, cannot be set

Return type:

boolean

class SpaceCenter.ResourceFlowMode

The way in which a resource flows between parts. See SpaceCenter.Resources.flow_mode().

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.