Closed yalov closed 5 years ago
I could expose a method to toggle FAR speed display to FARAPI. You would then have to look for if FAR has been loaded and disable its speed display.
Will I need to copy FARAPI.cs to my repo, similar to KAC_Wrapper ?
No, you load the method by reflection. Check how MechJeb does it https://github.com/MuMech/MechJeb2/blob/0d49eac5f938aabe5271de98b73b9563b802ff78/MechJeb2/VesselState.cs
ok, I will figure this out
I created FARReflection in the Start()
of KSPAddon
and was trying to call ToggleAirspeedDisplay
right after that in the Start()
, but it was returning failure of toggling.
Same thing happens for FARReflection placed in the constructor of KSPAddon
and ToggleAirspeedDisplay
placed in the start.
Then I called ToggleAirspeedDisplay()
in some later GameEvents like OnGameUnpause()
and OnSetSpeedMode()
, and it works ok, after manual un-pausing or SpeedMode
changes.
Is there some near-start-time Method or GameEvent, where it will be working?
The airspeed display is attached to FlightGUI which is a vessel module so you will need to toggle it at the start of every flight scene/vessel load. I've added a global option to make things easier
global version doesn't use Vessel
, so maybe
ToggleAirspeedDisplay(Vessel? v = null, bool? enabled = null)
and v == null
means globally?
Done, Vessel
is already nullable so no need for ?
. I've switched v
and enabled
around since global change by default might be more useful.
https://github.com/dkavolis/Ferram-Aerospace-Research/blob/256bf7ee4df26b69596b9056f47a2493284558f9/FerramAerospaceResearch/FARAPI.cs#L89-L128
ok, I think it works
Merged #33
Another one, looks like FlightGlobals.ActiveVessel.indicatedAirSpeed
doesn't shows right value with FAR.
Could you also add IAS for the current vessel? And maybe also EAS... for the future.
FAR calculates IAS and EAS in AirspeedSettingsGUI
. I can expose them in FARAPI.
thanks, it works.
when are you planning on making full release?
Merged #34
I don't know about a full release. If I changed the versioning to incrementing revision number without changing the name I could do more frequent releases if there were any changes.
that would be good
SpeedUnitAnnex (SUA) changes lines on the navball panel, so in the Surface Mode it looks like this:
both FAR and SUA make this, but FAR somehow wins:
https://github.com/dkavolis/Ferram-Aerospace-Research/blob/0a49305d18bcf19f38c33d25887a3e66a22d014c/FerramAerospaceResearch/FARGUI/FARFlightGUI/AirspeedSettingsGUI.cs#L201-L202
Anyway, looks like all this navball-panel-speed-units-feature can be passed to SUA. SUA for the planes has main speedometer (m/s), secondary speedometer (mach or knots or km/h or mph) and disabled by default IAS (m/s)
I have found the feature settings in the FAR: FAR toolbar - Fit Settings - Air Spd. All these units and IAS already in the SUA. (does EAS makes sense without FAR?)
left panel on that image (surface speed: 915.9 m/s, Mach 3.0, IAS: 12.5 m/s, AGL 23.2 km):
So possibility1: deleting some code in the AirspeedSettingsGUI and making FAR suggesting SUA possibility2: I could make SUA overriding FAR (without any changes in the FAR) on the Navball panel, any idea how?
UPD. possibility3: FAR detects SUA and disables FAR's navball-panel-text