Esempio n. 1
0
        public bool UnregisterFrom <S>()
            where S : TCAService
        {
            var srv = TCA.GetModule <S>();

            return(srv != null && srv.Unregister(this));
        }
Esempio n. 2
0
        public bool RegisterTo <S>(Func <VesselWrapper, bool> predicate = null)
            where S : TCAService
        {
            var srv = TCA.GetModule <S>();

            return(srv != null && srv.Register(this, predicate));
        }
Esempio n. 3
0
        public void UpdateState()
        {
            //update onPlanet state
            var on_planet = _OnPlanet();
            var in_orbit  = _InOrbit();

            if (on_planet != OnPlanet)
            {
                CFG.EnginesProfiles.OnPlanetChanged(on_planet);
                if (!on_planet)
                {
                    if (CFG.BlockThrottle)
                    {
                        var THR = TCA.GetModule <ThrottleControl>();
                        if (THR != null)
                        {
                            THR.Throttle = 0f;
                        }
                    }
                    CFG.DisableVSC();
                    CFG.Nav.Off();
                    CFG.HF.Off();
                }
            }
            OnPlanet       = on_planet;
            InOrbit        = in_orbit;
            IsActiveVessel = vessel != null && vessel == FlightGlobals.ActiveVessel;
        }
Esempio n. 4
0
 public void PreUpdateState(FlightCtrlState s)
 {
     //update control info
     PreUpdateControls = s;
     IsActiveVessel = vessel != null && vessel == FlightGlobals.ActiveVessel;
     HasUserInput = 
         !Mathfx.Approx(PreUpdateControls.pitch, PreUpdateControls.pitchTrim, 0.01f) ||
         !Mathfx.Approx(PreUpdateControls.roll, PreUpdateControls.rollTrim, 0.01f) ||
         !Mathfx.Approx(PreUpdateControls.yaw, PreUpdateControls.yawTrim, 0.01f);
     AutopilotDisabled = HasUserInput;
     //update onPlanet state
     var on_planet = vessel.OnPlanet();
     var in_orbit = vessel.InOrbit();
     if(on_planet != OnPlanet) 
     {
         if(CFG.Enabled)
             CFG.EnginesProfiles.OnPlanetChanged(on_planet);
         if(!on_planet) 
         { 
             if(CFG.BlockThrottle)
             {
                 var THR = TCA.GetModule<ThrottleControl>();
                 if(THR != null) THR.Throttle = 0f;
             }
             CFG.DisableVSC();
             CFG.Nav.Off(); 
             CFG.HF.Off();
             if(IsActiveVessel && TCAGui.Instance.ORB != null)
                 TCAGui.Instance.ActiveTab = TCAGui.Instance.ORB;
         }
     }
     OnPlanet = on_planet;
     InOrbit = in_orbit;
 }
 protected bool GetREN()
 {
     if (TCA == null && !GetTCA())
     {
         return(false);
     }
     REN = TCA.GetModule <RendezvousAutopilot>();
     return(REN != null);
 }
 protected bool GetModule()
 {
     if (TCA == null && !GetTCA())
     {
         return(false);
     }
     ORB = TCA.GetModule <ToOrbitAutopilot>();
     return(ORB != null);
 }
Esempio n. 7
0
 static void create_fields()
 {
     AllPanels.Clear();
     foreach (var fi in AllPanelFields)
     {
         var panel = TCA.CreateComponent(fi.FieldType) as ControlPanel;
         if (panel != null)
         {
             AllPanels.Add(panel);
         }
         fi.SetValue(null, panel);
     }
     ModuleFields.ForEach(fi => fi.SetValue(null, TCA.GetModule(fi.FieldType)));
 }
 protected virtual bool GetModule()
 {
     MOD = TCA.GetModule <T>();
     return(MOD != null);
 }