Exemplo n.º 1
0
 void Start()
 {
     Log.Info("FMRS_Register.Start");
     if (RecoveryControllerWrapper.RecoveryControllerAvailable)
     {
         var o = RecoveryControllerWrapper.RegisterMod("FMRS");
         Log.Info("RecoveryControllerWrapper.RegisterMod: " + o.ToString());
     }
 }
Exemplo n.º 2
0
 void Start()
 {
     Log.info("FMRS_Register.Start");
     if (RecoveryControllerWrapper.RecoveryControllerAvailable)
     {
         var o = RecoveryControllerWrapper.RegisterMod("FMRS");
         Log.info("RecoveryControllerWrapper.RegisterMod: {0}", o);
     }
 }
Exemplo n.º 3
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);
        }