Collection of types and functions to get information and manipulate in-game resources.
Resource flow direction
flowdirection.to_string ( ) -> string
String representation of the number
Name | Type | Read-only | Description |
---|---|---|---|
FLOW_INBOUND | ksp::resource::FlowDirection | R/O | Inbound resource request (i.e demand resource from other parts) |
FLOW_OUTBOUND | ksp::resource::FlowDirection | R/O | Outbound resource request (i.e. provide resource to other parts) |
flowdirectionconstants.from_string ( value : string ) -> Option<ksp::resource::FlowDirection>
Parse from string
Parameters
Name | Type | Optional | Description |
---|---|---|---|
value | string | Enum value to lookup |
Name | Type | Read-only | Description |
---|---|---|---|
list | ksp::resource::ResourceData[] | R/O | |
stored_total_mass | float | R/O | |
stored_total_thermal_mass | float | R/O |
resourcecontainer.dump_all ( ) -> Unit
Name | Type | Read-only | Description |
---|---|---|---|
capacity_units | float | R/O | |
resource | ksp::resource::ResourceDefinition | R/O | |
stored_units | float | R/O |
Represents an in-game resource.
Name | Type | Read-only | Description |
---|---|---|---|
display_abbreviation | string | R/O | Resource abbreviation as displayed in UI |
display_name | string | R/O | Name of the resource as displayed in UI |
id | int | R/O | Resource identifier |
is_recipe | bool | R/O | Check if resource is a recipe, i.e. a combination of resource |
mass_per_unit | float | R/O | Mass per resource unit |
mass_per_volume | float | R/O | Mass per volume aka. density |
name | string | R/O | Name of the resource |
recipe_ingredients | Option<ksp::resource::ResourceReceipeIngredient[] | R/O | Get ingredients if resource is a recipe. |
uses_air | bool | R/O | Check if resource requires air to be used. |
volume_per_unit | float | R/O | Volume per resource unit |
Name | Type | Read-only | Description |
---|---|---|---|
resource | ksp::resource::ResourceDefinition | R/O | |
units | float | R/O |
Name | Type | Read-only | Description |
---|---|---|---|
acceptance_threshold | float | R/O | |
rate | float | R/O | |
resource | ksp::resource::ResourceDefinition | R/O |
Represents a resource transfer
Name | Type | Read-only | Description |
---|---|---|---|
entries | ksp::resource::ResourceTransferEntry[] | R/O | Get currently registers resource transfer entries. |
is_running | bool | R/O | Check if a resource transfer is in progress. |
resourcetransfer.add_container ( flowDirection : ksp::resource::FlowDirection,
resourceContainer : ksp::resource::ResourceContainer,
relativeAmount : float ) -> bool
Parameters
Name | Type | Optional | Description |
---|---|---|---|
flowDirection | ksp::resource::FlowDirection | ||
resourceContainer | ksp::resource::ResourceContainer | ||
relativeAmount | float | x |
resourcetransfer.add_resource ( flowDirection : ksp::resource::FlowDirection,
resource : ksp::resource::ResourceData,
maxUnits : float ) -> bool
Parameters
Name | Type | Optional | Description |
---|---|---|---|
flowDirection | ksp::resource::FlowDirection | ||
resource | ksp::resource::ResourceData | ||
maxUnits | float |
resourcetransfer.clear ( ) -> Unit
Cleanup all registered resource transfer entries. This will implicitly stop the resource transfer if it is still running.
resourcetransfer.start ( ) -> bool
Start the resource transfer.
resourcetransfer.stop ( ) -> bool
Stop the resource transfer.
Name | Type | Read-only | Description |
---|---|---|---|
flow_direction | ksp::resource::FlowDirection | R/O | |
resource_container | ksp::resource::ResourceContainer | R/O |
Name | Type | Description |
---|---|---|
FlowDirection | ksp::resource::FlowDirectionConstants | Resource flow direction |
pub sync fn create_resource_transfer ( ) -> ksp::resource::ResourceTransfer