Ejemplo n.º 1
0
        public void OnPartActionUiCreate(Part partForUi)
        {
            // check if the part is actually one from this vessel
            if (partForUi.vessel != vessel)
            {
                return;
            }

            // hook part menu
            UIPartActionMenuPatcher.WrapPartActionEventItem(partForUi, InvokeEvent);
            UIPartActionMenuPatcher.WrapPartActionFieldItem(partForUi, InvokePartAction);
        }
Ejemplo n.º 2
0
        public void HookPartMenus()
        {
            UIPartActionMenuPatcher.Wrap(vessel, (e, ignoreDelay) =>
            {
                var v = FlightGlobals.ActiveVessel;
                if (v == null || v.isEVA || RTCore.Instance == null)
                {
                    e.Invoke();
                    return;
                }

                VesselSatellite vs = null;
                if (RTCore.Instance != null)
                {
                    vs = RTCore.Instance.Satellites[v];
                }

                if (vs == null || vs.HasLocalControl)
                {
                    e.Invoke();
                }
                else if (eventWhiteList.Contains(e.name))
                {
                    e.Invoke();
                }
                else if (vs.FlightComputer != null && vs.FlightComputer.InputAllowed)
                {
                    if (ignoreDelay)
                    {
                        e.Invoke();
                    }
                    else
                    {
                        vs.SignalProcessor.FlightComputer.Enqueue(EventCommand.Event(e));
                    }
                }
                else if (e.listParent.part.Modules.OfType <IAntenna>().Any() &&
                         !e.listParent.part.Modules.OfType <ModuleRTAntennaPassive>().Any() &&
                         RTSettings.Instance.ControlAntennaWithoutConnection)
                {
                    e.Invoke();
                }
                else
                {
                    ScreenMessages.PostScreenMessage(new ScreenMessage("No connection to send command on.", 4.0f, ScreenMessageStyle.UPPER_LEFT));
                }
            });
        }
Ejemplo n.º 3
0
        public void OnPartActionUiCreate(Part partForUi)
        {
            // check if the part is actually one from this vessel
            if (partForUi.vessel != vessel)
            {
                return;
            }

            // check if the current scene is not in flight
            if (HighLogic.fetch && !HighLogic.LoadedSceneIsFlight)
            {
                return;
            }

            // hook part menu
            UIPartActionMenuPatcher.WrapPartActionEventItem(partForUi, InvokeEvent);
            UIPartActionMenuPatcher.WrapPartActionFieldItem(partForUi, InvokePartAction);
        }
Ejemplo n.º 4
0
        public void HookPartMenus()
        {
            UIPartActionMenuPatcher.Wrap(vessel, (e, ignoreDelay) =>
            {
                var v = FlightGlobals.ActiveVessel;
                if (v == null || v.isEVA || RTCore.Instance == null)
                {
                    e.Invoke();
                    return;
                }

                var vs = RTCore.Instance.Satellites[v];
                if (vs == null || vs.HasLocalControl)
                {
                    e.Invoke();
                }
                else if (eventWhiteList.Contains(e.name))
                {
                    e.Invoke();
                }
                else if (vs.FlightComputer != null && vs.FlightComputer.InputAllowed)
                {
                    if (ignoreDelay)
                    {
                        e.Invoke();
                    }
                    else
                    {
                        vs.SignalProcessor.FlightComputer.Enqueue(EventCommand.Event(e));
                    }
                }
                else
                {
                    ScreenMessages.PostScreenMessage(new ScreenMessage("No connection to send command on.", 4.0f, ScreenMessageStyle.UPPER_LEFT));
                }
            });
        }