Skip to content

Commit

Permalink
Merge branch 'release/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
dbent committed Jun 24, 2015
2 parents 4e573f7 + f6b065a commit 9b30b5c
Show file tree
Hide file tree
Showing 11 changed files with 305 additions and 192 deletions.
15 changes: 13 additions & 2 deletions CHANGES.md
@@ -1,3 +1,14 @@
## v0.3.0
##### New
- Skin temperature added as a new metric.

##### Changes
- *Incompatible:* Configuration structure for temperature metrics has changed.
- "Temperature" in context menus abbreviated to "Temp."

##### Fixes
- Fix Internal Thermal Rate metric always being 0kW.

## v0.2.0
##### New
- Added thermal rate metrics to both overlays and context menu. These measure the change in thermal energy of a part
Expand All @@ -11,11 +22,11 @@
the temperature unit, the overlay metric, and the gradient scheme for the metric. Currently this options are not
persisted between loads.

##### Change
##### Changes
- *Incompatible:* Configuration structure has changed significantly.

## v0.1.1
##### Fix
##### Fixes
- Fix settings being loaded multiple times which would eventually cause the thermal overlays to fail.

## v0.1.0
Expand Down
61 changes: 55 additions & 6 deletions Configuration/HotSpot.cfg
Expand Up @@ -7,6 +7,13 @@ HOT_SPOT

CONTEXT_MENU
{
METRIC
{
name = TemperatureTemplate
enable = true
unit = Kelvin
}

METRIC
{
name = ThermalRateTemplate
Expand Down Expand Up @@ -180,11 +187,14 @@ HOT_SPOT
{
@CONTEXT_MENU
{
%METRIC[Temperature]
+METRIC[TemperatureTemplate]
{
@name = Temperature
%enable = true
%unit = Kelvin
@name = TemperatureInternal
}

+METRIC[TemperatureTemplate]
{
@name = TemperatureSkin
}

+METRIC[ThermalRateTemplate]
Expand Down Expand Up @@ -215,11 +225,50 @@ HOT_SPOT

@OVERLAY
{
%metric = Temperature
%metric = TemperatureInternal

+METRIC[TemperatureTemplate]
{
@name = TemperatureInternal
%scheme = TemperaturePartAbsolute

+SCHEME[TemperatureTemplate]
{
@name = TemperaturePartAbsolute
%friendlyName = Part Absolute

@GRADIENT
{
%max = PartAbsoluteMaximum
}
}

+SCHEME[TemperatureTemplate]
{
@name = TemperatureVesselCurrent
%friendlyName = Vessel Current

@GRADIENT
{
%max = VesselCurrentMaximum
}
}

+SCHEME[TemperatureTemplate]
{
@name = TemperatureVesselAbsolute
%friendlyName = Vessel Absolute

@GRADIENT
{
%max = VesselAbsoluteMaximum
}
}
}

+METRIC[TemperatureTemplate]
{
@name = Temperature
@name = TemperatureSkin
%scheme = TemperaturePartAbsolute

+SCHEME[TemperatureTemplate]
Expand Down
1 change: 1 addition & 0 deletions HotSpot.sln.DotSettings
Expand Up @@ -5,6 +5,7 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=Html_002EPathError/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MemberCanBePrivate_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MemberCanBePrivate_002ELocal/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=NotAccessedField_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedAutoPropertyAccessor_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedMember_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BUILTIN_TYPE_REFERENCE_STYLE/@EntryValue">UseKeyword</s:String>
Expand Down
41 changes: 35 additions & 6 deletions README.md
@@ -1,17 +1,22 @@
# Hot Spot [![Build status][build-badge]][build]

**Hot Spot** is a [MIT-licensed](LICENSE.md) Kerbal Space Program mod that displays better thermal metric data to the
user. It currently supports the following metrics:
**Hot Spot** is a [MIT-licensed](LICENSE.md) Kerbal Space Program mod that displays better thermal data. It currently
supports the following metrics:

- Temperature
- Thermal Rate

Hot Spot and display two kinds of temperatures:

- *Internal Temperature* - The temperature of the interior of a part.
- *Skin Temperature* - The temperature of the exposed surface of a part.

Thermal rate is the rate at which thermal energy is added or removed from a part. It is measured as energy per unit
time, i.e. [*power*][wiki-power]. Positive thermal rates indicate a part is gaining thermal energy, negative thermal
rates indicate a part is losing thermal energy. There are multiple kinds of thermal rates:

- *Internal Thermal Rate* - The change in thermal energy due to reactions/processes occuring within the part itself.
- *Conductive Thremal Rate* - The change in thermal energy due to being in contact with other parts.
- *Conductive Thermal Rate* - The change in thermal energy due to being in contact with other parts.
- *Convective Thermal Rate* - The change in thermal energy due to being in contact with a fluid, like the atmosphere.
- *Radiative Thermal Rate* - The change in thermal energy due to the emission or absorption of light.
- *Thermal Rate* - An aggregate value of the four previous rates.
Expand Down Expand Up @@ -45,11 +50,33 @@ The *Maximum* value depends on the scheme used:
- *Vessel Current* - The maximum current temperature of any part in the vessel.
- *Vessel Absolute* - The maximum temperature of any part in the vessel.

#### Thermal Rate
The color gradient used for thermal rates is as follows:

- Purple (*Vessel Current Minimum*, if negative)
- Blue (0.1×*Vessel Current Minimum*, if negative)
- Transparent (0)
- Yellow (0.1×*Vessel Current Maxmimum*, if positive)
- Orange (0.5×*Vessel Current Maxmimum*, if positive)
- Red (*Vessel Current Maxmimum*, if positive)

## Installation
To install, extract the contents of the archive to your KSP directory. This should create an `HotSpot` directory under
the `<KSP>/GameData` directory. All dependencies should also be installed.
### CKAN
Hot Spot's CKAN identifier is `HotSpot`. It may be installed from the command line with:

```
> ckan install HotSpot
```

It can also be installed from the GUI.

### Manual
1. Download the distribution package from [Kerbal Stuff][kerbalstuff] or [GitHub][github-releases].
2. Extract the contents of the archive to your KSP directory. This should create an `HotSpot` directory under
the `<KSP>/GameData` directory.
3. Follow the installation instructions for all dependencies.

Dependencies:
#### Dependencies
- [Module Manager][module-manager]

## Usage
Expand All @@ -64,6 +91,8 @@ please see the Module Manager documentation for more information.

[build]: https://ci.appveyor.com/project/Apokee/hotspot/branch/develop
[build-badge]: https://ci.appveyor.com/api/projects/status/ik9la5jusinnpu5n/branch/develop?svg=true
[github-releases]: https://github.com/Apokee/HotSpot/releases
[kerbalstuff]: https://kerbalstuff.com/mod/937/Hot%20Spot
[module-manager]: http://forum.kerbalspaceprogram.com/threads/55219
[wiki-celsius]: https://en.wikipedia.org/wiki/Celsius
[wiki-fahrenheit]: https://en.wikipedia.org/wiki/Fahrenheit
Expand Down
2 changes: 1 addition & 1 deletion Source/HotSpot/Configuration/OverlayNode.cs
Expand Up @@ -31,7 +31,7 @@ public MetricNode GetActiveMetric()

public static OverlayNode GetDefault()
{
return new OverlayNode(false, true, Metric.Temperature, new MetricNode[] { });
return new OverlayNode(false, true, Metric.TemperatureInternal, new MetricNode[] { });
}

public static OverlayNode TryParse(ConfigNode node)
Expand Down
2 changes: 1 addition & 1 deletion Source/HotSpot/Extensions/PartExtensions.cs
Expand Up @@ -4,7 +4,7 @@ internal static class PartExtensions
{
public static double GetThermalFlux(this Part part)
{
return part.thermalInternalFlux
return part.thermalInternalFluxPrevious
+ part.thermalConductionFlux
+ part.thermalConvectionFlux
+ part.thermalRadiationFlux
Expand Down
64 changes: 25 additions & 39 deletions Source/HotSpot/HotSpotGuiBehavior.cs
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using HotSpot.Model;
using HotSpot.Reflection;
Expand All @@ -20,7 +21,7 @@ public sealed class HotSpotGuiBehavior : MonoBehaviour
private bool _showConfigWindow;
private Rect _configWindowRect;
private ConfigWindowTab _configWindowTabActive = ConfigWindowTab.Context;
private bool _configWindowContextShowTemperatureUnit;
private readonly Dictionary<string, bool> _configWindowContextShowUnits = new Dictionary<string, bool>();
private bool _configWindowOverlayShowMetrics;
private bool _configWindowOverlayShowSchemes;

Expand All @@ -30,6 +31,11 @@ public void Start()
{
Log.Trace("Entering HotSpotGuiBehavior.Start()");

foreach (var metricNode in Config.Instance.ContextMenu.Metrics)
{
_configWindowContextShowUnits[metricNode.Name.Name] = false;
}

var buttonTexture = GameDatabase
.Instance
.GetTexture(Config.Instance.Gui.ButtonTexture, asNormalMap: false);
Expand Down Expand Up @@ -117,7 +123,7 @@ private void LateUpdateScreenMessage()
{
var scheme = Config.Instance.Overlay.GetActiveMetric().GetActiveScheme();

var metricMsg = Config.Instance.Overlay.Metric.FriendlyName;
var metricMsg = Config.Instance.Overlay.Metric.LongFriendlyName;
var schemMsg = scheme.FriendlyName == null ? string.Empty : $" ({scheme.FriendlyName})";
var stateMsg = PhysicsGlobals.ThermalColorsDebug ? "Enabled" : "Disabled";

Expand Down Expand Up @@ -194,60 +200,40 @@ private void OnContextTab()
{
GUILayout.BeginHorizontal();

metricNode.Enable = GUILayout.Toggle(metricNode.Enable, metricNode.Name.FriendlyName);
metricNode.Enable = GUILayout.Toggle(metricNode.Enable, metricNode.Name.LongFriendlyName);

var isTemperatureMetric = metricNode.Name.Name == "Temperature";

if (isTemperatureMetric)
if (metricNode.Name.Units.Length > 1)
{
GUILayout.FlexibleSpace();

if (GUILayout.Button("Unit"))
{
_configWindowContextShowTemperatureUnit = !_configWindowContextShowTemperatureUnit;
_configWindowContextShowUnits[metricNode.Name.Name] =
!_configWindowContextShowUnits[metricNode.Name.Name];
}
}

GUILayout.EndHorizontal();

if (_configWindowContextShowTemperatureUnit && isTemperatureMetric)
if (_configWindowContextShowUnits[metricNode.Name.Name])
{
var temperatureMetricNode = Config
.Instance
.ContextMenu
.Metrics
.SingleOrDefault(i => i.Name.Name == "Temperature");
GUILayout.BeginVertical();

if (temperatureMetricNode != null)
var unitIndex = 0;
for (var i = 0; i < metricNode.Name.Units.Length; i++)
{
GUILayout.BeginVertical();
var units = new[] { Unit.Kelvin, Unit.Rankine, Unit.Celsius, Unit.Fahrenheit };

int unitIndex;
switch (temperatureMetricNode.Unit)
if (metricNode.Name.Units[i] == metricNode.Unit)
{
case Unit.Kelvin:
unitIndex = 0;
break;
case Unit.Rankine:
unitIndex = 1;
break;
case Unit.Celsius:
unitIndex = 2;
break;
case Unit.Fahrenheit:
unitIndex = 3;
break;
default:
throw new ArgumentOutOfRangeException();
unitIndex = i;
break;
}
}

var newUnitIndex = GUILayout.SelectionGrid(unitIndex, units.Select(i => i.ToString()).ToArray(), 2);
var newUnitIndex = GUILayout.SelectionGrid(unitIndex, metricNode.Name.Units.Select(i => i.ToString()).ToArray(), 2);

temperatureMetricNode.Unit = units[newUnitIndex];
metricNode.Unit = metricNode.Name.Units[newUnitIndex];

GUILayout.EndVertical();
}
GUILayout.EndVertical();
}
}
GUILayout.EndVertical();
Expand All @@ -261,7 +247,7 @@ private void OnOverlayTab()

GUILayout.Label("Metric:",
new GUIStyle(GUI.skin.label) { fontStyle = FontStyle.Bold }, GUILayout.Width(55));
GUILayout.Label(Config.Instance.Overlay.Metric.FriendlyName);
GUILayout.Label(Config.Instance.Overlay.Metric.LongFriendlyName);
GUILayout.FlexibleSpace();
if (GUILayout.Button("Select", GUILayout.Width(50)))
{
Expand All @@ -285,7 +271,7 @@ private void OnOverlayTab()
}

var newMetricIndex = GUILayout.SelectionGrid(
metricIndex, metrics.Select(i => i.Name.FriendlyName).ToArray(), 1
metricIndex, metrics.Select(i => i.Name.LongFriendlyName).ToArray(), 1
);

Config.Instance.Overlay.Metric = metrics[newMetricIndex].Name;
Expand Down

0 comments on commit 9b30b5c

Please sign in to comment.