ksp::science
Collection of types and functions to get information and manipulate in-game science experiments.
Types
CompletedResearchReport
Represents a completed research report
Fields
Name |
Type |
Read-only |
Description |
---|---|---|---|
definition |
R/O |
Get the definition of the experiment. |
|
experiment_id |
string |
R/O |
|
research_location_id |
string |
R/O |
|
science_value |
float |
R/O |
Experiment
Represents an in-game science experiment.
Fields
Name |
Type |
Read-only |
Description |
---|---|---|---|
crew_required |
int |
R/O |
|
current_experiment_state |
R/O |
||
current_running_time |
float |
R/O |
|
current_situation_is_valid |
bool |
R/O |
|
definition |
R/O |
Get the definition of the experiment. |
|
experiment_id |
string |
R/O |
|
experiment_location |
Option<ksp::science::ResearchLocation> |
R/O |
Get the research location the experiment was last performed. |
experiment_uses_resources |
bool |
R/O |
|
has_enough_resources |
bool |
R/O |
|
previous_experiment_state |
R/O |
||
region_required |
bool |
R/O |
|
resources_cost |
R/O |
||
time_to_complete |
float |
R/O |
|
valid_locations |
R/O |
Methods
cancel_experiment
experiment.cancel_experiment ( ) -> bool
pause_experiment
experiment.pause_experiment ( ) -> bool
run_experiment
experiment.run_experiment ( ) -> bool
ExperimentDefinition
Represents definition of an in-game science experiment.
Fields
Name |
Type |
Read-only |
Description |
---|---|---|---|
data_value |
float |
R/O |
|
display_name |
string |
R/O |
|
id |
string |
R/O |
|
requires_eva |
bool |
R/O |
|
sample_value |
float |
R/O |
|
transmission_size |
float |
R/O |
ExperimentState
Science experiment state
Methods
to_string
experimentstate.to_string ( ) -> string
String representation of the number
ExperimentStateConstants
Fields
Name |
Type |
Read-only |
Description |
---|---|---|---|
ALREADYSTORED |
R/O |
Experiment has already stored results |
|
BLOCKED |
R/O |
Experiment is blocked |
|
INSUFFICIENTCREW |
R/O |
Experiment requires more available crew members |
|
INSUFFICIENTSTORAGE |
R/O |
Not enough storage capacity for experiment |
|
INVALIDLOCATION |
R/O |
Location not valid |
|
LOCATIONCHANGED |
R/O |
Experiment location changed |
|
NOCONTROL |
R/O |
Experiment requires control of the vessel |
|
NONE |
R/O |
Unknown state |
|
OUTOFRESOURCE |
R/O |
Experiment ran out of resources |
|
PAUSED |
R/O |
Experiment is paused |
|
READY |
R/O |
Experiment is ready to run |
|
RUNNING |
R/O |
Experiment is running |
Methods
from_string
experimentstateconstants.from_string ( value : string ) -> Option<ksp::science::ExperimentState>
Parse from string
Parameters
Name |
Type |
Optional |
Description |
---|---|---|---|
value |
string |
Enum value to lookup |
ResearchLocation
Represents a research location of a science experiment.
Fields
Name |
Type |
Read-only |
Description |
---|---|---|---|
body_name |
string |
R/O |
|
id |
string |
R/O |
|
requires_region |
bool |
R/O |
|
science_region |
string |
R/O |
|
science_situation |
R/O |
ResearchReport
Represents the stored report of a science experiment
Fields
Name |
Type |
Read-only |
Description |
---|---|---|---|
definition |
R/O |
Get the definition of the experiment. |
|
ec_required |
float |
R/O |
|
experiment_id |
string |
R/O |
|
report_type |
R/O |
||
research_location |
R/O |
Get the research location the experiment was performed at. |
|
research_location_id |
string |
R/O |
|
time_required |
float |
R/O |
|
transmission_percentage |
float |
R/O |
|
transmission_size |
float |
R/O |
|
transmission_status |
bool |
R/O |
Methods
start_transmit
researchreport.start_transmit ( ) -> bool
ScienceExperimentType
Science experiment type
Methods
to_string
scienceexperimenttype.to_string ( ) -> string
String representation of the number
ScienceExperimentTypeConstants
Fields
Name |
Type |
Read-only |
Description |
---|---|---|---|
Both |
R/O |
Science experiment producing both sample and data |
|
DataType |
R/O |
Science experiment producing data |
|
SampleType |
R/O |
Science experiment producing sample |
Methods
from_string
scienceexperimenttypeconstants.from_string ( value : string ) -> Option<ksp::science::ScienceExperimentType>
Parse from string
Parameters
Name |
Type |
Optional |
Description |
---|---|---|---|
value |
string |
Enum value to lookup |
ScienceReportType
Type of science report
Methods
to_string
sciencereporttype.to_string ( ) -> string
String representation of the number
ScienceReportTypeConstants
Fields
Name |
Type |
Read-only |
Description |
---|---|---|---|
DataType |
R/O |
Science data |
|
SampleType |
R/O |
Science sample for experiments |
Methods
from_string
sciencereporttypeconstants.from_string ( value : string ) -> Option<ksp::science::ScienceReportType>
Parse from string
Parameters
Name |
Type |
Optional |
Description |
---|---|---|---|
value |
string |
Enum value to lookup |
ScienceSituation
Situation of a science experiment
Methods
to_string
sciencesituation.to_string ( ) -> string
String representation of the number
ScienceSituationConstants
Fields
Name |
Type |
Read-only |
Description |
---|---|---|---|
Atmosphere |
R/O |
Experiment inside an atmosphere |
|
HighOrbit |
R/O |
Experiment in high orbit |
|
Landed |
R/O |
Experiment while landed |
|
LowOrbit |
R/O |
Experiment in low orbit |
|
None |
R/O |
No specific situation required |
|
Splashed |
R/O |
Experiment while splashed |
Methods
from_string
sciencesituationconstants.from_string ( value : string ) -> Option<ksp::science::ScienceSituation>
Parse from string
Parameters
Name |
Type |
Optional |
Description |
---|---|---|---|
value |
string |
Enum value to lookup |
Constants
Name |
Type |
Description |
---|---|---|
ExperimentState |
ksp::science::ExperimentStateConstants |
Science experiment state |
ScienceExperimentType |
ksp::science::ScienceExperimentTypeConstants |
Science experiment type |
ScienceReportType |
ksp::science::ScienceReportTypeConstants |
Type of science report |
ScienceSituation |
ksp::science::ScienceSituationConstants |
Situation of a science experiment |
Functions
get_completed_research_reports
pub sync fn get_completed_research_reports ( ) -> ksp::science::CompletedResearchReport[]
Get all completed research reports.