Skip to content

Commit 9b30b5c

Browse files
committed
Merge branch 'release/0.3.0'
2 parents 4e573f7 + f6b065a commit 9b30b5c

File tree

11 files changed

+305
-192
lines changed

11 files changed

+305
-192
lines changed

CHANGES.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
## v0.3.0
2+
##### New
3+
- Skin temperature added as a new metric.
4+
5+
##### Changes
6+
- *Incompatible:* Configuration structure for temperature metrics has changed.
7+
- "Temperature" in context menus abbreviated to "Temp."
8+
9+
##### Fixes
10+
- Fix Internal Thermal Rate metric always being 0kW.
11+
112
## v0.2.0
213
##### New
314
- Added thermal rate metrics to both overlays and context menu. These measure the change in thermal energy of a part
@@ -11,11 +22,11 @@
1122
the temperature unit, the overlay metric, and the gradient scheme for the metric. Currently this options are not
1223
persisted between loads.
1324

14-
##### Change
25+
##### Changes
1526
- *Incompatible:* Configuration structure has changed significantly.
1627

1728
## v0.1.1
18-
##### Fix
29+
##### Fixes
1930
- Fix settings being loaded multiple times which would eventually cause the thermal overlays to fail.
2031

2132
## v0.1.0

Configuration/HotSpot.cfg

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ HOT_SPOT
77

88
CONTEXT_MENU
99
{
10+
METRIC
11+
{
12+
name = TemperatureTemplate
13+
enable = true
14+
unit = Kelvin
15+
}
16+
1017
METRIC
1118
{
1219
name = ThermalRateTemplate
@@ -180,11 +187,14 @@ HOT_SPOT
180187
{
181188
@CONTEXT_MENU
182189
{
183-
%METRIC[Temperature]
190+
+METRIC[TemperatureTemplate]
184191
{
185-
@name = Temperature
186-
%enable = true
187-
%unit = Kelvin
192+
@name = TemperatureInternal
193+
}
194+
195+
+METRIC[TemperatureTemplate]
196+
{
197+
@name = TemperatureSkin
188198
}
189199

190200
+METRIC[ThermalRateTemplate]
@@ -215,11 +225,50 @@ HOT_SPOT
215225

216226
@OVERLAY
217227
{
218-
%metric = Temperature
228+
%metric = TemperatureInternal
229+
230+
+METRIC[TemperatureTemplate]
231+
{
232+
@name = TemperatureInternal
233+
%scheme = TemperaturePartAbsolute
234+
235+
+SCHEME[TemperatureTemplate]
236+
{
237+
@name = TemperaturePartAbsolute
238+
%friendlyName = Part Absolute
239+
240+
@GRADIENT
241+
{
242+
%max = PartAbsoluteMaximum
243+
}
244+
}
245+
246+
+SCHEME[TemperatureTemplate]
247+
{
248+
@name = TemperatureVesselCurrent
249+
%friendlyName = Vessel Current
250+
251+
@GRADIENT
252+
{
253+
%max = VesselCurrentMaximum
254+
}
255+
}
256+
257+
+SCHEME[TemperatureTemplate]
258+
{
259+
@name = TemperatureVesselAbsolute
260+
%friendlyName = Vessel Absolute
261+
262+
@GRADIENT
263+
{
264+
%max = VesselAbsoluteMaximum
265+
}
266+
}
267+
}
219268

220269
+METRIC[TemperatureTemplate]
221270
{
222-
@name = Temperature
271+
@name = TemperatureSkin
223272
%scheme = TemperaturePartAbsolute
224273

225274
+SCHEME[TemperatureTemplate]

HotSpot.sln.DotSettings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=Html_002EPathError/@EntryIndexedValue">DO_NOT_SHOW</s:String>
66
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MemberCanBePrivate_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
77
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MemberCanBePrivate_002ELocal/@EntryIndexedValue">HINT</s:String>
8+
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=NotAccessedField_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
89
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedAutoPropertyAccessor_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
910
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedMember_002EGlobal/@EntryIndexedValue">DO_NOT_SHOW</s:String>
1011
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/BUILTIN_TYPE_REFERENCE_STYLE/@EntryValue">UseKeyword</s:String>

README.md

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
# Hot Spot [![Build status][build-badge]][build]
22

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

66
- Temperature
77
- Thermal Rate
88

9+
Hot Spot and display two kinds of temperatures:
10+
11+
- *Internal Temperature* - The temperature of the interior of a part.
12+
- *Skin Temperature* - The temperature of the exposed surface of a part.
13+
914
Thermal rate is the rate at which thermal energy is added or removed from a part. It is measured as energy per unit
1015
time, i.e. [*power*][wiki-power]. Positive thermal rates indicate a part is gaining thermal energy, negative thermal
1116
rates indicate a part is losing thermal energy. There are multiple kinds of thermal rates:
1217

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

53+
#### Thermal Rate
54+
The color gradient used for thermal rates is as follows:
55+
56+
- Purple (*Vessel Current Minimum*, if negative)
57+
- Blue (0.1×*Vessel Current Minimum*, if negative)
58+
- Transparent (0)
59+
- Yellow (0.1×*Vessel Current Maxmimum*, if positive)
60+
- Orange (0.5×*Vessel Current Maxmimum*, if positive)
61+
- Red (*Vessel Current Maxmimum*, if positive)
62+
4863
## Installation
49-
To install, extract the contents of the archive to your KSP directory. This should create an `HotSpot` directory under
50-
the `<KSP>/GameData` directory. All dependencies should also be installed.
64+
### CKAN
65+
Hot Spot's CKAN identifier is `HotSpot`. It may be installed from the command line with:
66+
67+
```
68+
> ckan install HotSpot
69+
```
70+
71+
It can also be installed from the GUI.
72+
73+
### Manual
74+
1. Download the distribution package from [Kerbal Stuff][kerbalstuff] or [GitHub][github-releases].
75+
2. Extract the contents of the archive to your KSP directory. This should create an `HotSpot` directory under
76+
the `<KSP>/GameData` directory.
77+
3. Follow the installation instructions for all dependencies.
5178

52-
Dependencies:
79+
#### Dependencies
5380
- [Module Manager][module-manager]
5481

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

6592
[build]: https://ci.appveyor.com/project/Apokee/hotspot/branch/develop
6693
[build-badge]: https://ci.appveyor.com/api/projects/status/ik9la5jusinnpu5n/branch/develop?svg=true
94+
[github-releases]: https://github.com/Apokee/HotSpot/releases
95+
[kerbalstuff]: https://kerbalstuff.com/mod/937/Hot%20Spot
6796
[module-manager]: http://forum.kerbalspaceprogram.com/threads/55219
6897
[wiki-celsius]: https://en.wikipedia.org/wiki/Celsius
6998
[wiki-fahrenheit]: https://en.wikipedia.org/wiki/Fahrenheit

Source/HotSpot/Configuration/OverlayNode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public MetricNode GetActiveMetric()
3131

3232
public static OverlayNode GetDefault()
3333
{
34-
return new OverlayNode(false, true, Metric.Temperature, new MetricNode[] { });
34+
return new OverlayNode(false, true, Metric.TemperatureInternal, new MetricNode[] { });
3535
}
3636

3737
public static OverlayNode TryParse(ConfigNode node)

Source/HotSpot/Extensions/PartExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ internal static class PartExtensions
44
{
55
public static double GetThermalFlux(this Part part)
66
{
7-
return part.thermalInternalFlux
7+
return part.thermalInternalFluxPrevious
88
+ part.thermalConductionFlux
99
+ part.thermalConvectionFlux
1010
+ part.thermalRadiationFlux

Source/HotSpot/HotSpotGuiBehavior.cs

Lines changed: 25 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.Linq;
34
using HotSpot.Model;
45
using HotSpot.Reflection;
@@ -20,7 +21,7 @@ public sealed class HotSpotGuiBehavior : MonoBehaviour
2021
private bool _showConfigWindow;
2122
private Rect _configWindowRect;
2223
private ConfigWindowTab _configWindowTabActive = ConfigWindowTab.Context;
23-
private bool _configWindowContextShowTemperatureUnit;
24+
private readonly Dictionary<string, bool> _configWindowContextShowUnits = new Dictionary<string, bool>();
2425
private bool _configWindowOverlayShowMetrics;
2526
private bool _configWindowOverlayShowSchemes;
2627

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

34+
foreach (var metricNode in Config.Instance.ContextMenu.Metrics)
35+
{
36+
_configWindowContextShowUnits[metricNode.Name.Name] = false;
37+
}
38+
3339
var buttonTexture = GameDatabase
3440
.Instance
3541
.GetTexture(Config.Instance.Gui.ButtonTexture, asNormalMap: false);
@@ -117,7 +123,7 @@ private void LateUpdateScreenMessage()
117123
{
118124
var scheme = Config.Instance.Overlay.GetActiveMetric().GetActiveScheme();
119125

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

@@ -194,60 +200,40 @@ private void OnContextTab()
194200
{
195201
GUILayout.BeginHorizontal();
196202

197-
metricNode.Enable = GUILayout.Toggle(metricNode.Enable, metricNode.Name.FriendlyName);
203+
metricNode.Enable = GUILayout.Toggle(metricNode.Enable, metricNode.Name.LongFriendlyName);
198204

199-
var isTemperatureMetric = metricNode.Name.Name == "Temperature";
200-
201-
if (isTemperatureMetric)
205+
if (metricNode.Name.Units.Length > 1)
202206
{
203207
GUILayout.FlexibleSpace();
204208

205209
if (GUILayout.Button("Unit"))
206210
{
207-
_configWindowContextShowTemperatureUnit = !_configWindowContextShowTemperatureUnit;
211+
_configWindowContextShowUnits[metricNode.Name.Name] =
212+
!_configWindowContextShowUnits[metricNode.Name.Name];
208213
}
209214
}
210215

211216
GUILayout.EndHorizontal();
212217

213-
if (_configWindowContextShowTemperatureUnit && isTemperatureMetric)
218+
if (_configWindowContextShowUnits[metricNode.Name.Name])
214219
{
215-
var temperatureMetricNode = Config
216-
.Instance
217-
.ContextMenu
218-
.Metrics
219-
.SingleOrDefault(i => i.Name.Name == "Temperature");
220+
GUILayout.BeginVertical();
220221

221-
if (temperatureMetricNode != null)
222+
var unitIndex = 0;
223+
for (var i = 0; i < metricNode.Name.Units.Length; i++)
222224
{
223-
GUILayout.BeginVertical();
224-
var units = new[] { Unit.Kelvin, Unit.Rankine, Unit.Celsius, Unit.Fahrenheit };
225-
226-
int unitIndex;
227-
switch (temperatureMetricNode.Unit)
225+
if (metricNode.Name.Units[i] == metricNode.Unit)
228226
{
229-
case Unit.Kelvin:
230-
unitIndex = 0;
231-
break;
232-
case Unit.Rankine:
233-
unitIndex = 1;
234-
break;
235-
case Unit.Celsius:
236-
unitIndex = 2;
237-
break;
238-
case Unit.Fahrenheit:
239-
unitIndex = 3;
240-
break;
241-
default:
242-
throw new ArgumentOutOfRangeException();
227+
unitIndex = i;
228+
break;
243229
}
230+
}
244231

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

247-
temperatureMetricNode.Unit = units[newUnitIndex];
234+
metricNode.Unit = metricNode.Name.Units[newUnitIndex];
248235

249-
GUILayout.EndVertical();
250-
}
236+
GUILayout.EndVertical();
251237
}
252238
}
253239
GUILayout.EndVertical();
@@ -261,7 +247,7 @@ private void OnOverlayTab()
261247

262248
GUILayout.Label("Metric:",
263249
new GUIStyle(GUI.skin.label) { fontStyle = FontStyle.Bold }, GUILayout.Width(55));
264-
GUILayout.Label(Config.Instance.Overlay.Metric.FriendlyName);
250+
GUILayout.Label(Config.Instance.Overlay.Metric.LongFriendlyName);
265251
GUILayout.FlexibleSpace();
266252
if (GUILayout.Button("Select", GUILayout.Width(50)))
267253
{
@@ -285,7 +271,7 @@ private void OnOverlayTab()
285271
}
286272

287273
var newMetricIndex = GUILayout.SelectionGrid(
288-
metricIndex, metrics.Select(i => i.Name.FriendlyName).ToArray(), 1
274+
metricIndex, metrics.Select(i => i.Name.LongFriendlyName).ToArray(), 1
289275
);
290276

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

0 commit comments

Comments
 (0)