Exemplo n.º 1
0
        void GrumpyKerbal(FlightCtrlState state)
        {
            try
            {
                currentTime = Planetarium.GetUniversalTime();
                double          waitTime   = currentTime + delayTime;
                FlightCtrlState storeState = new FlightCtrlState();
                storeState.CopyFrom(state);
                flightState.Enqueue(new FlightState(storeState, waitTime));



                while (currentTime > flightState.Peek().Time)
                {
                    FlightState topState = flightState.Dequeue();
                    state.CopyFrom(topState.State);
                    lastState = topState.State;
                    return;
                }
                if (lastState != null)
                {
                    state.CopyFrom(lastState);
                }
                else
                {
                    state.Neutralize();
                }
            }
            catch (Exception ex)
            {
                Debug.Log("Snacks - GrumpyKerbal: " + ex.Message + ex.StackTrace);
            }
        }
Exemplo n.º 2
0
        private void OnFlyByWirePost(FlightCtrlState fcs)
        {
            if (!SignalProcessor.IsMaster)
            {
                return;
            }

            if (!InputAllowed)
            {
                fcs.Neutralize();
            }

            if (SignalProcessor.Powered)
            {
                foreach (var dc in mActiveCommands.Values.ToList())
                {
                    if (dc.Execute(this, fcs))
                    {
                        mActiveCommands.Remove(dc.Priority);
                    }
                }
            }

            foreach (var pilot in SanctionedPilots)
            {
                pilot.Invoke(fcs);
            }
        }
Exemplo n.º 3
0
        private void OnFlyByWire(FlightCtrlState st)
        {
            if (neutral.IsStale)
            {
                if (neutral.FlushValue)
                {
                    st.Neutralize();
                }
            }

            PushNewSetting(ref st);
        }
        private void PopFlightCtrlState(FlightCtrlState fcs)
        {
            FlightCtrlState delayed = mPreviousCtrl;

            // Pop any due flightctrlstates off the queue
            while (mFlightCtrlBuffer.Count > 0 &&
                   mFlightCtrlBuffer.Peek().TimeStamp < RTUtil.GetGameTime())
            {
                delayed = mFlightCtrlBuffer.Dequeue().State;
            }
            if (!InputAllowed)
            {
                float keepThrottle = mPreviousCtrl.mainThrottle;
                delayed.Neutralize();
                delayed.mainThrottle = keepThrottle;
            }
            fcs.CopyFrom(delayed);
        }
Exemplo n.º 5
0
        private void OnFlyByWire(FlightCtrlState st)
        {
            if (!bound)
            {
                return;
            }
            if (neutral.IsStale)
            {
                if (neutral.FlushValue)
                {
                    st.Neutralize();
                }
            }

            if (resetTrim.IsStale)
            {
                if (resetTrim.FlushValue)
                {
                    st.ResetTrim();
                }
            }

            PushNewSetting(ref st);
        }
Exemplo n.º 6
0
        private void OnFlyByWirePost(FlightCtrlState fcs)
        {
            if (!SignalProcessor.IsMaster) return;

            if (!InputAllowed && this.KeepThrottleNoConnect == false)
            {
                fcs.Neutralize();
            }

            if (SignalProcessor.Powered)
            {
                foreach (var dc in mActiveCommands.Values.ToList())
                {
                    if (dc.Execute(this, fcs)) mActiveCommands.Remove(dc.Priority);
                }
            }

            foreach (var pilot in SanctionedPilots)
            {
                pilot.Invoke(fcs);
            }
        }
Exemplo n.º 7
0
        private void OnFlyByWire(FlightCtrlState st)
        {
            if (neutral.IsStale)
            {
                if (neutral.FlushValue)
                {
                    st.Neutralize();
                }
            }

            PushNewSetting(ref st);
        }
Exemplo n.º 8
0
        private void OnFlyByWire(FlightCtrlState st)
        {
            if (!bound) return;
            if (neutral.IsStale)
            {
                if (neutral.FlushValue)
                {
                    st.Neutralize();
                }
            }

            if (resetTrim.IsStale)
            {
                if (resetTrim.FlushValue)
                {
                    st.ResetTrim();
                }
            }

            PushNewSetting(ref st);
        }
Exemplo n.º 9
0
        private void OnFlyByWirePost(FlightCtrlState fcs)
        {
            if (!SignalProcessor.IsMaster) return;

            if (!InputAllowed)
            {
                fcs.Neutralize();
            }

            if (SignalProcessor.Powered)
            {
                foreach (var dc in mActiveCommands.Values.TakeWhile(c => c.TimeStamp <= RTUtil.GameTime)
                                                         .Where(c => c.ExtraDelay <= 0).ToList())
                {
                    if (dc.Execute(this, fcs)) mActiveCommands.Remove(dc.Priority);
                }
            }

            foreach (var pilot in SanctionedPilots)
            {
                pilot.Invoke(fcs);
            }
        }