Skip to content

Commit d39db54

Browse files
Merge pull request #6 from TonkaCrash/master
Modified GetInfo to suppress info about texture only changes.
2 parents ceb5b37 + 2a54731 commit d39db54

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

B9PartSwitch/PartSwitch/ModuleB9PartSwitch.cs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,13 +229,32 @@ public override void OnStartFinished(StartState state)
229229

230230
public override string GetInfo()
231231
{
232+
// Rearrange building string used in VAB PartInfo popup, so that it is
233+
// only defined for tanks that switch resources. This is to drop side
234+
// panels that just list multiple texture changes adding clutter with
235+
// no functionally useful data about the part.
236+
232237
InitializeSubtypes();
233-
string outStr = $"<b><color=#7fdfffff>{SubtypesCount} {switcherDescriptionPlural}</color></b>";
238+
string outStr = " "; // just to keep it from being undefined and throwing an error.
239+
240+
bool onetime = true; // For subtype count and desciption
234241
foreach (var subtype in subtypes)
235242
{
236-
outStr += $"\n<b>- {subtype.title}</b>";
243+
bool first = true; // for subtype title
237244
foreach (var resource in subtype.tankType)
238-
outStr += $"\n <color=#99ff00ff>- {resource.resourceDefinition.displayName}</color>: {resource.unitsPerVolume * GetTotalVolume(subtype) :0.#}";
245+
{
246+
if (onetime)
247+
{
248+
onetime = false;
249+
outStr = $"<b><color=#7fdfffff>{SubtypesCount} {switcherDescriptionPlural}</color></b>";
250+
}
251+
if (first)
252+
{
253+
first = false;
254+
outStr += $"\n<b>- {subtype.title}</b>";
255+
}
256+
outStr += $"\n <color=#99ff00ff>- {resource.resourceDefinition.displayName}</color>: {resource.unitsPerVolume * GetTotalVolume(subtype):0.#}";
257+
}
239258
}
240259
return outStr;
241260
}

0 commit comments

Comments
 (0)