MechJeb2

MechJeb2

4M Downloads

Vessel mass and ‘physicsless’ parts

formicant opened this issue · 1 comments

commented

Since KSP 1.0, the mass of a physicsless part is added to its parent part.
MechJeb doesn’t take this fact into account when calculating the vessel’s mass.

In MechJebModuleInfoItems.cs, there’s a method VesselMass:

    [ValueInfoItem("Vessel mass", InfoItem.Category.Vessel, format = "F3", units = "t", showInEditor = true)]
    public double VesselMass()
    {
        if (HighLogic.LoadedSceneIsEditor) return EditorLogic.fetch.ship.parts
                              .Where(p => p.IsPhysicallySignificant()).Sum(p => p.TotalMass());
        else return vesselState.mass;
    }

I believe the where filter should be removed from there.

In the ``DryMass` method, however, the physicsless parts’ mass is added:

    [ValueInfoItem("Dry mass", InfoItem.Category.Vessel, showInEditor = true, format = "F3", units = "t")]
    public double DryMass()
    {
        return parts.Where(p => p.IsPhysicallySignificant()).Sum(p => p.mass + p.GetPhysicslessChildMass());
    }

I’m not sure though if anything else has to be changed.

commented

You may want to look into the dev branch source instead of the master branch.
And this commit : 1427ba1