Ejemplo n.º 1
0
        /*
         * 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;
        }
Ejemplo n.º 2
0
        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;
 }
Ejemplo n.º 4
0
 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;
 }
Ejemplo n.º 5
0
 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;
 }
Ejemplo n.º 6
0
 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;
 }
Ejemplo n.º 7
0
 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;
 }
Ejemplo n.º 8
0
 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); };
 }
Ejemplo n.º 9
0
Archivo: API.cs Proyecto: jvdnbus/SSAT2
        //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);
        }
Ejemplo n.º 10
0
 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);
     };
 }
Ejemplo n.º 11
0
 public AttitudeFragment(FlightComputer.FlightComputer fc, Action queue)
 {
     mFlightComputer = fc;
     mOnClickQueue   = queue;
 }
Ejemplo n.º 12
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)
            {
                RTLog.Notify("An exception occurred in ModuleSPU.OnSave(): ", RTLogLevel.LVL4, e);
                print(e);
            }
        }
Ejemplo n.º 13
0
 public RoverFragment(FlightComputer.FlightComputer fc, Action queue)
 {
     mFlightComputer = fc;
     mOnClickQueue   = queue;
 }
Ejemplo n.º 14
0
        /*
         * 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;
        }
Ejemplo n.º 15
0
 public QueueFragment(FlightComputer.FlightComputer fc)
 {
     mFlightComputer = fc;
     Delay = 0;
 }
Ejemplo n.º 16
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); }
        }
Ejemplo n.º 17
0
 public PowerFragment(FlightComputer.FlightComputer fc, Action queue)
 {
     mFlightComputer = fc;
     mOnClickQueue   = queue;
     mPowerMode      = PowerModes.Normal;
 }
Ejemplo n.º 18
0
 public AttitudeFragment(FlightComputer.FlightComputer fc, Action queue)
 {
     mFlightComputer = fc;
     mOnClickQueue = queue;
 }
Ejemplo n.º 19
0
 public QueueFragment(FlightComputer.FlightComputer fc)
 {
     mFlightComputer = fc;
     Delay           = 0;
 }