Beispiel #1
0
 public void SetTarget(TCAModule user, WayPoint wp = null)
 {
     if (wp == null)
     {
         TargetUsers.Remove(user);
         if (TargetUsers.Count == 0)
         {
             CFG.Target = null;
             if (vessel.targetObject is WayPoint)
             {
                 Target = null;
             }
         }
     }
     else
     {
         if (user != null)
         {
             TargetUsers.Add(user);
         }
         var t = wp.GetTarget();
         if (IsActiveVessel && wp != CFG.Target)
         {
             FlightGlobals.fetch.SetVesselTarget(t, true);
         }
         else
         {
             Target = t;
         }
         CFG.Target = wp;
         CFG.Target.Update(this);
     }
 }
Beispiel #2
0
 protected override void OnLateUpdate()
 {
     base.OnLateUpdate();
     // disable sub-panels depending on situation
     Controller.ToggleOnPlanet(VSL.OnPlanet);
     Controller.ToggleInOrbit(VSL.InOrbit);
     // set states of the indicators
     Controller.Ascending.isOn           = TCA.IsStateSet(TCAState.Ascending);
     Controller.LoosingAltitude.isOn     = TCA.IsStateSet(TCAState.LoosingAltitude);
     Controller.TerrainCollision.isOn    = TCA.IsStateSet(TCAState.GroundCollision);
     Controller.VesselCollision.isOn     = TCA.IsStateSet(TCAState.VesselCollision);
     Controller.LowControlAuthority.isOn = !VSL.Controls.HaveControlAuthority;
     Controller.EnginesUnoptimized.isOn  = TCA.IsStateSet(TCAState.Unoptimized);
     Controller.VSC.isOn         = TCAModule.ExistsAndActive(VSC);
     Controller.ALT.isOn         = TCAModule.ExistsAndActive(ALT);
     Controller.VTOLMode.isOn    = TCAModule.ExistsAndActive(VTOL_control);
     Controller.VTOLAssist.isOn  = TCA.IsStateSet(TCAState.VTOLAssist);
     Controller.Stabilizing.isOn = TCA.IsStateSet(TCAState.StabilizeFlight);
     Controller.NoEngines.isOn   = TCA.IsStateSet(TCAState.HaveEC) &&
                                   !TCA.IsStateSet(TCAState.HaveActiveEngines);
     Controller.NoEC.isOn = TCA.IsStateSet(TCAState.Enabled) &&
                            !TCA.IsStateSet(TCAState.HaveEC);
     Controller.SmartEngines.isOn = CFG.UseSmartEngines;
     Controller.Stop.isOn         = CFG.HF[HFlight.Stop] ||
                                    TCAModule.ExistsAndActive(anchor);
     Controller.Navigation.isOn = CFG.Nav.Any(Navigation.GoToTarget,
                                              Navigation.FollowPath,
                                              Navigation.FollowTarget);
     // fade out irrelevant indicators
     Controller.TerrainCollision.SetActive(TCAModule.ExistsAndActive(RAD));
     Controller.VesselCollision.SetActive(CFG.UseCPS);
     Controller.VTOLAssist.SetActive(CFG.VTOLAssistON);
     Controller.Stabilizing.SetActive(CFG.StabilizeFlight);
     Controller.SmartEngines.SetActive(VSL.Engines.Clusters.Multi);
 }
        public void SetTarget(TCAModule user, WayPoint wp = null)
        {
            if (wp == null)
            {
                TargetUsers.Remove(user);
                if (TargetUsers.Count == 0)
                {
                    CFG.Target = null;
                    if (vessel.targetObject is WayPoint)
                    {
                        Target = null;
                    }
                }
            }
            else
            {
                if (user != null)
                {
                    TargetUsers.Add(user);
                }
                var t = wp.GetTarget();
                if (IsActiveVessel && wp != CFG.Target)
                {
//                {
                    FlightGlobals.fetch.SetVesselTarget(t, true);
                }
//					Utils.Message("Target: {0}", t.GetName());
//                }
                else
                {
                    Target = t;
                }
                CFG.Target = wp;
            }
        }
Beispiel #4
0
 public bool Unregister(TCAModule module)
 {
     return(Clients.Remove(new Client(module)));
 }
Beispiel #5
0
 public bool Register(TCAModule module, Func <VesselWrapper, bool> predicate = null)
 {
     return(Clients.Add(new Client(module, predicate)));
 }
Beispiel #6
0
 public Client(TCAModule module, Func <VesselWrapper, bool> predicate = null)
 {
     Module = module; Predicate = predicate;
 }
Beispiel #7
0
 public static bool ExistsAndActive(TCAModule module) => module != null && module.IsActive;
        public TCAModule GetModule(Type T)
        {
            TCAModule module = null;

            return(ModulesDB.TryGetValue(T, out module)? module : null);
        }
        public M GetModule <M>() where M : TCAModule
        {
            TCAModule module = null;

            return(ModulesDB.TryGetValue(typeof(M), out module)? module as M : null);
        }