// if we're transitioning from a complete thrust phase to a coast, wait for staging, otherwise
        // just go off of whatever the solution says for the current time.
        private bool actuallyCoasting()
        {
            PontryaginBase.Arc current_arc = p.solution.arc(vesselState.time);

            if (last_burning_stage_complete && last_burning_stage <= vessel.currentStage)
            {
                return(false);
            }
            return(current_arc.thrust == 0);
        }
        private void handle_throttle()
        {
            if (p == null || p.solution == null)
            {
                return;
            }

            if (!allow_execution)
            {
                return;
            }

            if (status == PVGStatus.TERMINAL_RCS)
            {
                RCSOn();
                return;
            }

            PontryaginBase.Arc current_arc = p.solution.arc(vesselState.time);

            if (current_arc.thrust != 0)
            {
                last_burning_stage          = current_arc.ksp_stage;
                last_burning_stage_complete = current_arc.complete_burn;
            }

            if (actuallyCoasting())
            {
                // force RCS on at the state transition
                if (!isCoasting())
                {
                    if (!vessel.ActionGroups[KSPActionGroup.RCS])
                    {
                        vessel.ActionGroups.SetGroup(KSPActionGroup.RCS, true);
                    }
                }

                if (!isTerminalGuidance())
                {
                    if (vesselState.time < last_stage_time + 4)
                    {
                        status = PVGStatus.COASTING_STAGING;
                    }
                    else
                    {
                        status = PVGStatus.COASTING;
                    }
                }
                last_coasting_time = vesselState.time;

                // this turns off autostaging during the coast (which currently affects fairing separation)
                core.staging.autostageLimitInternal = last_burning_stage - 1;
                ThrustOff();
            }
            else
            {
                if (!isTerminalGuidance())
                {
                    if ((vesselState.time < last_stage_time + 4) || (vesselState.time < last_coasting_time + 4))
                    {
                        status = PVGStatus.BURNING_STAGING;
                    }
                    else
                    {
                        status = PVGStatus.BURNING;
                    }
                }

                if (core.staging.autostageLimitInternal > 0)
                {
                    core.staging.autostageLimitInternal = 0;
                }
                else
                {
                    ThrustOn();
                }
            }
        }