Ignore Mouse0 keybinding.
Ignore Mouse0 keybinding.

  1.0.19.0
  Added: Added current vessel name readout. (antplant)
  Added: 'Relative Radial Velocity' and 'Time To Rendezvous' readouts. (itwtx)
  Added: Readout help strings. (harryyoung)
  Changed: The 'Torque' value in the editor is now precise to two decimal places.
  Changed: Time formatting reference (Kerbin/Earth) is now based on the in-game setting.
  Changed: Eccentric Anomaly, Mean Anomaly and Mean Anomaly At Epoc now display in degrees rather than radians.
  Fixed: Optimised time formatting. (itwtx)
  Fixed: TimeToAtmosphere checks that the Apoapsis is outside atmosphere. (Kerbas-ad-astra)
  Fixed: Issue with stage priority flow. Caused Rapier calculations to fail if LF and O are drawn from different tanks. (Padishar)
  Fixed: Issue with angle to prograde/retrograde calculations on highly inclined orbits.
  Fixed: Editor input locks not being reset when a scene change is forced (e.g. via Kerbal Construction Time).
  Fixed: Roll axis readout now shows the correct sign.
  Removed: Time Formatter readout as it's not required anymore.
   
1.0.18.0 1.0.18.0
Added: Orbital readouts - "Speed at Periapsis" and "Speed at Apoapsis". (Padishar) Added: Orbital readouts - "Speed at Periapsis" and "Speed at Apoapsis". (Padishar)
Added: Manoeuvre readouts - "Post-burn Apoapsis" and "Post-burn Periapsis". (Padishar) Added: Manoeuvre readouts - "Post-burn Apoapsis" and "Post-burn Periapsis". (Padishar)
Added: Orbital readout - "Time to Atmosphere". Added: Orbital readout - "Time to Atmosphere".
Fixed: Synched the minimum simulation time sliders and stopped them from snapping back after 999ms. (saybur) Fixed: Synched the minimum simulation time sliders and stopped them from snapping back after 999ms. (saybur)
Fixed: Added workaround for the bug in Vessel.horizontalSrfSpeed (Padishar) Fixed: Added workaround for the bug in Vessel.horizontalSrfSpeed (Padishar)
Fixed: Physically insignificant part mass was not being correctly cascaded down through multiple parent parts. Fixed: Physically insignificant part mass was not being correctly cascaded down through multiple parent parts.
Fixed: Intake air demand calculation not working. Fixed: Intake air demand calculation not working.
Fixed: Some build engineer settings labels do not scale with UI size. Fixed: Some build engineer settings labels do not scale with UI size.
   
1.0.17.0 1.0.17.0
Added: 'Mach Number' readout under the 'Surface' category and included it on the default surface HUD. Added: 'Mach Number' readout under the 'Surface' category and included it on the default surface HUD.
Added: Stock sections in the Flight Engineer can now become HUDs. Added: Stock sections in the Flight Engineer can now become HUDs.
Added 'Thermal' readouts category including: Added 'Thermal' readouts category including:
Internal Flux Internal Flux
Convection Flux Convection Flux
Radiation Flux Radiation Flux
Critical Part Name Critical Part Name
Critical Part Temperature Critical Part Temperature
Critical Part Skin Temperature Critical Part Skin Temperature
Critical Part Thermal Percentage of Max Temperature Critical Part Thermal Percentage of Max Temperature
Hottest Part Name Hottest Part Name
Hottest Part Temperature Hottest Part Temperature
Hottest Part Skin Temperature Hottest Part Skin Temperature
Coldest Part Name Coldest Part Name
Coldest Part Temperature Coldest Part Temperature
Coldest Part Skin Temperature Coldest Part Skin Temperature
   
Changed: Mach on the Build Engineer now accurate to 2 decimal places. Changed: Mach on the Build Engineer now accurate to 2 decimal places.
Changed: Max mach in the Build Engineer defaults to 1.00 even when no jet engines are present. Changed: Max mach in the Build Engineer defaults to 1.00 even when no jet engines are present.
Changed: Increased eccentricity readout to 5 decimal places. Changed: Increased eccentricity readout to 5 decimal places.
Changed: Implemented Sarbian's object pooling. Changed: Implemented Sarbian's object pooling.
Changed: The default selected body is now assigned via 'Planitarium.Home'. Changed: The default selected body is now assigned via 'Planitarium.Home'.
Changed: HUDs to clamp fully inside the screen instead of allowing them to run off the edge by a certain amount. Changed: HUDs to clamp fully inside the screen instead of allowing them to run off the edge by a certain amount.
Fixed: Physically insignificant part mass is now associated with the parent part. Fixed: Physically insignificant part mass is now associated with the parent part.
Fixed: Longitude and Latitude readouts now use a KER formatter instead of Squad's incorrect implementation. Fixed: Longitude and Latitude readouts now use a KER formatter instead of Squad's incorrect implementation.
Fixed: Possible null reference in the Rendezvous Processor. Fixed: Possible null reference in the Rendezvous Processor.
Fixed: Fairing mass issues introduced with regards to simulation changes. Fixed: Fairing mass issues introduced with regards to simulation changes.
Fixed: Use of per-propellant fuel flow mode override. Fixed: Use of per-propellant fuel flow mode override.
Fixed: Burn times calculated for jet engines. Fixed: Burn times calculated for jet engines.
Fixed: Thrust issues introduced with Sarbian's simulation alterations. Fixed: Thrust issues introduced with Sarbian's simulation alterations.
Fixed: Issue where HUDs positioned close to the top/bottom of the screen could be pushed out of position. Fixed: Issue where HUDs positioned close to the top/bottom of the screen could be pushed out of position.
   
1.0.16.6, 02-05-15 1.0.16.6, 02-05-15
Fixed: Separately staged fairing mass jettisons are now calculated in the editor. Fixed: Separately staged fairing mass jettisons are now calculated in the editor.
   
1.0.16.5, 02-05-2015 1.0.16.5, 02-05-2015
Fixed: Delta-V not being correctly calculated. Fixed: Delta-V not being correctly calculated.
Changed: Editor locking now uses the InputLockManager. Changed: Editor locking now uses the InputLockManager.
   
1.0.16.4, 01-05-2015 1.0.16.4, 01-05-2015
Fixed: Physically insignificant part mass is now accounted for. Fixed: Physically insignificant part mass is now accounted for.
Changed: Module mass accounted for as it now makes its way onto the launch pad (e.g. fairings). Changed: Module mass accounted for as it now makes its way onto the launch pad (e.g. fairings).
   
Various optimisations: Various optimisations:
Object pooling. Object pooling.
Removed LINQ expressions. Removed LINQ expressions.
Converted foreach to for loops. Converted foreach to for loops.
   
1.0.16.3, 27-04-2015 1.0.16.3, 27-04-2015
Fixed issue with the toolbar icons not being created. Fixed issue with the toolbar icons not being created.
Removed superfluous 'm/s' on the mach slider in the build engineer. Removed superfluous 'm/s' on the mach slider in the build engineer.
   
1.0.16.2, 27-04-2015 1.0.16.2, 27-04-2015
Changed the atmospheric slider on the build engineer to default to 0km when changing bodies. Changed the atmospheric slider on the build engineer to default to 0km when changing bodies.
   
1.0.16.1, 26-04-2015, KSP Build #828 1.0.16.1, 26-04-2015, KSP Build #828
Merged Sarbian's mach adjustments. Merged Sarbian's mach adjustments.
Fixed bugs relating to thrust and atmosphere/velocity curves. Fixed bugs relating to thrust and atmosphere/velocity curves.
Changed the atmospheric slider on the Build Engineer to work based on altitude. Changed the atmospheric slider on the Build Engineer to work based on altitude.
Changed the atmospheric slider to clamp to the maximum altitude for the selected body. Changed the atmospheric slider to clamp to the maximum altitude for the selected body.
Changed the velocity slider to clamp to the maximum usable mach value for the current vessel. Changed the velocity slider to clamp to the maximum usable mach value for the current vessel.
   
1.0.16.0, 25-04-2015, KSP Build #821 1.0.16.0, 25-04-2015, KSP Build #821
Fixed errors relating to KSP 1.0 update. Fixed errors relating to KSP 1.0 update.
Fixed fuel simulation to account for new thrust system. Fixed fuel simulation to account for new thrust system.
Fixed atmospheric engines to use the new velocity curve. Fixed atmospheric engines to use the new velocity curve.
Fixed atmospheric readouts to work with the new atmospheric model. Fixed atmospheric readouts to work with the new atmospheric model.
   
1.0.15.2, 13-02-2015 1.0.15.2, 13-02-2015
Padishar's Fixes: Padishar's Fixes:
Fixed: Calculation of per-stage resource mass. Fixed: Calculation of per-stage resource mass.
   
1.0.15.1, 13-02-2015 1.0.15.1, 13-02-2015
Rebuild Rebuild
   
1.0.15.0, 08-02-2015 1.0.15.0, 08-02-2015
Padishar's Fixes: Padishar's Fixes:
Added: Support KIDS ISP thrust correction. Added: Support KIDS ISP thrust correction.
Fixed: Log spam for stage priority mode. Fixed: Log spam for stage priority mode.
Fixed: Locked tanks preventing simulation from staging. Fixed: Locked tanks preventing simulation from staging.
Fixed: No flow and all vessel modes to respect flow states. Fixed: No flow and all vessel modes to respect flow states.
   
1.0.14.1, 28-12-2014 1.0.14.1, 28-12-2014
Fixed: Missing texture on the ER-7500 model. Fixed: Missing texture on the ER-7500 model.
   
1.0.14.0, 28-12-2014 1.0.14.0, 28-12-2014
Added: Career mode that limits the Flight Engineer by: Added: Career mode that limits the Flight Engineer by:
- Requiring an Engineer Kerbal of any level, or placement of an Engineer Chip or ER-7500 part. - Requiring an Engineer Kerbal of any level, or placement of an Engineer Chip or ER-7500 part.
- Tracking station level 3 enables Flight Engineer everywhere. - Tracking station level 3 enables Flight Engineer everywhere.
   
Added: New readouts to the orbital category: Added: New readouts to the orbital category:
- Mean Anomaly at Epoc - Mean Anomaly at Epoc
   
Added: New readouts to the miscellaneous category: Added: New readouts to the miscellaneous category:
- System Time - System Time
   
Added: Editor Overlay Tab's X position is now changable in the BuildOverlay.xml settings file. Added: Editor Overlay Tab's X position is now changable in the BuildOverlay.xml settings file.
Changed: Editor Overlay Tabs start position moved over as to not overlap the parts menu. Changed: Editor Overlay Tabs start position moved over as to not overlap the parts menu.
Fixed: Bug where STAGE_PRIORITY_FLOW resources would not be corrently disabled/enabled. Fixed: Bug where STAGE_PRIORITY_FLOW resources would not be corrently disabled/enabled.
Fixed: Issue with the formatting large Mass and Cost values. Fixed: Issue with the formatting large Mass and Cost values.
Fixed: Error when loading the Engineer7500 part model. Fixed: Error when loading the Engineer7500 part model.
   
1.0.13.1, 16-12-2014 1.0.13.1, 16-12-2014
Fixed: Issue with manoeuvre node readouts and low tier tracking station. Fixed: Issue with manoeuvre node readouts and low tier tracking station.
   
1.0.13.0, 16-12-2014 1.0.13.0, 16-12-2014
Updated for KSP version 0.90 Updated for KSP version 0.90
   
Added: New readouts to the vessel category: Added: New readouts to the vessel category:
- Heading Rate - Heading Rate
- Pitch Rate - Pitch Rate
- Roll Rate - Roll Rate
   
Changed: Simulation to look for fuel lines that use CModuleFuelLine module. Changed: Simulation to look for fuel lines that use CModuleFuelLine module.
Fixed: Editor Overlay now loads the saved visibility value properly. Fixed: Editor Overlay now loads the saved visibility value properly.
Fixed: Altitude (Terrain) will no longer give a reading below sea level. Fixed: Altitude (Terrain) will no longer give a reading below sea level.
Fixed: Suicide burn now uses radar altitude that clamps to sea level. Fixed: Suicide burn now uses radar altitude that clamps to sea level.
   
1.0.12.0, 01-12-2014 1.0.12.0, 01-12-2014
Added: Setting in Build Engineer to enable/disable vectored thrust calculations. Added: Setting in Build Engineer to enable/disable vectored thrust calculations.
Added: Thrust torque field in Build Engineer (courtesy of mic_e). Added: Thrust torque field in Build Engineer (courtesy of mic_e).
Added: New readouts to the vessel category: Added: New readouts to the vessel category:
- Thrust Offset Angle (courtesy of mic_e) - Thrust Offset Angle (courtesy of mic_e)
- Thrust Torque (courtesy of mic_e) - Thrust Torque (courtesy of mic_e)
- Part Count: stage/total - Part Count: stage/total
- Heading - Heading
- Pitch - Pitch
- Roll - Roll
   
Added: New readouts to the surface category: Added: New readouts to the surface category:
- Situation - Situation
   
Added: New readouts to the miscellaneous category: Added: New readouts to the miscellaneous category:
- Vectored Thrust Toggle - Vectored Thrust Toggle
   
Fixed: The category selection within the section editors now do not always reset back to 'Orbital'. Fixed: The category selection within the section editors now do not always reset back to 'Orbital'.
Fixed: Issue where the vessel simulation can sometimes permanently freeze. Fixed: Issue where the vessel simulation can sometimes permanently freeze.
Fixed: Issue where the vessel simulation would not show updates when the delay was set lower than the frame rate. Fixed: Issue where the vessel simulation would not show updates when the delay was set lower than the frame rate.
   
1.0.11.3, 11-11-2014 1.0.11.3, 11-11-2014
Changed: Gravity measurements for Isp to 9.82. Changed: Gravity measurements for Isp to 9.82.
   
1.0.11.2, 10-11-2014 1.0.11.2, 10-11-2014
Changed: Gravity measurements for Isp calculations from 9.81 to 9.8066 for accuracy. Changed: Gravity measurements for Isp calculations from 9.81 to 9.8066 for accuracy.
Changed: Manoeuvre node burn times are now more accurate. Changed: Manoeuvre node burn times are now more accurate.
Fixed: Bug in the manoeuvre node burn time calculations where it was not averaging acceleration correctly. Fixed: Bug in the manoeuvre node burn time calculations where it was not averaging acceleration correctly.
   
1.0.11.1, 07-11-2014 1.0.11.1, 07-11-2014
Changed: Build Engineer now shows stage part count as well as total. Changed: Build Engineer now shows stage part count as well as total.
Changed: Build Overlay Vessel tab data: Changed: Build Overlay Vessel tab data:
DeltaV: stage / total DeltaV: stage / total
Mass: stage / total Mass: stage / total
TWR: start (max) <- shows for bottom stage only. TWR: start (max) <- shows for bottom stage only.
Parts: stage / total Parts: stage / total
   
Fixed: Issue with the vessel tab vanishing from the editor. Fixed: Issue with the vessel tab vanishing from the editor.
   
1.0.11.0, 06-11-2014 1.0.11.0, 06-11-2014
Added: New readouts to the orbital category: Added: New readouts to the orbital category:
- Current SOI - Current SOI
- Manoeuvre Node DeltaV (Prograde) - Manoeuvre Node DeltaV (Prograde)
- Manoeuvre Node DeltaV (Normal) - Manoeuvre Node DeltaV (Normal)
- Manoeuvre Node DeltaV (Radial) - Manoeuvre Node DeltaV (Radial)
- Manoeuvre Node DeltaV (Total) - Manoeuvre Node DeltaV (Total)
- Manoeuvre Node Burn Time - Manoeuvre Node Burn Time
- Manoeuvre Node Half Burn Time - Manoeuvre Node Half Burn Time
- Manoeuvre Node Angle to Prograde - Manoeuvre Node Angle to Prograde
- Manoeuvre Node Angle to Retrograde - Manoeuvre Node Angle to Retrograde
- Time to Manoeuvre Node - Time to Manoeuvre Node
- Time to Manoeuvre Burn - Time to Manoeuvre Burn
   
Added: Readout help strings by ClassyJakey. Added: Readout help strings by ClassyJakey.
   
Fixed: Issue with separators in HUDs. Fixed: Issue with separators in HUDs.
Fixed: Issue with HUDs with backgrounds that have no displayed lines. Fixed: Issue with HUDs with backgrounds that have no displayed lines.
   
Padishar's Fixes: Padishar's Fixes:
Fixed: Issue with multicouplers when attached to parent by bottom node. Fixed: Issue with multicouplers when attached to parent by bottom node.
Fixed: Issue with sepratrons on solid rocket boosters. Fixed: Issue with sepratrons on solid rocket boosters.
   
1.0.10.0, 19-10-2014 1.0.10.0, 19-10-2014
UPDATE NOTICE: If you are updating from a previous version of Kerbal Engineer 1.0, please UPDATE NOTICE: If you are updating from a previous version of Kerbal Engineer 1.0, please
delete the 'Settings/SectionLibrary.xml' file, or remove the old install first. This will delete the 'Settings/SectionLibrary.xml' file, or remove the old install first. This will
reset the Flight Engineer sections to their default values and enable the new HUD functionality. reset the Flight Engineer sections to their default values and enable the new HUD functionality.
   
Added: New reaouts to the vessel category: Added: New reaouts to the vessel category:
- Suicide Burn Altitude (height above terrain to start burn) - Suicide Burn Altitude (height above terrain to start burn)
- Suicide Burn Distance (distance to suicide burn altitude) - Suicide Burn Distance (distance to suicide burn altitude)
- Suicide Burn DeltaV (velocity change required to zero vertical speed) - Suicide Burn DeltaV (velocity change required to zero vertical speed)
*** F5 for safety and use at your own risk! *** *** F5 for safety and use at your own risk! ***
   
Added: HUD type sections to the Flight Engineer. Added: HUD type sections to the Flight Engineer.
Added: HUD sections can have a smoked background for easy visibility. Added: HUD sections can have a smoked background for easy visibility.
Added: 'Switch to Target' button on the Target Selector readout. Added: 'Switch to Target' button on the Target Selector readout.
Changed: The default installed readouts to reduce new user brain melt. Changed: The default installed readouts to reduce new user brain melt.
Fixed: Flight Engineer not saving its hidden state. Fixed: Flight Engineer not saving its hidden state.
Fixed: Bug in the phase angle calculations. Fixed: Bug in the phase angle calculations.
Fixed: Bug where the Build Engineer would stay locked after hiding with the shortcut key. Fixed: Bug where the Build Engineer would stay locked after hiding with the shortcut key.
   
1.0.9.3, 08-10-2014 1.0.9.3, 08-10-2014
Added: Title of the build engineer in compact mode now shows if you are using atmospheric data. Added: Title of the build engineer in compact mode now shows if you are using atmospheric data.
Added: New readout to the surface category: Added: New readout to the surface category:
- Vertical Acceleration - Vertical Acceleration
- Horizontal Acceleration - Horizontal Acceleration
   
Changed: Atmospheric efficiency readout now shows as a percentage. Changed: Atmospheric efficiency readout now shows as a percentage.
Changed: Atmospheric settings (pressure/velocity) in the editor condensed onto a single line. Changed: Atmospheric settings (pressure/velocity) in the editor condensed onto a single line.
Fixed: Bug where the overlays in the editor would stay open outside of parts screen. Fixed: Bug where the overlays in the editor would stay open outside of parts screen.
   
1.0.9.2, 07-10-2014 1.0.9.2, 07-10-2014
Updated for KSP v0.25.0 Updated for KSP v0.25.0
Changed: Prettyfied Latitude and Longitude readouts. Changed: Prettyfied Latitude and Longitude readouts.
Changed: ModuleLandingGear now uses the physical significance flag. Changed: ModuleLandingGear now uses the physical significance flag.
Changed: Updated MiniAVC to 1.0.2.4. Changed: Updated MiniAVC to 1.0.2.4.
   
1.0.9.1, 17-09-2014 1.0.9.1, 17-09-2014
Fixed: Part size bug caused by TweakScale's cost calculator. Fixed: Part size bug caused by TweakScale's cost calculator.
   
1.0.9.0, 15-09-2014 1.0.9.0, 15-09-2014
Added: Build Engineer now also implements the '\' backslash show/hide shortcut. Added: Build Engineer now also implements the '\' backslash show/hide shortcut.
Added: New readouts to the vessel category: Added: New readouts to the vessel category:
- Current Stage DeltaV - Current Stage DeltaV
- Surface Thrust to Weight Ratio - Surface Thrust to Weight Ratio
   
Added: New editor overlay system. Added: New editor overlay system.
- Sleeker design. - Sleeker design.
- Hover over part information options: - Hover over part information options:
- Name only - Name only
- Middle click to show - Middle click to show
- Always show - Always show
- Slide out overlay displays: - Slide out overlay displays:
- Vessel information - Vessel information
- Resources list - Resources list
   
Fixed: Cost calculation now works with mods implementing IPartCostModifier. Fixed: Cost calculation now works with mods implementing IPartCostModifier.
   
1.0.8.1, 06-09-2014 1.0.8.1, 06-09-2014
Fixed: Bug which caused rendezvous readouts to freeze the game or show all zeros. Fixed: Bug which caused rendezvous readouts to freeze the game or show all zeros.
   
1.0.8.0, 06-09-2014 1.0.8.0, 06-09-2014
Added: New readouts to the vessel category: Added: New readouts to the vessel category:
- Intake Air (Usage) - Intake Air (Usage)
   
Added: New readouts to the rendezvous category: Added: New readouts to the rendezvous category:
- Relative Velocity - Relative Velocity
- Relative Speed - Relative Speed
   
Fixed: An issue where deltaV would not be calculated whilst flying. Fixed: An issue where deltaV would not be calculated whilst flying.
Fixed: NullRef whilst loading the in flight Action Menu. Fixed: NullRef whilst loading the in flight Action Menu.
   
1.0.7.1, 02-09-2014 1.0.7.1, 02-09-2014
Changed: Reversed Intake Air readout from 'S/D' to 'D/S' for easier reading. Changed: Reversed Intake Air readout from 'S/D' to 'D/S' for easier reading.
Changed: Increased Intake Air readout precision to 4 decimal places. Changed: Increased Intake Air readout precision to 4 decimal places.
Fixed: Issue where Intake Air supply was not representative of total supply. Fixed: Issue where Intake Air supply was not representative of total supply.
Fixed: Bug where actual thrust does not reset to zero on deactivated engines. Fixed: Bug where actual thrust does not reset to zero on deactivated engines.
Fixed: Thrust now scales with velocity for atmospheric engines. (Padishar's fix) Fixed: Thrust now scales with velocity for atmospheric engines. (Padishar's fix)
   
1.0.7.0, 01-09-2014 1.0.7.0, 01-09-2014
Added: Part count information to the Build Engineer. Added: Part count information to the Build Engineer.
Added: Reset button to the G-Force readout. Added: Reset button to the G-Force readout.
Added: Preset system to the Flight Engineer. Added: Preset system to the Flight Engineer.
Added: New stock presets: Added: New stock presets:
- Orbital - Orbital
- Surface - Surface
- Vessel - Vessel
- Rendezvous - Rendezvous
   
Added: New readouts to the orbital category: Added: New readouts to the orbital category:
- True Anomaly - True Anomaly
- Eccentric Anomaly - Eccentric Anomaly
- Mean Anomaly - Mean Anomaly
- Argument of Periapsis - Argument of Periapsis
- Angle to Prograde - Angle to Prograde
- Angle to Retrograde - Angle to Retrograde
   
Added: New readouts to the vessel category: Added: New readouts to the vessel category:
- Intake Air (Demand) - Intake Air (Demand)
- Intake Air (Supply) - Intake Air (Supply)
- Intake Air (Supply/Demand) - Intake Air (Supply/Demand)
   
Added: New readouts to the rendezvous category. Added: New readouts to the rendezvous category.
- Semi-major Axis - Semi-major Axis
- Semi-minor Axis - Semi-minor Axis
   
Added: Time formatter which can show time as referenced by any celestial body. Added: Time formatter which can show time as referenced by any celestial body.
Added: New readouts to the miscellaneous category: Added: New readouts to the miscellaneous category:
- Time Reference Adjuster - Time Reference Adjuster
   
Changed: Moved Sim Delay readout into the Miscellaneous category. Changed: Moved Sim Delay readout into the Miscellaneous category.
Changed: Updated MiniAVC to v1.0.2.3. Changed: Updated MiniAVC to v1.0.2.3.
Fixed: Issues with large value wrap around in the Flight Engineer. Fixed: Issues with large value wrap around in the Flight Engineer.
Fixed: Bug in the phase angle calculation. Fixed: Bug in the phase angle calculation.
   
1.0.6.0, 23-08-2014 1.0.6.0, 23-08-2014
Added: Time and Angle to equatorial ascending/descending nodes in the orbital display. Added: Time and Angle to equatorial ascending/descending nodes in the orbital display.
Added: Time and Angle to relative ascending/descending nodes in the rendezvous display. Added: Time and Angle to relative ascending/descending nodes in the rendezvous display.
Added: Overlay tooltip information delay adjustment slider to the Build Engineer settings. Added: Overlay tooltip information delay adjustment slider to the Build Engineer settings.
Added: Ability to rename the stock displays in the Flight Engineer. Added: Ability to rename the stock displays in the Flight Engineer.
Changed: Build Engineer is now hidden when not in parts view. Changed: Build Engineer is now hidden when not in parts view.
Changed: Custom display panels will only show in the control bar if an abbreviation is set. Changed: Custom display panels will only show in the control bar if an abbreviation is set.
Changed: Licensing and readme structures are now more verbose to satisfy the new add-on rules. Changed: Licensing and readme structures are now more verbose to satisfy the new add-on rules.
Fixed: Updated MiniAVC to v1.0.2.1 (fixes remote check bug as well as other minor bugs). Fixed: Updated MiniAVC to v1.0.2.1 (fixes remote check bug as well as other minor bugs).
   
1.0.5.0, 13-08-2014 1.0.5.0, 13-08-2014
Added: Acceleration readout to the Vessel category (current / maximum). Added: Acceleration readout to the Vessel category (current / maximum).
Added: Category library system for the Flight Engineer readouts. Added: Category library system for the Flight Engineer readouts.
Added: Drop-down category selection to better support the new system. Added: Drop-down category selection to better support the new system.
Changed: Misc category now called Miscellaneous (this will cause previously added readouts from this category to vanish). Changed: Misc category now called Miscellaneous (this will cause previously added readouts from this category to vanish).
Fixed: Bug with the Build Engineer toolbar button. Fixed: Bug with the Build Engineer toolbar button.
Fixed: Some buggyness when trying to close the bodies drop-down in the Build Engineer via the button. Fixed: Some buggyness when trying to close the bodies drop-down in the Build Engineer via the button.
Fixed: Flight Engineer toolbar menu now hides when hiding the GUI with F2. Fixed: Flight Engineer toolbar menu now hides when hiding the GUI with F2.
Fixed: Flight Engineer toolbar button now disables when in module mode and no engineer is running. Fixed: Flight Engineer toolbar button now disables when in module mode and no engineer is running.
   
1.0.4.0, 12-08-2014 1.0.4.0, 12-08-2014
Added: Better stock toolbar support in the flight engineer. Added: Better stock toolbar support in the flight engineer.
Added: Dynamically generated celestial body library for supporting add-ons that modify the star system. Added: Dynamically generated celestial body library for supporting add-ons that modify the star system.
Changed: Reference bodies are now listed with a nestable menu system. Changed: Reference bodies are now listed with a nestable menu system.
Changed: Extended logging system has been improved. Changed: Extended logging system has been improved.
Changed: Swapped out integrated MiniAVC in place of the official bundle version. Changed: Swapped out integrated MiniAVC in place of the official bundle version.
Changed: Increased general distance precision to 1 decimal place. Changed: Increased general distance precision to 1 decimal place.
Changed: Increased Semi-major/minor axis precision to 3 decimal places. Changed: Increased Semi-major/minor axis precision to 3 decimal places.
Fixed: Impact altitude was mistakenly formatted as an angle, it is now formatted correctly as a distance. Fixed: Impact altitude was mistakenly formatted as an angle, it is now formatted correctly as a distance.
   
1.0.3.0, 30-07-2014 1.0.3.0, 30-07-2014
Added: Integrated KSP-AVC support with MiniAVC. Added: Integrated KSP-AVC support with MiniAVC.
Added: Setting to change the simulation delay in the Build Engineer. Added: Setting to change the simulation delay in the Build Engineer.
Added: Setting to enable and disable the build overlay system. Added: Setting to enable and disable the build overlay system.
Added: Burn time to Delta-V readouts. Added: Burn time to Delta-V readouts.
Added: Atmospheric readouts fully support FAR. Added: Atmospheric readouts fully support FAR.
Added: Atmospheric readouts are disabled with NEAR. Added: Atmospheric readouts are disabled with NEAR.
Changed: Force formatting inversely scales decimal precision with value. Changed: Force formatting inversely scales decimal precision with value.
Fixed: Flickering in VAB and Vessel display. Fixed: Flickering in VAB and Vessel display.
Fixed: Bug saving the GUI display size. Fixed: Bug saving the GUI display size.
   
1.0.2.0, 27-07-2014 1.0.2.0, 27-07-2014
Added: Separator readout module under Misc in the Flight Engineer. Added: Separator readout module under Misc in the Flight Engineer.
Added: Adjustable GUI display size. Added: Adjustable GUI display size.
Added: Display size can be adjusted in the Build Engineer settings. Added: Display size can be adjusted in the Build Engineer settings.
Added: Misc readout for adjusting display size in the Flight Engineer. Added: Misc readout for adjusting display size in the Flight Engineer.
Changed: The rendezvous readout for the target's Orbital Period has higher precision. Changed: The rendezvous readout for the target's Orbital Period has higher precision.
Fixed: White toolbar icon by manually importing the texture if it cannot be found in the game database. Fixed: White toolbar icon by manually importing the texture if it cannot be found in the game database.
Fixed: Engines that have a minimum thrust are now calculated properly. (Thanks to nosscire.) Fixed: Engines that have a minimum thrust are now calculated properly. (Thanks to nosscire.)
Fixed: Compact collapse mode is now saved in the Build Engineer. Fixed: Compact collapse mode is now saved in the Build Engineer.
   
1.0.1.0, 26-07-2014 1.0.1.0, 26-07-2014
Added: Part-less Flight Engineer. Added: Part-less Flight Engineer.
Added: Ability to collapse the Build Engineer into compact mode from left or right. Added: Ability to collapse the Build Engineer into compact mode from left or right.
Added: Settings in Build Engineer for compact collapse mode and partless/module Flight Engineer. Added: Settings in Build Engineer for compact collapse mode and partless/module Flight Engineer.
Added: Biome, Impact Biome and Slope readouts. Added: Biome, Impact Biome and Slope readouts.
Added: Extra logging and exception handling. Added: Extra logging and exception handling.
Added: The original Engineer Chip part. Added: The original Engineer Chip part.
Added: "Show Engineer" toggle on the Flight Engineer toolbar. Added: "Show Engineer" toggle on the Flight Engineer toolbar.
Changed: Extended logging system now also writes to the standard KSP logs. Changed: Extended logging system now also writes to the standard KSP logs.
Changed: Extended logging saves next to the .dll file. Changed: Extended logging saves next to the .dll file.
Changed: ER7500 part has no physical significance. Changed: ER7500 part has no physical significance.
Fixed: ActionMenu and DisplayStack destruction bug. Fixed: ActionMenu and DisplayStack destruction bug.
   
1.0.0.1, 24-07-2014 1.0.0.1, 24-07-2014
Added: Stock toolbar support in the Flight Engineer. Added: Stock toolbar support in the Flight Engineer.
Changed: Orbital Period has higher precision. Changed: Orbital Period has higher precision.
Fixed: Various NullRefs in editor window and overlay. Fixed: Various NullRefs in editor window and overlay.
   
1.0.0.0, 24-07-2014 1.0.0.0, 24-07-2014
Initial release for public testing. Initial release for public testing.
   
// //
// Kerbal Engineer Redux // Copyright (C) 2015 CYBUTEK
//  
// Copyright (C) 2014 CYBUTEK  
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
namespace KerbalEngineer.Editor namespace KerbalEngineer.Editor
{ {
#region Using Directives  
using System; using System;
using Extensions; using Extensions;
using Flight; using Flight;
using Helpers; using Helpers;
using Settings; using Settings;
using UIControls; using UIControls;
using UnityEngine; using UnityEngine;
using VesselSimulator; using VesselSimulator;
   
#endregion  
   
[KSPAddon(KSPAddon.Startup.EditorAny, false)] [KSPAddon(KSPAddon.Startup.EditorAny, false)]
public class BuildAdvanced : MonoBehaviour public class BuildAdvanced : MonoBehaviour
{ {
#region Fields public static float Altitude;
public static float Altitude = 0.0f;  
  private static Rect compactModeRect = new Rect(0.0f, 5.0f, 0.0f, 20.0f);
  private static Stage stage;
  private static int stagesCount;
  private static int stagesLength;
  private static string title;
   
private GUIStyle areaSettingStyle; private GUIStyle areaSettingStyle;
private GUIStyle areaStyle; private GUIStyle areaStyle;
private float atmosphericMach; private float atmosphericMach;
private GUIStyle bodiesButtonActiveStyle; private GUIStyle bodiesButtonActiveStyle;
private GUIStyle bodiesButtonStyle; private GUIStyle bodiesButtonStyle;
private DropDown bodiesList; private DropDown bodiesList;
private Rect bodiesListPosition; private Rect bodiesListPosition;
private GUIStyle buttonStyle; private GUIStyle buttonStyle;
private int compactCheck; private int compactCheck;
private bool compactCollapseRight; private bool compactCollapseRight;
private bool compactMode; private bool compactMode;
private float compactRight; private float compactRight;
private bool hasChanged; private bool hasChanged;
private GUIStyle infoStyle; private GUIStyle infoStyle;
private bool isEditorLocked; private bool isEditorLocked;
private float maxMach; private float maxMach;
private int numberOfStages; private int numberOfStages;
private Rect position = new Rect(265.0f, 45.0f, 0, 0); private Rect position = new Rect(265.0f, 45.0f, 0, 0);
private GUIStyle settingAtmoStyle; private GUIStyle settingAtmoStyle;
private GUIStyle settingStyle; private GUIStyle settingStyle;
private bool showAllStages; private bool showAllStages;
private bool showAtmosphericDetails; private bool showAtmosphericDetails;
private bool showSettings; private bool showSettings;
private Stage[] stages; private Stage[] stages;
private GUIStyle titleStyle; private GUIStyle titleStyle;
private bool visible = true; private bool visible = true;
private GUIStyle windowStyle; private GUIStyle windowStyle;
#endregion  
   
#region Properties  
/// <summary> /// <summary>
/// Gets the current instance if started or returns null. /// Gets the current instance if started or returns null.
/// </summary> /// </summary>
public static BuildAdvanced Instance { get; private set; } public static BuildAdvanced Instance { get; private set; }
   
/// <summary> /// <summary>
/// Gets and sets whether to show in compact mode. /// Gets and sets whether to show in compact mode.
/// </summary> /// </summary>
public bool CompactMode public bool CompactMode
{ {
get get
{ {
return compactMode; return compactMode;
} }
set set
{ {
compactMode = value; compactMode = value;
} }
} }
   
/// <summary> /// <summary>
/// Gets and sets whether to show all stages. /// Gets and sets whether to show all stages.
/// </summary> /// </summary>
public bool ShowAllStages public bool ShowAllStages
{ {
get get
{ {
return showAllStages; return showAllStages;
} }
set set
{ {
showAllStages = value; showAllStages = value;
} }
} }
   
/// <summary> /// <summary>
/// Gets and sets whether to use atmospheric details. /// Gets and sets whether to use atmospheric details.
/// </summary> /// </summary>
public bool ShowAtmosphericDetails public bool ShowAtmosphericDetails
{ {
get get
{ {
return showAtmosphericDetails; return showAtmosphericDetails;
} }
set set
{ {
showAtmosphericDetails = value; showAtmosphericDetails = value;
} }
} }
   
/// <summary> /// <summary>
/// Gets and sets whether to show the settings display. /// Gets and sets whether to show the settings display.
/// </summary> /// </summary>
public bool ShowSettings public bool ShowSettings
{ {
get get
{ {
return showSettings; return showSettings;
} }
set set
{ {
showSettings = value; showSettings = value;
} }
} }
   
/// <summary> /// <summary>
/// Gets and sets whether the display is enabled. /// Gets and sets whether the display is enabled.
/// </summary> /// </summary>
public bool Visible public bool Visible
{ {
get get
{ {
return visible; return visible;
} }
set set
{ {
visible = value; visible = value;
} }
} }
#endregion  
   
#region Methods  
private static Rect compactModeRect = new Rect(0.0f, 5.0f, 0.0f, 20.0f);  
private static Stage stage;  
private static int stagesCount;  
private static int stagesLength;  
private static string title;  
   
protected void Awake() protected void Awake()
{ {
try try
{ {
Instance = this; Instance = this;
bodiesList = gameObject.AddComponent<DropDown>(); bodiesList = gameObject.AddComponent<DropDown>();
bodiesList.DrawCallback = DrawBodiesList; bodiesList.DrawCallback = DrawBodiesList;
Load(); Load();
   
SimManager.UpdateModSettings(); SimManager.UpdateModSettings();
SimManager.OnReady -= GetStageInfo; SimManager.OnReady -= GetStageInfo;
SimManager.OnReady += GetStageInfo; SimManager.OnReady += GetStageInfo;
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.Exception(ex, "BuildAdvanced.Awake()"); Logger.Exception(ex, "BuildAdvanced.Awake()");
} }
} }
   
/// <summary> /// <summary>
/// Saves the settings when this object is destroyed. /// Saves the settings when this object is destroyed.
/// </summary> /// </summary>
protected void OnDestroy() protected void OnDestroy()
{ {
  Logger.Log("BuildAdvanced->OnDestroy");
   
try try
{ {
SettingHandler handler = new SettingHandler(); SettingHandler handler = new SettingHandler();
handler.Set("visible", visible); handler.Set("visible", visible);
handler.Set("windowPositionX", position.x); handler.Set("windowPositionX", position.x);
handler.Set("windowPositionY", position.y); handler.Set("windowPositionY", position.y);
handler.Set("compactMode", compactMode); handler.Set("compactMode", compactMode);
handler.Set("compactCollapseRight", compactCollapseRight); handler.Set("compactCollapseRight", compactCollapseRight);
handler.Set("showAllStages", showAllStages); handler.Set("showAllStages", showAllStages);
handler.Set("showAtmosphericDetails", showAtmosphericDetails); handler.Set("showAtmosphericDetails", showAtmosphericDetails);
handler.Set("showSettings", showSettings); handler.Set("showSettings", showSettings);
handler.Set("selectedBodyName", CelestialBodies.SelectedBody.Name); handler.Set("selectedBodyName", CelestialBodies.SelectedBody.Name);
handler.Save("BuildAdvanced.xml"); handler.Save("BuildAdvanced.xml");
GuiDisplaySize.OnSizeChanged -= OnSizeChanged; GuiDisplaySize.OnSizeChanged -= OnSizeChanged;
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.Exception(ex, "BuildAdvanced.OnDestroy()"); Logger.Exception(ex, "BuildAdvanced.OnDestroy()");
} }
   
  EditorLock(false);
} }
   
protected void OnGUI() protected void OnGUI()
{ {
try try
{ {
if (!visible || EditorLogic.fetch == null || EditorLogic.fetch.ship.parts.Count == 0 || EditorLogic.fetch.editorScreen != EditorScreen.Parts) if (!visible || EditorLogic.fetch == null || EditorLogic.fetch.ship.parts.Count == 0 || EditorLogic.fetch.editorScreen != EditorScreen.Parts)
{ {
return; return;
} }
   
if (stages == null) if (stages == null)
{ {
return; return;
} }
   
// Change the window title based on whether in compact mode or not. // Change the window title based on whether in compact mode or not.
title = !compactMode ? "KERBAL ENGINEER REDUX " + EngineerGlobals.ASSEMBLY_VERSION : "K.E.R. " + EngineerGlobals.ASSEMBLY_VERSION; title = !compactMode ? "KERBAL ENGINEER REDUX " + EngineerGlobals.ASSEMBLY_VERSION : "K.E.R. " + EngineerGlobals.ASSEMBLY_VERSION;
   
// Reset the window size when the staging or something else has changed. // Reset the window size when the staging or something else has changed.
stagesLength = stages.Length; stagesLength = stages.Length;
if (showAllStages) if (showAllStages)
{ {
stagesCount = stagesLength; stagesCount = stagesLength;
} }
if (showAllStages == false) if (showAllStages == false)
{ {
stagesCount = 0; stagesCount = 0;
for (int i = 0; i < stagesLength; ++i) for (int i = 0; i < stagesLength; ++i)
{ {
if (stages[i].deltaV > 0.0f) if (stages[i].deltaV > 0.0f)
{ {
stagesCount = stagesCount + 1; stagesCount = stagesCount + 1;
} }
} }
} }
   
if (hasChanged || stagesCount != numberOfStages) if (hasChanged || stagesCount != numberOfStages)
{ {
hasChanged = false; hasChanged = false;
numberOfStages = stagesCount; numberOfStages = stagesCount;
   
position.width = 0; position.width = 0;
position.height = 0; position.height = 0;
} }
   
GUI.skin = null; GUI.skin = null;
position = GUILayout.Window(GetInstanceID(), position, Window, title, windowStyle).ClampToScreen(); position = GUILayout.Window(GetInstanceID(), position, Window, title, windowStyle).ClampToScreen();
   
if (compactCheck > 0 && compactCollapseRight) if (compactCheck > 0 && compactCollapseRight)
{ {
position.x = compactRight - position.width; position.x = compactRight - position.width;
compactCheck--; compactCheck--;
} }
else if (compactCheck > 0) else if (compactCheck > 0)
{ {
compactCheck = 0; compactCheck = 0;
} }
   
// Check editor lock to manage click-through. // Check editor lock to manage click-through.
CheckEditorLock(); CheckEditorLock();
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.Exception(ex, "BuildAdvanced.OnGUI()"); Logger.Exception(ex, "BuildAdvanced.OnGUI()");
} }
} }
   
protected void Start() protected void Start()
{ {
try try
{ {
InitialiseStyles(); InitialiseStyles();
GuiDisplaySize.OnSizeChanged += OnSizeChanged; GuiDisplaySize.OnSizeChanged += OnSizeChanged;
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.Exception(ex, "BuildAdvanced.Start()"); Logger.Exception(ex, "BuildAdvanced.Start()");
} }
} }
   
protected void Update() protected void Update()
{ {
try try
{ {
if (Input.GetKeyDown(KeyBinder.EditorShowHide)) if (Input.GetKeyDown(KeyBinder.EditorShowHide))
{ {
visible = !visible; visible = !visible;
if (!visible) if (!visible)
{ {
EditorLock(false); EditorLock(false);
} }
} }
   
if (!visible || EditorLogic.fetch == null || EditorLogic.fetch.ship.parts.Count == 0) if (!visible || EditorLogic.fetch == null || EditorLogic.fetch.ship.parts.Count == 0)
{ {
bodiesList.enabled = false; bodiesList.enabled = false;
return; return;
} }
   
// Configure the simulation parameters based on the selected reference body. // Configure the simulation parameters based on the selected reference body.
SimManager.Gravity = CelestialBodies.SelectedBody.Gravity; SimManager.Gravity = CelestialBodies.SelectedBody.Gravity;
   
if (showAtmosphericDetails) if (showAtmosphericDetails)
{ {
SimManager.Atmosphere = CelestialBodies.SelectedBody.GetAtmospheres(Altitude); SimManager.Atmosphere = CelestialBodies.SelectedBody.GetAtmospheres(Altitude);
} }
else else
{ {
SimManager.Atmosphere = 0; SimManager.Atmosphere = 0;
} }
   
SimManager.Mach = atmosphericMach; SimManager.Mach = atmosphericMach;
   
SimManager.RequestSimulation(); SimManager.RequestSimulation();
SimManager.TryStartSimulation(); SimManager.TryStartSimulation();
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.Exception(ex, "BuildAdvanced.Update()"); Logger.Exception(ex, "BuildAdvanced.Update()");
} }
} }
   
/// <summary> /// <summary>
/// Checks whether the editor should be locked to stop click-through. /// Checks whether the editor should be locked to stop click-through.
/// </summary> /// </summary>
private void CheckEditorLock() private void CheckEditorLock()
{ {
if ((position.MouseIsOver() || bodiesList.Position.MouseIsOver()) && !isEditorLocked) if ((position.MouseIsOver() || bodiesList.Position.MouseIsOver()) && !isEditorLocked)
{ {
EditorLock(true); EditorLock(true);
} }
else if (!position.MouseIsOver() && !bodiesList.Position.MouseIsOver() && isEditorLocked) else if (!position.MouseIsOver() && !bodiesList.Position.MouseIsOver() && isEditorLocked)
{ {
EditorLock(false); EditorLock(false);
} }
} }
   
/// <summary> /// <summary>
/// Draws the atmospheric settings. /// Draws the atmospheric settings.
/// </summary> /// </summary>
private void DrawAtmosphericDetails() private void DrawAtmosphericDetails()
{ {
try try
{ {
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
GUILayout.BeginVertical(); GUILayout.BeginVertical();
GUILayout.Label("Altitude: " + (Altitude * 0.001f).ToString("F1") + "km", settingAtmoStyle, GUILayout.Width(125.0f * GuiDisplaySize.Offset)); GUILayout.Label("Altitude: " + (Altitude * 0.001f).ToString("F1") + "km", settingAtmoStyle, GUILayout.Width(125.0f * GuiDisplaySize.Offset));
GUI.skin = HighLogic.Skin; GUI.skin = HighLogic.Skin;
Altitude = GUILayout.HorizontalSlider(Altitude, 0.0f, (float)(CelestialBodies.SelectedBody.CelestialBody.atmosphereDepth)); Altitude = GUILayout.HorizontalSlider(Altitude, 0.0f, (float)(CelestialBodies.SelectedBody.CelestialBody.atmosphereDepth));
GUI.skin = null; GUI.skin = null;
GUILayout.EndVertical(); GUILayout.EndVertical();
   
GUILayout.Space(5.0f); GUILayout.Space(5.0f);
   
GUILayout.BeginVertical(); GUILayout.BeginVertical();
GUILayout.Label("Mach: " + atmosphericMach.ToString("F2"), settingAtmoStyle, GUILayout.Width(125.0f * GuiDisplaySize.Offset)); GUILayout.Label("Mach: " + atmosphericMach.ToString("F2"), settingAtmoStyle, GUILayout.Width(125.0f * GuiDisplaySize.Offset));
GUI.skin = HighLogic.Skin; GUI.skin = HighLogic.Skin;
atmosphericMach = GUILayout.HorizontalSlider(Mathf.Clamp(atmosphericMach, 0.0f, maxMach), 0.0f, maxMach); atmosphericMach = GUILayout.HorizontalSlider(Mathf.Clamp(atmosphericMach, 0.0f, maxMach), 0.0f, maxMach);
GUI.skin = null; GUI.skin = null;
GUILayout.EndVertical(); GUILayout.EndVertical();
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.Exception(ex, "BuildAdvanced.DrawAtmosphericDetails()"); Logger.Exception(ex, "BuildAdvanced.DrawAtmosphericDetails()");
} }
} }
   
private void DrawBodiesList() private void DrawBodiesList()
{ {
if (CelestialBodies.SystemBody == CelestialBodies.SelectedBody) if (CelestialBodies.SystemBody == CelestialBodies.SelectedBody)
{ {
DrawBody(CelestialBodies.SystemBody); DrawBody(CelestialBodies.SystemBody);
} }
else else
{ {
foreach (CelestialBodies.BodyInfo body in CelestialBodies.SystemBody.Children) foreach (CelestialBodies.BodyInfo body in CelestialBodies.SystemBody.Children)
{ {
DrawBody(body); DrawBody(body);
} }
} }
} }
   
private void DrawBody(CelestialBodies.BodyInfo bodyInfo, int depth = 0) private void DrawBody(CelestialBodies.BodyInfo bodyInfo, int depth = 0)
{ {
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
GUILayout.Space(20.0f * depth); GUILayout.Space(20.0f * depth);
if (GUILayout.Button(bodyInfo.Children.Count > 0 ? bodyInfo.Name + " [" + bodyInfo.Children.Count + "]" : bodyInfo.Name, bodyInfo.Selected && bodyInfo.SelectedDepth == 0 ? bodiesButtonActiveStyle : bodiesButtonStyle)) if (GUILayout.Button(bodyInfo.Children.Count > 0 ? bodyInfo.Name + " [" + bodyInfo.Children.Count + "]" : bodyInfo.Name, bodyInfo.Selected && bodyInfo.SelectedDepth == 0 ? bodiesButtonActiveStyle : bodiesButtonStyle))
{ {
CelestialBodies.SetSelectedBody(bodyInfo.Name); CelestialBodies.SetSelectedBody(bodyInfo.Name);
Altitude = 0.0f; Altitude = 0.0f;
bodiesList.Resize = true; bodiesList.Resize = true;
} }
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
if (bodyInfo.Selected) if (bodyInfo.Selected)
{ {
for (int i = 0; i < bodyInfo.Children.Count; ++i) for (int i = 0; i < bodyInfo.Children.Count; ++i)
{ {
DrawBody(bodyInfo.Children[i], depth + 1); DrawBody(bodyInfo.Children[i], depth + 1);
} }
} }
} }
   
/// <summary> /// <summary>
/// Draws the burn time column. /// Draws the burn time column.
/// </summary> /// </summary>
private void DrawBurnTime() private void DrawBurnTime()
{ {
GUILayout.BeginVertical(GUILayout.Width(75.0f * GuiDisplaySize.Offset)); GUILayout.BeginVertical(GUILayout.Width(75.0f * GuiDisplaySize.Offset));
GUILayout.Label("BURN", titleStyle); GUILayout.Label("BURN", titleStyle);
for (int i = 0; i < stagesLength; ++i) for (int i = 0; i < stagesLength; ++i)
{ {
stage = stages[i]; stage = stages[i];
if (showAllStages || stage.deltaV > 0.0) if (showAllStages || stage.deltaV > 0.0)
{ {
GUILayout.Label(TimeFormatter.ConvertToString(stage.time), infoStyle); GUILayout.Label(TimeFormatter.ConvertToString(stage.time), infoStyle);
} }
} }
GUILayout.EndVertical(); GUILayout.EndVertical();
} }
   
/// <summary> /// <summary>
/// Draws the cost column. /// Draws the cost column.
/// </summary> /// </summary>
private void DrawCost() private void DrawCost()
{ {
GUILayout.BeginVertical(GUILayout.Width(110.0f * GuiDisplaySize.Offset)); GUILayout.BeginVertical(GUILayout.Width(110.0f * GuiDisplaySize.Offset));
GUILayout.Label("COST", titleStyle); GUILayout.Label("COST", titleStyle);
for (int i = 0; i < stagesLength; ++i) for (int i = 0; i < stagesLength; ++i)
{ {
stage = stages[i]; stage = stages[i];
if (showAllStages || stage.deltaV > 0.0) if (showAllStages || stage.deltaV > 0.0)
{ {
GUILayout.Label(Units.Cost(stage.cost, stage.totalCost), infoStyle); GUILayout.Label(Units.Cost(stage.cost, stage.totalCost), infoStyle);
} }
} }
GUILayout.EndVertical(); GUILayout.EndVertical();
} }
   
/// <summary> /// <summary>
/// Draws the deltaV column. /// Draws the deltaV column.
/// </summary> /// </summary>
private void DrawDeltaV() private void DrawDeltaV()
{ {
GUILayout.BeginVertical(GUILayout.Width(100.0f * GuiDisplaySize.Offset)); GUILayout.BeginVertical(GUILayout.Width(100.0f * GuiDisplaySize.Offset));
GUILayout.Label("DELTA-V", titleStyle); GUILayout.Label("DELTA-V", titleStyle);
for (int i = 0; i < stagesLength; ++i) for (int i = 0; i < stagesLength; ++i)
{ {
stage = stages[i]; stage = stages[i];
if (showAllStages || stage.deltaV > 0.0) if (showAllStages || stage.deltaV > 0.0)
{ {
GUILayout.Label(stage.deltaV.ToString("N0") + " / " + stage.inverseTotalDeltaV.ToString("N0") + "m/s", infoStyle); GUILayout.Label(stage.deltaV.ToString("N0") + " / " + stage.inverseTotalDeltaV.ToString("N0") + "m/s", infoStyle);
} }
} }
GUILayout.EndVertical(); GUILayout.EndVertical();
} }
   
/// <summary> /// <summary>
/// Draws the specific impluse column. /// Draws the specific impluse column.
/// </summary> /// </summary>
private void DrawIsp() private void DrawIsp()
{ {
GUILayout.BeginVertical(GUILayout.Width(75.0f * GuiDisplaySize.Offset)); GUILayout.BeginVertical(GUILayout.Width(75.0f * GuiDisplaySize.Offset));
GUILayout.Label("ISP", titleStyle); GUILayout.Label("ISP", titleStyle);
for (int i = 0; i < stagesLength; ++i) for (int i = 0; i < stagesLength; ++i)
{ {
stage = stages[i]; stage = stages[i];
if (showAllStages || stage.deltaV > 0.0) if (showAllStages || stage.deltaV > 0.0)
{ {
GUILayout.Label(stage.isp.ToString("F1") + "s", infoStyle); GUILayout.Label(stage.isp.ToString("F1") + "s", infoStyle);
} }
} }
GUILayout.EndVertical(); GUILayout.EndVertical();
} }
   
/// <summary> /// <summary>
/// Draws the mass column. /// Draws the mass column.
/// </summary> /// </summary>
private void DrawMass() private void DrawMass()
{ {
GUILayout.BeginVertical(GUILayout.Width(110.0f * GuiDisplaySize.Offset)); GUILayout.BeginVertical(GUILayout.Width(110.0f * GuiDisplaySize.Offset));
GUILayout.Label("MASS", titleStyle); GUILayout.Label("MASS", titleStyle);
for (int i = 0; i < stagesLength; ++i) for (int i = 0; i < stagesLength; ++i)
{ {
stage = stages[i]; stage = stages[i];
if (showAllStages || stage.deltaV > 0.0) if (showAllStages || stage.deltaV > 0.0)
{ {
GUILayout.Label(Units.ToMass(stage.mass, stage.totalMass), infoStyle); GUILayout.Label(Units.ToMass(stage.mass, stage.totalMass), infoStyle);
} }
} }
GUILayout.EndVertical(); GUILayout.EndVertical();
} }
   
/// <summary> /// <summary>
/// Draws the part count column. /// Draws the part count column.
/// </summary> /// </summary>
private void DrawPartCount() private void DrawPartCount()
{ {
GUILayout.BeginVertical(GUILayout.Width(50.0f * GuiDisplaySize.Offset)); GUILayout.BeginVertical(GUILayout.Width(50.0f * GuiDisplaySize.Offset));
GUILayout.Label("PARTS", titleStyle); GUILayout.Label("PARTS", titleStyle);
for (int i = 0; i < stagesLength; ++i) for (int i = 0; i < stagesLength; ++i)
{ {
stage = stages[i]; stage = stages[i];
if (showAllStages || stage.deltaV > 0.0) if (showAllStages || stage.deltaV > 0.0)
{ {
GUILayout.Label(stage.partCount + " / " + stage.totalPartCount, infoStyle); GUILayout.Label(stage.partCount + " / " + stage.totalPartCount, infoStyle);
} }
} }
GUILayout.EndVertical(); GUILayout.EndVertical();
} }
   
/// <summary> /// <summary>
/// Draws the settings panel. /// Draws the settings panel.
/// </summary> /// </summary>
private void DrawSettings() private void DrawSettings()
{ {
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
GUILayout.Label("Compact mode collapses to the:", settingStyle); GUILayout.Label("Compact mode collapses to the:", settingStyle);
compactCollapseRight = !GUILayout.Toggle(!compactCollapseRight, "LEFT", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset)); compactCollapseRight = !GUILayout.Toggle(!compactCollapseRight, "LEFT", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset));
compactCollapseRight = GUILayout.Toggle(compactCollapseRight, "RIGHT", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset)); compactCollapseRight = GUILayout.Toggle(compactCollapseRight, "RIGHT", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
GUILayout.Label("Simulate using vectored thrust values:", settingStyle); GUILayout.Label("Simulate using vectored thrust values:", settingStyle);
SimManager.vectoredThrust = GUILayout.Toggle(SimManager.vectoredThrust, "ENABLED", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset)); SimManager.vectoredThrust = GUILayout.Toggle(SimManager.vectoredThrust, "ENABLED", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
GUILayout.Label("Verbose Simulation Log:", settingStyle); GUILayout.Label("Verbose Simulation Log:", settingStyle);
SimManager.logOutput = GUILayout.Toggle(SimManager.logOutput, "ENABLED", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset)); SimManager.logOutput = GUILayout.Toggle(SimManager.logOutput, "ENABLED", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
GUILayout.Label("Build Engineer Overlay:", settingStyle); GUILayout.Label("Build Engineer Overlay:", settingStyle);
BuildOverlay.Visible = GUILayout.Toggle(BuildOverlay.Visible, "VISIBLE", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset)); BuildOverlay.Visible = GUILayout.Toggle(BuildOverlay.Visible, "VISIBLE", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset));
BuildOverlayPartInfo.NamesOnly = GUILayout.Toggle(BuildOverlayPartInfo.NamesOnly, "NAMES ONLY", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset)); BuildOverlayPartInfo.NamesOnly = GUILayout.Toggle(BuildOverlayPartInfo.NamesOnly, "NAMES ONLY", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset));
BuildOverlayPartInfo.ClickToOpen = GUILayout.Toggle(BuildOverlayPartInfo.ClickToOpen, "CLICK TO OPEN", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset)); BuildOverlayPartInfo.ClickToOpen = GUILayout.Toggle(BuildOverlayPartInfo.ClickToOpen, "CLICK TO OPEN", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
GUILayout.Label("Flight Engineer activation mode:", settingStyle); GUILayout.Label("Flight Engineer activation mode:", settingStyle);
FlightEngineerCore.IsCareerMode = GUILayout.Toggle(FlightEngineerCore.IsCareerMode, "CAREER", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset)); FlightEngineerCore.IsCareerMode = GUILayout.Toggle(FlightEngineerCore.IsCareerMode, "CAREER", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset));
FlightEngineerCore.IsCareerMode = !GUILayout.Toggle(!FlightEngineerCore.IsCareerMode, "PARTLESS", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset)); FlightEngineerCore.IsCareerMode = !GUILayout.Toggle(!FlightEngineerCore.IsCareerMode, "PARTLESS", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
GUILayout.Label("Flight Engineer Career Limitations:", settingStyle); GUILayout.Label("Flight Engineer Career Limitations:", settingStyle);
FlightEngineerCore.IsKerbalLimited = GUILayout.Toggle(FlightEngineerCore.IsKerbalLimited, "KERBAL", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset)); FlightEngineerCore.IsKerbalLimited = GUILayout.Toggle(FlightEngineerCore.IsKerbalLimited, "KERBAL", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset));
FlightEngineerCore.IsTrackingStationLimited = GUILayout.Toggle(FlightEngineerCore.IsTrackingStationLimited, "TRACKING", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset)); FlightEngineerCore.IsTrackingStationLimited = GUILayout.Toggle(FlightEngineerCore.IsTrackingStationLimited, "TRACKING", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset));
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal();
GUILayout.Label("GUI Size: " + GuiDisplaySize.Increment, settingStyle); GUILayout.Label("GUI Size: " + GuiDisplaySize.Increment, settingStyle);
if (GUILayout.Button("<", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset))) if (GUILayout.Button("<", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset)))
{ {
GuiDisplaySize.Increment--; GuiDisplaySize.Increment--;
} }
if (GUILayout.Button(">", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset))) if (GUILayout.Button(">", buttonStyle, GUILayout.Width(100.0f * GuiDisplaySize.Offset)))
{ {
GuiDisplaySize.Increment++; GuiDisplaySize.Increment++;
} }
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
GUILayout.Label("Minimum delay between simulations: " + SimManager.minSimTime.TotalMilliseconds + "ms", settingStyle); GUILayout.Label("Minimum delay between simulations: " + SimManager.minSimTime.TotalMilliseconds + "ms", settingStyle);
GUI.skin = HighLogic.Skin; GUI.skin = HighLogic.Skin;
SimManager.minSimTime = TimeSpan.FromMilliseconds(GUILayout.HorizontalSlider((float)SimManager.minSimTime.TotalMilliseconds, 0, 2000.0f)); SimManager.minSimTime = TimeSpan.FromMilliseconds(GUILayout.HorizontalSlider((float)SimManager.minSimTime.TotalMilliseconds, 0, 2000.0f));
GUI.skin = null; GUI.skin = null;
} }
   
/// <summary> /// <summary>
/// Draws the stage number column. /// Draws the stage number column.
/// </summary> /// </summary>
private void DrawStageNumbers() private void DrawStageNumbers()
{ {
GUILayout.BeginVertical(GUILayout.Width(30.0f * GuiDisplaySize.Offset)); GUILayout.BeginVertical(GUILayout.Width(30.0f * GuiDisplaySize.Offset));
GUILayout.Label(string.Empty, titleStyle); GUILayout.Label(string.Empty, titleStyle);
for (int i = 0; i < stagesLength; ++i) for (int i = 0; i < stagesLength; ++i)
{ {
stage = stages[i]; stage = stages[i];
if (showAllStages || stage.deltaV > 0.0) if (showAllStages || stage.deltaV > 0.0)
{ {
GUILayout.Label("S" + stage.number, titleStyle); GUILayout.Label("S" + stage.number, titleStyle);
} }
} }
GUILayout.EndVertical(); GUILayout.EndVertical();
} }
   
/// <summary> /// <summary>
/// Draws the thrust column. /// Draws the thrust column.
/// </summary> /// </summary>
private void DrawThrust() private void DrawThrust()
{ {
GUILayout.BeginVertical(GUILayout.Width(75.0f * GuiDisplaySize.Offset)); GUILayout.BeginVertical(GUILayout.Width(75.0f * GuiDisplaySize.Offset));
GUILayout.Label("THRUST", titleStyle); GUILayout.Label("THRUST", titleStyle);
for (int i = 0; i < stagesLength; ++i) for (int i = 0; i < stagesLength; ++i)
{ {
stage = stages[i]; stage = stages[i];
if (showAllStages || stage.deltaV > 0.0) if (showAllStages || stage.deltaV > 0.0)
{ {
GUILayout.Label(stage.thrust.ToForce(), infoStyle); GUILayout.Label(stage.thrust.ToForce(), infoStyle);
} }
} }
GUILayout.EndVertical(); GUILayout.EndVertical();
} }
   
/// <summary> /// <summary>
/// Draws the torque column. /// Draws the torque column.
/// </summary> /// </summary>
private void DrawTorque() private void DrawTorque()
{ {
GUILayout.BeginVertical(GUILayout.Width(75.0f * GuiDisplaySize.Offset)); GUILayout.BeginVertical(GUILayout.Width(75.0f * GuiDisplaySize.Offset));
GUILayout.Label("TORQUE", titleStyle); GUILayout.Label("TORQUE", titleStyle);
for (int i = 0; i < stagesLength; ++i) for (int i = 0; i < stagesLength; ++i)
{ {
stage = stages[i]; stage = stages[i];
if (showAllStages || stage.deltaV > 0.0) if (showAllStages || stage.deltaV > 0.0)
{ {
GUILayout.Label(stage.maxThrustTorque.ToTorque(), infoStyle); GUILayout.Label(stage.maxThrustTorque.ToTorque(), infoStyle);
} }
} }
GUILayout.EndVertical(); GUILayout.EndVertical();
} }
   
/// <summary> /// <summary>
/// Drwas the thrust to weight ratio column. /// Drwas the thrust to weight ratio column.
/// </summary> /// </summary>
private void DrawTwr() private void DrawTwr()
{ {
GUILayout.BeginVertical(GUILayout.Width(100.0f * GuiDisplaySize.Offset)); GUILayout.BeginVertical(GUILayout.Width(100.0f * GuiDisplaySize.Offset));
GUILayout.Label("TWR (MAX)", titleStyle); GUILayout.Label("TWR (MAX)", titleStyle);
for (int i = 0; i < stagesLength; ++i) for (int i = 0; i < stagesLength; ++i)
{ {
stage = stages[i]; stage = stages[i];
if (showAllStages || stage.deltaV > 0.0) if (showAllStages || stage.deltaV > 0.0)
{ {
GUILayout.Label(stage.thrustToWeight.ToString("F2") + " (" + stage.maxThrustToWeight.ToString("F2") + ")", infoStyle); GUILayout.Label(stage.thrustToWeight.ToString("F2") + " (" + stage.maxThrustToWeight.ToString("F2") + ")", infoStyle);
} }
} }
GUILayout.EndVertical(); GUILayout.EndVertical();
} }
   
private void EditorLock(bool state) private void EditorLock(bool state)
{ {
if (state) if (state)
{ {
InputLockManager.SetControlLock(ControlTypes.All, "KER_BuildAdvanced"); InputLockManager.SetControlLock(ControlTypes.All, "KER_BuildAdvanced");
BuildOverlayPartInfo.Hidden = true; BuildOverlayPartInfo.Hidden = true;
isEditorLocked = true; isEditorLocked = true;
} }
else else
{ {
InputLockManager.SetControlLock(ControlTypes.None, "KER_BuildAdvanced"); InputLockManager.SetControlLock(ControlTypes.None, "KER_BuildAdvanced");
BuildOverlayPartInfo.Hidden = false; BuildOverlayPartInfo.Hidden = false;
isEditorLocked = false; isEditorLocked = false;
} }
} }
   
private void GetStageInfo() private void GetStageInfo()
{ {
stages = SimManager.Stages; stages = SimManager.Stages;
if (stages != null && stages.Length > 0) if (stages != null && stages.Length > 0)
{ {
maxMach = stages[stages.Length - 1].maxMach; maxMach = stages[stages.Length - 1].maxMach;
} }
} }
   
/// <summary> /// <summary>
/// Initialises all the styles that are required. /// Initialises all the styles that are required.
/// </summary> /// </summary>
private void InitialiseStyles() private void InitialiseStyles()
{ {
windowStyle = new GUIStyle(HighLogic.Skin.window) windowStyle = new GUIStyle(HighLogic.Skin.window)
{ {
alignment = TextAnchor.UpperLeft alignment = TextAnchor.UpperLeft
}; };
   
areaStyle = new GUIStyle(HighLogic.Skin.box) areaStyle = new GUIStyle(HighLogic.Skin.box)
{ {
padding = new RectOffset(0, 0, 9, 0) padding = new RectOffset(0, 0, 9, 0)
}; };
   
areaSettingStyle = new GUIStyle(HighLogic.Skin.box) areaSettingStyle = new GUIStyle(HighLogic.Skin.box)
{ {
padding = new RectOffset(10, 10, 10, 10) padding = new RectOffset(10, 10, 10, 10)
}; };
   
buttonStyle = new GUIStyle(HighLogic.Skin.button) buttonStyle = new GUIStyle(HighLogic.Skin.button)
{ {
normal = normal =
{ {
textColor = Color.white textColor = Color.white
}, },
fontSize = (int)(11 * GuiDisplaySize.Offset), fontSize = (int)(11 * GuiDisplaySize.Offset),
fontStyle = FontStyle.Bold, fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleCenter alignment = TextAnchor.MiddleCenter
}; };
   
titleStyle = new GUIStyle(HighLogic.Skin.label) titleStyle = new GUIStyle(HighLogic.Skin.label)
{ {
normal = normal =
{ {
textColor = Color.white textColor = Color.white
}, },
fontSize = (int)(11 * GuiDisplaySize.Offset), fontSize = (int)(11 * GuiDisplaySize.Offset),
fontStyle = FontStyle.Bold, fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleCenter, alignment = TextAnchor.MiddleCenter,
stretchWidth = true, stretchWidth = true
}; };
   
infoStyle = new GUIStyle(HighLogic.Skin.label) infoStyle = new GUIStyle(HighLogic.Skin.label)
{ {
fontSize = (int)(11 * GuiDisplaySize.Offset), fontSize = (int)(11 * GuiDisplaySize.Offset),
fontStyle = FontStyle.Bold, fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleCenter, alignment = TextAnchor.MiddleCenter,
stretchWidth = true stretchWidth = true
}; };
   
settingStyle = new GUIStyle(titleStyle) settingStyle = new GUIStyle(titleStyle)
{ {
alignment = TextAnchor.MiddleLeft, alignment = TextAnchor.MiddleLeft,
stretchWidth = true, stretchWidth = true,
stretchHeight = true stretchHeight = true
}; };
   
settingAtmoStyle = new GUIStyle(titleStyle) settingAtmoStyle = new GUIStyle(titleStyle)
{ {
margin = new RectOffset(), margin = new RectOffset(),
padding = new RectOffset(), padding = new RectOffset(),
alignment = TextAnchor.UpperLeft alignment = TextAnchor.UpperLeft
}; };
   
bodiesButtonStyle = new GUIStyle(HighLogic.Skin.button) bodiesButtonStyle = new GUIStyle(HighLogic.Skin.button)
{ {
margin = new RectOffset(0, 0, 2, 0), margin = new RectOffset(0, 0, 2, 0),
padding = new RectOffset(5, 5, 5, 5), padding = new RectOffset(5, 5, 5, 5),
normal = normal =
{ {
textColor = Color.white textColor = Color.white
}, },
active = active =
{ {
textColor = Color.white textColor = Color.white
}, },
fontSize = (int)(11 * GuiDisplaySize.Offset), fontSize = (int)(11 * GuiDisplaySize.Offset),
fontStyle = FontStyle.Bold, fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleCenter, alignment = TextAnchor.MiddleCenter,
fixedHeight = 20.0f fixedHeight = 20.0f
}; };
   
bodiesButtonActiveStyle = new GUIStyle(bodiesButtonStyle) bodiesButtonActiveStyle = new GUIStyle(bodiesButtonStyle)
{ {
normal = bodiesButtonStyle.onNormal, normal = bodiesButtonStyle.onNormal,
hover = bodiesButtonStyle.onHover hover = bodiesButtonStyle.onHover
}; };
} }
   
/// <summary> /// <summary>
/// Loads the settings when this object is created. /// Loads the settings when this object is created.
/// </summary> /// </summary>
private void Load() private void Load()
{ {
try try
{ {
SettingHandler handler = SettingHandler.Load("BuildAdvanced.xml"); SettingHandler handler = SettingHandler.Load("BuildAdvanced.xml");
handler.Get("visible", ref visible); handler.Get("visible", ref visible);
position.x = handler.Get("windowPositionX", position.x); position.x = handler.Get("windowPositionX", position.x);
position.y = handler.Get("windowPositionY", position.y); position.y = handler.Get("windowPositionY", position.y);
handler.Get("compactMode", ref compactMode); handler.Get("compactMode", ref compactMode);
handler.Get("compactCollapseRight", ref compactCollapseRight); handler.Get("compactCollapseRight", ref compactCollapseRight);
handler.Get("showAllStages", ref showAllStages); handler.Get("showAllStages", ref showAllStages);
handler.Get("showAtmosphericDetails", ref showAtmosphericDetails); handler.Get("showAtmosphericDetails", ref showAtmosphericDetails);
handler.Get("showSettings", ref showSettings); handler.Get("showSettings", ref showSettings);
CelestialBodies.SetSelectedBody(handler.Get("selectedBodyName", CelestialBodies.SelectedBody.Name)); CelestialBodies.SetSelectedBody(handler.Get("selectedBodyName", CelestialBodies.SelectedBody.Name));
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.Exception(ex, "BuildAdvanced.Load()"); Logger.Exception(ex, "BuildAdvanced.Load()");
} }
} }
   
private void OnSizeChanged() private void OnSizeChanged()
{ {
InitialiseStyles(); InitialiseStyles();
hasChanged = true; hasChanged = true;
} }
   
/// <summary> /// <summary>
/// Draws the OnGUI window. /// Draws the OnGUI window.
/// </summary> /// </summary>
private void Window(int windowId) private void Window(int windowId)
{ {
try try
{ {
compactModeRect = new Rect(position.width - 70.0f * GuiDisplaySize.Offset, 5.0f, 65.0f * GuiDisplaySize.Offset, 20.0f); compactModeRect = new Rect(position.width - 70.0f * GuiDisplaySize.Offset, 5.0f, 65.0f * GuiDisplaySize.Offset, 20.0f);
   
// Draw the compact mode toggle. // Draw the compact mode toggle.
if (GUI.Toggle(compactModeRect, compactMode, "COMPACT", buttonStyle) != compactMode) if (GUI.Toggle(compactModeRect, compactMode, "COMPACT", buttonStyle) != compactMode)
{ {
hasChanged = true; hasChanged = true;
compactCheck = 2; compactCheck = 2;
compactRight = position.xMax; compactRight = position.xMax;
compactMode = !compactMode; compactMode = !compactMode;
} }
   
// When not in compact mode draw the 'All Stages' and 'Atmospheric' toggles. // When not in compact mode draw the 'All Stages' and 'Atmospheric' toggles.
if (!compactMode) if (!compactMode)
{ {
if (GUI.Toggle(new Rect(position.width - 143.0f * GuiDisplaySize.Offset, 5.0f, 70.0f * GuiDisplaySize.Offset, 20.0f), showSettings, "SETTINGS", buttonStyle) != showSettings) if (GUI.Toggle(new Rect(position.width - 143.0f * GuiDisplaySize.Offset, 5.0f, 70.0f * GuiDisplaySize.Offset, 20.0f), showSettings, "SETTINGS", buttonStyle) != showSettings)
{ {
hasChanged = true; hasChanged = true;
showSettings = !showSettings; showSettings = !showSettings;
} }
   
if (GUI.Toggle(new Rect(position.width - 226.0f * GuiDisplaySize.Offset, 5.0f, 80.0f * GuiDisplaySize.Offset, 20.0f), showAllStages, "ALL STAGES", buttonStyle) != showAllStages) if (GUI.Toggle(new Rect(position.width - 226.0f * GuiDisplaySize.Offset, 5.0f, 80.0f * GuiDisplaySize.Offset, 20.0f), showAllStages, "ALL STAGES", buttonStyle) != showAllStages)
{ {
hasChanged = true; hasChanged = true;
showAllStages = !showAllStages; showAllStages = !showAllStages;
} }
   
if (GUI.Toggle(new Rect(position.width - 324.0f * GuiDisplaySize.Offset, 5.0f, 95.0f * GuiDisplaySize.Offset, 20.0f), showAtmosphericDetails, "ATMOSPHERIC", buttonStyle) != showAtmosphericDetails) if (GUI.Toggle(new Rect(position.width - 324.0f * GuiDisplaySize.Offset, 5.0f, 95.0f * GuiDisplaySize.Offset, 20.0f), showAtmosphericDetails, "ATMOSPHERIC", buttonStyle) != showAtmosphericDetails)
{ {
hasChanged = true; hasChanged = true;
showAtmosphericDetails = !showAtmosphericDetails; showAtmosphericDetails = !showAtmosphericDetails;
} }
   
bodiesListPosition = new Rect(position.width - 452.0f * GuiDisplaySize.Offset, 5.0f, 125.0f * GuiDisplaySize.Offset, 20.0f); bodiesListPosition = new Rect(position.width - 452.0f * GuiDisplaySize.Offset, 5.0f, 125.0f * GuiDisplaySize.Offset, 20.0f);
bodiesList.enabled = GUI.Toggle(bodiesListPosition, bodiesList.enabled, "BODY: " + CelestialBodies.SelectedBody.Name.ToUpper(), buttonStyle); bodiesList.enabled = GUI.Toggle(bodiesListPosition, bodiesList.enabled, "BODY: " + CelestialBodies.SelectedBody.Name.ToUpper(), buttonStyle);
bodiesList.SetPosition(bodiesListPosition.Translate(position)); bodiesList.SetPosition(bodiesListPosition.Translate(position));
} }
else else
{ {
if (GUI.Toggle(new Rect(position.width - 133.0f * GuiDisplaySize.Offset, 5.0f, 60.0f * GuiDisplaySize.Offset, 20.0f), showAtmosphericDetails, "ATMO", buttonStyle) != showAtmosphericDetails) if (GUI.Toggle(new Rect(position.width - 133.0f * GuiDisplaySize.Offset, 5.0f, 60.0f * GuiDisplaySize.Offset, 20.0f), showAtmosphericDetails, "ATMO", buttonStyle) != showAtmosphericDetails)
{ {
hasChanged = true; hasChanged = true;
showAtmosphericDetails = !showAtmosphericDetails; showAtmosphericDetails = !showAtmosphericDetails;
} }
} }
   
// Draw the main informational display box. // Draw the main informational display box.
if (!compactMode) if (!compactMode)
{ {
GUILayout.BeginHorizontal(areaStyle); GUILayout.BeginHorizontal(areaStyle);
DrawStageNumbers(); DrawStageNumbers();
DrawPartCount(); DrawPartCount();
DrawCost(); DrawCost();
DrawMass(); DrawMass();
DrawIsp(); DrawIsp();
DrawThrust(); DrawThrust();
DrawTorque(); DrawTorque();
DrawTwr(); DrawTwr();
DrawDeltaV(); DrawDeltaV();
DrawBurnTime(); DrawBurnTime();
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
   
if (showAtmosphericDetails && !compactMode) if (showAtmosphericDetails && !compactMode)
{ {
GUILayout.BeginVertical(areaSettingStyle); GUILayout.BeginVertical(areaSettingStyle);
DrawAtmosphericDetails(); DrawAtmosphericDetails();
GUILayout.EndVertical(); GUILayout.EndVertical();
} }
   
if (showSettings) if (showSettings)
{ {
GUILayout.BeginVertical(areaSettingStyle); GUILayout.BeginVertical(areaSettingStyle);
DrawSettings(); DrawSettings();
GUILayout.EndVertical(); GUILayout.EndVertical();
} }
} }
else // Draw only a few details when in compact mode. else // Draw only a few details when in compact mode.
{ {
GUILayout.BeginHorizontal(areaStyle); GUILayout.BeginHorizontal(areaStyle);
DrawStageNumbers(); DrawStageNumbers();
DrawTwr(); DrawTwr();
DrawDeltaV(); DrawDeltaV();
GUILayout.EndHorizontal(); GUILayout.EndHorizontal();
} }
   
GUI.DragWindow(); GUI.DragWindow();
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.Exception(ex, "BuildAdvanced.Window()"); Logger.Exception(ex, "BuildAdvanced.Window()");
} }
} }
#endregion  
} }
} }
// //
// Copyright (C) 2015 CYBUTEK // Copyright (C) 2015 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
namespace KerbalEngineer namespace KerbalEngineer
{ {
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
   
public static class EngineerGlobals public static class EngineerGlobals
{ {
/// <summary> /// <summary>
/// Current version of the Kerbal Engineer assembly. /// Current version of the Kerbal Engineer assembly.
/// </summary> /// </summary>
public const string ASSEMBLY_VERSION = "1.0.18.0"; public const string ASSEMBLY_VERSION = "1.0.18.1";
   
private static string assemblyFile; private static string assemblyFile;
private static string assemblyName; private static string assemblyName;
private static string assemblyPath; private static string assemblyPath;
   
/// <summary> /// <summary>
/// Gets the Kerbal Engineer assembly's path including the file name. /// Gets the Kerbal Engineer assembly's path including the file name.
/// </summary> /// </summary>
public static string AssemblyFile public static string AssemblyFile
{ {
get get
{ {
return assemblyFile ?? (assemblyFile = Assembly.GetExecutingAssembly().Location); return assemblyFile ?? (assemblyFile = Assembly.GetExecutingAssembly().Location);
} }
} }
   
/// <summary> /// <summary>
/// Gets the Kerbal Engineer assembly's file name. /// Gets the Kerbal Engineer assembly's file name.
/// </summary> /// </summary>
public static string AssemblyName public static string AssemblyName
{ {
get get
{ {
return assemblyName ?? (assemblyName = new FileInfo(AssemblyFile).Name); return assemblyName ?? (assemblyName = new FileInfo(AssemblyFile).Name);
} }
} }
   
/// <summary> /// <summary>
/// Gets the Kerbal Engineer assembly's path excluding the file name. /// Gets the Kerbal Engineer assembly's path excluding the file name.
/// </summary> /// </summary>
public static string AssemblyPath public static string AssemblyPath
{ {
get get
{ {
return assemblyPath ?? (assemblyPath = AssemblyFile.Replace(new FileInfo(AssemblyFile).Name, "")); return assemblyPath ?? (assemblyPath = AssemblyFile.Replace(new FileInfo(AssemblyFile).Name, ""));
} }
} }
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
   
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
using UnityEngine; using UnityEngine;
   
#endregion #endregion
   
namespace KerbalEngineer.Extensions namespace KerbalEngineer.Extensions
{ {
public static class OrbitExtensions public static class OrbitExtensions
{ {
#region Constants #region Constants
   
public const double Tau = Math.PI * 2.0; public const double Tau = Math.PI * 2.0;
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public static double GetAngleToAscendingNode(this Orbit orbit) public static double GetAngleToAscendingNode(this Orbit orbit)
{ {
return GetAngleToTrueAnomaly(orbit, GetTrueAnomalyOfAscendingNode(orbit)); return GetAngleToTrueAnomaly(orbit, GetTrueAnomalyOfAscendingNode(orbit));
} }
   
public static double GetAngleToDescendingNode(this Orbit orbit) public static double GetAngleToDescendingNode(this Orbit orbit)
{ {
return GetAngleToTrueAnomaly(orbit, GetTrueAnomalyOfDescendingNode(orbit)); return GetAngleToTrueAnomaly(orbit, GetTrueAnomalyOfDescendingNode(orbit));
} }
   
public static double GetAngleToPrograde(this Orbit orbit) public static double GetAngleToPrograde(this Orbit orbit)
{ {
return GetAngleToPrograde(orbit, Planetarium.GetUniversalTime()); return GetAngleToPrograde(orbit, Planetarium.GetUniversalTime());
} }
   
public static double GetAngleToPrograde(this Orbit orbit, double universalTime) public static double GetAngleToPrograde(this Orbit orbit, double universalTime)
{ {
if (orbit.referenceBody == CelestialBodies.SystemBody.CelestialBody) if (orbit.referenceBody == CelestialBodies.SystemBody.CelestialBody)
{ {
return 0.0; return 0.0;
} }
   
var angle = AngleHelper.GetAngleBetweenVectors(orbit.getRelativePositionAtUT(universalTime), Vector3d orbitVector = orbit.getRelativePositionAtUT(universalTime);
Vector3d.Exclude(orbit.GetOrbitNormal(), orbit.referenceBody.orbit.getRelativePositionAtUT(universalTime))); orbitVector.z = 0.0;
   
angle = AngleHelper.Clamp360(angle - 90.0); Vector3d bodyVector = orbit.referenceBody.orbit.getOrbitalVelocityAtUT(universalTime);
  bodyVector.z = 0.0;
   
return orbit.inclination > 90.0 ? angle : 360.0 - angle; double angle = AngleHelper.GetAngleBetweenVectors(bodyVector, orbitVector);
   
  return AngleHelper.Clamp360(orbit.inclination < 90.0 ? angle : 360.0 - angle);
} }
   
public static double GetAngleToRetrograde(this Orbit orbit) public static double GetAngleToRetrograde(this Orbit orbit)
{ {
return GetAngleToRetrograde(orbit, Planetarium.GetUniversalTime()); return GetAngleToRetrograde(orbit, Planetarium.GetUniversalTime());
} }
   
public static double GetAngleToRetrograde(this Orbit orbit, double universalTime) public static double GetAngleToRetrograde(this Orbit orbit, double universalTime)
{ {
if (orbit.referenceBody == CelestialBodies.SystemBody.CelestialBody) if (orbit.referenceBody == CelestialBodies.SystemBody.CelestialBody)
{ {
return 0.0; return 0.0;
} }
   
var angle = AngleHelper.GetAngleBetweenVectors(orbit.getRelativePositionAtUT(universalTime), Vector3d orbitVector = orbit.getRelativePositionAtUT(universalTime);
Vector3d.Exclude(orbit.GetOrbitNormal(), orbit.referenceBody.orbit.getRelativePositionAtUT(universalTime))); orbitVector.z = 0.0;
   
angle = AngleHelper.Clamp360(angle + 90.0); Vector3d bodyVector = orbit.referenceBody.orbit.getOrbitalVelocityAtUT(universalTime);
  bodyVector.z = 0.0;
   
return orbit.inclination > 90.0 ? angle : 360.0 - angle; double angle = AngleHelper.GetAngleBetweenVectors(-bodyVector, orbitVector);
   
  return AngleHelper.Clamp360(orbit.inclination < 90.0 ? angle : 360.0 - angle);
} }
   
public static double GetAngleToTrueAnomaly(this Orbit orbit, double trueAnomaly) public static double GetAngleToTrueAnomaly(this Orbit orbit, double trueAnomaly)
{ {
return AngleHelper.Clamp360(trueAnomaly - orbit.trueAnomaly); return AngleHelper.Clamp360(trueAnomaly - orbit.trueAnomaly);
} }
   
public static double GetAngleToVector(this Orbit orbit, Vector3d vector) public static double GetAngleToVector(this Orbit orbit, Vector3d vector)
{ {
return GetAngleToTrueAnomaly(orbit, GetTrueAnomalyFromVector(orbit, Vector3d.Exclude(orbit.GetOrbitNormal(), vector))); return GetAngleToTrueAnomaly(orbit, GetTrueAnomalyFromVector(orbit, Vector3d.Exclude(orbit.GetOrbitNormal(), vector)));
} }
   
public static double GetPhaseAngle(this Orbit orbit, Orbit target) public static double GetPhaseAngle(this Orbit orbit, Orbit target)
{ {
var angle = AngleHelper.GetAngleBetweenVectors(Vector3d.Exclude(orbit.GetOrbitNormal(), target.pos), orbit.pos); var angle = AngleHelper.GetAngleBetweenVectors(Vector3d.Exclude(orbit.GetOrbitNormal(), target.pos), orbit.pos);
return (orbit.semiMajorAxis < target.semiMajorAxis) ? angle : angle - 360.0; return (orbit.semiMajorAxis < target.semiMajorAxis) ? angle : angle - 360.0;
} }
   
public static double GetRelativeInclination(this Orbit orbit, Orbit target) public static double GetRelativeInclination(this Orbit orbit, Orbit target)
{ {
return Vector3d.Angle(orbit.GetOrbitNormal(), target.GetOrbitNormal()); return Vector3d.Angle(orbit.GetOrbitNormal(), target.GetOrbitNormal());
} }
   
public static double GetTimeToAscendingNode(this Orbit orbit) public static double GetTimeToAscendingNode(this Orbit orbit)
{ {
return GetTimeToTrueAnomaly(orbit, GetTrueAnomalyOfAscendingNode(orbit)); return GetTimeToTrueAnomaly(orbit, GetTrueAnomalyOfAscendingNode(orbit));
} }
   
public static double GetTimeToDescendingNode(this Orbit orbit) public static double GetTimeToDescendingNode(this Orbit orbit)
{ {
return GetTimeToTrueAnomaly(orbit, GetTrueAnomalyOfDescendingNode(orbit)); return GetTimeToTrueAnomaly(orbit, GetTrueAnomalyOfDescendingNode(orbit));
} }
   
public static double GetTimeToTrueAnomaly(this Orbit orbit, double trueAnomaly) public static double GetTimeToTrueAnomaly(this Orbit orbit, double trueAnomaly)
{ {
var time = orbit.GetDTforTrueAnomaly(trueAnomaly * Mathf.Deg2Rad, orbit.period); var time = orbit.GetDTforTrueAnomaly(trueAnomaly * Mathf.Deg2Rad, orbit.period);
return time < 0.0 ? time + orbit.period : time; return time < 0.0 ? time + orbit.period : time;
} }
   
public static double GetTimeToVector(this Orbit orbit, Vector3d vector) public static double GetTimeToVector(this Orbit orbit, Vector3d vector)
{ {
return GetTimeToTrueAnomaly(orbit, GetTrueAnomalyFromVector(orbit, vector)); return GetTimeToTrueAnomaly(orbit, GetTrueAnomalyFromVector(orbit, vector));
} }
   
public static double GetTrueAnomalyFromVector(this Orbit orbit, Vector3d vector) public static double GetTrueAnomalyFromVector(this Orbit orbit, Vector3d vector)
{ {
return orbit.GetTrueAnomalyOfZupVector(vector) * Mathf.Rad2Deg; return orbit.GetTrueAnomalyOfZupVector(vector) * Mathf.Rad2Deg;
} }
   
public static double GetTrueAnomalyOfAscendingNode(this Orbit orbit) public static double GetTrueAnomalyOfAscendingNode(this Orbit orbit)
{ {
return 360.0 - orbit.argumentOfPeriapsis; return 360.0 - orbit.argumentOfPeriapsis;
} }
   
public static double GetTrueAnomalyOfDescendingNode(this Orbit orbit) public static double GetTrueAnomalyOfDescendingNode(this Orbit orbit)
{ {
return 180.0 - orbit.argumentOfPeriapsis; return 180.0 - orbit.argumentOfPeriapsis;
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
   
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
using UnityEngine; using UnityEngine;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Miscellaneous namespace KerbalEngineer.Flight.Readouts.Miscellaneous
{ {
public class Separator : ReadoutModule public class Separator : ReadoutModule
{ {
#region Fields #region Fields
   
private GUIStyle boxStyle; private GUIStyle boxStyle;
private GUIStyle boxStyleHud; private GUIStyle boxStyleHud;
   
#endregion #endregion
   
#region Constructors #region Constructors
   
public Separator() public Separator()
{ {
this.Name = "Separator"; this.Name = "Separator";
this.Category = ReadoutCategory.GetCategory("Miscellaneous"); this.Category = ReadoutCategory.GetCategory("Miscellaneous");
this.HelpString = String.Empty; this.HelpString = "Creats a line to help seperate subsections in a module.";
this.IsDefault = false; this.IsDefault = false;
this.Cloneable = true; this.Cloneable = true;
   
this.InitialiseStyles(); this.InitialiseStyles();
   
GuiDisplaySize.OnSizeChanged += this.InitialiseStyles; GuiDisplaySize.OnSizeChanged += this.InitialiseStyles;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
GUILayout.Box(String.Empty, section.IsHud ? this.boxStyleHud : this.boxStyle); GUILayout.Box(String.Empty, section.IsHud ? this.boxStyleHud : this.boxStyle);
} }
   
#endregion #endregion
   
#region Methods: private #region Methods: private
   
private void InitialiseStyles() private void InitialiseStyles()
{ {
this.boxStyle = new GUIStyle this.boxStyle = new GUIStyle
{ {
normal = normal =
{ {
background = TextureHelper.CreateTextureFromColour(new Color(1.0f, 1.0f, 1.0f, 0.5f)) background = TextureHelper.CreateTextureFromColour(new Color(1.0f, 1.0f, 1.0f, 0.5f))
}, },
fixedHeight = 1.0f, fixedHeight = 1.0f,
stretchWidth = true stretchWidth = true
}; };
   
this.boxStyleHud = new GUIStyle(this.boxStyle) this.boxStyleHud = new GUIStyle(this.boxStyle)
{ {
margin = new RectOffset(0, 0, (int)(8 * GuiDisplaySize.Offset), 0) margin = new RectOffset(0, 0, (int)(8 * GuiDisplaySize.Offset), 0)
}; };
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
   
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
using UnityEngine; using UnityEngine;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Miscellaneous namespace KerbalEngineer.Flight.Readouts.Miscellaneous
{ {
public class SystemTime : ReadoutModule public class SystemTime : ReadoutModule
{ {
   
   
#region Constructors #region Constructors
   
public SystemTime() public SystemTime()
{ {
this.Name = "System Time"; this.Name = "System Time";
this.Category = ReadoutCategory.GetCategory("Miscellaneous"); this.Category = ReadoutCategory.GetCategory("Miscellaneous");
this.HelpString = String.Empty; this.HelpString = "Shows the System Time in 12 hour format (AM/PM)";
this.IsDefault = false; this.IsDefault = false;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
this.DrawLine(DateTime.Now.ToLongTimeString(), section.IsHud); this.DrawLine(DateTime.Now.ToLongTimeString(), section.IsHud);
} }
   
#endregion #endregion
   
} }
} }
//  
// Kerbal Engineer Redux  
//  
// Copyright (C) 2014 CYBUTEK  
//  
// This program is free software: you can redistribute it and/or modify  
// it under the terms of the GNU General Public License as published by  
// the Free Software Foundation, either version 3 of the License, or  
// (at your option) any later version.  
//  
// This program is distributed in the hope that it will be useful,  
// but WITHOUT ANY WARRANTY; without even the implied warranty of  
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the  
// GNU General Public License for more details.  
//  
// You should have received a copy of the GNU General Public License  
// along with this program. If not, see <http://www.gnu.org/licenses/>.  
//  
 
#region Using Directives  
 
using System;  
 
using KerbalEngineer.Flight.Sections;  
using KerbalEngineer.Helpers;  
 
using UnityEngine;  
 
#endregion  
 
namespace KerbalEngineer.Flight.Readouts.Miscellaneous  
{  
public class TimeReference : ReadoutModule  
{  
#region Constructors  
 
public TimeReference()  
{  
this.Name = "Time Reference Adjuster";  
this.Category = ReadoutCategory.GetCategory("Miscellaneous");  
this.HelpString = String.Empty;  
this.IsDefault = false;  
}  
 
#endregion  
 
#region Methods: public  
 
public override void Draw(SectionModule section)  
{  
GUILayout.BeginHorizontal();  
GUILayout.Label("Time Ref.: " + TimeFormatter.Reference, this.NameStyle);  
if (GUILayout.Button("Earth", this.ButtonStyle))  
{  
TimeFormatter.SetReference();  
}  
if (GUILayout.Button("Kerbin", this.ButtonStyle))  
{  
TimeFormatter.SetReference(PSystemManager.Instance.localBodies.Find(body => body.bodyName.Equals("Kerbin")));  
}  
GUILayout.EndHorizontal();  
}  
 
#endregion  
}  
}  
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital namespace KerbalEngineer.Flight.Readouts.Orbital
{ {
public class AngleToEquatorialAscendingNode : ReadoutModule public class AngleToEquatorialAscendingNode : ReadoutModule
{ {
#region Constructors #region Constructors
   
public AngleToEquatorialAscendingNode() public AngleToEquatorialAscendingNode()
{ {
this.Name = "Angle to Equ. AN"; this.Name = "Angle to Equ. AN";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = string.Empty; this.HelpString = "Angular Distance from the vessel to crossing the Equator of the central body, going north of it.";
this.IsDefault = false; this.IsDefault = false;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
this.DrawLine(FlightGlobals.ActiveVessel.orbit.GetAngleToAscendingNode().ToAngle(), section.IsHud); this.DrawLine(FlightGlobals.ActiveVessel.orbit.GetAngleToAscendingNode().ToAngle(), section.IsHud);
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital namespace KerbalEngineer.Flight.Readouts.Orbital
{ {
public class AngleToEquatorialDescendingNode : ReadoutModule public class AngleToEquatorialDescendingNode : ReadoutModule
{ {
#region Constructors #region Constructors
   
public AngleToEquatorialDescendingNode() public AngleToEquatorialDescendingNode()
{ {
this.Name = "Angle to Equ. DN"; this.Name = "Angle to Equ. DN";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = string.Empty; this.HelpString = "Angular Distance from the vessel to crossing the Equator of the central body, going south of it.";
this.IsDefault = false; this.IsDefault = false;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
this.DrawLine(FlightGlobals.ActiveVessel.orbit.GetAngleToDescendingNode().ToAngle(), section.IsHud); this.DrawLine(FlightGlobals.ActiveVessel.orbit.GetAngleToDescendingNode().ToAngle(), section.IsHud);
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital namespace KerbalEngineer.Flight.Readouts.Orbital
{ {
public class AngleToPrograde : ReadoutModule public class AngleToPrograde : ReadoutModule
{ {
#region Constructors #region Constructors
   
public AngleToPrograde() public AngleToPrograde()
{ {
this.Name = "Angle to Prograde"; this.Name = "Angle to Prograde";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = String.Empty; this.HelpString = "Angular Distance from the vessel to crossing the Orbit of the central body on it's retrograde side.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
this.DrawLine(FlightGlobals.ship_orbit.GetAngleToPrograde().ToAngle(), section.IsHud); this.DrawLine(FlightGlobals.ship_orbit.GetAngleToPrograde().ToAngle(), section.IsHud);
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital namespace KerbalEngineer.Flight.Readouts.Orbital
{ {
public class AngleToRetrograde : ReadoutModule public class AngleToRetrograde : ReadoutModule
{ {
#region Constructors #region Constructors
   
public AngleToRetrograde() public AngleToRetrograde()
{ {
this.Name = "Angle to Retrograde"; this.Name = "Angle to Retrograde";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = String.Empty; this.HelpString = "Angular Distance from the vessel to crossing the Orbit of the central body on it's retrograde side.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
this.DrawLine(FlightGlobals.ship_orbit.GetAngleToRetrograde().ToAngle(), section.IsHud); this.DrawLine(FlightGlobals.ship_orbit.GetAngleToRetrograde().ToAngle(), section.IsHud);
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital namespace KerbalEngineer.Flight.Readouts.Orbital
{ {
public class ApoapsisHeight : ReadoutModule public class ApoapsisHeight : ReadoutModule
{ {
#region Constructors #region Constructors
   
public ApoapsisHeight() public ApoapsisHeight()
{ {
this.Name = "Apoapsis Height"; this.Name = "Apoapsis Height";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = "Shows the vessel's apoapsis height relative to sea level. (Apoapsis is the highest point of an orbit.)"; this.HelpString = "Shows the vessel's apoapsis height relative to sea level. (Apoapsis is the highest point of an orbit.)";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
this.DrawLine(FlightGlobals.ship_orbit.ApA.ToDistance(), section.IsHud); this.DrawLine(FlightGlobals.ship_orbit.ApA.ToDistance(), section.IsHud);
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2015 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives  
   
using System;  
   
using KerbalEngineer.Extensions;  
using KerbalEngineer.Flight.Sections;  
   
#endregion  
   
namespace KerbalEngineer.Flight.Readouts.Orbital namespace KerbalEngineer.Flight.Readouts.Orbital
{ {
  using Extensions;
  using Helpers;
  using Sections;
   
public class EccentricAnomaly : ReadoutModule public class EccentricAnomaly : ReadoutModule
{ {
#region Constructors  
   
public EccentricAnomaly() public EccentricAnomaly()
{ {
this.Name = "Eccentric Anomaly"; Name = "Eccentric Anomaly";
this.Category = ReadoutCategory.GetCategory("Orbital"); Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = String.Empty; HelpString = string.Empty;
this.IsDefault = false; IsDefault = false;
} }
   
#endregion  
   
#region Methods: public  
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
this.DrawLine(FlightGlobals.ship_orbit.eccentricAnomaly.ToAngle(), section.IsHud); DrawLine((FlightGlobals.ship_orbit.eccentricAnomaly * Units.RAD_TO_DEG).ToAngle(), section.IsHud);
} }
   
#endregion  
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital namespace KerbalEngineer.Flight.Readouts.Orbital
{ {
public class Inclination : ReadoutModule public class Inclination : ReadoutModule
{ {
#region Constructors #region Constructors
   
public Inclination() public Inclination()
{ {
this.Name = "Inclination"; this.Name = "Inclination";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = "Shows the vessel's orbital inclination."; this.HelpString = "Shows the vessel's orbital inclination relative to the Equator.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
this.DrawLine(FlightGlobals.ship_orbit.inclination.ToAngle(), section.IsHud); this.DrawLine(FlightGlobals.ship_orbit.inclination.ToAngle(), section.IsHud);
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode
{ {
public class NodeAngleToPrograde : ReadoutModule public class NodeAngleToPrograde : ReadoutModule
{ {
#region Constructors #region Constructors
   
public NodeAngleToPrograde() public NodeAngleToPrograde()
{ {
this.Name = "Manoeuvre Node Angle to Prograde"; this.Name = "Manoeuvre Node Angle to Prograde";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = String.Empty; this.HelpString = "Angular Distance from the Node to crossing the Orbit of the central body on it's prograde side.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (!ManoeuvreProcessor.ShowDetails) if (!ManoeuvreProcessor.ShowDetails)
{ {
return; return;
} }
   
this.DrawLine("Node Angle to Prograde", ManoeuvreProcessor.AngleToPrograde.ToAngle(), section.IsHud); this.DrawLine("Node Angle to Prograde", ManoeuvreProcessor.AngleToPrograde.ToAngle(), section.IsHud);
} }
   
public override void Reset() public override void Reset()
{ {
ManoeuvreProcessor.Reset(); ManoeuvreProcessor.Reset();
} }
   
public override void Update() public override void Update()
{ {
ManoeuvreProcessor.RequestUpdate(); ManoeuvreProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode
{ {
public class NodeAngleToRetrograde : ReadoutModule public class NodeAngleToRetrograde : ReadoutModule
{ {
#region Constructors #region Constructors
   
public NodeAngleToRetrograde() public NodeAngleToRetrograde()
{ {
this.Name = "Manoeuvre Node Angle to Retrograde"; this.Name = "Manoeuvre Node Angle to Retrograde";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = String.Empty; this.HelpString = "Angular Distance from the Node to crossing the Orbit of the central body on it's retrograde side.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (!ManoeuvreProcessor.ShowDetails) if (!ManoeuvreProcessor.ShowDetails)
{ {
return; return;
} }
   
this.DrawLine("Node Angle to Retrograde", ManoeuvreProcessor.AngleToRetrograde.ToAngle(), section.IsHud); this.DrawLine("Node Angle to Retrograde", ManoeuvreProcessor.AngleToRetrograde.ToAngle(), section.IsHud);
} }
   
public override void Reset() public override void Reset()
{ {
ManoeuvreProcessor.Reset(); ManoeuvreProcessor.Reset();
} }
   
public override void Update() public override void Update()
{ {
ManoeuvreProcessor.RequestUpdate(); ManoeuvreProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
   
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode
{ {
public class NodeBurnTime : ReadoutModule public class NodeBurnTime : ReadoutModule
{ {
#region Constructors #region Constructors
   
public NodeBurnTime() public NodeBurnTime()
{ {
this.Name = "Manoeuvre Node Burn Time"; this.Name = "Manoeuvre Node Burn Time";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = String.Empty; this.HelpString = "The burn's total duration.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (!ManoeuvreProcessor.ShowDetails) if (!ManoeuvreProcessor.ShowDetails)
{ {
return; return;
} }
   
this.DrawLine("Node Burn Time", TimeFormatter.ConvertToString(ManoeuvreProcessor.BurnTime), section.IsHud); this.DrawLine("Node Burn Time", TimeFormatter.ConvertToString(ManoeuvreProcessor.BurnTime), section.IsHud);
} }
   
public override void Reset() public override void Reset()
{ {
ManoeuvreProcessor.Reset(); ManoeuvreProcessor.Reset();
} }
   
public override void Update() public override void Update()
{ {
ManoeuvreProcessor.RequestUpdate(); ManoeuvreProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
   
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode
{ {
public class NodeHalfBurnTime : ReadoutModule public class NodeHalfBurnTime : ReadoutModule
{ {
#region Constructors #region Constructors
   
public NodeHalfBurnTime() public NodeHalfBurnTime()
{ {
this.Name = "Manoeuvre Node Half Burn Time"; this.Name = "Manoeuvre Node Half Burn Time";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = String.Empty; this.HelpString = "Half of the burn's total duration.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (!ManoeuvreProcessor.ShowDetails) if (!ManoeuvreProcessor.ShowDetails)
{ {
return; return;
} }
   
this.DrawLine("Node Burn Time (½)", TimeFormatter.ConvertToString(ManoeuvreProcessor.HalfBurnTime), section.IsHud); this.DrawLine("Node Burn Time (½)", TimeFormatter.ConvertToString(ManoeuvreProcessor.HalfBurnTime), section.IsHud);
} }
   
public override void Reset() public override void Reset()
{ {
ManoeuvreProcessor.Reset(); ManoeuvreProcessor.Reset();
} }
   
public override void Update() public override void Update()
{ {
ManoeuvreProcessor.RequestUpdate(); ManoeuvreProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode
{ {
public class NodeNormalDeltaV : ReadoutModule public class NodeNormalDeltaV : ReadoutModule
{ {
#region Constructors #region Constructors
   
public NodeNormalDeltaV() public NodeNormalDeltaV()
{ {
this.Name = "Manoeuvre Node DeltaV (Normal)"; this.Name = "Manoeuvre Node DeltaV (Normal)";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = String.Empty; this.HelpString = "Normal component of the total change in velocity.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (!ManoeuvreProcessor.ShowDetails) if (!ManoeuvreProcessor.ShowDetails)
{ {
return; return;
} }
   
this.DrawLine("Node DeltaV (Normal)", ManoeuvreProcessor.NormalDeltaV.ToSpeed(), section.IsHud); this.DrawLine("Node DeltaV (Normal)", ManoeuvreProcessor.NormalDeltaV.ToSpeed(), section.IsHud);
} }
   
public override void Reset() public override void Reset()
{ {
ManoeuvreProcessor.Reset(); ManoeuvreProcessor.Reset();
} }
   
public override void Update() public override void Update()
{ {
ManoeuvreProcessor.RequestUpdate(); ManoeuvreProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode
{ {
public class NodeProgradeDeltaV : ReadoutModule public class NodeProgradeDeltaV : ReadoutModule
{ {
#region Constructors #region Constructors
   
public NodeProgradeDeltaV() public NodeProgradeDeltaV()
{ {
this.Name = "Manoeuvre Node DeltaV (Prograde)"; this.Name = "Manoeuvre Node DeltaV (Prograde)";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = String.Empty; this.HelpString = "Prograde/Retrograde component of the total change in velocity.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (!ManoeuvreProcessor.ShowDetails) if (!ManoeuvreProcessor.ShowDetails)
{ {
return; return;
} }
   
this.DrawLine("Node DeltaV (Prograde)", ManoeuvreProcessor.ProgradeDeltaV.ToSpeed(), section.IsHud); this.DrawLine("Node DeltaV (Prograde)", ManoeuvreProcessor.ProgradeDeltaV.ToSpeed(), section.IsHud);
} }
   
public override void Reset() public override void Reset()
{ {
ManoeuvreProcessor.Reset(); ManoeuvreProcessor.Reset();
} }
   
public override void Update() public override void Update()
{ {
ManoeuvreProcessor.RequestUpdate(); ManoeuvreProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode
{ {
public class NodeRadialDeltaV : ReadoutModule public class NodeRadialDeltaV : ReadoutModule
{ {
#region Constructors #region Constructors
   
public NodeRadialDeltaV() public NodeRadialDeltaV()
{ {
this.Name = "Manoeuvre Node DeltaV (Radial)"; this.Name = "Manoeuvre Node DeltaV (Radial)";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = String.Empty; this.HelpString = "Radial component of the total change in velocity.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (!ManoeuvreProcessor.ShowDetails) if (!ManoeuvreProcessor.ShowDetails)
{ {
return; return;
} }
   
this.DrawLine("Node DeltaV (Radial)", ManoeuvreProcessor.RadialDeltaV.ToSpeed(), section.IsHud); this.DrawLine("Node DeltaV (Radial)", ManoeuvreProcessor.RadialDeltaV.ToSpeed(), section.IsHud);
} }
   
public override void Reset() public override void Reset()
{ {
ManoeuvreProcessor.Reset(); ManoeuvreProcessor.Reset();
} }
   
public override void Update() public override void Update()
{ {
ManoeuvreProcessor.RequestUpdate(); ManoeuvreProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
   
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode
{ {
public class NodeTimeToHalfBurn : ReadoutModule public class NodeTimeToHalfBurn : ReadoutModule
{ {
#region Constructors #region Constructors
   
public NodeTimeToHalfBurn() public NodeTimeToHalfBurn()
{ {
this.Name = "Time to Manoeuvre Burn"; this.Name = "Time to Manoeuvre Burn";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = String.Empty; this.HelpString = "Time until the Manoeuvre should be started.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (!ManoeuvreProcessor.ShowDetails) if (!ManoeuvreProcessor.ShowDetails)
{ {
return; return;
} }
   
this.DrawLine("Time to Node Burn", TimeFormatter.ConvertToString(ManoeuvreProcessor.UniversalTime - ManoeuvreProcessor.HalfBurnTime - Planetarium.GetUniversalTime()), section.IsHud); this.DrawLine("Time to Node Burn", TimeFormatter.ConvertToString(ManoeuvreProcessor.UniversalTime - ManoeuvreProcessor.HalfBurnTime - Planetarium.GetUniversalTime()), section.IsHud);
} }
   
public override void Reset() public override void Reset()
{ {
ManoeuvreProcessor.Reset(); ManoeuvreProcessor.Reset();
} }
   
public override void Update() public override void Update()
{ {
ManoeuvreProcessor.RequestUpdate(); ManoeuvreProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
   
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode
{ {
public class NodeTimeToManoeuvre : ReadoutModule public class NodeTimeToManoeuvre : ReadoutModule
{ {
#region Constructors #region Constructors
   
public NodeTimeToManoeuvre() public NodeTimeToManoeuvre()
{ {
this.Name = "Time to Manoeuvre Node"; this.Name = "Time to Manoeuvre Node";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = String.Empty; this.HelpString = "Time until the vessel reaches the position of the Manoeuvre Node.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (!ManoeuvreProcessor.ShowDetails) if (!ManoeuvreProcessor.ShowDetails)
{ {
return; return;
} }
   
this.DrawLine("Time to Node", TimeFormatter.ConvertToString(ManoeuvreProcessor.UniversalTime - Planetarium.GetUniversalTime()), section.IsHud); this.DrawLine("Time to Node", TimeFormatter.ConvertToString(ManoeuvreProcessor.UniversalTime - Planetarium.GetUniversalTime()), section.IsHud);
} }
   
public override void Reset() public override void Reset()
{ {
ManoeuvreProcessor.Reset(); ManoeuvreProcessor.Reset();
} }
   
public override void Update() public override void Update()
{ {
ManoeuvreProcessor.RequestUpdate(); ManoeuvreProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode
{ {
public class NodeTotalDeltaV : ReadoutModule public class NodeTotalDeltaV : ReadoutModule
{ {
#region Constructors #region Constructors
   
public NodeTotalDeltaV() public NodeTotalDeltaV()
{ {
this.Name = "Manoeuvre Node DeltaV (Total)"; this.Name = "Manoeuvre Node DeltaV (Total)";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = String.Empty; this.HelpString = "Total change in velocity during the burn.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (!ManoeuvreProcessor.ShowDetails) if (!ManoeuvreProcessor.ShowDetails)
{ {
return; return;
} }
   
this.DrawLine("Node DeltaV (Total)", ManoeuvreProcessor.TotalDeltaV.ToSpeed() + " (" + (ManoeuvreProcessor.HasDeltaV ? "S" + ManoeuvreProcessor.FinalStage : "X") + ")", section.IsHud); this.DrawLine("Node DeltaV (Total)", ManoeuvreProcessor.TotalDeltaV.ToSpeed() + " (" + (ManoeuvreProcessor.HasDeltaV ? "S" + ManoeuvreProcessor.FinalStage : "X") + ")", section.IsHud);
} }
   
public override void Reset() public override void Reset()
{ {
ManoeuvreProcessor.Reset(); ManoeuvreProcessor.Reset();
} }
   
public override void Update() public override void Update()
{ {
ManoeuvreProcessor.RequestUpdate(); ManoeuvreProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode
{ {
public class PostBurnApoapsis : ReadoutModule public class PostBurnApoapsis : ReadoutModule
{ {
#region Constructors #region Constructors
   
public PostBurnApoapsis() public PostBurnApoapsis()
{ {
this.Name = "Post-burn Apoapsis"; this.Name = "Post-burn Apoapsis";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = String.Empty; this.HelpString = "Farthest point of the vessel's ofbit after the burn.";
this.IsDefault = false; this.IsDefault = false;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (!ManoeuvreProcessor.ShowDetails) if (!ManoeuvreProcessor.ShowDetails)
{ {
return; return;
} }
   
this.DrawLine("Post-burn Apoapsis", ManoeuvreProcessor.PostBurnAp.ToDistance(), section.IsHud); this.DrawLine("Post-burn Apoapsis", ManoeuvreProcessor.PostBurnAp.ToDistance(), section.IsHud);
} }
   
public override void Reset() public override void Reset()
{ {
ManoeuvreProcessor.Reset(); ManoeuvreProcessor.Reset();
} }
   
public override void Update() public override void Update()
{ {
ManoeuvreProcessor.RequestUpdate(); ManoeuvreProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode namespace KerbalEngineer.Flight.Readouts.Orbital.ManoeuvreNode
{ {
public class PostBurnPeriapsis : ReadoutModule public class PostBurnPeriapsis : ReadoutModule
{ {
#region Constructors #region Constructors
   
public PostBurnPeriapsis() public PostBurnPeriapsis()
{ {
this.Name = "Post-burn Periapsis"; this.Name = "Post-burn Periapsis";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = String.Empty; this.HelpString = "Closest point of the vessel's ofbit after the burn.";
this.IsDefault = false; this.IsDefault = false;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (!ManoeuvreProcessor.ShowDetails) if (!ManoeuvreProcessor.ShowDetails)
{ {
return; return;
} }
   
this.DrawLine("Post-burn Periapsis", ManoeuvreProcessor.PostBurnPe.ToDistance(), section.IsHud); this.DrawLine("Post-burn Periapsis", ManoeuvreProcessor.PostBurnPe.ToDistance(), section.IsHud);
} }
   
public override void Reset() public override void Reset()
{ {
ManoeuvreProcessor.Reset(); ManoeuvreProcessor.Reset();
} }
   
public override void Update() public override void Update()
{ {
ManoeuvreProcessor.RequestUpdate(); ManoeuvreProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2015 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives  
   
using System;  
   
using KerbalEngineer.Extensions;  
using KerbalEngineer.Flight.Sections;  
   
#endregion  
   
namespace KerbalEngineer.Flight.Readouts.Orbital namespace KerbalEngineer.Flight.Readouts.Orbital
{ {
  using Extensions;
  using Helpers;
  using Sections;
   
public class MeanAnomaly : ReadoutModule public class MeanAnomaly : ReadoutModule
{ {
#region Constructors  
   
public MeanAnomaly() public MeanAnomaly()
{ {
this.Name = "Mean Anomaly"; Name = "Mean Anomaly";
this.Category = ReadoutCategory.GetCategory("Orbital"); Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = String.Empty; HelpString = string.Empty;
this.IsDefault = false; IsDefault = false;
} }
   
#endregion  
   
#region Methods: public  
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
this.DrawLine(FlightGlobals.ship_orbit.meanAnomaly.ToAngle(), section.IsHud); DrawLine((FlightGlobals.ship_orbit.meanAnomaly * Units.RAD_TO_DEG).ToAngle(), section.IsHud);
} }
   
#endregion  
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2015 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives  
   
using System;  
   
using KerbalEngineer.Extensions;  
using KerbalEngineer.Flight.Sections;  
   
#endregion  
   
namespace KerbalEngineer.Flight.Readouts.Orbital namespace KerbalEngineer.Flight.Readouts.Orbital
{ {
  using Extensions;
  using Helpers;
  using Sections;
   
public class MeanAnomalyAtEpoc : ReadoutModule public class MeanAnomalyAtEpoc : ReadoutModule
{ {
#region Constructors  
   
public MeanAnomalyAtEpoc() public MeanAnomalyAtEpoc()
{ {
this.Name = "Mean Anomaly at Epoc"; Name = "Mean Anomaly at Epoc";
this.Category = ReadoutCategory.GetCategory("Orbital"); Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = String.Empty; HelpString = string.Empty;
this.IsDefault = false; IsDefault = false;
} }
   
#endregion  
   
#region Methods: public  
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
this.DrawLine(FlightGlobals.ship_orbit.meanAnomalyAtEpoch.ToAngle(), section.IsHud); DrawLine((FlightGlobals.ship_orbit.meanAnomalyAtEpoch * Units.RAD_TO_DEG).ToAngle(), section.IsHud);
} }
   
#endregion  
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital namespace KerbalEngineer.Flight.Readouts.Orbital
{ {
public class PeriapsisHeight : ReadoutModule public class PeriapsisHeight : ReadoutModule
{ {
#region Constructors #region Constructors
   
public PeriapsisHeight() public PeriapsisHeight()
{ {
this.Name = "Periapsis Height"; this.Name = "Periapsis Height";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = "Shows the vessel's periapsis height relative to sea level. (Periapsis is the lowest point of an orbit."; this.HelpString = "Shows the vessel's periapsis height relative to sea level. (Periapsis is the lowest point of an orbit.)";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
this.DrawLine(FlightGlobals.ship_orbit.PeA.ToDistance(), section.IsHud); this.DrawLine(FlightGlobals.ship_orbit.PeA.ToDistance(), section.IsHud);
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital namespace KerbalEngineer.Flight.Readouts.Orbital
{ {
public class TimeToAtmosphere : ReadoutModule public class TimeToAtmosphere : ReadoutModule
{ {
//private LogMsg log = new LogMsg(); //private LogMsg log = new LogMsg();
#region Constructors #region Constructors
   
public TimeToAtmosphere() public TimeToAtmosphere()
{ {
this.Name = "Time to Atmosphere"; this.Name = "Time to Atmosphere";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = "Shows the time until the vessel enters or leaves atmosphere."; this.HelpString = "Shows the time until the vessel enters or leaves the atmosphere.";
this.IsDefault = false; this.IsDefault = false;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
String str; String str;
Orbit orbit = FlightGlobals.ship_orbit; Orbit orbit = FlightGlobals.ship_orbit;
   
if (orbit.referenceBody.atmosphere && orbit.PeA < orbit.referenceBody.atmosphereDepth) if (orbit.referenceBody.atmosphere && orbit.PeA < orbit.referenceBody.atmosphereDepth && orbit.ApA > orbit.referenceBody.atmosphereDepth)
{ {
double tA = orbit.TrueAnomalyAtRadius(orbit.referenceBody.atmosphereDepth + orbit.referenceBody.Radius); double tA = orbit.TrueAnomalyAtRadius(orbit.referenceBody.atmosphereDepth + orbit.referenceBody.Radius);
//log.buf.AppendFormat("tA = {0}\n", tA); //log.buf.AppendFormat("tA = {0}\n", tA);
double utTime = Planetarium.GetUniversalTime(); double utTime = Planetarium.GetUniversalTime();
//log.buf.AppendFormat("utTime = {0}\n", utTime); //log.buf.AppendFormat("utTime = {0}\n", utTime);
double timeAtRad1 = orbit.GetUTforTrueAnomaly(tA, orbit.period * 0.5); double timeAtRad1 = orbit.GetUTforTrueAnomaly(tA, orbit.period * 0.5);
//log.buf.AppendFormat("timeAtRad1 = {0}\n", timeAtRad1); //log.buf.AppendFormat("timeAtRad1 = {0}\n", timeAtRad1);
if (timeAtRad1 < utTime) if (timeAtRad1 < utTime)
{ {
timeAtRad1 += orbit.period; timeAtRad1 += orbit.period;
//log.buf.AppendFormat("timeAtRad1 = {0}\n", timeAtRad1); //log.buf.AppendFormat("timeAtRad1 = {0}\n", timeAtRad1);
} }
double timeAtRad2 = orbit.GetUTforTrueAnomaly(-tA, orbit.period * 0.5); double timeAtRad2 = orbit.GetUTforTrueAnomaly(-tA, orbit.period * 0.5);
//log.buf.AppendFormat("timeAtRad2 = {0}\n", timeAtRad2); //log.buf.AppendFormat("timeAtRad2 = {0}\n", timeAtRad2);
if (timeAtRad2 < utTime) if (timeAtRad2 < utTime)
{ {
timeAtRad2 += orbit.period; timeAtRad2 += orbit.period;
//log.buf.AppendFormat("timeAtRad2 = {0}\n", timeAtRad2); //log.buf.AppendFormat("timeAtRad2 = {0}\n", timeAtRad2);
} }
double time = Math.Min(timeAtRad1, timeAtRad2) - utTime; double time = Math.Min(timeAtRad1, timeAtRad2) - utTime;
//log.buf.AppendFormat("time = {0}\n", time); //log.buf.AppendFormat("time = {0}\n", time);
   
if (Double.IsNaN(time)) if (Double.IsNaN(time))
{ {
str = "---s"; str = "---s";
//log.buf.AppendLine("time is NaN"); //log.buf.AppendLine("time is NaN");
} }
else else
{ {
str = TimeFormatter.ConvertToString(time); str = TimeFormatter.ConvertToString(time);
//log.buf.AppendFormat("str = {0}\n", str); //log.buf.AppendFormat("str = {0}\n", str);
} }
} }
else else
{ {
str = "---s"; str = "---s";
//log.buf.AppendLine("no atmosphere or pe > atmosphere"); //log.buf.AppendLine("no atmosphere, pe > atmosphere, or ap < atmosphere");
} }
   
//log.Flush(); //log.Flush();
this.DrawLine(str, section.IsHud); this.DrawLine(str, section.IsHud);
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital namespace KerbalEngineer.Flight.Readouts.Orbital
{ {
public class TimeToEquatorialAscendingNode : ReadoutModule public class TimeToEquatorialAscendingNode : ReadoutModule
{ {
#region Constructors #region Constructors
   
public TimeToEquatorialAscendingNode() public TimeToEquatorialAscendingNode()
{ {
this.Name = "Time to Equ. AN"; this.Name = "Time to Equ. AN";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = string.Empty; this.HelpString = "Shows the time until the vessel corsses the Equator, going north of it.";
this.IsDefault = false; this.IsDefault = false;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
this.DrawLine(TimeFormatter.ConvertToString(FlightGlobals.ActiveVessel.orbit.GetTimeToAscendingNode()), section.IsHud); this.DrawLine(TimeFormatter.ConvertToString(FlightGlobals.ActiveVessel.orbit.GetTimeToAscendingNode()), section.IsHud);
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Orbital namespace KerbalEngineer.Flight.Readouts.Orbital
{ {
public class TimeToEquatorialDescendingNode : ReadoutModule public class TimeToEquatorialDescendingNode : ReadoutModule
{ {
#region Constructors #region Constructors
   
public TimeToEquatorialDescendingNode() public TimeToEquatorialDescendingNode()
{ {
this.Name = "Time to Equ. DN"; this.Name = "Time to Equ. DN";
this.Category = ReadoutCategory.GetCategory("Orbital"); this.Category = ReadoutCategory.GetCategory("Orbital");
this.HelpString = string.Empty; this.HelpString = "Shows the time until the vessel corsses the Equator, going south of it.";
this.IsDefault = false; this.IsDefault = false;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
this.DrawLine(TimeFormatter.ConvertToString(FlightGlobals.ActiveVessel.orbit.GetTimeToDescendingNode()), section.IsHud); this.DrawLine(TimeFormatter.ConvertToString(FlightGlobals.ActiveVessel.orbit.GetTimeToDescendingNode()), section.IsHud);
} }
   
#endregion #endregion
} }
} }
// //
// Copyright (C) 2015 CYBUTEK // Copyright (C) 2015 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
namespace KerbalEngineer.Flight.Readouts namespace KerbalEngineer.Flight.Readouts
{ {
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using Miscellaneous; using Miscellaneous;
using Orbital; using Orbital;
using Orbital.ManoeuvreNode; using Orbital.ManoeuvreNode;
using Rendezvous; using Rendezvous;
using Settings; using Settings;
using Surface; using Surface;
using Thermal; using Thermal;
using Vessel; using Vessel;
using AltitudeSeaLevel = Surface.AltitudeSeaLevel; using AltitudeSeaLevel = Surface.AltitudeSeaLevel;
using ApoapsisHeight = Orbital.ApoapsisHeight; using ApoapsisHeight = Orbital.ApoapsisHeight;
using OrbitalPeriod = Orbital.OrbitalPeriod; using OrbitalPeriod = Orbital.OrbitalPeriod;
using PeriapsisHeight = Orbital.PeriapsisHeight; using PeriapsisHeight = Orbital.PeriapsisHeight;
using SemiMajorAxis = Orbital.SemiMajorAxis; using SemiMajorAxis = Orbital.SemiMajorAxis;
using SemiMinorAxis = Orbital.SemiMinorAxis; using SemiMinorAxis = Orbital.SemiMinorAxis;
using TimeToApoapsis = Orbital.TimeToApoapsis; using TimeToApoapsis = Orbital.TimeToApoapsis;
using TimeToPeriapsis = Orbital.TimeToPeriapsis; using TimeToPeriapsis = Orbital.TimeToPeriapsis;
   
public static class ReadoutLibrary public static class ReadoutLibrary
{ {
private static List<ReadoutModule> readouts = new List<ReadoutModule>(); private static List<ReadoutModule> readouts = new List<ReadoutModule>();
   
/// <summary> /// <summary>
/// Sets up and populates the readout library with the stock readouts. /// Sets up and populates the readout library with the stock readouts.
/// </summary> /// </summary>
static ReadoutLibrary() static ReadoutLibrary()
{ {
try try
{ {
ReadoutCategory.SetCategory("Orbital", "Readout for orbital manovoeures."); ReadoutCategory.SetCategory("Orbital", "Readout for orbital manovoeures.");
ReadoutCategory.SetCategory("Surface", "Surface and atmospheric readouts."); ReadoutCategory.SetCategory("Surface", "Surface and atmospheric readouts.");
ReadoutCategory.SetCategory("Vessel", "Vessel performance statistics."); ReadoutCategory.SetCategory("Vessel", "Vessel performance statistics.");
ReadoutCategory.SetCategory("Rendezvous", "Readouts for rendezvous manovoeures."); ReadoutCategory.SetCategory("Rendezvous", "Readouts for rendezvous manovoeures.");
ReadoutCategory.SetCategory("Thermal", "Thermal characteristics readouts."); ReadoutCategory.SetCategory("Thermal", "Thermal characteristics readouts.");
ReadoutCategory.SetCategory("Miscellaneous", "Miscellaneous readouts."); ReadoutCategory.SetCategory("Miscellaneous", "Miscellaneous readouts.");
ReadoutCategory.Selected = ReadoutCategory.GetCategory("Orbital"); ReadoutCategory.Selected = ReadoutCategory.GetCategory("Orbital");
   
// Orbital // Orbital
readouts.Add(new ApoapsisHeight()); readouts.Add(new ApoapsisHeight());
readouts.Add(new PeriapsisHeight()); readouts.Add(new PeriapsisHeight());
readouts.Add(new TimeToApoapsis()); readouts.Add(new TimeToApoapsis());
readouts.Add(new TimeToPeriapsis()); readouts.Add(new TimeToPeriapsis());
readouts.Add(new Inclination()); readouts.Add(new Inclination());
readouts.Add(new TimeToEquatorialAscendingNode()); readouts.Add(new TimeToEquatorialAscendingNode());
readouts.Add(new TimeToEquatorialDescendingNode()); readouts.Add(new TimeToEquatorialDescendingNode());
readouts.Add(new AngleToEquatorialAscendingNode()); readouts.Add(new AngleToEquatorialAscendingNode());
readouts.Add(new AngleToEquatorialDescendingNode()); readouts.Add(new AngleToEquatorialDescendingNode());
readouts.Add(new Eccentricity()); readouts.Add(new Eccentricity());
readouts.Add(new OrbitalSpeed()); readouts.Add(new OrbitalSpeed());
readouts.Add(new OrbitalPeriod()); readouts.Add(new OrbitalPeriod());
readouts.Add(new CurrentSoi()); readouts.Add(new CurrentSoi());
readouts.Add(new LongitudeOfAscendingNode()); readouts.Add(new LongitudeOfAscendingNode());
readouts.Add(new LongitudeOfPeriapsis()); readouts.Add(new LongitudeOfPeriapsis());
readouts.Add(new ArgumentOfPeriapsis()); readouts.Add(new ArgumentOfPeriapsis());
readouts.Add(new TrueAnomaly()); readouts.Add(new TrueAnomaly());
readouts.Add(new MeanAnomaly()); readouts.Add(new MeanAnomaly());
readouts.Add(new MeanAnomalyAtEpoc()); readouts.Add(new MeanAnomalyAtEpoc());
readouts.Add(new EccentricAnomaly()); readouts.Add(new EccentricAnomaly());
readouts.Add(new SemiMajorAxis()); readouts.Add(new SemiMajorAxis());
readouts.Add(new SemiMinorAxis()); readouts.Add(new SemiMinorAxis());
readouts.Add(new AngleToPrograde()); readouts.Add(new AngleToPrograde());
readouts.Add(new AngleToRetrograde()); readouts.Add(new AngleToRetrograde());
readouts.Add(new NodeProgradeDeltaV()); readouts.Add(new NodeProgradeDeltaV());
readouts.Add(new NodeNormalDeltaV()); readouts.Add(new NodeNormalDeltaV());
readouts.Add(new NodeRadialDeltaV()); readouts.Add(new NodeRadialDeltaV());
readouts.Add(new NodeTotalDeltaV()); readouts.Add(new NodeTotalDeltaV());
readouts.Add(new NodeBurnTime()); readouts.Add(new NodeBurnTime());
readouts.Add(new NodeHalfBurnTime()); readouts.Add(new NodeHalfBurnTime());
readouts.Add(new NodeTimeToManoeuvre()); readouts.Add(new NodeTimeToManoeuvre());
readouts.Add(new NodeTimeToHalfBurn()); readouts.Add(new NodeTimeToHalfBurn());
readouts.Add(new NodeAngleToPrograde()); readouts.Add(new NodeAngleToPrograde());
readouts.Add(new NodeAngleToRetrograde()); readouts.Add(new NodeAngleToRetrograde());
readouts.Add(new PostBurnApoapsis()); readouts.Add(new PostBurnApoapsis());
readouts.Add(new PostBurnPeriapsis()); readouts.Add(new PostBurnPeriapsis());
readouts.Add(new SpeedAtApoapsis()); readouts.Add(new SpeedAtApoapsis());
readouts.Add(new SpeedAtPeriapsis()); readouts.Add(new SpeedAtPeriapsis());
readouts.Add(new TimeToAtmosphere()); readouts.Add(new TimeToAtmosphere());
   
// Surface // Surface
readouts.Add(new AltitudeSeaLevel()); readouts.Add(new AltitudeSeaLevel());
readouts.Add(new AltitudeTerrain()); readouts.Add(new AltitudeTerrain());
readouts.Add(new VerticalSpeed()); readouts.Add(new VerticalSpeed());
readouts.Add(new VerticalAcceleration()); readouts.Add(new VerticalAcceleration());
readouts.Add(new HorizontalSpeed()); readouts.Add(new HorizontalSpeed());
readouts.Add(new HorizontalAcceleration()); readouts.Add(new HorizontalAcceleration());
readouts.Add(new MachNumber()); readouts.Add(new MachNumber());
readouts.Add(new Latitude()); readouts.Add(new Latitude());
readouts.Add(new Longitude()); readouts.Add(new Longitude());
readouts.Add(new GeeForce()); readouts.Add(new GeeForce());
readouts.Add(new TerminalVelocity()); readouts.Add(new TerminalVelocity());
readouts.Add(new AtmosphericEfficiency()); readouts.Add(new AtmosphericEfficiency());
readouts.Add(new Biome()); readouts.Add(new Biome());
readouts.Add(new Situation()); readouts.Add(new Situation());
readouts.Add(new Slope()); readouts.Add(new Slope());
readouts.Add(new ImpactTime()); readouts.Add(new ImpactTime());
readouts.Add(new ImpactLongitude()); readouts.Add(new ImpactLongitude());
readouts.Add(new ImpactLatitude()); readouts.Add(new ImpactLatitude());
readouts.Add(new ImpactAltitude()); readouts.Add(new ImpactAltitude());
readouts.Add(new ImpactBiome()); readouts.Add(new ImpactBiome());
   
// Vessel // Vessel
  readouts.Add(new Name());
readouts.Add(new DeltaVStaged()); readouts.Add(new DeltaVStaged());
readouts.Add(new DeltaVCurrent()); readouts.Add(new DeltaVCurrent());
readouts.Add(new DeltaVTotal()); readouts.Add(new DeltaVTotal());
readouts.Add(new DeltaVCurrentTotal()); readouts.Add(new DeltaVCurrentTotal());
readouts.Add(new SpecificImpulse()); readouts.Add(new SpecificImpulse());
readouts.Add(new Mass()); readouts.Add(new Mass());
readouts.Add(new Thrust()); readouts.Add(new Thrust());
readouts.Add(new ThrustToWeight()); readouts.Add(new ThrustToWeight());
readouts.Add(new ThrustOffsetAngle()); readouts.Add(new ThrustOffsetAngle());
readouts.Add(new ThrustTorque()); readouts.Add(new ThrustTorque());
readouts.Add(new SurfaceThrustToWeight()); readouts.Add(new SurfaceThrustToWeight());
readouts.Add(new Acceleration()); readouts.Add(new Acceleration());
readouts.Add(new SuicideBurnAltitude()); readouts.Add(new SuicideBurnAltitude());
readouts.Add(new SuicideBurnDistance()); readouts.Add(new SuicideBurnDistance());
readouts.Add(new SuicideBurnDeltaV()); readouts.Add(new SuicideBurnDeltaV());
readouts.Add(new IntakeAirUsage()); readouts.Add(new IntakeAirUsage());
readouts.Add(new IntakeAirDemand()); readouts.Add(new IntakeAirDemand());
readouts.Add(new IntakeAirSupply()); readouts.Add(new IntakeAirSupply());
readouts.Add(new IntakeAirDemandSupply()); readouts.Add(new IntakeAirDemandSupply());
readouts.Add(new PartCount()); readouts.Add(new PartCount());
readouts.Add(new Heading()); readouts.Add(new Heading());
readouts.Add(new Pitch()); readouts.Add(new Pitch());
readouts.Add(new Roll()); readouts.Add(new Roll());
readouts.Add(new HeadingRate()); readouts.Add(new HeadingRate());
readouts.Add(new PitchRate()); readouts.Add(new PitchRate());
readouts.Add(new RollRate()); readouts.Add(new RollRate());
   
// Rendezvous // Rendezvous
readouts.Add(new TargetSelector()); readouts.Add(new TargetSelector());
readouts.Add(new PhaseAngle()); readouts.Add(new PhaseAngle());
readouts.Add(new InterceptAngle()); readouts.Add(new InterceptAngle());
readouts.Add(new RelativeVelocity()); readouts.Add(new RelativeVelocity());
readouts.Add(new RelativeSpeed()); readouts.Add(new RelativeSpeed());
readouts.Add(new RelativeInclination()); readouts.Add(new RelativeInclination());
readouts.Add(new TimeToRelativeAscendingNode()); readouts.Add(new TimeToRelativeAscendingNode());
readouts.Add(new TimeToRelativeDescendingNode()); readouts.Add(new TimeToRelativeDescendingNode());
readouts.Add(new AngleToRelativeAscendingNode()); readouts.Add(new AngleToRelativeAscendingNode());
readouts.Add(new AngleToRelativeDescendingNode()); readouts.Add(new AngleToRelativeDescendingNode());
readouts.Add(new Rendezvous.AltitudeSeaLevel()); readouts.Add(new Rendezvous.AltitudeSeaLevel());
readouts.Add(new Rendezvous.ApoapsisHeight()); readouts.Add(new Rendezvous.ApoapsisHeight());
readouts.Add(new Rendezvous.PeriapsisHeight()); readouts.Add(new Rendezvous.PeriapsisHeight());
readouts.Add(new Rendezvous.TimeToApoapsis()); readouts.Add(new Rendezvous.TimeToApoapsis());
readouts.Add(new Rendezvous.TimeToPeriapsis()); readouts.Add(new Rendezvous.TimeToPeriapsis());
readouts.Add(new Distance()); readouts.Add(new Distance());
readouts.Add(new Rendezvous.OrbitalPeriod()); readouts.Add(new Rendezvous.OrbitalPeriod());
readouts.Add(new Rendezvous.SemiMajorAxis()); readouts.Add(new Rendezvous.SemiMajorAxis());
readouts.Add(new Rendezvous.SemiMinorAxis()); readouts.Add(new Rendezvous.SemiMinorAxis());
  readouts.Add(new Rendezvous.RelativeRadialVelocity());
  readouts.Add(new Rendezvous.TimeToRendezvous());
   
// Thermal // Thermal
readouts.Add(new InternalFlux()); readouts.Add(new InternalFlux());
readouts.Add(new ConvectionFlux()); readouts.Add(new ConvectionFlux());
readouts.Add(new RadiationFlux()); readouts.Add(new RadiationFlux());
readouts.Add(new CriticalPart()); readouts.Add(new CriticalPart());
readouts.Add(new CriticalTemperature()); readouts.Add(new CriticalTemperature());
readouts.Add(new CriticalSkinTemperature()); readouts.Add(new CriticalSkinTemperature());
readouts.Add(new CriticalThermalPercentage()); readouts.Add(new CriticalThermalPercentage());
readouts.Add(new HottestPart()); readouts.Add(new HottestPart());
readouts.Add(new HottestTemperature()); readouts.Add(new HottestTemperature());
readouts.Add(new HottestSkinTemperature()); readouts.Add(new HottestSkinTemperature());
readouts.Add(new CoolestPart()); readouts.Add(new CoolestPart());
readouts.Add(new CoolestTemperature()); readouts.Add(new CoolestTemperature());
readouts.Add(new CoolestSkinTemperature()); readouts.Add(new CoolestSkinTemperature());
   
// Misc // Misc
readouts.Add(new Separator()); readouts.Add(new Separator());
readouts.Add(new GuiSizeAdjustor()); readouts.Add(new GuiSizeAdjustor());
readouts.Add(new SimulationDelay()); readouts.Add(new SimulationDelay());
readouts.Add(new TimeReference());  
readouts.Add(new VectoredThrustToggle()); readouts.Add(new VectoredThrustToggle());
readouts.Add(new SystemTime()); readouts.Add(new SystemTime());
   
LoadHelpStrings(); LoadHelpStrings();
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.Exception(ex); Logger.Exception(ex);
} }
} }
   
/// <summary> /// <summary>
/// Gets and sets the available readout modules. /// Gets and sets the available readout modules.
/// </summary> /// </summary>
public static List<ReadoutModule> Readouts public static List<ReadoutModule> Readouts
{ {
get get
{ {
return readouts; return readouts;
} }
set set
{ {
readouts = value; readouts = value;
} }
} }
   
/// <summary> /// <summary>
/// Gets a list of readout modules which are associated with the specified category. /// Gets a list of readout modules which are associated with the specified category.
/// </summary> /// </summary>
public static List<ReadoutModule> GetCategory(ReadoutCategory category) public static List<ReadoutModule> GetCategory(ReadoutCategory category)
{ {
return readouts.Where(r => r.Category == category).ToList(); return readouts.Where(r => r.Category == category).ToList();
} }
   
/// <summary> /// <summary>
/// Gets a readout module with the specified name or class name. (Returns null if not found.) /// Gets a readout module with the specified name or class name. (Returns null if not found.)
/// </summary> /// </summary>
public static ReadoutModule GetReadout(string name) public static ReadoutModule GetReadout(string name)
{ {
return readouts.FirstOrDefault(r => r.Name == name || r.GetType().Name == name || r.Category + "." + r.GetType().Name == name); return readouts.FirstOrDefault(r => r.Name == name || r.GetType().Name == name || r.Category + "." + r.GetType().Name == name);
} }
   
/// <summary> /// <summary>
/// Resets all the readout modules. /// Resets all the readout modules.
/// </summary> /// </summary>
public static void Reset() public static void Reset()
{ {
foreach (ReadoutModule readout in readouts) foreach (ReadoutModule readout in readouts)
{ {
readout.Reset(); readout.Reset();
} }
} }
   
/// <summary> /// <summary>
/// Loads the help strings from file. /// Loads the help strings from file.
/// </summary> /// </summary>
private static void LoadHelpStrings() private static void LoadHelpStrings()
{ {
try try
{ {
SettingHandler handler = SettingHandler.Load("HelpStrings.xml"); SettingHandler handler = SettingHandler.Load("HelpStrings.xml");
foreach (ReadoutModule readout in readouts) foreach (ReadoutModule readout in readouts)
{ {
readout.HelpString = handler.GetSet(readout.Category + "." + readout.GetType().Name, readout.HelpString); readout.HelpString = handler.GetSet(readout.Category + "." + readout.GetType().Name, readout.HelpString);
} }
handler.Save("HelpStrings.xml"); handler.Save("HelpStrings.xml");
} }
catch (Exception ex) catch (Exception ex)
{ {
Logger.Exception(ex); Logger.Exception(ex);
} }
} }
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Rendezvous namespace KerbalEngineer.Flight.Readouts.Rendezvous
{ {
public class AltitudeSeaLevel : ReadoutModule public class AltitudeSeaLevel : ReadoutModule
{ {
#region Constructors #region Constructors
   
public AltitudeSeaLevel() public AltitudeSeaLevel()
{ {
this.Name = "Altitude (Sea Level)"; this.Name = "Altitude (Sea Level)";
this.Category = ReadoutCategory.GetCategory("Rendezvous"); this.Category = ReadoutCategory.GetCategory("Rendezvous");
this.HelpString = string.Empty; this.HelpString = "Shows the target's altitude above sea level.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (RendezvousProcessor.ShowDetails) if (RendezvousProcessor.ShowDetails)
{ {
this.DrawLine(RendezvousProcessor.AltitudeSeaLevel.ToDistance(), section.IsHud); this.DrawLine(RendezvousProcessor.AltitudeSeaLevel.ToDistance(), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
RendezvousProcessor.RequestUpdate(); RendezvousProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Rendezvous namespace KerbalEngineer.Flight.Readouts.Rendezvous
{ {
public class AngleToRelativeAscendingNode : ReadoutModule public class AngleToRelativeAscendingNode : ReadoutModule
{ {
#region Constructors #region Constructors
   
public AngleToRelativeAscendingNode() public AngleToRelativeAscendingNode()
{ {
this.Name = "Angle to Rel. AN"; this.Name = "Angle to Rel. AN";
this.Category = ReadoutCategory.GetCategory("Rendezvous"); this.Category = ReadoutCategory.GetCategory("Rendezvous");
this.HelpString = string.Empty; this.HelpString = "Angular Distance from the vessel to crossing the orbit of the target object, going north of it.";
this.IsDefault = false; this.IsDefault = false;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (RendezvousProcessor.ShowDetails) if (RendezvousProcessor.ShowDetails)
{ {
this.DrawLine(RendezvousProcessor.AngleToAscendingNode.ToAngle(), section.IsHud); this.DrawLine(RendezvousProcessor.AngleToAscendingNode.ToAngle(), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
RendezvousProcessor.RequestUpdate(); RendezvousProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Rendezvous namespace KerbalEngineer.Flight.Readouts.Rendezvous
{ {
public class AngleToRelativeDescendingNode : ReadoutModule public class AngleToRelativeDescendingNode : ReadoutModule
{ {
#region Constructors #region Constructors
   
public AngleToRelativeDescendingNode() public AngleToRelativeDescendingNode()
{ {
this.Name = "Angle to Rel. DN"; this.Name = "Angle to Rel. DN";
this.Category = ReadoutCategory.GetCategory("Rendezvous"); this.Category = ReadoutCategory.GetCategory("Rendezvous");
this.HelpString = string.Empty; this.HelpString = "Angular Distance from the vessel to crossing the orbit of the target object, going south of it.";
this.IsDefault = false; this.IsDefault = false;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (RendezvousProcessor.ShowDetails) if (RendezvousProcessor.ShowDetails)
{ {
this.DrawLine(RendezvousProcessor.AngleToDescendingNode.ToAngle(), section.IsHud); this.DrawLine(RendezvousProcessor.AngleToDescendingNode.ToAngle(), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
RendezvousProcessor.RequestUpdate(); RendezvousProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Rendezvous namespace KerbalEngineer.Flight.Readouts.Rendezvous
{ {
public class ApoapsisHeight : ReadoutModule public class ApoapsisHeight : ReadoutModule
{ {
#region Constructors #region Constructors
   
public ApoapsisHeight() public ApoapsisHeight()
{ {
this.Name = "Apoapsis Height"; this.Name = "Apoapsis Height";
this.Category = ReadoutCategory.GetCategory("Rendezvous"); this.Category = ReadoutCategory.GetCategory("Rendezvous");
this.HelpString = string.Empty; this.HelpString = "Shows the targets's apoapsis height relative to sea level. (Apoapsis is the highest point of an orbit.)";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (RendezvousProcessor.ShowDetails) if (RendezvousProcessor.ShowDetails)
{ {
this.DrawLine(RendezvousProcessor.ApoapsisHeight.ToDistance(), section.IsHud); this.DrawLine(RendezvousProcessor.ApoapsisHeight.ToDistance(), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
RendezvousProcessor.RequestUpdate(); RendezvousProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Rendezvous namespace KerbalEngineer.Flight.Readouts.Rendezvous
{ {
public class Distance : ReadoutModule public class Distance : ReadoutModule
{ {
#region Constructors #region Constructors
   
public Distance() public Distance()
{ {
this.Name = "Distance"; this.Name = "Distance";
this.Category = ReadoutCategory.GetCategory("Rendezvous"); this.Category = ReadoutCategory.GetCategory("Rendezvous");
this.HelpString = string.Empty; this.HelpString = "Current distance between the vessel and the target object.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (RendezvousProcessor.ShowDetails) if (RendezvousProcessor.ShowDetails)
{ {
this.DrawLine(RendezvousProcessor.Distance.ToDistance(), section.IsHud); this.DrawLine(RendezvousProcessor.Distance.ToDistance(), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
RendezvousProcessor.RequestUpdate(); RendezvousProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Rendezvous namespace KerbalEngineer.Flight.Readouts.Rendezvous
{ {
public class OrbitalPeriod : ReadoutModule public class OrbitalPeriod : ReadoutModule
{ {
#region Constructors #region Constructors
   
public OrbitalPeriod() public OrbitalPeriod()
{ {
this.Name = "Orbital Period"; this.Name = "Orbital Period";
this.Category = ReadoutCategory.GetCategory("Rendezvous"); this.Category = ReadoutCategory.GetCategory("Rendezvous");
this.HelpString = string.Empty; this.HelpString = "Shows the amount of time it will take the target object to complete a full orbit.";
this.IsDefault = false; this.IsDefault = false;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (RendezvousProcessor.ShowDetails) if (RendezvousProcessor.ShowDetails)
{ {
this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.OrbitalPeriod, "F3"), section.IsHud); this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.OrbitalPeriod, "F3"), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
RendezvousProcessor.RequestUpdate(); RendezvousProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Rendezvous namespace KerbalEngineer.Flight.Readouts.Rendezvous
{ {
public class PeriapsisHeight : ReadoutModule public class PeriapsisHeight : ReadoutModule
{ {
#region Constructors #region Constructors
   
public PeriapsisHeight() public PeriapsisHeight()
{ {
this.Name = "Periapsis Height"; this.Name = "Periapsis Height";
this.Category = ReadoutCategory.GetCategory("Rendezvous"); this.Category = ReadoutCategory.GetCategory("Rendezvous");
this.HelpString = string.Empty; this.HelpString = "Shows the targets's periapsis height relative to sea level. (Periapsis is the lowest point of an orbit.)";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (RendezvousProcessor.ShowDetails) if (RendezvousProcessor.ShowDetails)
{ {
this.DrawLine(RendezvousProcessor.PeriapsisHeight.ToDistance(), section.IsHud); this.DrawLine(RendezvousProcessor.PeriapsisHeight.ToDistance(), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
RendezvousProcessor.RequestUpdate(); RendezvousProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Rendezvous namespace KerbalEngineer.Flight.Readouts.Rendezvous
{ {
public class PhaseAngle : ReadoutModule public class PhaseAngle : ReadoutModule
{ {
#region Constructors #region Constructors
   
public PhaseAngle() public PhaseAngle()
{ {
this.Name = "Phase Angle"; this.Name = "Phase Angle";
this.Category = ReadoutCategory.GetCategory("Rendezvous"); this.Category = ReadoutCategory.GetCategory("Rendezvous");
this.HelpString = string.Empty; this.HelpString = "Angular distance of the vessel relative to the target object.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (RendezvousProcessor.ShowDetails) if (RendezvousProcessor.ShowDetails)
{ {
this.DrawLine(RendezvousProcessor.PhaseAngle.ToAngle(), section.IsHud); this.DrawLine(RendezvousProcessor.PhaseAngle.ToAngle(), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
RendezvousProcessor.RequestUpdate(); RendezvousProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
  //
  // Kerbal Engineer Redux
  //
  // Copyright (C) 2014 CYBUTEK
  //
  // This program is free software: you can redistribute it and/or modify
  // it under the terms of the GNU General Public License as published by
  // the Free Software Foundation, either version 3 of the License, or
  // (at your option) any later version.
  //
  // This program is distributed in the hope that it will be useful,
  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  // GNU General Public License for more details.
  //
  // You should have received a copy of the GNU General Public License
  // along with this program. If not, see <http://www.gnu.org/licenses/>.
  //
 
  #region Using Directives
 
  using KerbalEngineer.Extensions;
  using KerbalEngineer.Flight.Sections;
 
  #endregion
 
  namespace KerbalEngineer.Flight.Readouts.Rendezvous
  {
  public class RelativeRadialVelocity : ReadoutModule
  {
  #region Constructors
 
  public RelativeRadialVelocity()
  {
  this.Name = "Relative Radial Velocity";
  this.Category = ReadoutCategory.GetCategory("Rendezvous");
  this.HelpString = "Relative radial velocity between your vessel and the target object";
  this.IsDefault = false;
  }
 
  #endregion
 
  #region Methods: public
 
  public override void Draw(SectionModule section)
  {
  if (RendezvousProcessor.ShowDetails)
  {
  this.DrawLine(RendezvousProcessor.RelativeRadialVelocity.ToSpeed(), section.IsHud);
  }
  }
 
  public override void Reset()
  {
  FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance);
  }
 
  public override void Update()
  {
  RendezvousProcessor.RequestUpdate();
  }
 
  #endregion
  }
  }
 
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2015 CYBUTEK // Copyright (C) 2015 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
namespace KerbalEngineer.Flight.Readouts.Rendezvous namespace KerbalEngineer.Flight.Readouts.Rendezvous
{ {
using System; using System;
using Extensions; using Extensions;
using Helpers; using Helpers;
   
public class RendezvousProcessor : IUpdatable, IUpdateRequest public class RendezvousProcessor : IUpdatable, IUpdateRequest
{ {
private static readonly RendezvousProcessor instance = new RendezvousProcessor(); private static readonly RendezvousProcessor instance = new RendezvousProcessor();
   
private Orbit originOrbit; private Orbit originOrbit;
private Orbit targetOrbit; private Orbit targetOrbit;
   
/// <summary> /// <summary>
/// Gets the target's altitude above its reference body. /// Gets the target's altitude above its reference body.
/// </summary> /// </summary>
public static double AltitudeSeaLevel { get; private set; } public static double AltitudeSeaLevel { get; private set; }
   
/// <summary> /// <summary>
/// Gets the angle from the origin position to the ascending node. /// Gets the angle from the origin position to the ascending node.
/// </summary> /// </summary>
public static double AngleToAscendingNode { get; private set; } public static double AngleToAscendingNode { get; private set; }
   
/// <summary> /// <summary>
/// Gets the angle from the origin position to the descending node. /// Gets the angle from the origin position to the descending node.
/// </summary> /// </summary>
public static double AngleToDescendingNode { get; private set; } public static double AngleToDescendingNode { get; private set; }
   
/// <summary> /// <summary>
/// Gets the target's apoapsis above its reference body. /// Gets the target's apoapsis above its reference body.
/// </summary> /// </summary>
public static double ApoapsisHeight { get; private set; } public static double ApoapsisHeight { get; private set; }
   
/// <summary> /// <summary>
/// Gets the distance from the origin position to the target position. /// Gets the distance from the origin position to the target position.
/// </summary> /// </summary>
public static double Distance { get; private set; } public static double Distance { get; private set; }
   
/// <summary> /// <summary>
/// Gets the current instance of the rendezvous processor. /// Gets the current instance of the rendezvous processor.
/// </summary> /// </summary>
public static RendezvousProcessor Instance public static RendezvousProcessor Instance
{ {
get get
{ {
return instance; return instance;
} }
} }
   
/// <summary> /// <summary>
/// Gets the difference in angle from the origin position to where it is most efficient to burn for an encounter. /// Gets the difference in angle from the origin position to where it is most efficient to burn for an encounter.
/// </summary> /// </summary>
public static double InterceptAngle { get; private set; } public static double InterceptAngle { get; private set; }
   
/// <summary> /// <summary>
/// Gets the orbital period of the target orbit. /// Gets the orbital period of the target orbit.
/// </summary> /// </summary>
public static double OrbitalPeriod { get; private set; } public static double OrbitalPeriod { get; private set; }
   
/// <summary> /// <summary>
/// Gets the target's periapsis above its reference body. /// Gets the target's periapsis above its reference body.
/// </summary> /// </summary>
public static double PeriapsisHeight { get; private set; } public static double PeriapsisHeight { get; private set; }
   
/// <summary> /// <summary>
/// Gets the difference in angle from the origin position to the target position based on a common reference. /// Gets the difference in angle from the origin position to the target position based on a common reference.
/// </summary> /// </summary>
public static double PhaseAngle { get; private set; } public static double PhaseAngle { get; private set; }
   
/// <summary> /// <summary>
/// Gets the angular difference between the origin and target orbits. /// Gets the angular difference between the origin and target orbits.
/// </summary> /// </summary>
public static double RelativeInclination { get; private set; } public static double RelativeInclination { get; private set; }
   
/// <summary> /// <summary>
/// Gets the relative orbital speed between the vessel and target. /// Gets the relative orbital speed between the vessel and target.
/// </summary> /// </summary>
public static double RelativeSpeed { get; private set; } public static double RelativeSpeed { get; private set; }
   
/// <summary> /// <summary>
/// Gets the relative orbital velocity between the vessel and target. /// Gets the relative orbital velocity between the vessel and target.
/// </summary> /// </summary>
public static double RelativeVelocity { get; private set; } public static double RelativeVelocity { get; private set; }
   
/// <summary> /// <summary>
/// Gets the semi-major axis of the target orbit. /// Gets the semi-major axis of the target orbit.
/// </summary> /// </summary>
public static double SemiMajorAxis { get; private set; } public static double SemiMajorAxis { get; private set; }
   
/// <summary> /// <summary>
/// Gets the semi-minor axis of the target orbit. /// Gets the semi-minor axis of the target orbit.
/// </summary> /// </summary>
public static double SemiMinorAxis { get; private set; } public static double SemiMinorAxis { get; private set; }
   
/// <summary> /// <summary>
/// Gets whether the details are ready to be shown. /// Gets whether the details are ready to be shown.
/// </summary> /// </summary>
public static bool ShowDetails { get; private set; } public static bool ShowDetails { get; private set; }
   
/// <summary> /// <summary>
/// Gets the target's time to apoapsis. /// Gets the target's time to apoapsis.
/// </summary> /// </summary>
public static double TimeToApoapsis { get; private set; } public static double TimeToApoapsis { get; private set; }
   
/// <summary> /// <summary>
/// Gets the time it will take to reach the ascending node. /// Gets the time it will take to reach the ascending node.
/// </summary> /// </summary>
public static double TimeToAscendingNode { get; private set; } public static double TimeToAscendingNode { get; private set; }
   
/// <summary> /// <summary>
/// Gets the time it will take to reach the descending node. /// Gets the time it will take to reach the descending node.
/// </summary> /// </summary>
public static double TimeToDescendingNode { get; private set; } public static double TimeToDescendingNode { get; private set; }
   
/// <summary> /// <summary>
/// Gets the target's time to periapsis. /// Gets the target's time to periapsis.
/// </summary> /// </summary>
public static double TimeToPeriapsis { get; private set; } public static double TimeToPeriapsis { get; private set; }
   
  /// <summary>
  /// Gets the relative radial velocity.
  /// </summary>
  public static double RelativeRadialVelocity { get; private set; }
   
  /// <summary>
  /// Gets approximate (linearly) time to the minimum distance between objects.
  /// </summary>
  public static double TimeToRendezvous { get; private set; }
   
/// <summary> /// <summary>
/// Gets and sets whether the updatable object should be updated. /// Gets and sets whether the updatable object should be updated.
/// </summary> /// </summary>
public bool UpdateRequested { get; set; } public bool UpdateRequested { get; set; }
   
/// <summary> /// <summary>
/// Request and update to calculate the details. /// Request and update to calculate the details.
/// </summary> /// </summary>
public static void RequestUpdate() public static void RequestUpdate()
{ {
instance.UpdateRequested = true; instance.UpdateRequested = true;
} }
   
/// <summary> /// <summary>
/// Updates the details by recalculating if requested. /// Updates the details by recalculating if requested.
/// </summary> /// </summary>
public void Update() public void Update()
{ {
if (FlightGlobals.fetch == null || if (FlightGlobals.fetch == null ||
FlightGlobals.fetch.VesselTarget == null || FlightGlobals.fetch.VesselTarget == null ||
FlightGlobals.ActiveVessel == null || FlightGlobals.ActiveVessel == null ||
FlightGlobals.ActiveVessel.targetObject == null || FlightGlobals.ActiveVessel.targetObject == null ||
FlightGlobals.ActiveVessel.targetObject.GetOrbit() == null || FlightGlobals.ActiveVessel.targetObject.GetOrbit() == null ||
FlightGlobals.ship_orbit == null || FlightGlobals.ship_orbit == null ||
FlightGlobals.ship_orbit.referenceBody == null) FlightGlobals.ship_orbit.referenceBody == null)
{ {
ShowDetails = false; ShowDetails = false;
return; return;
} }
   
ShowDetails = true; ShowDetails = true;
   
targetOrbit = FlightGlobals.fetch.VesselTarget.GetOrbit(); targetOrbit = FlightGlobals.fetch.VesselTarget.GetOrbit();
originOrbit = (FlightGlobals.ship_orbit.referenceBody == Planetarium.fetch.Sun || originOrbit = (FlightGlobals.ship_orbit.referenceBody == Planetarium.fetch.Sun ||
FlightGlobals.ship_orbit.referenceBody == FlightGlobals.ActiveVessel.targetObject.GetOrbit().referenceBody) FlightGlobals.ship_orbit.referenceBody == FlightGlobals.ActiveVessel.targetObject.GetOrbit().referenceBody)
? FlightGlobals.ship_orbit ? FlightGlobals.ship_orbit
: FlightGlobals.ship_orbit.referenceBody.orbit; : FlightGlobals.ship_orbit.referenceBody.orbit;
   
RelativeInclination = originOrbit.GetRelativeInclination(targetOrbit); RelativeInclination = originOrbit.GetRelativeInclination(targetOrbit);
RelativeVelocity = FlightGlobals.ship_tgtSpeed; RelativeVelocity = FlightGlobals.ship_tgtSpeed;
RelativeSpeed = FlightGlobals.ship_obtSpeed - targetOrbit.orbitalSpeed; RelativeSpeed = FlightGlobals.ship_obtSpeed - targetOrbit.orbitalSpeed;
PhaseAngle = originOrbit.GetPhaseAngle(targetOrbit); PhaseAngle = originOrbit.GetPhaseAngle(targetOrbit);
InterceptAngle = CalcInterceptAngle(); InterceptAngle = CalcInterceptAngle();
TimeToAscendingNode = originOrbit.GetTimeToVector(GetAscendingNode()); TimeToAscendingNode = originOrbit.GetTimeToVector(GetAscendingNode());
TimeToDescendingNode = originOrbit.GetTimeToVector(GetDescendingNode()); TimeToDescendingNode = originOrbit.GetTimeToVector(GetDescendingNode());
AngleToAscendingNode = originOrbit.GetAngleToVector(GetAscendingNode()); AngleToAscendingNode = originOrbit.GetAngleToVector(GetAscendingNode());
AngleToDescendingNode = originOrbit.GetAngleToVector(GetDescendingNode()); AngleToDescendingNode = originOrbit.GetAngleToVector(GetDescendingNode());
AltitudeSeaLevel = targetOrbit.altitude; AltitudeSeaLevel = targetOrbit.altitude;
ApoapsisHeight = targetOrbit.ApA; ApoapsisHeight = targetOrbit.ApA;
PeriapsisHeight = targetOrbit.PeA; PeriapsisHeight = targetOrbit.PeA;
TimeToApoapsis = targetOrbit.timeToAp; TimeToApoapsis = targetOrbit.timeToAp;
TimeToPeriapsis = targetOrbit.timeToPe; TimeToPeriapsis = targetOrbit.timeToPe;
SemiMajorAxis = targetOrbit.semiMajorAxis; SemiMajorAxis = targetOrbit.semiMajorAxis;
SemiMinorAxis = targetOrbit.semiMinorAxis; SemiMinorAxis = targetOrbit.semiMinorAxis;
   
Distance = Vector3d.Distance(targetOrbit.pos, originOrbit.pos); Distance = Vector3d.Distance(targetOrbit.pos, originOrbit.pos);
OrbitalPeriod = targetOrbit.period; OrbitalPeriod = targetOrbit.period;
   
  // beware that the order/sign of coordinates is inconsistent across different exposed variables
  // in particular, v below does not equal to FlightGlobals.ship_tgtVelocity
  Vector3d x = targetOrbit.pos - originOrbit.pos;
  Vector3d v = targetOrbit.vel - originOrbit.vel;
  double xv = Vector3d.Dot(x, v);
  TimeToRendezvous = - xv / Vector3d.SqrMagnitude(v);
  RelativeRadialVelocity = xv / Vector3d.Magnitude(x);
} }
   
private double CalcInterceptAngle() private double CalcInterceptAngle()
{ {
double originRadius = (originOrbit.semiMinorAxis + originOrbit.semiMajorAxis) * 0.5; double originRadius = (originOrbit.semiMinorAxis + originOrbit.semiMajorAxis) * 0.5;
double targetRadius = (targetOrbit.semiMinorAxis + targetOrbit.semiMajorAxis) * 0.5; double targetRadius = (targetOrbit.semiMinorAxis + targetOrbit.semiMajorAxis) * 0.5;
double angle = 180.0 * (1.0 - Math.Pow((originRadius + targetRadius) / (2.0 * targetRadius), 1.5)); double angle = 180.0 * (1.0 - Math.Pow((originRadius + targetRadius) / (2.0 * targetRadius), 1.5));
angle = PhaseAngle - angle; angle = PhaseAngle - angle;
return RelativeInclination < 90.0 ? AngleHelper.Clamp360(angle) : AngleHelper.Clamp360(360.0 - (180.0 - angle)); return RelativeInclination < 90.0 ? AngleHelper.Clamp360(angle) : AngleHelper.Clamp360(360.0 - (180.0 - angle));
} }
   
private Vector3d GetAscendingNode() private Vector3d GetAscendingNode()
{ {
return Vector3d.Cross(targetOrbit.GetOrbitNormal(), originOrbit.GetOrbitNormal()); return Vector3d.Cross(targetOrbit.GetOrbitNormal(), originOrbit.GetOrbitNormal());
} }
   
private Vector3d GetDescendingNode() private Vector3d GetDescendingNode()
{ {
return Vector3d.Cross(originOrbit.GetOrbitNormal(), targetOrbit.GetOrbitNormal()); return Vector3d.Cross(originOrbit.GetOrbitNormal(), targetOrbit.GetOrbitNormal());
} }
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
   
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Rendezvous namespace KerbalEngineer.Flight.Readouts.Rendezvous
{ {
public class SemiMajorAxis : ReadoutModule public class SemiMajorAxis : ReadoutModule
{ {
#region Constructors #region Constructors
   
public SemiMajorAxis() public SemiMajorAxis()
{ {
this.Name = "Semi-major Axis"; this.Name = "Semi-major Axis";
this.Category = ReadoutCategory.GetCategory("Rendezvous"); this.Category = ReadoutCategory.GetCategory("Rendezvous");
this.HelpString = String.Empty; this.HelpString = "Shows the distance from the centre of the target's orbit to the farthest edge.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (RendezvousProcessor.ShowDetails) if (RendezvousProcessor.ShowDetails)
{ {
this.DrawLine(Units.ToDistance(RendezvousProcessor.SemiMajorAxis, 3), section.IsHud); this.DrawLine(Units.ToDistance(RendezvousProcessor.SemiMajorAxis, 3), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
RendezvousProcessor.RequestUpdate(); RendezvousProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using System; using System;
   
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Rendezvous namespace KerbalEngineer.Flight.Readouts.Rendezvous
{ {
public class SemiMinorAxis : ReadoutModule public class SemiMinorAxis : ReadoutModule
{ {
#region Constructors #region Constructors
   
public SemiMinorAxis() public SemiMinorAxis()
{ {
this.Name = "Semi-minor Axis"; this.Name = "Semi-minor Axis";
this.Category = ReadoutCategory.GetCategory("Rendezvous"); this.Category = ReadoutCategory.GetCategory("Rendezvous");
this.HelpString = String.Empty; this.HelpString = "Shows the distance from the centre of the target's orbit to the nearest edge.";
this.IsDefault = false; this.IsDefault = false;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (RendezvousProcessor.ShowDetails) if (RendezvousProcessor.ShowDetails)
{ {
this.DrawLine(Units.ToDistance(RendezvousProcessor.SemiMajorAxis, 3), section.IsHud); this.DrawLine(Units.ToDistance(RendezvousProcessor.SemiMajorAxis, 3), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
RendezvousProcessor.RequestUpdate(); RendezvousProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Rendezvous namespace KerbalEngineer.Flight.Readouts.Rendezvous
{ {
public class TimeToApoapsis : ReadoutModule public class TimeToApoapsis : ReadoutModule
{ {
#region Constructors #region Constructors
   
public TimeToApoapsis() public TimeToApoapsis()
{ {
this.Name = "Time to Apoapsis"; this.Name = "Time to Apoapsis";
this.Category = ReadoutCategory.GetCategory("Rendezvous"); this.Category = ReadoutCategory.GetCategory("Rendezvous");
this.HelpString = string.Empty; this.HelpString = "Shows the time until the target reaches apoapsis, the highest point of the orbit.";
this.IsDefault = false; this.IsDefault = false;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (RendezvousProcessor.ShowDetails) if (RendezvousProcessor.ShowDetails)
{ {
this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToApoapsis), section.IsHud); this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToApoapsis), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
RendezvousProcessor.RequestUpdate(); RendezvousProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Rendezvous namespace KerbalEngineer.Flight.Readouts.Rendezvous
{ {
public class TimeToPeriapsis : ReadoutModule public class TimeToPeriapsis : ReadoutModule
{ {
#region Constructors #region Constructors
   
public TimeToPeriapsis() public TimeToPeriapsis()
{ {
this.Name = "Time to Periapsis"; this.Name = "Time to Periapsis";
this.Category = ReadoutCategory.GetCategory("Rendezvous"); this.Category = ReadoutCategory.GetCategory("Rendezvous");
this.HelpString = string.Empty; this.HelpString = "Shows the time until the target reaches periapsis, the lowest point of the orbit.";
this.IsDefault = false; this.IsDefault = false;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (RendezvousProcessor.ShowDetails) if (RendezvousProcessor.ShowDetails)
{ {
this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToPeriapsis), section.IsHud); this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToPeriapsis), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
RendezvousProcessor.RequestUpdate(); RendezvousProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Rendezvous namespace KerbalEngineer.Flight.Readouts.Rendezvous
{ {
public class TimeToRelativeAscendingNode : ReadoutModule public class TimeToRelativeAscendingNode : ReadoutModule
{ {
#region Constructors #region Constructors
   
public TimeToRelativeAscendingNode() public TimeToRelativeAscendingNode()
{ {
this.Name = "Time to Rel. AN"; this.Name = "Time to Rel. AN";
this.Category = ReadoutCategory.GetCategory("Rendezvous"); this.Category = ReadoutCategory.GetCategory("Rendezvous");
this.HelpString = string.Empty; this.HelpString = "Time until the vessel crosses the target's orbit, going north.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (RendezvousProcessor.ShowDetails) if (RendezvousProcessor.ShowDetails)
{ {
this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToAscendingNode), section.IsHud); this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToAscendingNode), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
RendezvousProcessor.RequestUpdate(); RendezvousProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Rendezvous namespace KerbalEngineer.Flight.Readouts.Rendezvous
{ {
public class TimeToRelativeDescendingNode : ReadoutModule public class TimeToRelativeDescendingNode : ReadoutModule
{ {
#region Constructors #region Constructors
   
public TimeToRelativeDescendingNode() public TimeToRelativeDescendingNode()
{ {
this.Name = "Time to Rel. DN"; this.Name = "Time to Rel. DN";
this.Category = ReadoutCategory.GetCategory("Rendezvous"); this.Category = ReadoutCategory.GetCategory("Rendezvous");
this.HelpString = string.Empty; this.HelpString = "Time until the vessel crosses the target's orbit, going south.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (RendezvousProcessor.ShowDetails) if (RendezvousProcessor.ShowDetails)
{ {
this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToDescendingNode), section.IsHud); this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToDescendingNode), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
RendezvousProcessor.RequestUpdate(); RendezvousProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
  //
  // Kerbal Engineer Redux
  //
  // Copyright (C) 2014 CYBUTEK
  //
  // This program is free software: you can redistribute it and/or modify
  // it under the terms of the GNU General Public License as published by
  // the Free Software Foundation, either version 3 of the License, or
  // (at your option) any later version.
  //
  // This program is distributed in the hope that it will be useful,
  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  // GNU General Public License for more details.
  //
  // You should have received a copy of the GNU General Public License
  // along with this program. If not, see <http://www.gnu.org/licenses/>.
  //
 
  #region Using Directives
 
  using KerbalEngineer.Flight.Sections;
  using KerbalEngineer.Helpers;
 
  #endregion
 
  namespace KerbalEngineer.Flight.Readouts.Rendezvous
  {
  public class TimeToRendezvous : ReadoutModule
  {
  #region Constructors
 
  public TimeToRendezvous()
  {
  this.Name = "Time to Rendezvous";
  this.Category = ReadoutCategory.GetCategory("Rendezvous");
  this.HelpString = "Approximate (linearly) time to the minimum distance between objects.";
  this.IsDefault = false;
  }
 
  #endregion
 
  #region Methods: public
 
  public override void Draw(SectionModule section)
  {
  if (RendezvousProcessor.ShowDetails)
  {
  this.DrawLine(TimeFormatter.ConvertToString(RendezvousProcessor.TimeToRendezvous), section.IsHud);
  }
  }
 
  public override void Reset()
  {
  FlightEngineerCore.Instance.AddUpdatable(RendezvousProcessor.Instance);
  }
 
  public override void Update()
  {
  RendezvousProcessor.RequestUpdate();
  }
 
  #endregion
  }
  }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Surface namespace KerbalEngineer.Flight.Readouts.Surface
{ {
public class ImpactAltitude : ReadoutModule public class ImpactAltitude : ReadoutModule
{ {
#region Constructors #region Constructors
   
public ImpactAltitude() public ImpactAltitude()
{ {
this.Name = "Impact Altitude"; this.Name = "Impact Altitude";
this.Category = ReadoutCategory.GetCategory("Surface"); this.Category = ReadoutCategory.GetCategory("Surface");
this.HelpString = string.Empty; this.HelpString = "Altitude at which the Vessel will impact.";
this.IsDefault = false; this.IsDefault = false;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (ImpactProcessor.ShowDetails) if (ImpactProcessor.ShowDetails)
{ {
this.DrawLine(ImpactProcessor.Altitude.ToDistance(), section.IsHud); this.DrawLine(ImpactProcessor.Altitude.ToDistance(), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(ImpactProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(ImpactProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
ImpactProcessor.RequestUpdate(); ImpactProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Surface namespace KerbalEngineer.Flight.Readouts.Surface
{ {
public class ImpactBiome : ReadoutModule public class ImpactBiome : ReadoutModule
{ {
#region Constructors #region Constructors
   
public ImpactBiome() public ImpactBiome()
{ {
this.Name = "Impact Biome"; this.Name = "Impact Biome";
this.Category = ReadoutCategory.GetCategory("Surface"); this.Category = ReadoutCategory.GetCategory("Surface");
this.HelpString = string.Empty; this.HelpString = "Biome the Vessel will impact in.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (ImpactProcessor.ShowDetails) if (ImpactProcessor.ShowDetails)
{ {
this.DrawLine(ImpactProcessor.Biome, section.IsHud); this.DrawLine(ImpactProcessor.Biome, section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(ImpactProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(ImpactProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
ImpactProcessor.RequestUpdate(); ImpactProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Surface namespace KerbalEngineer.Flight.Readouts.Surface
{ {
public class ImpactLatitude : ReadoutModule public class ImpactLatitude : ReadoutModule
{ {
#region Constructors #region Constructors
   
public ImpactLatitude() public ImpactLatitude()
{ {
this.Name = "Impact Latitude"; this.Name = "Impact Latitude";
this.Category = ReadoutCategory.GetCategory("Surface"); this.Category = ReadoutCategory.GetCategory("Surface");
this.HelpString = string.Empty; this.HelpString = "Latitude of the impact position.";
this.IsDefault = false; this.IsDefault = false;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (ImpactProcessor.ShowDetails) if (ImpactProcessor.ShowDetails)
{ {
this.DrawLine(ImpactProcessor.Latitude.ToAngle(), section.IsHud); this.DrawLine(ImpactProcessor.Latitude.ToAngle(), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(ImpactProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(ImpactProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
ImpactProcessor.RequestUpdate(); ImpactProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Extensions; using KerbalEngineer.Extensions;
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Surface namespace KerbalEngineer.Flight.Readouts.Surface
{ {
public class ImpactLongitude : ReadoutModule public class ImpactLongitude : ReadoutModule
{ {
#region Constructors #region Constructors
   
public ImpactLongitude() public ImpactLongitude()
{ {
this.Name = "Impact Longitude"; this.Name = "Impact Longitude";
this.Category = ReadoutCategory.GetCategory("Surface"); this.Category = ReadoutCategory.GetCategory("Surface");
this.HelpString = string.Empty; this.HelpString = "Longditude of the impact position.";
this.IsDefault = false; this.IsDefault = false;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (ImpactProcessor.ShowDetails) if (ImpactProcessor.ShowDetails)
{ {
this.DrawLine(ImpactProcessor.Longitude.ToAngle(), section.IsHud); this.DrawLine(ImpactProcessor.Longitude.ToAngle(), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(ImpactProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(ImpactProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
ImpactProcessor.RequestUpdate(); ImpactProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Surface namespace KerbalEngineer.Flight.Readouts.Surface
{ {
public class ImpactTime : ReadoutModule public class ImpactTime : ReadoutModule
{ {
#region Constructors #region Constructors
   
public ImpactTime() public ImpactTime()
{ {
this.Name = "Impact Time"; this.Name = "Impact Time";
this.Category = ReadoutCategory.GetCategory("Surface"); this.Category = ReadoutCategory.GetCategory("Surface");
this.HelpString = string.Empty; this.HelpString = "Shows time until the vessel impacts the central object.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (ImpactProcessor.ShowDetails) if (ImpactProcessor.ShowDetails)
{ {
this.DrawLine(TimeFormatter.ConvertToString(ImpactProcessor.Time), section.IsHud); this.DrawLine(TimeFormatter.ConvertToString(ImpactProcessor.Time), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(ImpactProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(ImpactProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
ImpactProcessor.RequestUpdate(); ImpactProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Surface namespace KerbalEngineer.Flight.Readouts.Surface
{ {
public class Latitude : ReadoutModule public class Latitude : ReadoutModule
{ {
#region Constructors #region Constructors
   
public Latitude() public Latitude()
{ {
this.Name = "Latitude"; this.Name = "Latitude";
this.Category = ReadoutCategory.GetCategory("Surface"); this.Category = ReadoutCategory.GetCategory("Surface");
this.HelpString = "Shows the vessel's latitude position around the celestial body. Latitude is the angle from the equator to poles."; this.HelpString = "Shows the vessel's latitude position around the celestial body. Latitude is the angle from the equator to poles.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
this.DrawLine(Units.ToAngleDMS(FlightGlobals.ship_latitude) + (FlightGlobals.ship_latitude < 0 ? " S" : " N"), section.IsHud); this.DrawLine(Units.ToAngleDMS(FlightGlobals.ship_latitude) + (FlightGlobals.ship_latitude < 0 ? " S" : " N"), section.IsHud);
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
namespace KerbalEngineer.Flight.Readouts.Surface namespace KerbalEngineer.Flight.Readouts.Surface
{ {
using Helpers; using Helpers;
using Sections; using Sections;
   
public class Longitude : ReadoutModule public class Longitude : ReadoutModule
{ {
public Longitude() public Longitude()
{ {
Name = "Longitude"; Name = "Longitude";
Category = ReadoutCategory.GetCategory("Surface"); Category = ReadoutCategory.GetCategory("Surface");
HelpString = "Shows the vessel's longitude around a celestial body. Longitude is the angle from the bodies prime meridian."; HelpString = "Shows the vessel's longitude around a celestial body. Longitude is the angle from the bodies prime meridian.";
IsDefault = true; IsDefault = true;
} }
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
double angle = AngleHelper.Clamp180(FlightGlobals.ship_longitude); double angle = AngleHelper.Clamp180(FlightGlobals.ship_longitude);
DrawLine(Units.ToAngleDMS(angle) + (angle < 0.0 ? "W" : " E"), section.IsHud); DrawLine(Units.ToAngleDMS(angle) + (angle < 0.0 ? "W" : " E"), section.IsHud);
} }
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Surface namespace KerbalEngineer.Flight.Readouts.Surface
{ {
public class Situation : ReadoutModule public class Situation : ReadoutModule
{ {
#region Constructors #region Constructors
   
public Situation() public Situation()
{ {
this.Name = "Situation"; this.Name = "Situation";
this.Category = ReadoutCategory.GetCategory("Surface"); this.Category = ReadoutCategory.GetCategory("Surface");
this.HelpString = string.Empty; this.HelpString = "Shows the vessel's current scientific situation. (Landed, Splashed, Flying Low/High, In Space Low/High)";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
switch (ScienceUtil.GetExperimentSituation(FlightGlobals.ActiveVessel)) switch (ScienceUtil.GetExperimentSituation(FlightGlobals.ActiveVessel))
{ {
case ExperimentSituations.SrfLanded: case ExperimentSituations.SrfLanded:
this.DrawLine("Landed"); this.DrawLine("Landed");
break; break;
   
case ExperimentSituations.SrfSplashed: case ExperimentSituations.SrfSplashed:
this.DrawLine("Splashed"); this.DrawLine("Splashed");
break; break;
   
case ExperimentSituations.FlyingLow: case ExperimentSituations.FlyingLow:
this.DrawLine("Flying Low"); this.DrawLine("Flying Low");
break; break;
   
case ExperimentSituations.FlyingHigh: case ExperimentSituations.FlyingHigh:
this.DrawLine("Flying High"); this.DrawLine("Flying High");
break; break;
   
case ExperimentSituations.InSpaceLow: case ExperimentSituations.InSpaceLow:
this.DrawLine("In Space Low"); this.DrawLine("In Space Low");
break; break;
   
case ExperimentSituations.InSpaceHigh: case ExperimentSituations.InSpaceHigh:
this.DrawLine("In Space High"); this.DrawLine("In Space High");
break; break;
} }
} }
   
#endregion #endregion
   
#region Methods: private #region Methods: private
   
private static string GetBiome() private static string GetBiome()
{ {
return ScienceUtil.GetExperimentBiome(FlightGlobals.ActiveVessel.mainBody, FlightGlobals.ActiveVessel.latitude, FlightGlobals.ActiveVessel.longitude); return ScienceUtil.GetExperimentBiome(FlightGlobals.ActiveVessel.mainBody, FlightGlobals.ActiveVessel.latitude, FlightGlobals.ActiveVessel.longitude);
} }
   
private static string GetBodyPlural() private static string GetBodyPlural()
{ {
return FlightGlobals.currentMainBody.bodyName.EndsWith("s") ? FlightGlobals.currentMainBody.bodyName + "\'" : FlightGlobals.currentMainBody.bodyName + "\'s"; return FlightGlobals.currentMainBody.bodyName.EndsWith("s") ? FlightGlobals.currentMainBody.bodyName + "\'" : FlightGlobals.currentMainBody.bodyName + "\'s";
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2015 CYBUTEK // Copyright (C) 2015 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
namespace KerbalEngineer.Flight.Readouts.Thermal namespace KerbalEngineer.Flight.Readouts.Thermal
{ {
using Sections; using Sections;
   
public class CoolestPart : ReadoutModule public class CoolestPart : ReadoutModule
{ {
public CoolestPart() public CoolestPart()
{ {
Name = "Coolest Part"; Name = "Coolest Part";
Category = ReadoutCategory.GetCategory("Thermal"); Category = ReadoutCategory.GetCategory("Thermal");
HelpString = string.Empty; HelpString = "The part of the vessel that is enduring the lowest temperature.";
IsDefault = true; IsDefault = true;
} }
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (ThermalProcessor.ShowDetails) if (ThermalProcessor.ShowDetails)
{ {
DrawLine(ThermalProcessor.CoolestPartName, section.IsHud); DrawLine(ThermalProcessor.CoolestPartName, section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
ThermalProcessor.RequestUpdate(); ThermalProcessor.RequestUpdate();
} }
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2015 CYBUTEK // Copyright (C) 2015 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
namespace KerbalEngineer.Flight.Readouts.Thermal namespace KerbalEngineer.Flight.Readouts.Thermal
{ {
using Helpers; using Helpers;
using Sections; using Sections;
   
public class CoolestSkinTemperature : ReadoutModule public class CoolestSkinTemperature : ReadoutModule
{ {
public CoolestSkinTemperature() public CoolestSkinTemperature()
{ {
Name = "Coolest Skin Temperature"; Name = "Coolest Skin Temperature";
Category = ReadoutCategory.GetCategory("Thermal"); Category = ReadoutCategory.GetCategory("Thermal");
HelpString = string.Empty; HelpString = "Lowest external Temperature on the Vessel.";
IsDefault = true; IsDefault = true;
} }
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (ThermalProcessor.ShowDetails) if (ThermalProcessor.ShowDetails)
{ {
DrawLine(Units.ToTemperature(ThermalProcessor.CoolestSkinTemperature, ThermalProcessor.CoolestSkinTemperatureMax), section.IsHud); DrawLine(Units.ToTemperature(ThermalProcessor.CoolestSkinTemperature, ThermalProcessor.CoolestSkinTemperatureMax), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
ThermalProcessor.RequestUpdate(); ThermalProcessor.RequestUpdate();
} }
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2015 CYBUTEK // Copyright (C) 2015 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
namespace KerbalEngineer.Flight.Readouts.Thermal namespace KerbalEngineer.Flight.Readouts.Thermal
{ {
using Helpers; using Helpers;
using Sections; using Sections;
   
public class CoolestTemperature : ReadoutModule public class CoolestTemperature : ReadoutModule
{ {
public CoolestTemperature() public CoolestTemperature()
{ {
Name = "Coolest Temperature"; Name = "Coolest Temperature";
Category = ReadoutCategory.GetCategory("Thermal"); Category = ReadoutCategory.GetCategory("Thermal");
HelpString = string.Empty; HelpString = "Lowest internal Temperature on the Vessel.";
IsDefault = true; IsDefault = true;
} }
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (ThermalProcessor.ShowDetails) if (ThermalProcessor.ShowDetails)
{ {
DrawLine(Units.ToTemperature(ThermalProcessor.CoolestTemperature, ThermalProcessor.CoolestTemperatureMax), section.IsHud); DrawLine(Units.ToTemperature(ThermalProcessor.CoolestTemperature, ThermalProcessor.CoolestTemperatureMax), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
ThermalProcessor.RequestUpdate(); ThermalProcessor.RequestUpdate();
} }
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2015 CYBUTEK // Copyright (C) 2015 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
namespace KerbalEngineer.Flight.Readouts.Thermal namespace KerbalEngineer.Flight.Readouts.Thermal
{ {
using Sections; using Sections;
   
public class CriticalPart : ReadoutModule public class CriticalPart : ReadoutModule
{ {
public CriticalPart() public CriticalPart()
{ {
Name = "Critical Part"; Name = "Critical Part";
Category = ReadoutCategory.GetCategory("Thermal"); Category = ReadoutCategory.GetCategory("Thermal");
HelpString = string.Empty; HelpString = "This part is structually most critical. If it endures too high temperature there is a high chance for major structual failure!";
IsDefault = true; IsDefault = true;
} }
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (ThermalProcessor.ShowDetails) if (ThermalProcessor.ShowDetails)
{ {
DrawLine(ThermalProcessor.CriticalPartName, section.IsHud); DrawLine(ThermalProcessor.CriticalPartName, section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
ThermalProcessor.RequestUpdate(); ThermalProcessor.RequestUpdate();
} }
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2015 CYBUTEK // Copyright (C) 2015 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
namespace KerbalEngineer.Flight.Readouts.Thermal namespace KerbalEngineer.Flight.Readouts.Thermal
{ {
using Helpers; using Helpers;
using Sections; using Sections;
   
public class CriticalSkinTemperature : ReadoutModule public class CriticalSkinTemperature : ReadoutModule
{ {
public CriticalSkinTemperature() public CriticalSkinTemperature()
{ {
Name = "Critical Skin Temperature"; Name = "Critical Skin Temperature";
Category = ReadoutCategory.GetCategory("Thermal"); Category = ReadoutCategory.GetCategory("Thermal");
HelpString = string.Empty; HelpString = "Highest external Temperature on the part of the Vessel that is structually most critical.";
IsDefault = true; IsDefault = true;
} }
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (ThermalProcessor.ShowDetails) if (ThermalProcessor.ShowDetails)
{ {
DrawLine(Units.ToTemperature(ThermalProcessor.CriticalSkinTemperature, ThermalProcessor.CriticalSkinTemperatureMax), section.IsHud); DrawLine(Units.ToTemperature(ThermalProcessor.CriticalSkinTemperature, ThermalProcessor.CriticalSkinTemperatureMax), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
ThermalProcessor.RequestUpdate(); ThermalProcessor.RequestUpdate();
} }
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2015 CYBUTEK // Copyright (C) 2015 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
namespace KerbalEngineer.Flight.Readouts.Thermal namespace KerbalEngineer.Flight.Readouts.Thermal
{ {
using Helpers; using Helpers;
using Sections; using Sections;
   
public class CriticalTemperature : ReadoutModule public class CriticalTemperature : ReadoutModule
{ {
public CriticalTemperature() public CriticalTemperature()
{ {
Name = "Critical Temperature"; Name = "Critical Temperature";
Category = ReadoutCategory.GetCategory("Thermal"); Category = ReadoutCategory.GetCategory("Thermal");
HelpString = string.Empty; HelpString = "Internal Temperature on the part of the Vessel that is structually most critical.";
IsDefault = true; IsDefault = true;
} }
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (ThermalProcessor.ShowDetails) if (ThermalProcessor.ShowDetails)
{ {
DrawLine(Units.ToTemperature(ThermalProcessor.CriticalTemperature, ThermalProcessor.CriticalTemperatureMax), section.IsHud); DrawLine(Units.ToTemperature(ThermalProcessor.CriticalTemperature, ThermalProcessor.CriticalTemperatureMax), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
ThermalProcessor.RequestUpdate(); ThermalProcessor.RequestUpdate();
} }
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2015 CYBUTEK // Copyright (C) 2015 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
namespace KerbalEngineer.Flight.Readouts.Thermal namespace KerbalEngineer.Flight.Readouts.Thermal
{ {
using Extensions; using Extensions;
using Sections; using Sections;
   
public class CriticalThermalPercentage : ReadoutModule public class CriticalThermalPercentage : ReadoutModule
{ {
public CriticalThermalPercentage() public CriticalThermalPercentage()
{ {
Name = "Critical Thermal Percentage"; Name = "Critical Thermal Percentage";
Category = ReadoutCategory.GetCategory("Thermal"); Category = ReadoutCategory.GetCategory("Thermal");
HelpString = string.Empty; HelpString = "Shows how high a temperature the critical Part is enduring relative to it's maximal temperature.";
IsDefault = true; IsDefault = true;
} }
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (ThermalProcessor.ShowDetails) if (ThermalProcessor.ShowDetails)
{ {
DrawLine(ThermalProcessor.CriticalTemperaturePercentage.ToPercent(), section.IsHud); DrawLine(ThermalProcessor.CriticalTemperaturePercentage.ToPercent(), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
ThermalProcessor.RequestUpdate(); ThermalProcessor.RequestUpdate();
} }
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2015 CYBUTEK // Copyright (C) 2015 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
namespace KerbalEngineer.Flight.Readouts.Thermal namespace KerbalEngineer.Flight.Readouts.Thermal
{ {
using Sections; using Sections;
   
public class HottestPart : ReadoutModule public class HottestPart : ReadoutModule
{ {
public HottestPart() public HottestPart()
{ {
Name = "Hottest Part"; Name = "Hottest Part";
Category = ReadoutCategory.GetCategory("Thermal"); Category = ReadoutCategory.GetCategory("Thermal");
HelpString = string.Empty; HelpString = "The part of the vessel that is enduring the highest temperature.";
IsDefault = true; IsDefault = true;
} }
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (ThermalProcessor.ShowDetails) if (ThermalProcessor.ShowDetails)
{ {
DrawLine(ThermalProcessor.HottestPartName, section.IsHud); DrawLine(ThermalProcessor.HottestPartName, section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
ThermalProcessor.RequestUpdate(); ThermalProcessor.RequestUpdate();
} }
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2015 CYBUTEK // Copyright (C) 2015 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
namespace KerbalEngineer.Flight.Readouts.Thermal namespace KerbalEngineer.Flight.Readouts.Thermal
{ {
using Helpers; using Helpers;
using Sections; using Sections;
   
public class HottestSkinTemperature : ReadoutModule public class HottestSkinTemperature : ReadoutModule
{ {
public HottestSkinTemperature() public HottestSkinTemperature()
{ {
Name = "Hottest Skin Temperature"; Name = "Hottest Skin Temperature";
Category = ReadoutCategory.GetCategory("Thermal"); Category = ReadoutCategory.GetCategory("Thermal");
HelpString = string.Empty; HelpString = "Highest external Temperature on the Vessel.";
IsDefault = true; IsDefault = true;
} }
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (ThermalProcessor.ShowDetails) if (ThermalProcessor.ShowDetails)
{ {
DrawLine(Units.ToTemperature(ThermalProcessor.HottestSkinTemperature, ThermalProcessor.HottestSkinTemperatureMax), section.IsHud); DrawLine(Units.ToTemperature(ThermalProcessor.HottestSkinTemperature, ThermalProcessor.HottestSkinTemperatureMax), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
ThermalProcessor.RequestUpdate(); ThermalProcessor.RequestUpdate();
} }
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2015 CYBUTEK // Copyright (C) 2015 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
namespace KerbalEngineer.Flight.Readouts.Thermal namespace KerbalEngineer.Flight.Readouts.Thermal
{ {
using Helpers; using Helpers;
using Sections; using Sections;
   
public class HottestTemperature : ReadoutModule public class HottestTemperature : ReadoutModule
{ {
public HottestTemperature() public HottestTemperature()
{ {
Name = "Hottest Temperature"; Name = "Hottest Temperature";
Category = ReadoutCategory.GetCategory("Thermal"); Category = ReadoutCategory.GetCategory("Thermal");
HelpString = string.Empty; HelpString = "Highest internal Temperature on the Vessel.";
IsDefault = true; IsDefault = true;
} }
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (ThermalProcessor.ShowDetails) if (ThermalProcessor.ShowDetails)
{ {
DrawLine(Units.ToTemperature(ThermalProcessor.HottestTemperature, ThermalProcessor.HottestTemperatureMax), section.IsHud); DrawLine(Units.ToTemperature(ThermalProcessor.HottestTemperature, ThermalProcessor.HottestTemperatureMax), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(ThermalProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
ThermalProcessor.RequestUpdate(); ThermalProcessor.RequestUpdate();
} }
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
#region Using Directives #region Using Directives
   
using KerbalEngineer.Flight.Sections; using KerbalEngineer.Flight.Sections;
using KerbalEngineer.Helpers; using KerbalEngineer.Helpers;
   
#endregion #endregion
   
namespace KerbalEngineer.Flight.Readouts.Vessel namespace KerbalEngineer.Flight.Readouts.Vessel
{ {
public class Acceleration : ReadoutModule public class Acceleration : ReadoutModule
{ {
#region Constructors #region Constructors
   
public Acceleration() public Acceleration()
{ {
this.Name = "Acceleration"; this.Name = "Acceleration";
this.Category = ReadoutCategory.GetCategory("Vessel"); this.Category = ReadoutCategory.GetCategory("Vessel");
this.HelpString = string.Empty; this.HelpString = "Shows the current and maximum acceleration of the craft.";
this.IsDefault = true; this.IsDefault = true;
} }
   
#endregion #endregion
   
#region Methods: public #region Methods: public
   
public override void Draw(SectionModule section) public override void Draw(SectionModule section)
{ {
if (SimulationProcessor.ShowDetails) if (SimulationProcessor.ShowDetails)
{ {
this.DrawLine(Units.ToAcceleration(SimulationProcessor.LastStage.actualThrust / SimulationProcessor.LastStage.totalMass, SimulationProcessor.LastStage.thrust / SimulationProcessor.LastStage.totalMass), section.IsHud); this.DrawLine(Units.ToAcceleration(SimulationProcessor.LastStage.actualThrust / SimulationProcessor.LastStage.totalMass, SimulationProcessor.LastStage.thrust / SimulationProcessor.LastStage.totalMass), section.IsHud);
} }
} }
   
public override void Reset() public override void Reset()
{ {
FlightEngineerCore.Instance.AddUpdatable(SimulationProcessor.Instance); FlightEngineerCore.Instance.AddUpdatable(SimulationProcessor.Instance);
} }
   
public override void Update() public override void Update()
{ {
SimulationProcessor.RequestUpdate(); SimulationProcessor.RequestUpdate();
} }
   
#endregion #endregion
} }
} }
// //
// Kerbal Engineer Redux // Kerbal Engineer Redux
// //
// Copyright (C) 2014 CYBUTEK // Copyright (C) 2014 CYBUTEK
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
// //
   
namespace KerbalEngineer.Flight.Readouts.Vessel namespace KerbalEngineer.Flight.Readouts.Vessel
{ {
#region Using Directives #region Using Directives
   
using UnityEngine; using UnityEngine;
   
#endregion #endregion
   
public class AttitudeProcessor : IUpdatable, IUpdateRequest public class AttitudeProcessor : IUpdatable, IUpdateRequest
{ {
#region Fields #region Fields
   
private static readonly AttitudeProcessor instance = new AttitudeProcessor(); private static readonly AttitudeProcessor instance = new AttitudeProcessor();
   
private Vector3 centreOfMass = Vector3.zero; private Vector3 centreOfMass = Vector3.zero;
   
private double heading; private double heading;
private double headingRate; private double headingRate;
private Vector3 north = Vector3.zero; private Vector3 north = Vector3.zero;
private double pitch; private double pitch;
private double pitchRate; private double pitchRate;
private double previousHeading; private double previousHeading;
private double previousPitch; private double previousPitch;
private double previousRoll; private double previousRoll;
private double roll; private double roll;
private double rollRate; private double rollRate;
private Quaternion surfaceRotation; private Quaternion surfaceRotation;
private Vector3 up = Vector3.zero; private Vector3 up = Vector3.zero;
   
#endregion #endregion
   
#region Properties #region Properties
   
public static double Heading public static double Heading
{ {
get { return instance.heading; } get { return instance.heading; }
} }
   
public static double HeadingRate public static double HeadingRate
{ {
get { return instance.headingRate; } get { return instance.headingRate; }
} }
   
public static AttitudeProcessor Instance public static AttitudeProcessor Instance
{ {
get { return instance; } get { return instance; }
} }
   
public static double Pitch public static double Pitch
{ {
get { return instance.pitch; } get { return instance.pitch; }
} }
   
public static double PitchRate public static double PitchRate
{ {
get { return instance.pitchRate; } get { return instance.pitchRate; }
} }
   
public static double Roll public static double Roll
{ {
get { return instance.roll; } get { return instance.roll; }
} }
   
public static double RollRate public static double RollRate
{ {
get { return instance.rollRate; } get { return instance.rollRate; }
} }
   
public bool UpdateRequested { get; set; } public bool UpdateRequested { get; set; }
   
#endregion #endregion
   
#region Methods #region Methods
   
public static void RequestUpdate() public static void RequestUpdate()
{ {
instance.UpdateRequested = true; instance.UpdateRequested = true;
} }
   
public void Update() public void Update()
{ {
this.surfaceRotation = this.GetSurfaceRotation(); this.surfaceRotation = this.GetSurfaceRotation();
   
this.previousHeading = this.heading; this.previousHeading = this.heading;
this.previousPitch = this.pitch; this.previousPitch = this.pitch;
this.previousRoll = this.roll; this.previousRoll = this.roll;
   
// This code was derived from MechJeb2's implementation for getting the vessel's surface relative rotation. // This code was derived from MechJeb2's implementation for getting the vessel's surface relative rotation.
this.heading = this.surfaceRotation.eulerAngles.y; this.heading = this.surfaceRotation.eulerAngles.y;
this.pitch = this.surfaceRotation.eulerAngles.x > 180.0f this.pitch = this.surfaceRotation.eulerAngles.x > 180.0f
? 360.0f - this.surfaceRotation.eulerAngles.x ? 360.0f - this.surfaceRotation.eulerAngles.x
: -this.surfaceRotation.eulerAngles.x; : -this.surfaceRotation.eulerAngles.x;
this.roll = this.surfaceRotation.eulerAngles.z > 180.0f this.roll = this.surfaceRotation.eulerAngles.z > 180.0f
? this.surfaceRotation.eulerAngles.z - 360.0f ? 360.0f - this.surfaceRotation.eulerAngles.z
: this.surfaceRotation.eulerAngles.z; : -this.surfaceRotation.eulerAngles.z;
   
this.headingRate = this.heading - this.previousHeading; this.headingRate = this.heading - this.previousHeading;
this.pitchRate = this.pitch - this.previousPitch; this.pitchRate = this.pitch - this.previousPitch;
this.rollRate = this.roll - this.previousRoll; this.rollRate = this.roll - this.previousRoll;
} }
   
private Quaternion GetSurfaceRotation() private Quaternion GetSurfaceRotation()
{ {
// This code was derived from MechJeb2's implementation for getting the vessel's surface relative rotation. // This code was derived from MechJeb2's implementation for getting the vessel's surface relative rotation.
this.centreOfMass = FlightGlobals.ActiveVessel.findWorldCenterOfMass(); this.centreOfMass = FlightGlobals.ActiveVessel.findWorldCenterOfMass();
this.up = (this.centreOfMass - FlightGlobals.ActiveVessel.mainBody.position).normalized; this.up = (this.centreOfMass - FlightGlobals.ActiveVessel.mainBody.position).normalized;
this.north = Vector3.ProjectOnPlane((FlightGlobals.ActiveVessel.mainBody.position + FlightGlobals.ActiveVessel.mainBody.transform.up * (float)FlightGlobals.ActiveVessel.mainBody.Radius) - this.centreOfMass, this.up).normalized; this.north = Vector3.Proje