Resources#
-
type krpc_SpaceCenter_Resources_t#
Represents the collection of resources stored in a vessel, stage or part. Created by calling
krpc_SpaceCenter_Vessel_Resources(),krpc_SpaceCenter_Stage_Resources(),krpc_SpaceCenter_EditorVessel_Resources()orkrpc_SpaceCenter_Part_Resources().-
krpc_error_t krpc_SpaceCenter_Resources_All(krpc_connection_t connection, krpc_list_object_t *returnValue, krpc_SpaceCenter_Resources_t instance)#
All the individual resources that can be stored.
- Game Scenes:
Flight, Editor Vab, Editor Sph
-
krpc_error_t krpc_SpaceCenter_Resources_WithResource(krpc_connection_t connection, krpc_list_object_t *returnValue, krpc_SpaceCenter_Resources_t instance, const char *name)#
All the individual resources with the given name that can be stored.
- Parameters:
- Game Scenes:
Flight, Editor Vab, Editor Sph
-
krpc_error_t krpc_SpaceCenter_Resources_Names(krpc_connection_t connection, krpc_list_string_t *returnValue, krpc_SpaceCenter_Resources_t instance)#
A list of resource names that can be stored.
- Game Scenes:
Flight, Editor Vab, Editor Sph
-
krpc_error_t krpc_SpaceCenter_Resources_HasResource(krpc_connection_t connection, bool *returnValue, krpc_SpaceCenter_Resources_t instance, const char *name)#
Check whether the named resource can be stored.
- Parameters:
name – The name of the resource.
- Game Scenes:
Flight, Editor Vab, Editor Sph
-
krpc_error_t krpc_SpaceCenter_Resources_Amount(krpc_connection_t connection, float *returnValue, krpc_SpaceCenter_Resources_t instance, const char *name)#
Returns the amount of a resource that is currently stored.
- Parameters:
name – The name of the resource.
- Game Scenes:
Flight, Editor Vab, Editor Sph
-
krpc_error_t krpc_SpaceCenter_Resources_Max(krpc_connection_t connection, float *returnValue, krpc_SpaceCenter_Resources_t instance, const char *name)#
Returns the amount of a resource that can be stored.
- Parameters:
name – The name of the resource.
- Game Scenes:
Flight, Editor Vab, Editor Sph
-
krpc_error_t krpc_SpaceCenter_Resources_Density(krpc_connection_t connection, float *returnValue, const char *name)#
Returns the density of a resource, in \(kg/l\).
- Parameters:
name – The name of the resource.
- Game Scenes:
Flight, Editor Vab, Editor Sph
-
krpc_error_t krpc_SpaceCenter_Resources_FlowMode(krpc_connection_t connection, krpc_SpaceCenter_ResourceFlowMode_t *returnValue, const char *name)#
Returns the flow mode of a resource.
- Parameters:
name – The name of the resource.
- Game Scenes:
Flight, Editor Vab, Editor Sph
-
krpc_error_t krpc_SpaceCenter_Resources_Enabled(krpc_connection_t connection, bool *returnValue, krpc_SpaceCenter_Resources_t instance)#
-
krpc_error_t krpc_SpaceCenter_Resources_set_Enabled(krpc_connection_t connection, krpc_SpaceCenter_Resources_t instance, bool value)#
Whether use of all the resources are enabled.
- Game Scenes:
Flight, Editor Vab, Editor Sph
Note
This is
trueif all of the resources are enabled. If any of the resources are not enabled, this isfalse.
-
krpc_error_t krpc_SpaceCenter_Resources_All(krpc_connection_t connection, krpc_list_object_t *returnValue, krpc_SpaceCenter_Resources_t instance)#
-
type krpc_SpaceCenter_Resource_t#
An individual resource stored within a part. Created using methods in the
krpc_SpaceCenter_Resources_tclass.-
krpc_error_t krpc_SpaceCenter_Resource_Name(krpc_connection_t connection, char **returnValue, krpc_SpaceCenter_Resource_t instance)#
The name of the resource.
- Game Scenes:
Flight, Editor Vab, Editor Sph
-
krpc_error_t krpc_SpaceCenter_Resource_Part(krpc_connection_t connection, krpc_SpaceCenter_Part_t *returnValue, krpc_SpaceCenter_Resource_t instance)#
The part containing the resource.
- Game Scenes:
Flight, Editor Vab, Editor Sph
-
krpc_error_t krpc_SpaceCenter_Resource_Amount(krpc_connection_t connection, float *returnValue, krpc_SpaceCenter_Resource_t instance)#
The amount of the resource that is currently stored in the part.
- Game Scenes:
Flight, Editor Vab, Editor Sph
-
krpc_error_t krpc_SpaceCenter_Resource_Max(krpc_connection_t connection, float *returnValue, krpc_SpaceCenter_Resource_t instance)#
The total amount of the resource that can be stored in the part.
- Game Scenes:
Flight, Editor Vab, Editor Sph
-
krpc_error_t krpc_SpaceCenter_Resource_Density(krpc_connection_t connection, float *returnValue, krpc_SpaceCenter_Resource_t instance)#
The density of the resource, in \(kg/l\).
- Game Scenes:
Flight, Editor Vab, Editor Sph
-
krpc_error_t krpc_SpaceCenter_Resource_FlowMode(krpc_connection_t connection, krpc_SpaceCenter_ResourceFlowMode_t *returnValue, krpc_SpaceCenter_Resource_t instance)#
The flow mode of the resource.
- Game Scenes:
Flight, Editor Vab, Editor Sph
-
krpc_error_t krpc_SpaceCenter_Resource_Enabled(krpc_connection_t connection, bool *returnValue, krpc_SpaceCenter_Resource_t instance)#
-
krpc_error_t krpc_SpaceCenter_Resource_set_Enabled(krpc_connection_t connection, krpc_SpaceCenter_Resource_t instance, bool value)#
Whether use of this resource is enabled.
- Game Scenes:
Flight, Editor Vab, Editor Sph
-
krpc_error_t krpc_SpaceCenter_Resource_Name(krpc_connection_t connection, char **returnValue, krpc_SpaceCenter_Resource_t instance)#
-
type krpc_SpaceCenter_ResourceTransfer_t#
Transfer resources between parts.
-
krpc_error_t krpc_SpaceCenter_ResourceTransfer_Start(krpc_connection_t connection, krpc_SpaceCenter_ResourceTransfer_t *returnValue, krpc_SpaceCenter_Part_t fromPart, krpc_SpaceCenter_Part_t toPart, const char *resource, float 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
krpc_SpaceCenter_ResourceTransfer_Complete()to check if the transfer is complete. Usekrpc_SpaceCenter_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.
Note
Use
krpc_SpaceCenter_ResourceTransfer_Cancel()to stop the transfer before it finishes; a canceled transfer is marked as complete. Usekrpc_SpaceCenter_ResourceTransfer_Remove()to release the memory the server holds for a transfer that is done with. A transfer is stopped and removed if the client that started it disconnects, or if the flight it runs in is left.
-
krpc_error_t krpc_SpaceCenter_ResourceTransfer_Cancel(krpc_connection_t connection, krpc_SpaceCenter_ResourceTransfer_t instance)#
Cancel the transfer. No more of the resource is moved and
krpc_SpaceCenter_ResourceTransfer_Complete()becomes true.
-
krpc_error_t krpc_SpaceCenter_ResourceTransfer_Remove(krpc_connection_t connection, krpc_SpaceCenter_ResourceTransfer_t instance)#
Remove the transfer, releasing the memory the server holds for it. The transfer is canceled if it has not finished.
Note
Any further use of this object throws an exception. A transfer that is left is held until the parts it runs between are gone, the flight it runs in is left, or the client that started it disconnects, whichever comes first; the first of those may be the rest of the flight away.
-
krpc_error_t krpc_SpaceCenter_ResourceTransfer_Amount(krpc_connection_t connection, float *returnValue, krpc_SpaceCenter_ResourceTransfer_t instance)#
The amount of the resource that has been transferred.
-
krpc_error_t krpc_SpaceCenter_ResourceTransfer_Complete(krpc_connection_t connection, bool *returnValue, krpc_SpaceCenter_ResourceTransfer_t instance)#
Whether the transfer has completed. Also becomes true if the transfer is canceled by calling
krpc_SpaceCenter_ResourceTransfer_Cancel().
-
krpc_error_t krpc_SpaceCenter_ResourceTransfer_Start(krpc_connection_t connection, krpc_SpaceCenter_ResourceTransfer_t *returnValue, krpc_SpaceCenter_Part_t fromPart, krpc_SpaceCenter_Part_t toPart, const char *resource, float maxAmount)#
-
type krpc_SpaceCenter_ResourceFlowMode_t#
The way in which a resource flows between parts. See
krpc_SpaceCenter_Resources_FlowMode().-
KRPC_SPACECENTER_RESOURCEFLOWMODE_VESSEL#
The resource flows to any part in the vessel. For example, electric charge.
-
KRPC_SPACECENTER_RESOURCEFLOWMODE_STAGE#
The resource flows from parts in the first stage, followed by the second, and so on. For example, mono-propellant.
-
KRPC_SPACECENTER_RESOURCEFLOWMODE_ADJACENT#
The resource flows between adjacent parts within the vessel. For example, liquid fuel or oxidizer.
-
KRPC_SPACECENTER_RESOURCEFLOWMODE_NONE#
The resource does not flow. For example, solid fuel.
-
KRPC_SPACECENTER_RESOURCEFLOWMODE_VESSEL#