RemoteTechnologiesGroup / RemoteTech

Community developed continuation of Kerbal Space Program's RemoteTech mod.
http://remotetechnologiesgroup.github.io/RemoteTech
GNU General Public License v2.0
230 stars 103 forks source link

API methods primarily to support Kerbalism but can be used by others #754

Closed PiezPiedPy closed 5 years ago

PiezPiedPy commented 6 years ago

Added two methods for a Power Down state.

I created this functionality for Kerbalism so we can disable satellites when EC is Zero. I could not use the IsInRadioBlackout as it was conflicting with our Blackout system due to it using IsInRadioBlackout to detect if the satellite is in Blackout, we do this just in case another mod sets this flag independently of Kerbalism's CME Storms. Setting IsInRadioBlackout as a workaround for loss of power would trigger our signals display to show a Blackout for the satellite when there was none. Adding a check to not show the Blackout condition when EC was zero caused the signals display to show no Blackout when a Blackout condition existed and EC was Zero 👿

Works identically to the IsInRadioBlackout flag. Could probably be implemented better but I did not want to go messing with your code too much since I am not familiar with your project source.


Added an RTCoreSpaceCenter Class which allows mods to access connection data via API from the Space Center scene. This is needed by Kerbalism to allow it to show connection details in the Space Center Monitor display. The RTCoreSpaceCenter Class is enabled/disabled via an API method EnableInSPC


Added a method to determine if a vessel directly targets a ground station. Kerbalism uses this to determine if a vessel is directly linked to the KSC or if the connection to KSC is via a relay connection. Also a method to retrieve the name of the directly targeted ground station with the shortest link and a method to retrieve the name of the first hop satellite to KSC with the shortest link, used for the Signal monitor tooltip in Kerbalism.


Added a method to retrieve the names of satellites. Kerbalism uses this to display names in its signals tooltip.

PiezPiedPy commented 5 years ago

I've added all I need to the API for now. Any more upgrades to Kerbalisms Signal System that may need more API methods wont be in the near future. Any changes you think will improve performance or a different way to return the needed information will be appreciated.

KSP-TaxiService commented 5 years ago

It will take while to review codes and test on my side before this PR can be accepted.

Likely, I may reformat some codes for better performance or enforce the RT's best practices after this PR merge.

Many thanks for your contributions on Kerbalism and RT API!

KSP-TaxiService commented 5 years ago

@PiezPiedPy, are you able to verify in the space center scene that RT's satellite count is not zero when API's enabledInSPC is on?

My debugging tells RT does not have any satellite running in this scene.

PiezPiedPy commented 5 years ago

I've not accessed the RT satellite count in Kerbalism so I couldn't tell you what it is but I can tell you that the API functions I created for RT return the correct information I need when in the SPC.

IsRTActive RTPacketSize RTPacketInterval and the resHandler are also returning correct values from the ProtoPartModuleSnapshot and part_prefab.Modules for unloaded vessels parts with ModuleRTAntenna modules.

See this section of code https://github.com/steamp0rt/Kerbalism/pull/161/files#diff-7818d9d8809983022d8b760418a16a2dR268

Also I enable the enabledInSPC flag when in the MainMenu scene before a save game is loaded. https://github.com/steamp0rt/Kerbalism/pull/161/files#diff-d2a2ed5c7f12f6715930759b6c3b5293R11

ghost commented 5 years ago

Any way this could be backported to 1.3.1?

PiezPiedPy commented 5 years ago

Cant see why not, I compiled a 1.3.1 private build that worked. I can make a PR with the changes needed to the .csproj and build scripts but for CI, changes will be needed similar to Kerbalisms method of CI compiling that someone in the RT Team will have to make.

KSP-TaxiService commented 5 years ago

@steamp0rt I don't see why not too. I will do this along with a next RT release. PiezPiedPy, don't need to make CI changes to our RT csproj because the cores of 1.2, 1.3 and 1.4 are very similar to each other and we just swap KSP assemblies for these versions.

KSP-TaxiService commented 5 years ago

@PiezPiedPy, thanks for your patience. Please help to update and test Kerbalism on your pull request.

If it goes well, this pull request will be accepted.

PiezPiedPy commented 5 years ago

@KSP-TaxiService Tested your changes and they work fine, Thanks 😃

ghost commented 5 years ago

@KSP-TaxiService tell me when the new version of RT is out

KSP-TaxiService commented 5 years ago

I target this Sunday as I need to do a rigorous test on all new changes since the last release.

ghost commented 5 years ago

Ok.