public void HookPartMenus() { UIPartActionMenuPatcher.Wrap(vessel, (e, ignore_delay) => { 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 (ignore_delay) { 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)); } }); }