RemoteTechnologiesGroup / RemoteTech

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

VAB and SPH target button #724

Closed drunkeNNN closed 4 years ago

drunkeNNN commented 7 years ago

added VAB and SPH target button created vessel storage that keeps track of sat guid, name and body while in VAB and SPH

neitsa commented 7 years ago

@drunkeNNN Thanks a lot for your PR; would it be possible to remove all the project related files from your PR (the two .json and your .sln). Thanks a lot :)

KSP-TaxiService commented 7 years ago

@drunkeNNN Can you remove your csproj as well? We are using Appveyor, automated build bot, to compile a release build from the RT repos and post this build into the releases page.

When this pull request is eventually accepted, I will manually add <Compile Include="PersistentVesselStorage.cs" /> to the src/RemoteTech/RemoteTech.csproj in the repos.

KSP-TaxiService commented 7 years ago

In my quick tests, the functionality of targeting is working well in both editor and flight. But two issues are discovered.

Reproduction steps:

  1. Go to Tracking Station and enter any vessel
  2. Press M to open Map View
  3. Change one RT filter to the Multi-Path mode (show multiple yellow paths of all vessels)
  4. ESC and quit to Space Center

Neither of these issues are reproducible in the RT develop. I am tracking down on the origins of both issues.

drunkeNNN commented 7 years ago

I figured out the NullReference thing. In NetworkRenderer.OnPreCull() the if condition needs to read if (MapView.MapIsEnabled && HighLogic.LoadedScene!=GameScenes.SPACECENTER && HighLogic.LoadedScene != GameScenes.EDITOR)

and in OnGui() the same issue is present: if (Event.current.type == EventType.Repaint && MapView.MapIsEnabled && HighLogic.LoadedScene != GameScenes.SPACECENTER && HighLogic.LoadedScene != GameScenes.EDITOR)

There seems to be another null-ref-bug when doing the following: Go to Tracking Station and enter any vessel Press M to open Map View Change one RT filter to the Multi-Path mode (show multiple yellow paths of all vessels) ESC and quit to TrackingStation

[EXC 00:36:33.884] NullReferenceException: Object reference not set to an instance of an object GameObjectExtension.GetChild (UnityEngine.GameObject obj, System.String childName) RemoteTech.UI.FilterOverlay.get_PositionSatellite () RemoteTech.UI.FilterOverlay.get_PositionAntenna () RemoteTech.UI.FilterOverlay.Draw () RemoteTech.RTCore.OnGUI ()

The issue occurs in line 98 which is already marked as hacky code. I have no clue how to get that fixed at the moment and no clue how my codechanges might even affect this line. I haven't tested whether this is there in the RT-dev however. I'll dive into things during this week and I'll try to fix the github stuff.

The debug-window does show up for me.

KSP-TaxiService commented 7 years ago

I think I figure out how your code changes cause so wide disruption in some seemingly unrelated classes. When your subclasses of RTCore start up in both space-center and editor scenes, they through RTCore try to initialize/cache bunch of data that are not available in either scene, like MapView or satellite positions. This is why some things in the superclass break down.

Using the full RTCore base to just cache the planets and satellites may be too overkill. It is not good idea to keep add scene conditions to codes depending on flight/tracking station.

Is it possible to write a lightweight version of RTCore for the editor and space-center scenes only? This would avoid surprise NullReferenceException issues and allow editor/center-centered ideas to be implemented in this class.

drunkeNNN commented 7 years ago

This object would have to live not only during the editor/space center scenes but just like RT-Core during all game scenes where time passes since FlightGlobals.Vessels is cleared during the Editor scenes. The reason why I kept the RTCore was because I tried to avoid all the edge cases where vessels can be created and destroyed during flight. But your probably right. Thats just a bad workaround.

KSP-TaxiService commented 4 years ago

drunkeNNN's pull request is implemented in a reduced form i.e. not depending on full-function RTCore to avoid the side-effect issues. Many thanks to drunkeNNN!