Add Support for Kerbalism Science Transfers
PapaJoesSoup opened this issue ยท 2 comments
Please add support for Kerbalism science.
I guess the most important thing is the way Kerbalism handles science. There is a "Transfer Data here" button on any controllable part with a "HardDrive" when more than one part with a HardDrive is in the vessel - and a "HardDrive" can store data and/or samples in slots.
There is a difficulty setting as well, to toggle the possibility to move samples automatically (by pressing that "Transfer Data here" button) or only when a scientist is on board.
I suggest that Kerbalism's setting gets priority for the handling of samples. So the SM method of moving science should trigger the Kerbalism method (I don't know if there is an API for that @gotmachine) and obey the Kerbalism difficulty setting,
There is no API for that, you will have to use reflection on the Kerbalism classes.
For an equivalent of the "move data here" functionality, you can call the HardDrive.TransferData()
KSPEvent :
https://github.com/Kerbalism/Kerbalism/blob/1d6c68e090d9f07092306f2e0702aec4a5908e1f/src/Kerbalism/Modules/HardDrive.cs#L272-L281
If you want to provide the ability to move data from one specific drive to another, you could get the Drive
object references from the HardDrive
partmodules, and call the bool Drive.Move(Drive destination, bool moveSamples)
method :
https://github.com/Kerbalism/Kerbalism/blob/1d6c68e090d9f07092306f2e0702aec4a5908e1f/src/Kerbalism/Modules/HardDrive.cs#L38
https://github.com/Kerbalism/Kerbalism/blob/1d6c68e090d9f07092306f2e0702aec4a5908e1f/src/Kerbalism/Science/Drive.cs#L306
However, the Drive.Move()
doesn't include the check to sample transfer difficulty preferences, so you will need to somehow get the vessel crew count and PreferencesScience.Instance.sampleTransfer
bool, to pass the PreferencesScience.Instance.sampleTransfer || crewCount > 0
condition as the moveSamples
argument :
https://github.com/Kerbalism/Kerbalism/blob/6fc4503048dd766d6d29aece9f167214bdfae24f/src/Kerbalism/System/Preferences.cs#L123