Staging Doesn't Start New Engine Dev 740
Opened this issue · 18 comments
When staging, Mechjeb correctly activates decoupler, but next stage engine never starts. Tested with fresh install of unmodded KSP. [email protected]
Built simple rocket with multiple stages. New engine will start if I do manual staging. This may have originated with 728, but my ability to interpret code is SUPER minimal.
This is on the dev build. The release build works fine. I just did a FRESH INSTALL of KSP 1.31 with no mod except Mechjeb dev 742. Everything stock. Engine start and launch clamps release fine. Then when the lower stage is complete, the decoupler works fine, but the upper stage engine never autostarts. As I noted, they started doing stuff with the staging code on dev 728. I reverted to dev 727 and all is well.
Sorry - I apparently was not on a dev build... I can reproduce the bug now.
It's caused by f956290 (MechJeb2/MechJebModuleStagingController.cs, line 82). After staging the decoupler CurrentStage and StageCount are equal, hence it returns from the function. When I change the line back to previous version, the staging works properly.
I am reluctant to revert it myself since I don't know why the call to vessel.LiftedOff() was removed. I'll put a note on the diff, so the author can chime in.
Thank-you SO MUCH. I had seen other people note the problem and although it was easy to work around with manual staging it puzzled me quite a bit. I cannot tell you how much time I spent making sure that it was not something I was doing or my install.
Is this on a dev build or release build? I'm on a dev build here and the staging seems to be fine.
Sorry guys. That was part of PR #920, which among other things added the ability for autostaging to release launch clamps (very nice for RO where engines take time to ramp up and you want to wait till the rocket will actually lift off), hence that logic needed to be relaxed to allow staging even if the vessel is on the ground.
I'm not totally surprised by this bug, since we were uncertain at the time about the change to that logic that you identified. But we still need to do that check -- has the player staged at least once? -- correctly, or else the feature breaks.
@tekinozbek if you can figure that out, that should fix this issue.
cc @sarbian @lamont-granquist who reviewed the code originally and might have ideas.
What is "the MET bug" mentioned in #920?
We could use FlightLogger.LiftOff to check stage status, or if that API has the same behavior as vessel.LiftedOff(), then we could traverse the FlightLogger.eventLog to check if we have staged at any point during the flight.
The "MET bug" is when mission time (aka MET) starts ticking due to physics wobble when the scene loads (very common KSP bug that would also screw up some logic that used to be in the PEG code as well, even without autostaging). When autostaging was enabled that result in some very lolwut autostaging of everything so MechJeb would burn through all your stages right on the launch pad.
You can replicate it fairly easily by using the sphere hucking thing in the debug menu. You have to tone it down a lot so it doesn't cause any damage, but just plonk the vehicle on the launch pad and make it wiggle enough that MET starts ticking. Then have auto-staging enabled and try to launch. I have not tried that recently (and haven't been playing KSP for the past couple of week, been taking a break).
(also i got nothing tonight on this bug -- bit too much insomnia last night)
Ah also note that the original comment in that bug mentions "Also fixes unreported bug in autostaging where bouncing vehicle will trigger staging unexpectedly" which is exactly what i meant by "the MET bug" => vehicle bouncing around on the pad triggers MET to start running.
And I'm reasonably certain FlightLogger.LiftOff
has the same behavior as vessel.LiftedOff()
from when I looked into that when I was wrangling the PEG code.
Here's what I wound up doing with the PEG code:
FlightLogger.LiftOff seems to have the same behavior, yes.
Using the sphere hucking thing, I was able to get the MET to start without launching and see that FlightLogger.eventLog doesn't contain a "Liftoff!" event until the first stage is engaged.
What's weird though is that I've been launching rockets with this patch, just fine. So I think I'm missing something in the conditions to exercise this bug. I'm playing RO/RSS on 1.2.2 still though.