diff --git a/Scale.cs b/Scale.cs
index 3bb820de..5785de6b 100644
--- a/Scale.cs
+++ b/Scale.cs
@@ -70,6 +70,11 @@ public class TweakScale : PartModule, IPartCostModifier
/// The scale exponentValue array. If isFreeScale is false, the part may only be one of these scales.
///
protected float[] scaleFactors = { 0.625f, 1.25f, 2.5f, 3.75f, 5f };
+
+ ///
+ /// The node scale array. If node scales are defined the nodes will be resized to these values.
+ ///
+ protected int[] scaleNodes = { };
///
/// The unmodified prefab part. From this, default values are found.
@@ -215,6 +220,7 @@ private void SetupFromConfig(ScaleConfig config)
if (scaleFactors.Length > 0)
{
scaleFactors = config.scaleFactors;
+ scaleNodes = config.scaleNodes;
options.options = config.scaleNames;
}
}
@@ -316,8 +322,15 @@ private void rescaleNode(AttachNode node, AttachNode baseNode)
}
else
{
- var options = (UI_ChooseOption)this.Fields["tweakName"].uiControlEditor;
- node.size = (int)(baseNode.size + (tweakName - Tools.ClosestIndex(defaultScale, config.allScaleFactors)) / (float)config.allScaleFactors.Length * 5);
+ var options = (UI_ChooseOption)this.Fields["tweakName"].uiControlEditor;
+ if (scaleNodes.Length > 0)
+ {
+ node.size = (int)(baseNode.size + (1 * scaleNodes[tweakName]));
+ }
+ else
+ {
+ node.size = (int)(baseNode.size + (tweakName - Tools.ClosestIndex(defaultScale, config.allScaleFactors)) / (float)config.allScaleFactors.Length * 5);
+ }
}
if (node.size < 0)
{
diff --git a/ScaleConfig.cs b/ScaleConfig.cs
index bf350cbb..3459cd1f 100644
--- a/ScaleConfig.cs
+++ b/ScaleConfig.cs
@@ -83,6 +83,7 @@ public static ScaleConfig[] AllConfigs
private static ScaleConfig defaultConfig = new ScaleConfig();
private float[] _scaleFactors = { 0.625f, 1.25f, 2.5f, 3.75f, 5f };
+ private int[] _scaleNodes = { };
private string[] _scaleNames = { "62.5cm", "1.25m", "2.5m", "3.75m", "5m" };
public Dictionary exponents = new Dictionary();
@@ -119,6 +120,14 @@ public string[] scaleNames
return result;
}
}
+
+ public int[] scaleNodes
+ {
+ get
+ {
+ return _scaleNodes;
+ }
+ }
private ScaleConfig()
{
@@ -139,6 +148,7 @@ public ScaleConfig(ConfigNode config)
maxValue = Tools.ConfigValue(config, "maxScale", defaultValue: source.maxValue);
suffix = Tools.ConfigValue(config, "suffix", defaultValue: source.suffix);
_scaleFactors = Tools.ConfigValue(config, "scaleFactors", defaultValue: source._scaleFactors);
+ _scaleNodes = Tools.ConfigValue(config, "scaleNodes", defaultValue: source._scaleNodes);
_scaleNames = Tools.ConfigValue(config, "scaleNames", defaultValue: source._scaleNames).Select(a => a.Trim()).ToArray();
techRequired = Tools.ConfigValue(config, "techRequired", defaultValue: source.techRequired).Select(a=>a.Trim()).ToArray();
name = Tools.ConfigValue(config, "name", defaultValue: "unnamed scaletype");
@@ -168,6 +178,7 @@ public override string ToString()
string result = "ScaleConfig {\n";
result += " isFreeScale = " + isFreeScale.ToString() + "\n";
result += " scaleFactors = " + scaleFactors.ToString() + "\n";
+ result += " scaleNodes = " + scaleNodes.ToString() + "\n";
result += " minValue = " + minValue.ToString() + "\n";
result += " maxValue = " + maxValue.ToString() + "\n";
return result + "}";