Add native downrange capability to ReachState - #76
Conversation
| private bool CheckDownrange(Vessel vessel) | ||
| { | ||
| CelestialBody homeBody = FlightGlobals.GetHomeBody(); | ||
| Vector3d surfaceNVector = homeBody.GetSurfaceNVector(SpaceCenter.Instance.Latitude, SpaceCenter.Instance.Longitude); |
There was a problem hiding this comment.
The space center's current location is not necessarily where the vessel was launched. (e.g. consider switching the KSC in the middle of flight.)
There was a problem hiding this comment.
This is how it is done in the said RP-0 plugin. I am new to C#, so if you could please recommend a better solution, that would be great.
There was a problem hiding this comment.
Said RP-0 plugin (assuming you are referring to DownrangeDistanceVesselParam.cs sets a mark latitude and longitude on launch, and uses that as the starting position instead.
There was a problem hiding this comment.
I bet the distance doesn't even start at 0 if you measure from space center origin. Then there's the issue that you can use other launch sites. I believe you can launch even from other celestial bodies!
|
I'd suggest removing the |
|
It might be easier to expose the stock F3 distance travelled metric. KSPCF has a fix for it now and should thus be accurate. Although IDK how it behaves with scene or vessel switches. |
The way I have implemented currently should be good enough. |
This is the first time I've made a PR. How do I remove changes? (edit: figured it out; done) |
Sorry to be mean here but what is good enough for the closed RP-1 ecosystem might not be good enough for a general-purpose implementation that will be used across installs with who knows what kind of other mods or planet packs. |
I mean, it's just math. You can check the math yourself. The [f3] screen has never been accurate for me, and the method I am using agrees with MechJeb's flight grapher window's downrange readout. |
|
Interesting. I'll see if I can figure out how to set up a mark placement system at launch, then. |
|
Seriously though. I think the stock distance travelled metric is a better fit for CC. |
|
Alright, sure. I was having trouble adding a mark thing anyways (maybe I should learn how C# actually works before trying to mod, lol). What's the expression that returns that value in the [f3] screen? |
|
See KSPModdingLibs/KSPCommunityFixes#402. Probably FlightLogger.totalDistance (or groundDistance, test both) The change hasn't actually been released yet, so maybe have this PR on draft until KSPCF has its next release. |
|
Alright, it's now in the dev branch of my repository. Once the KSPCF fix releases, I'll push the dev branch here and we should be good to go |

Inside ReachState, there are now minDownrange and maxDownrange for downrange contracts. The downrange contracts in RP-1 are provided by an old RP-0 plugin, and I want to have downrange contracts to be an option for those not necessarily using RP-1. These will be used for Sol-Contracts.
The zh-cn localization needs to be updated similarly to the en-us, but I don't speak that language, so I did not update it.