public void PDPNDumpDataEvent()
        {
            Log.Info("PDPNDumpDataEvent");
            Log.Info("storedVesselName: " + storedVesselName);
            Log.Info("vesselType: " + vesselType.ToString());
            Log.Info("priority: " + priority.ToString());
//            Log.Info("vesselId: " + vesselId.ToString());
            Log.Info("needsManualInput: " + needsManualInput.ToString());
            Log.Info("renamed: " + renamed.ToString());
            Log.Info("originalStoredVesselName: " + originalStoredVesselName);
            //Log.Info("originalShipName: " + originalShipName);
            //Log.Info("partOrigVesselGuid: " + partOrigVesselGuid.ToString());
            Log.Info("Constants.pdpnVesselModule.vessel.id: " + pdpnVesselModule.vessel.id.ToString());
        }
        private static string GetLocalizedDescriptionOf(VesselType vesselType)
        {
            FieldInfo info = typeof(VesselType).GetField(vesselType.ToString());

            if (info == null)
            {
                return(vesselType.ToString());
            }
            DescriptionAttribute[] attributes = (DescriptionAttribute[])info.GetCustomAttributes(typeof(DescriptionAttribute), false);
            if ((attributes == null) || (attributes.Length < 1))
            {
                return(vesselType.ToString());
            }
            return(attributes[0].Description);
        }
        public ConfigNode Save(ConfigNode config)
        {
            ConfigNode node = config.AddNode(ConfigNodeName);

            node.AddValue("vesselName", vesselName);
            node.AddValue("vesselType", vesselType.ToString());
            node.AddValue("numCrew", numCrew);
            node.AddValue("numOccupiedParts", numOccupiedParts);

            node.AddValue("lastUpdate", lastUpdate);
            node.AddValue("lastFood", lastFood);
            node.AddValue("lastWater", lastWater);
            node.AddValue("lastOxygen", lastOxygen);
            node.AddValue("lastElectricity", lastElectricity);

            node.AddValue("remainingFood", remainingFood);
            node.AddValue("remainingWater", remainingWater);
            node.AddValue("remainingOxygen", remainingOxygen);
            node.AddValue("remainingElectricity", remainingElectricity);
            node.AddValue("remainingCO2", remainingCO2);
            node.AddValue("remainingWaste", remainingWaste);
            node.AddValue("remainingWasteWater", remainingWasteWater);

            node.AddValue("maxFood", maxFood);
            node.AddValue("maxWater", maxWater);
            node.AddValue("maxOxygen", maxOxygen);
            node.AddValue("maxElectricity", maxElectricity);

            node.AddValue("estimatedElectricityConsumptionRate", estimatedElectricityConsumptionRate);

            node.AddValue("hibernating", hibernating);

            return(node);
        }
Beispiel #4
0
        void onAccept(string name, VesselType vt)
        {
            print("name: " + name + "    VesselType: " + vt.ToString());
            FlightGlobals.ActiveVessel.vesselName = name;

            print("FlightGlobals.ActiveVessel.name: " + FlightGlobals.ActiveVessel.name);
            Events ["ActivateEvent"].active = true;
        }
Beispiel #5
0
        public static void SetVisibility(VesselType vt, bool visible)
        {
            string vtName = vt.ToString();

            for (int i = 0; i < Resources.vesselTypesList.Count; i++)
            {
                if (Resources.vesselTypesList[i].name == vtName)
                {
                    Resources.vesselTypesList[i].visible = visible;
                }
            }
        }
Beispiel #6
0
        public ConfigNode Save(ConfigNode config)
        {
            ConfigNode node = config.AddNode(ConfigNodeName);

            node.AddValue("vesselName", VesselName);
            node.AddValue("vesselType", VesselType.ToString());
            node.AddValue("numCrew", NumCrew);
            node.AddValue("numOccupiedParts", NumOccupiedParts);

            for (int i = 0; i < LoadGlobals.SubsystemArrayCache.Length; i++) // Enum.GetValues(typeof(Subsystem)).Length; i++)
            {
                string nme = ((Subsystem)i).ToString();
                node.AddValue(nme + "Toggle", SubsystemToggle[i]);
                node.AddValue(nme + "Drain", SubsystemDrain[i]);
            }
            for (int i = 0; i < LoadGlobals.GuiSectionArrayCache.Length; i++) // Enum.GetValues(typeof(GUISection)).Length; i++)
            {
                string nme = ((GUISection)i).ToString();
                node.AddValue(nme + "Flag", GuiSectionEnableFlag[i]);
            }

            node.AddValue("managerEnabled", ManagerEnabled);
            node.AddValue("ShowCrew", ShowCrew);
            node.AddValue("ShowParts", ShowParts);
            node.AddValue("hibernating", Hibernating);
            node.AddValue("EmgcyShutActive", EmgcyShutActive);
            node.AddValue("AutoPilotDisabled", AutoPilotDisabled);
            node.AddValue("AutoPilotDisTime", AutoPilotDisTime);
            node.AddValue("AutoPilotDisCounter", AutoPilotDisCounter);
            node.AddValue("timeLastElectricity", TimeLastElectricity);
            node.AddValue("lastUpdate", LastUpdate);
            node.AddValue("EmgcyShutOverride", EmgcyShutOverride);
            node.AddValue("EmgcyShutOverrideStarted", EmgcyShutOverrideStarted);
            node.AddValue("Emergencypowerdownactivated", Emergencypowerdownactivated);
            node.AddValue("Emergencypowerdownreset", Emergencypowerdownreset);
            node.AddValue("Emergencypowerdownprevactivated", Emergencypowerdownprevactivated);
            node.AddValue("Emergencypowerdownresetprevactivated", Emergencypowerdownresetprevactivated);
            node.AddValue("ESPPriorityHighProcessed", ESPPriorityHighProcessed);
            node.AddValue("ESPPriorityMediumProcessed", ESPPriorityMediumProcessed);
            node.AddValue("ESPPriorityLowProcessed", ESPPriorityLowProcessed);
            node.AddValue("ESPPriorityHighResetProcessed", ESPPriorityHighResetProcessed);
            node.AddValue("ESPPriorityMediumResetProcessed", ESPPriorityMediumResetProcessed);
            node.AddValue("ESPPriorityLowResetProcessed", ESPPriorityLowResetProcessed);
            node.AddValue("EspPriority", (int)EspPriority);
            node.AddValue("ReenableRcs", ReenableRcs);
            node.AddValue("ReenableSas", ReenableSas);
            node.AddValue("IsolateReservePower", IsolateReservePower);

            return(node);
        }
Beispiel #7
0
        static int getVesselType(VesselType v)
        {
            int cnt = 0;

            //for (int cnt = vtypes.Length - 1; cnt >= 0; --cnt)
            //{
            foreach (string s in vtypes)
            {
                if (v.ToString() == s)
                {
                    return(cnt);
                }
                cnt++;
            }
            return(0);
        }
        public void FixedUpdate()
        {
            if (vesselType == VesselType.Unknown)
            {
                Part p = Utils.getModulePartParent(this);
                if (p != null)
                {
                    vesselType = p.vesselType;

                    Log.Info("FixedUpdate  vesselType: " + vesselType.ToString() +
                             "  name: " + Utils.getModulePartParent(this).name);
                }
            }

            if (HighLogic.LoadedSceneIsFlight)
            {
                //Log.Info ("FixedUpdate partOrigVesselGuid: " + partOrigVesselGuid.ToString () + " id: " + FlightGlobals.ActiveVessel.id.ToString () + " needsManualInput: " + needsManualInput.ToString ()  + " p.partName: " + this.name +" ActiveVessel.vesselName: " + FlightGlobals.ActiveVessel.vesselName);
                //if (FlightGlobals.ActiveVessel.id == Utils.getCurrentVessel (this).id) {
                if (Utils.getCurrentVessel(this).isActiveVessel)
                {
                    if (needsManualInput)
                    {
                        Log.Info("FixedUpdate: needsManualInput: " + vessel.vesselName);
                        Log.Info("FixedUpdate");
                        Log.Info("ActiveVessel.id: " + FlightGlobals.ActiveVessel.id.ToString());
                        Log.Info("Active vessel: " + Utils.getCurrentVessel(this).vesselName);
                        Log.Info("storedVesselName: " + storedVesselName);
                        Log.Info("vesselType: " + vesselType.ToString());
                        Log.Info("priority: " + priority.ToString());
                        Log.Info("needsManualInput: " + needsManualInput.ToString());
                        Log.Info("p.partName: " + this.name);

                        string s = PDPN_SelectionWindow.formatManualEntryName(Utils.getActiveCommandPodModule(vessel.parts), vessel.vesselName, false, true, originalStoredVesselName);
                        if (s != "")
                        {
                            vessel.vesselName = s;
                        }
                        PDPN_SelectionWindow.flightReady = true;
                        PDPN_SelectionWindow.physicsCnt  = 0;
                        needsManualInput         = false;
                        pdpnVesselModule.renamed = true;
                    }
                }
            }
        }
Beispiel #9
0
        internal ConfigNode Save(ConfigNode config)
        {
            ConfigNode node = config.AddNode(ConfigNodeName);

            node.AddValue("vesselName", vesselName);
            node.AddValue("vesselType", vesselType.ToString());
            node.AddValue("numSeats", numSeats);
            node.AddValue("numCrew", numCrew);
            node.AddValue("numOccupiedParts", numOccupiedParts);
            node.AddValue("numFrznCrew", numFrznCrew);
            node.AddValue("hibernating", hibernating);
            node.AddValue("hasextDoor", hasextDoor);
            node.AddValue("hasextPod", hasextPod);
            node.AddValue("lastUpdate", lastUpdate);
            node.AddValue("storedEC", storedEC);
            node.AddValue("predictedECOut", predictedECOut);
            return(node);
        }
        void onAccept(string name, VesselType vt)
        {
            print ("name: " + name + "    VesselType: " + vt.ToString ());
            FlightGlobals.ActiveVessel.vesselName = name;

            print ("FlightGlobals.ActiveVessel.name: " + FlightGlobals.ActiveVessel.name);
            Events ["ActivateEvent"].active = true;
        }
Beispiel #11
0
 /// <summary>
 /// Returns the VesselType
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return(VesselType.ToString());
 }
 private string IDGenerator(VesselType vesselType, EntityType entityType, int index)
 {
     return(entityType.ToString() + vesselType.ToString() + "_" + index);
 }
        public override void ModuleWindow(int id)
        {
            if (this.core.AllVesselTypes.Length < 1)
            {
                return;
            }

            if (selectedBodyIdx >= this.core.SortedBodyList.Count)
            {
                selectedBodyIdx.value %= this.core.SortedBodyList.Count;
            }

            if (selectedBodyIdx < 0)
            {
                selectedBodyIdx.value += this.core.SortedBodyList.Count;
            }

            GUILayout.BeginVertical();

            GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
            if (GUILayout.Button("<"))
            {
                selectedBodyIdx.value--;
                if (selectedBodyIdx < 0)
                {
                    selectedBodyIdx.value = this.core.SortedBodyList.Count - 1;
                }
            }
            GUILayout.Label(this.core.SortedBodyList[selectedBodyIdx].bodyName, VOID_Styles.labelCenterBold, GUILayout.ExpandWidth(true));
            if (GUILayout.Button(">"))
            {
                selectedBodyIdx.value++;
                if (selectedBodyIdx > this.core.SortedBodyList.Count - 1)
                {
                    selectedBodyIdx.value = 0;
                }
            }
            GUILayout.EndHorizontal();

            seletedBody = this.core.SortedBodyList[selectedBodyIdx];

            GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
            if (GUILayout.Button("<"))
            {
                selectedVesselTypeIdx.value--;
                if (selectedVesselTypeIdx < 0)
                {
                    selectedVesselTypeIdx.value = this.core.AllVesselTypes.Length - 1;
                }
            }
            GUILayout.Label(this.core.AllVesselTypes[selectedVesselTypeIdx].ToString(), VOID_Styles.labelCenterBold, GUILayout.ExpandWidth(true));
            if (GUILayout.Button(">"))
            {
                selectedVesselTypeIdx.value++;
                if (selectedVesselTypeIdx > this.core.AllVesselTypes.Length - 1)
                {
                    selectedVesselTypeIdx.value = 0;
                }
            }
            GUILayout.EndHorizontal();

            selectedVesselType = this.core.AllVesselTypes[selectedVesselTypeIdx];

            GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
            if (GUILayout.Button("Landed", GUILayout.ExpandWidth(true)))
            {
                vesselSituation = "Landed";
            }
            if (GUILayout.Button("Orbiting", GUILayout.ExpandWidth(true)))
            {
                vesselSituation = "Orbiting";
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
            GUILayout.Label(
                VOID_Tools.UppercaseFirst(vesselSituation) + " " + selectedVesselType.ToString() + "s  @ " + seletedBody.bodyName,
                VOID_Styles.labelCenter,
                GUILayout.ExpandWidth(true));
            GUILayout.EndHorizontal();

            selectorScrollPos = GUILayout.BeginScrollView(selectorScrollPos, false, false);

            Vessel v;

            for (int idx = 0; idx < FlightGlobals.Vessels.Count; idx++)
            {
                v = FlightGlobals.Vessels[idx];

                if (v != Vessel && v.vesselType == selectedVesselType && v.mainBody == seletedBody)
                {
                    if ((vesselSituation == "Landed" &&
                         (v.situation == Vessel.Situations.LANDED ||
                          v.situation == Vessel.Situations.PRELAUNCH ||
                          v.situation == Vessel.Situations.SPLASHED)) ||
                        (vesselSituation == "Orbiting" &&
                         (v.situation == Vessel.Situations.ESCAPING ||
                          v.situation == Vessel.Situations.FLYING ||
                          v.situation == Vessel.Situations.ORBITING ||
                          v.situation == Vessel.Situations.SUB_ORBITAL))
                        )
                    {
                        if (GUILayout.Button(v.vesselName, GUILayout.ExpandWidth(true)))
                        {
                            if (_selectedVessel != v)
                            {
                                _selectedVessel = v;                                 //set clicked vessel as selected_vessel
                                this.Active     = true;                              //turn bool on to open the window if closed
                            }
                            else
                            {
                                _selectedVessel = null;
                            }
                        }
                    }
                }
            }

            GUILayout.EndScrollView();

            GUILayout.EndVertical();

            base.ModuleWindow(id);
        }