/* * PartModule overridden methods */ public override void OnStart(StartState state) { if (state != StartState.Editor) { if (vessel == null) { RTLog.Notify("ModuleSPU: OnStart : No vessel!", RTLogLevel.LVL2); return; } RTLog.Notify($"ModuleSPU: OnStart [{VesselName}]"); GameEvents.onVesselWasModified.Add(OnVesselModified); GameEvents.onPartUndock.Add(OnPartUndock); GameEvents.onPartActionUICreate.Add(OnPartActionUiCreate); GameEvents.onPartActionUIDismiss.Add(OnPartActionUiDismiss); VesselId = vessel.id; if (RTCore.Instance != null) { RTCore.Instance.Satellites.Register(vessel, this); if (FlightComputer == null) { FlightComputer = new FlightComputer.FlightComputer(this); } } } Fields["GUI_Status"].guiActive = ShowGUI_Status; }
public PIDControllerFragment(FlightComputer.FlightComputer fc, Action queue) { mFlightComputer = fc; mOnClickQueue = queue; LoadFlightPIDValues(); }
public FlightComputerWindow(FlightComputer.FlightComputer fc) : base(Guid.NewGuid(), "FlightComputer", new Rect(100, 100, 0, 0), WindowAlign.Floating) { mSavePosition = true; mFlightComputer = fc; mAttitude = new AttitudeFragment(fc, () => mQueueEnabled = !mQueueEnabled); mRover = new RoverFragment(fc, () => mQueueEnabled = !mQueueEnabled); mQueue = new QueueFragment(fc); mQueueEnabled = false; }
public FlightComputerWindow(FlightComputer.FlightComputer fc) : base(Guid.NewGuid(), appTitle, new Rect(100, 100, 0, 0), WindowAlign.Floating) { mSavePosition = true; mFlightComputer = fc; mAttitude = new AttitudeFragment(fc, () => OnQueue()); mRover = new RoverFragment(fc, () => OnQueue()); mPower = new PowerFragment(fc, () => OnQueue()); mPID = new PIDControllerFragment(fc, () => OnQueue()); mQueue = new QueueFragment(fc); mQueueEnabled = false; }
public override void OnStart(StartState state) { if (state != StartState.Editor) { GameEvents.onVesselWasModified.Add(OnVesselModified); GameEvents.onPartUndock.Add(OnPartUndock); GameEvents.onPartActionUICreate.Add(onPartActionUICreate); mRegisteredId = vessel.id; RTCore.Instance.Satellites.Register(vessel, this); if (FlightComputer == null) FlightComputer = new FlightComputer.FlightComputer(this); } Fields["GUI_Status"].guiActive = ShowGUI_Status; }
public override void OnStart(StartState state) { if (state != StartState.Editor) { GameEvents.onVesselWasModified.Add(OnVesselModified); GameEvents.onPartUndock.Add(OnPartUndock); mRegisteredId = vessel.id; RTCore.Instance.Satellites.Register(vessel, this); if (FlightComputer == null) { FlightComputer = new FlightComputer.FlightComputer(this); } } Fields["GUI_Status"].guiActive = ShowGUI_Status; }
public override void OnLoad(ConfigNode node) { base.OnLoad(node); try { if (HighLogic.fetch && HighLogic.LoadedSceneIsFlight) { if (FlightComputer == null) { FlightComputer = new FlightComputer.FlightComputer(this); } FlightComputer.load(node); } } catch (Exception e) { print(e); }; }
//exposed method called by other mods, passing a ConfigNode to RemoteTech public static bool QueueCommandToFlightComputer(ConfigNode externalData) { if (RTCore.Instance == null) { return(false); } //check we were actually passed a config node if (externalData == null) { return(false); } // check our min values if (!externalData.HasValue("GUIDString") && !externalData.HasValue("Executor") && !externalData.HasValue("ReflectionType")) { return(false); } try { Guid externalVesselId = new Guid(externalData.GetValue("GUIDString")); // you can only push a new external command if the vessel guid is the current active vessel if (FlightGlobals.ActiveVessel.id != externalVesselId) { RTLog.Verbose("Passed Guid is not the active Vessels guid", RTLogLevel.API); return(false); } // maybe we should look if this vessel hasLocal control or not. If so, we can execute the command // immediately // get the flight computer FlightComputer.FlightComputer computer = RTCore.Instance.Satellites[externalVesselId].FlightComputer; var extCmd = FlightComputer.Commands.ExternalAPICommand.FromExternal(externalData); computer.Enqueue(extCmd); return(true); } catch (Exception ex) { RTLog.Verbose(ex.Message, RTLogLevel.API); } return(false); }
public override void OnLoad(ConfigNode node) { base.OnLoad(node); try { if (HighLogic.fetch && HighLogic.LoadedSceneIsFlight) { if (FlightComputer == null) { FlightComputer = new FlightComputer.FlightComputer(this); } FlightComputer.Load(node); } } catch (Exception e) { RTLog.Notify("An exception occurred in ModuleSPU.OnLoad(): ", RTLogLevel.LVL4, e); print(e); }; }
public AttitudeFragment(FlightComputer.FlightComputer fc, Action queue) { mFlightComputer = fc; mOnClickQueue = queue; }
public override void OnSave(ConfigNode node) { base.OnSave(node); try { if (HighLogic.fetch && HighLogic.LoadedSceneIsFlight) { if (FlightComputer == null) FlightComputer = new FlightComputer.FlightComputer(this); FlightComputer.Save(node); } } catch (Exception e) { RTLog.Notify("An exception occurred in ModuleSPU.OnSave(): ", RTLogLevel.LVL4, e); print(e); } }
public RoverFragment(FlightComputer.FlightComputer fc, Action queue) { mFlightComputer = fc; mOnClickQueue = queue; }
/* * PartModule overridden methods */ public override void OnStart(StartState state) { if (state != StartState.Editor) { if (vessel == null) { RTLog.Notify("ModuleSPU: OnStart : No vessel!", RTLogLevel.LVL2); return; } RTLog.Notify($"ModuleSPU: OnStart [{VesselName}]"); GameEvents.onVesselWasModified.Add(OnVesselModified); GameEvents.onPartUndock.Add(OnPartUndock); GameEvents.onPartActionUICreate.Add(OnPartActionUiCreate); GameEvents.onPartActionUIDismiss.Add(OnPartActionUiDismiss); VesselId = vessel.id; if(RTCore.Instance != null) { RTCore.Instance.Satellites.Register(vessel, this); if (FlightComputer == null) FlightComputer = new FlightComputer.FlightComputer(this); } } Fields["GUI_Status"].guiActive = ShowGUI_Status; }
public QueueFragment(FlightComputer.FlightComputer fc) { mFlightComputer = fc; Delay = 0; }
public override void OnSave(ConfigNode node) { base.OnSave(node); try { if (HighLogic.fetch && HighLogic.LoadedSceneIsFlight) { if (FlightComputer == null) FlightComputer = new FlightComputer.FlightComputer(this); FlightComputer.Save(node); } } catch (Exception e) { print(e); } }
public PowerFragment(FlightComputer.FlightComputer fc, Action queue) { mFlightComputer = fc; mOnClickQueue = queue; mPowerMode = PowerModes.Normal; }