KSP-RO / ProceduralParts

A continuation of StretchySRBs, which is a continuation of StretchyTanks
71 stars 79 forks source link

ProceduralTanks "half empty" when loading #205

Closed OliverPA77 closed 8 years ago

OliverPA77 commented 8 years ago

Procedural tanks are empty to half empty upon loading in VAB even though they are full in the craft file. Seems line 481 in TankContentSwitcher.cs is the problem - it references part.mass instead of mass. I changed that line, recompiled the dll and the issue is gone. return Math.Round((res.unitsConst + tankVolume * res.unitsPerKL + mass * res.unitsPerT) * shapeMultiplier, 2);

Same goes for lines 392 and 396 but in this case it is merely a display issue. float totalMass = mass + (float)resourceMass; if (selectedTankType.isStructural) massDisplay = MathUtils.FormatMass(totalMass); else massDisplay = "Dry: " + MathUtils.FormatMass(mass) + " / Wet: " + MathUtils.FormatMass(totalMass); TankContentSwitcher.txt

TomekCB commented 8 years ago

Nice. Im waiting since few weeks for this fix.

NathanKell commented 8 years ago

I am leaving the display using part.mass; it may at most lag a physics frame behind the real mass, but this ensures that if there are other part mass modifiers on the part, the display will be correct.