KSPModdingLibs / KSPCommunityFixes

Community patches for bugs in the KSP codebase
49 stars 17 forks source link

Stock inventory does not handle part mass modifiers or resource mass correctly #182

Closed JonnyOThan closed 7 months ago

JonnyOThan commented 7 months ago

If you have a stock part with ModulePartVariant on it that changes the part's mass, the inventory module only uses the prefab mass when calculating how much of the inventory is filled.

For example the RCS block thruster has many variants with different nozzle counts, and each one has a different mass. But if you place this part in an inventory, it always takes up 0.04t:

image

image

image

image

Further, the info box that you get when right-clicking on the part in inventory seems to only show the mass of the variant that is selected in the parts box, not the one that is currently in the inventory. This thruster should have a mass of 0.02t, but it shows 0.03t because that's what's selected in the parts box:

image

Further, the mass of parts that have resources is not represented correctly - they always weigh as much as they do when full of resources. To reproduce: place a fuel tank somewhere on the ship, then remove its resources. Place it in an inventory, and the mass is incorrect:

image

image