Skip to content

Commit

Permalink
Merge pull request #125 from M1rageDev/master
Browse files Browse the repository at this point in the history
Update JSINumericInput.cs
  • Loading branch information
JonnyOThan authored Aug 5, 2024
2 parents 9d3807a + 20da3f9 commit 11a01f1
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions RasterPropMonitor/Auxiliary modules/JSINumericInput.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*****************************************************************************
/*****************************************************************************
* RasterPropMonitor
* =================
* Plugin for Kerbal Space Program
Expand Down Expand Up @@ -234,7 +234,7 @@ private class NumericInput
private float delta = 0.0f;
private double pressStart = 0.0;
private double lastUpdate = 0.0;
private readonly float increment = 0.0f;
private readonly VariableOrNumber increment = null;
private readonly FloatCurve incrementCurve = null;
private bool pressed = false;
private readonly bool pressAndHold = false;
Expand All @@ -258,11 +258,10 @@ internal NumericInput(ConfigNode node, InternalProp internalProp)
throw new Exception("USERINPUTSET missing increment or incrementCurve, or it has both");
}

if (node.HasValue("increment") && !float.TryParse(node.GetValue("increment"), out increment))
{
throw new Exception("USERINPUTSET bad increment");
}
else if (node.HasNode("incrementCurve"))
RasterPropMonitorComputer rpmComp = RasterPropMonitorComputer.FindFromProp(internalProp);
increment = rpmComp.InstantiateVariableOrNumber(node.GetValue("increment"));

if (node.HasNode("incrementCurve"))
{
ConfigNode incNode = node.GetNode("incrementCurve");
string[] keys = incNode.GetValues("key");
Expand Down Expand Up @@ -401,7 +400,7 @@ internal float Update(double currentTime)

private void Click()
{
delta += increment;
delta += increment.AsFloat();
pressed = true;
}

Expand Down

0 comments on commit 11a01f1

Please sign in to comment.