/*************************************************************************************************************************/
        public void fill_Vessels_list()
        {
#if DEBUG
            // if (Debug_Level_1_Active)
            Log.PushStackInfo("FMRS_Core.fill_Vessels_list", "entering fill_Vessels_list()");
#endif

            foreach (Vessel temp_vessel in FlightGlobals.Vessels)
            {
                if (!Vessels.Contains(temp_vessel.id))
                {
                    Vessels.Add(temp_vessel.id);
#if DEBUG
                    if (Debug_Active)
                    {
                        Log.Info("" + temp_vessel.vesselName + " Found");
                    }
#endif
                }
            }
#if DEBUG
            // if (Debug_Level_1_Active)
            Log.PopStackInfo("leaving fill_Vessels_list()");
#endif
        }
Exemple #2
0
        /// <summary>
        /// Load all vessels from KML Tree.
        /// </summary>
        /// <param name="master">The GuiTreeManager that manages the loaded tree</param>
        public void Load(GuiTreeManager master)
        {
            Vessels.Clear();
            VesselsList.Items.Clear();
            VesselsDetails.Children.Clear();

            List <KmlVessel> list = master.GetFlatList <KmlVessel>();

            foreach (KmlVessel vessel in list)
            {
                if (vessel.Origin == KmlVessel.VesselOrigin.Flightstate)
                {
                    Vessels.Add(vessel);
                }
            }

            // Sort the list
            Vessels = Vessels.OrderBy(x => x.Name).ToList();

            foreach (KmlVessel vessel in Vessels)
            {
                GuiVesselsNode node = new GuiVesselsNode(vessel);
                node.MouseDoubleClick += VesselsNode_MouseDoubleClick;
                VesselsList.Items.Add(node);
            }

            // Apply current filter and count visible items
            UpdateVisibility();
        }
Exemple #3
0
        static Constants()
        {
            var    min_capacity = 30;
            var    max_capacity = 150;
            var    speed        = 100;
            Random r            = new Random();
            var    shipCount    = 10;

            for (int i = 0; i < shipCount; i++)
            {
                var shipname = "Ship" + i.ToString();

                var capacity = r.Next(min_capacity, max_capacity);
                Vessels.Add(new VesselConfig(shipname, capacity, speed));
            }
            var currentPortId = 0;
            var portCount     = PortIds.Count;

            for (int i = 0; i < shipCount; i++)
            {
                var shipname = "Ship" + i.ToString();
                if (portCount == currentPortId)
                {
                    currentPortId = 0;
                }
                PortIds[currentPortId].startingVessels.Add(shipname);
            }
            //or load configuration from files.
        }
Exemple #4
0
 public void SubscribeAddVessel()
 {
     MessagingCenter.Subscribe <AddVesselPageViewModel, Vessel>(this, "addVessel", (s, param) =>
     {
         Vessels.Add(param);
         SetVesselBackground();
     });
 }
        public override void AcceptChanges()
        {
            Version = DataStrings.VesselDataCurrentVersion;
            HullRaces.AcceptChanges();
            Vessels.AcceptChanges();

            base.AcceptChanges();
        }
Exemple #6
0
        public ActionResult DeleteConfirmed(int id)
        {
            Vessels vessels = db.Vessels.Find(id);

            db.Vessels.Remove(vessels);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #7
0
 public ActionResult Edit([Bind(Include = "ID,VesselName,VesselDeparture,DepartureFrom,VesselArrival,ArrivingTo")] Vessels vessels)
 {
     if (ModelState.IsValid)
     {
         db.Entry(vessels).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(vessels));
 }
Exemple #8
0
        public ActionResult Create([Bind(Include = "ID,VesselName,VesselDeparture,DepartureFrom,VesselArrival,ArrivingTo")] Vessels vessels)
        {
            if (ModelState.IsValid)
            {
                db.Vessels.Add(vessels);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(vessels));
        }
        /*************************************************************************************************************************/
        public void main_vessel_changed(string save_file)
        {
#if DEBUG
            // if (Debug_Level_1_Active)
            Log.PushStackInfo("FMRS_Core.main_vessel_changed", "enter main_vessel_changed(string save_file) " + save_file);
            if (Debug_Active)
            {
                Log.Info("switching main vessel");
            }
#endif
            ProtoVessel temp_proto;
            Game        loadgame = GamePersistence.LoadGame(save_file, HighLogic.SaveFolder + "/FMRS", false, false);

            if (loadgame != null && loadgame.compatible && loadgame.flightState != null)
            {
                temp_proto = loadgame.flightState.protoVessels.Find(p => p.vesselID == _SAVE_Main_Vessel);
                if (temp_proto != null)
                {
                    if (Vessels_dropped.ContainsKey(temp_proto.vesselID))
                    {
                        delete_dropped_vessel(temp_proto.vesselID);
                    }

                    Vessels_dropped.Add(temp_proto.vesselID, quicksave_file_name);
                    Vessels_dropped_names.Add(temp_proto.vesselID, temp_proto.vesselName);
                    Vessels.Add(temp_proto.vesselID);
                }
#if DEBUG
                else
                if (Debug_Active)
                {
                    Log.Info("main vessel not found");
                }
#endif

                if (Vessels_dropped.ContainsKey(FlightGlobals.ActiveVessel.id))
                {
                    delete_dropped_vessel(FlightGlobals.ActiveVessel.id);
                }

                _SAVE_Main_Vessel = FlightGlobals.ActiveVessel.id;
            }
#if DEBUG
            else
            if (Debug_Active)
            {
                Log.Info("unable to load savefile");
            }

            // if (Debug_Level_1_Active)
            Log.PopStackInfo("leaving main_vessel_changed(string save_file)");
#endif
        }
Exemple #10
0
        void GetVessels()
        {
            var r = App.Database.GetItemsAsync().Result;

            if (r != null)
            {
                foreach (var item in r)
                {
                    Vessels.Add(item);
                }
                SetVesselBackground();
            }
        }
Exemple #11
0
        // GET: Vessels/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Vessels vessels = db.Vessels.Find(id);

            if (vessels == null)
            {
                return(HttpNotFound());
            }
            return(View(vessels));
        }
Exemple #12
0
 void SetVesselBackground()
 {
     for (int i = 0; i < Vessels.Count(); i++)
     {
         if (IsOddNumber(i))
         {
             Vessels[i].vesselBackground = "mask.png";
         }
         else
         {
             Vessels[i].vesselBackground = "mask2.png";
         }
     }
 }
Exemple #13
0
        public Cocktail(Cocktails id, string name, string color, bool ice, Vessels vessel, PrepMethods prepMethod, Garnishes garnish,
                        params CocktailIngredient[] recipe)
        {
            Id   = id;
            Name = name;
            Ice  = ice;

            Vessel     = vessel;
            PrepMethod = prepMethod;
            Garnish    = garnish;

            Recipe = recipe;

            Color = color;
        }
Exemple #14
0
        /*************************************************************************************************************************/
        public void fill_Vessels_list()
        {
            Log.PushStackInfo("FMRS_Core.fill_Vessels_list", "entering fill_Vessels_list()");

            foreach (Vessel temp_vessel in FlightGlobals.Vessels)
            {
                if (!Vessels.Contains(temp_vessel.id))
                {
                    Vessels.Add(temp_vessel.id);
                    Log.dbg("{0} Found", temp_vessel.vesselName);
                }
            }

            Log.PopStackInfo("leaving fill_Vessels_list()");
        }
 void OnEnable()
 {
     _target       = (Vessels)target;
     _objects      = Resources.LoadAll("Vessels", typeof(GameObject)).ToList();
     _vesselsSaved = (VesselsSaved)Resources.Load("VesselsConfig");
 }
 public override void RejectChanges()
 {
     HullRaces.RejectChanges();
     Vessels.RejectChanges();
     base.RejectChanges();
 }
        // Hold Temperature Set Point
        public void HoldTemp(Vessels vesselName, double Target)
        {
            // Creating a new vessel instance
            Brewery.vessel Vessel = new Brewery.vessel(vesselName);

            // Get the selected vessel instance
            if(vesselName == Vessels.HLT) { Vessel = brewery.HLT; }
            else if(vesselName == Vessels.MLT) { Vessel = brewery.MLT; }
            else { Vessel = brewery.BK; }

            // Set the Target Set Point to the Vessel Instance
            if (Target == 0)
            {
                // Turn burner off
                LightBurner(Vessel.Name, false);
                Vessel.Temp.SetPoint = Target;
                Vessel.Temp.SetPointReached = true;
                goto MessageUpdates;
            }
            else
            {
                Vessel.Temp.SetPoint = Target;
            }

            // Check if temp is within range and process burner action
            if (Vessel.Temp.Value <= Target - ProcessSettings.TempHoldingRange && !Vessel.Burner.IsOn)
            {
                LightBurner(Vessel.Name, true);
                Vessel.Temp.SetPointReached = false;
            }
            else if (Vessel.Temp.Value >= Target + ProcessSettings.TempHoldingRange && Vessel.Burner.IsOn)
            {
                LightBurner(Vessel.Name, false);
                Vessel.Temp.SetPointReached = false;
            }
            else if(Vessel.Temp.Value >= Target - ProcessSettings.TempHoldingRange && Vessel.Temp.Value <= Target + ProcessSettings.TempHoldingRange)
            {
                Vessel.Temp.SetPointReached = true;
            }
            else
            {
                Vessel.Temp.SetPointReached = false;
            }

            // Copy Back the set point info to the brewery instance and send the corresponding update message
            MessageUpdates:
            if (vesselName == Vessels.HLT)
            {
                brewery.HLT = Vessel;
                Messenger.Default.Send<Brewery>(brewery, "HLTTempSetPointReachedUpdate");
                Messenger.Default.Send<Brewery>(brewery, "HLTTempSetPointUpdate");
            }
            else if (vesselName == Vessels.MLT)
            {
                brewery.MLT = Vessel;
                Messenger.Default.Send<Brewery>(brewery, "MLTTempSetPointReachedUpdate");
                Messenger.Default.Send<Brewery>(brewery, "MLTTempSetPointUpdate");
            }
            else
            {
                brewery.BK = Vessel;
                Messenger.Default.Send<Brewery>(brewery, "BKTempSetPointReachedUpdate");
                Messenger.Default.Send<Brewery>(brewery, "BKTempSetPointUpdate");
            }
            
        }
 public override void EndInitialization()
 {
     HullRaces.EndInitialization();
     Vessels.EndInitialization();
     base.EndInitialization();
 }
 public override void BeginInitialization()
 {
     base.BeginInitialization();
     HullRaces.BeginInitialization();
     Vessels.BeginInitialization();
 }
Exemple #20
0
 public vessel(Vessels _vesselType)
 {
     Volume = new volume();
     Temp = new temp();
     Burner = new burner();
     Name = _vesselType;
 }
Exemple #21
0
 public Vessel(Vessels id, string name)
 {
     Id   = id;
     Name = name;
 }
Exemple #22
0
        /*************************************************************************************************************************/
        public bool search_for_new_vessels(string save_file_name)
        {
            bool new_vessel_found = false, controllable = false;

            Log.PushStackInfo("FMRS_Core.search_for_new_vessels(string)", "entering search_for_new_vessels(string save_file_name) {0}", save_file_name);

            foreach (Vessel temp_vessel in FlightGlobals.Vessels)
            {
                controllable = false;

                //Check if the stage was claimed by another mod or by this mod
                string controllingMod = RecoveryControllerWrapper.ControllingMod(temp_vessel);

                bool FMRSIsControllingMod = false;
                if (controllingMod != null)
                {
                    Log.info("RecoveryControllerWrapper.ControllingMod for vessel: {0} : {1}", temp_vessel.name, controllingMod);

                    FMRSIsControllingMod = string.Equals(controllingMod, "FMRS", StringComparison.OrdinalIgnoreCase);
                }

                if (controllingMod == null ||
                    string.Equals(controllingMod, "auto", StringComparison.OrdinalIgnoreCase) ||
                    FMRSIsControllingMod)
                {
                    if (!Vessels.Contains(temp_vessel.id))
                    {
                        if (FMRSIsControllingMod ||
                            (
                                ((temp_vessel.isCommandable && temp_vessel.IsControllable) || (_SETTING_Control_Uncontrollable && controllingMod == null)) &&
                                temp_vessel.vesselType != VesselType.EVA &&
                                temp_vessel.vesselType != VesselType.Flag &&
                                temp_vessel.vesselType != VesselType.SpaceObject &&
                                temp_vessel.vesselType != VesselType.Unknown
                            )
                            )
                        {
                            controllable = true;
                        }
                        else
                        {
                            foreach (ProtoPartSnapshot proto_part in temp_vessel.protoVessel.protoPartSnapshots)
                            {
                                List <ProtoPartModuleSnapshot> proto_modules = proto_part.modules;
                                ProtoPartModuleSnapshot        module        = null;

                                if (proto_modules != null &&
                                    (_SETTING_Parachutes &&
                                     ((controllingMod != null && string.Equals(controllingMod, "FMRS", StringComparison.OrdinalIgnoreCase)) ||
                                      !_SETTING_Defer_Parachutes_to_StageRecovery ||
                                      !stageRecoveryInstalled)
                                    )
                                    )
                                {
                                    //
                                    module = proto_part.modules.Find(p => p.moduleName == "RealChuteModule" ||
                                                                     p.moduleName == "ModuleParachute" ||
                                                                     p.moduleName == "ModuleKrKerbalParachute" ||
                                                                     p.moduleName == "RealChuteFAR");
                                    if (module != null)
                                    {
                                        controllable = true;
                                    }
                                }

                                if (proto_part.protoCrewNames.Count > 0)
                                {
                                    controllable = true;
                                }
                            }
                        }
                        foreach (Part p in temp_vessel.Parts)
                        {
                            foreach (PartModule pm in p.Modules)
                            {
                                if (pm.moduleName == "FMRS_PM")
                                {
                                    if ((pm as FMRS_PM).parent_vessel != "00000000-0000-0000-0000-000000000000")
                                    {
                                        controllable = false;
                                        break;
                                    }
                                }
                            }
                            break;
                        }

                        if (controllable)
                        {
                            Log.dbg("{0} Found and will be added to the dicts", temp_vessel.vesselName);

                            Vessels_dropped.Add(temp_vessel.id, save_file_name);
                            Vessels_dropped_names.Add(temp_vessel.id, temp_vessel.vesselName);
                            Vessel_State.Add(temp_vessel.id, vesselstate.FLY);
                            foreach (Part p in temp_vessel.Parts)
                            {
                                foreach (PartModule pm in p.Modules)
                                {
                                    if (pm.moduleName == "FMRS_PM")
                                    {
                                        pm.StartCoroutine("setid");
                                    }
                                }
                            }

                            foreach (ProtoPartSnapshot part_snapshot in temp_vessel.protoVessel.protoPartSnapshots)
                            {
                                foreach (ProtoCrewMember member in part_snapshot.protoModuleCrew)
                                {
                                    if (!Kerbal_dropped.ContainsKey(member.name))
                                    {
                                        Kerbal_dropped.Add(member.name, temp_vessel.id);
                                    }
                                }
                            }
                            new_vessel_found = true;
                        }
                        Vessels.Add(temp_vessel.id);
                    }
                }
            }

            Log.PopStackInfo("leaving search_for_new_vessels(string save_file_name)");

            return(new_vessel_found);
        }
Exemple #23
0
        /*************************************************************************************************************************/
        public void flight_scene_update_routine()
        {
            Log.PushStackInfo("FMRS_Core.flight_scene_update_routine", "entering flight_scene_update_routine()");
            Instance = this;
            if (_SETTING_Enabled)
            {
                if (timer_start_delay_active)
                {
                    if ((Timer_Start_Delay + Time_Trigger_Start_Delay) <= Planetarium.GetUniversalTime())
                    {
                        if (!_SAVE_Switched_To_Dropped)
                        {
                            write_recovered_values_to_save();
                        }
                        else
                        {
                            List <Guid> temp_guid_list = new List <Guid>();
                            foreach (Guid id in loaded_vessels)
                            {
                                if (FlightGlobals.Vessels.Find(v => v.id == id) == null)
                                {
                                    temp_guid_list.Add(id);
                                }
                            }
                            foreach (Guid id in temp_guid_list)
                            {
                                Log.dbg("loaded_vessels: removing " + id.ToString());
                                loaded_vessels.Remove(id);
                            }
                            Log.dbg("loaded_vessels: " + loaded_vessels.Count.ToString());
                        }
                        timer_start_delay_active = false;
                    }
                }

                if (timer_staging_active)
                {
                    if (timer_cuto_active && _SETTING_Auto_Cut_Off)
                    {
                        //if ((Time_Trigger_Cuto + 0.1) <= Planetarium.GetUniversalTime())
                        //if (_SETTING_Auto_Cut_Off)
                        {
                            Log.dbg("auto thrust cut off");
                            foreach (Vessel temp_vessel in FlightGlobals.Vessels)
                            {
                                if (!Vessels.Contains(temp_vessel.id))
                                {
                                    temp_vessel.ctrlState.mainThrottle = 0;
                                }
                            }
                            timer_cuto_active = false;
                        }
                    }

                    if ((Time_Trigger_Staging + Timer_Stage_Delay) <= Planetarium.GetUniversalTime())
                    {
                        Log.dbg("Has Staged Delayed");

                        last_staging_event = Planetarium.GetUniversalTime();

                        timer_staging_active = false;

                        quicksave_file_name = FILES.GAMESAVE_NAME + FlightGlobals.ActiveVessel.currentStage.ToString();

                        if (Vessels_dropped.ContainsValue(quicksave_file_name) || (separated_vessel && !staged_vessel))
                        {
                            int nr_save_file = 0;

                            foreach (KeyValuePair <Guid, string> temp_keyvalues in Vessels_dropped)
                            {
                                if (temp_keyvalues.Value.Contains("separated_"))
                                {
                                    if (nr_save_file <= Convert.ToInt16(temp_keyvalues.Value.Substring(20)))
                                    {
                                        nr_save_file = Convert.ToInt16(temp_keyvalues.Value.Substring(20)) + 1;
                                    }
                                }
                            }

                            quicksave_file_name = FILES.GAMESAVE_NAME + "separated_" + nr_save_file;
                        }

                        separated_vessel = false;
                        staged_vessel    = false;

                        if (search_for_new_vessels(quicksave_file_name))
                        {
                            // GamePersistence.SaveGame(quicksave_file_name, HighLogic.SaveFolder + "/FMRS", SaveMode.OVERWRITE);
                            FMRS_SAVE_Util.Instance.SaveGame("FMRS_Core.flight_scene_update_routine", quicksave_file_name, HighLogic.SaveFolder + "/FMRS", SaveMode.OVERWRITE);

                            if (_SAVE_Main_Vessel != FlightGlobals.ActiveVessel.id && !_SAVE_Switched_To_Dropped)
                            {
                                main_vessel_changed(quicksave_file_name);
                            }

                            set_save_value(save_cat.SAVEFILE, quicksave_file_name, Planetarium.GetUniversalTime().ToString());
                            write_save_values_to_file();
                        }
                    }
                }

                if (n_launchpad_preflight && !FlightGlobals.ActiveVessel.Landed)
                {
                    EventReport dummy_event = null;
                    Log.dbg("non launchpad launch");
                    n_launchpad_preflight = false;
                    launch_routine(dummy_event);
                }
            }

            Log.PopStackInfo("leaving flight_scene_update_routine");
        }
Exemple #24
0
        /*************************************************************************************************************************/
        public void flight_scene_start_routine()
        {
            Log.PushStackInfo("FMRS_Core.flight_scene_start_routine", "entering flight_scene_start_routine()");
            Log.dbg("FMRS flight_scene_start_routine");

            plugin_active = true;
            if (FlightGlobals.ActiveVessel == null)
            {
                Log.info("ActiveVessel is null");
            }
            else
            {
                if (FlightGlobals.ActiveVessel.situation == Vessel.Situations.PRELAUNCH || n_launchpad_preflight || flight_preflight)
                {
                    Log.dbg("FMRS Vessel is prelaunch");

                    delete_dropped_vessels();
                    _SETTING_Enabled          = true;
                    _SAVE_Switched_To_Dropped = false;
                    _SAVE_Kick_To_Main        = false;
                    _SAVE_Main_Vessel         = FlightGlobals.ActiveVessel.id;
                    _SAVE_Launched_At         = 0;
                    _SAVE_Has_Launched        = false;

                    if (flight_preflight)
                    {
                        _SAVE_Flight_Reset = true;
                    }

                    foreach (Part p in FlightGlobals.ActiveVessel.Parts)
                    {
                        foreach (PartModule pm in p.Modules)
                        {
                            if (pm.moduleName == "FMRS_PM")
                            {
                                pm.StartCoroutine("resetid");
                            }
                        }
                    }

                    recover_values.Clear();

                    StartCoroutine(save_game_pre_flight());
                }
            }

            can_restart = HighLogic.CurrentGame.Parameters.Flight.CanRestart;
            if (HighLogic.CurrentGame.Parameters.Flight.CanQuickLoad && HighLogic.CurrentGame.Parameters.Flight.CanQuickSave)
            {
                can_q_save_load = true;
            }
            else
            {
                can_q_save_load = false;
            }

            if (FlightGlobals.ActiveVessel.id == _SAVE_Main_Vessel)
            {
                _SAVE_Switched_To_Dropped = false;
                _SAVE_Kick_To_Main        = false;
            }
            else
            {
                _SAVE_Switched_To_Dropped = true;
            }


            Time_Trigger_Start_Delay = Planetarium.GetUniversalTime();
            timer_start_delay_active = true;

            if (_SAVE_Switched_To_Dropped)
            {
                foreach (KeyValuePair <Guid, string> kvp in Vessels_dropped)
                {
                    if (kvp.Value == _SAVE_Switched_To_Savefile)
                    {
                        if (get_vessel_state(kvp.Key) == vesselstate.FLY)
                        {
                            loaded_vessels.Add(kvp.Key);
                        }
                    }
                }

                Log.dbg("loaded_vessels: {0}", loaded_vessels.Count);

                if (_SETTING_Throttle_Log)
                {
                    ThrottleReplay = new FMRS_THL.FMRS_THL_Rep();

                    foreach (Vessel v in FlightGlobals.Vessels)
                    {
                        if (v.id == _SAVE_Main_Vessel)
                        {
                            //if (v.loaded)
                            {
                                Log.info("appling flybywire callback to main vessel");
                                v.OnFlyByWire += new FlightInputCallback(ThrottleReplay.flybywire);
                            }
                        }
                    }
                }
            }

            if ((windowPos.x == 0) && (windowPos.y == 0))
            {
                windowPos = new Rect(Screen.width / 2, Screen.height / 2, 50, 50);
                write_save_values_to_file();
            }

            Vessels.Clear();
            fill_Vessels_list();

            timer_staging_active = false;
            really_close         = false;
            revert_to_launch     = false;
            separated_vessel     = false;
            staged_vessel        = false;

            current_rep     = Reputation.CurrentRep;
            last_rep_change = 0;

            attach_handlers();

            if (!main_ui_active)
            {
                main_ui_active = true;

                Log.dbg("activate drawMainGUI");
            }

            Log.PopStackInfo("leaving flight_scene_start_routine()");
        }
Exemple #25
0
        /*************************************************************************************************************************/
        public bool search_for_new_vessels(string save_file_name)
        {
            bool new_vessel_found = false, controllable = false;

#if DEBUG
            // if (Debug_Level_1_Active)
            Log.PushStackInfo("FMRS_Core.search_for_new_vessels(string)", "entering search_for_new_vessels(string save_file_name) " + save_file_name);
#endif
            foreach (Vessel temp_vessel in FlightGlobals.Vessels)
            {
                controllable = false;

                if (!Vessels.Contains(temp_vessel.id))
                {
                    if (temp_vessel.isCommandable &&
                        temp_vessel.IsControllable &&
                        temp_vessel.vesselType != VesselType.EVA &&
                        temp_vessel.vesselType != VesselType.Flag &&
                        temp_vessel.vesselType != VesselType.SpaceObject &&
                        temp_vessel.vesselType != VesselType.Unknown)
                    {
                        controllable = true;
                    }
                    else
                    {
                        foreach (ProtoPartSnapshot proto_part in temp_vessel.protoVessel.protoPartSnapshots)
                        {
                            List <ProtoPartModuleSnapshot> proto_modules = proto_part.modules;
                            ProtoPartModuleSnapshot        module        = null;

                            if (proto_modules != null && (_SETTING_Parachutes && (!_SETTING_Defer_Parachutes_to_StageRecovery || !stageRecoveryInstalled)))
                            {
                                //
                                module = proto_part.modules.Find(p => p.moduleName == "RealChuteModule" ||
                                                                 p.moduleName == "ModuleParachute" ||
                                                                 p.moduleName == "ModuleKrKerbalParachute" ||
                                                                 p.moduleName == "RealChuteFAR");
                                if (module != null)
                                {
                                    controllable = true;
                                }
                            }

                            if (proto_part.protoCrewNames.Count > 0)
                            {
                                controllable = true;
                            }
                        }
                    }
                    foreach (Part p in temp_vessel.Parts)
                    {
                        foreach (PartModule pm in p.Modules)
                        {
                            if (pm.moduleName == "FMRS_PM")
                            {
                                if ((pm as FMRS_PM).parent_vessel != "00000000-0000-0000-0000-000000000000")
                                {
                                    controllable = false;
                                    break;
                                }
                            }
                        }
                        break;
                    }

                    if (controllable)
                    {
#if DEBUG
                        if (Debug_Active)
                        {
                            Log.Info("" + temp_vessel.vesselName + " Found and will be added to the dicts");
                        }
#endif

                        Vessels_dropped.Add(temp_vessel.id, save_file_name);
                        Vessels_dropped_names.Add(temp_vessel.id, temp_vessel.vesselName);
                        Vessel_State.Add(temp_vessel.id, vesselstate.FLY);
                        foreach (Part p in temp_vessel.Parts)
                        {
                            foreach (PartModule pm in p.Modules)
                            {
                                if (pm.moduleName == "FMRS_PM")
                                {
                                    pm.StartCoroutine("setid");
                                }
                            }
                        }

                        foreach (ProtoPartSnapshot part_snapshot in temp_vessel.protoVessel.protoPartSnapshots)
                        {
                            foreach (ProtoCrewMember member in part_snapshot.protoModuleCrew)
                            {
                                if (!Kerbal_dropped.ContainsKey(member.name))
                                {
                                    Kerbal_dropped.Add(member.name, temp_vessel.id);
                                }
                            }
                        }
                        new_vessel_found = true;
                    }
                    Vessels.Add(temp_vessel.id);
                }
            }
#if DEBUG
            // if (Debug_Level_1_Active)
            Log.PopStackInfo("leaving search_for_new_vessels(string save_file_name)");
#endif
            return(new_vessel_found);
        }
        // Turn a burner On or Off
        public void LightBurner(Vessels vessel, bool State)
        {
            if(BurnerCommandSent) { return; }

            int BurnerPin;

            if (vessel == Vessels.HLT) { BurnerPin = hardwareSettings.HLT_Burner_Pin; }
            else if(vessel == Vessels.MLT) { BurnerPin = hardwareSettings.MLT_Burner_Pin; }
            else { BurnerPin = hardwareSettings.BK_Burner_Pin; }
            BurnerCommandSent = true;

            arduino.DigitalWrite(BurnerPin, State);
        }
Exemple #27
0
 public Cocktail(Cocktails id, string name, string color, Vessels vessel, PrepMethods prepMethod, Garnishes garnish,
                 params CocktailIngredient[] recipe) : this(id, name, color, false, vessel, prepMethod, garnish, recipe)
 {
 }