diff --git a/B9PartSwitch/PartSwitch/ModuleB9PartSwitch.cs b/B9PartSwitch/PartSwitch/ModuleB9PartSwitch.cs index 185dd82..3ab5a05 100644 --- a/B9PartSwitch/PartSwitch/ModuleB9PartSwitch.cs +++ b/B9PartSwitch/PartSwitch/ModuleB9PartSwitch.cs @@ -229,13 +229,32 @@ public override void OnStartFinished(StartState state) public override string GetInfo() { + // Rearrange building string used in VAB PartInfo popup, so that it is + // only defined for tanks that switch resources. This is to drop side + // panels that just list multiple texture changes adding clutter with + // no functionally useful data about the part. + InitializeSubtypes(); - string outStr = $"{SubtypesCount} {switcherDescriptionPlural}"; + string outStr = " "; // just to keep it from being undefined and throwing an error. + + bool onetime = true; // For subtype count and desciption foreach (var subtype in subtypes) { - outStr += $"\n- {subtype.title}"; + bool first = true; // for subtype title foreach (var resource in subtype.tankType) - outStr += $"\n - {resource.resourceDefinition.displayName}: {resource.unitsPerVolume * GetTotalVolume(subtype) :0.#}"; + { + if (onetime) + { + onetime = false; + outStr = $"{SubtypesCount} {switcherDescriptionPlural}"; + } + if (first) + { + first = false; + outStr += $"\n- {subtype.title}"; + } + outStr += $"\n - {resource.resourceDefinition.displayName}: {resource.unitsPerVolume * GetTotalVolume(subtype):0.#}"; + } } return outStr; }