public void Update()
{
if (!HighLogic.LoadedSceneIsEditor)
return;
bool newTopBottom = detectNewAttach();
if (triggerUpdate || newTopBottom)
{
updateScale();
}
if (triggerUpdate)
{
updateMass();
changeResources();
updateSurfaceNodes();
foreach (Part p in part.symmetryCounterparts)
{
var counterpart = p.Modules.OfType<StretchyTanks>().FirstOrDefault();
updateConterpartSize(counterpart);
if (counterpart.tankType != tankType || counterpart.burnTime != burnTime) // NK SRB
{
counterpart.tankType = tankType;
counterpart.burnTime = burnTime;
counterpart.changeResources();
counterpart.triggerUpdate = true;
}
if (!counterpart.textureSet.Equals(textureSet))
{
counterpart.textureSet = textureSet;
counterpart.textureType = -1;
counterpart.changeTextures();
counterpart.triggerUpdate = true;
}
}
// update MFS
if (part.Modules.Contains("ModuleFuelTanks"))
{
try
{
double curVolume = (double)initialDryMass * calcVolumeFactor() * 1600;
//const double DELTA = 0.001f;
//double mVol = (double)(part.Modules["ModuleFuelTanks"].Fields.GetValue("volume"));
//if (mVol > curVolume + DELTA || mVol < curVolume - DELTA)
//{
part.Modules["ModuleFuelTanks"].SendMessage("ChangeVolume", (curVolume));
//}
}
catch (Exception e)
{
print("*ST* changing volume, caught: " + e.Message);
}
}
triggerUpdate = false;
}
}