Example #1
0
 public override void OnLoad(ConfigNode node)
 {
     if (CompatibilityChecker.IsWin64())
     {
         return;
     }
     control.Load(node);
     if (node.HasValue("baseMass"))
     {
         float.TryParse(node.GetValue("baseMass"), out base_mass);
     }
     else
     {
         base_mass = base.part.mass;
     }
 }
Example #2
0
 public override void OnStart(StartState state)
 {
     if (CompatibilityChecker.IsWin64())
     {
         return;
     }
     RecycleField = part.FindModelComponent <Collider> (RecycleField_name);
     Debug.Log(String.Format("[EL Recycler] OnStart: {0}", RecycleField));
     if (RecycleField != null)
     {
         RecycleField.enabled = false;
     }
     if (state == PartModule.StartState.None ||
         state == PartModule.StartState.Editor)
     {
         return;
     }
     sm.Start(RecycleField);
 }
Example #3
0
        void OnGUI()
        {
            if (CompatibilityChecker.IsWin64())
            {
                return;
            }
            GUI.skin = HighLogic.Skin;
            string name = "Extraplanetary Launchpad";
            string ver  = ExSettings.GetVersion();
            string sit  = control.builder.vessel.situation.ToString();

            windowpos = GUILayout.Window(GetInstanceID(),
                                         windowpos, WindowGUI,
                                         name + " " + ver + ": " + sit,
                                         GUILayout.Width(640));
            if (craftlist != null)
            {
                craftlist.OnGUI();
            }
        }
Example #4
0
 public override void OnStart(PartModule.StartState state)
 {
     if (CompatibilityChecker.IsWin64())
     {
         Events["HideUI"].active = false;
         Events["ShowUI"].active = false;
         return;
     }
     if (state == PartModule.StartState.None ||
         state == PartModule.StartState.Editor)
     {
         return;
     }
     control.OnStart();
     GameEvents.onVesselSituationChange.Add(onVesselSituationChange);
     GameEvents.onCrewTransferred.Add(onCrewTransferred);
     StartCoroutine(WaitAndDetermineRange());
     ExSurveyTracker.onSiteAdded.Add(onSiteAdded);
     ExSurveyTracker.onSiteRemoved.Add(onSiteRemoved);
     ExSurveyTracker.onSiteModified.Add(onSiteModified);
 }
 public override void OnLoad(ConfigNode node)
 {
     if (CompatibilityChecker.IsWin64())
     {
         return;
     }
     if (HighLogic.LoadedScene == GameScenes.FLIGHT)
     {
         Debug.Log(String.Format("[EL Workshop] {0} cap: {1} seats: {2}",
                                 part, part.CrewCapacity,
                                 part.FindModulesImplementing <KerbalSeat> ().Count));
         if (IgnoreCrewCapacity || part.CrewCapacity > 0)
         {
             GameEvents.onCrewTransferred.Add(onCrewTransferred);
             GameEvents.onVesselWasModified.Add(onVesselWasModified);
             functional = true;
         }
         else if (part.FindModulesImplementing <KerbalSeat> ().Count > 0)
         {
             GameEvents.onPartCouple.Add(onPartCouple);
             GameEvents.onPartUndock.Add(onPartUndock);
             GameEvents.onVesselWasModified.Add(onVesselWasModified);
             functional = true;
         }
         else
         {
             functional = false;
             Fields["Productivity"].guiActive       = false;
             Fields["VesselProductivity"].guiActive = false;
         }
     }
     if (node.HasValue("lastUpdateString"))
     {
         double.TryParse(node.GetValue("lastUpdateString"), out lastUpdate);
     }
 }
Example #6
0
 public void Save(ConfigNode node)
 {
     if (CompatibilityChecker.IsWin64())
     {
         return;
     }
     if (recycle_parts != null)
     {
         var rp = recycle_parts.Select(s => s.ToString()).ToArray();
         node.AddValue("recycle_parts", String.Join(" ", rp));
     }
     if (part_resources != null)
     {
         foreach (var res in part_resources)
         {
             var pr = node.AddNode("part_resource");
             res.Save(pr);
         }
     }
     if (fsm.CurrentState != null)
     {
         node.AddValue("state", fsm.CurrentState.name);
     }
 }
        public override void OnLoad(ConfigNode config)
        {
            //Debug.Log (String.Format ("[EL] Settings load"));
            var settings = config.GetNode("Settings");

            if (settings == null)
            {
                settings    = new ConfigNode("Settings");
                gui_enabled = true;                 // Show settings window on first startup
            }
            if (!settings.HasValue("UseKAC"))
            {
                var val = use_KAC;
                settings.AddValue("UseKAC", val);
            }
            if (!settings.HasValue("KACAction"))
            {
                var val = KACAction.ToString();
                settings.AddValue("KACAction", val);
            }

            var  uks = settings.GetValue("UseKAC");
            bool uk  = true;

            bool.TryParse(uks, out uk);
            use_KAC = uk;

            string str = settings.GetValue("KACAction");

            switch (str)
            {
            case ("KillWarp"):
                KACAction = KACWrapper.KACAPI.AlarmActionEnum.KillWarp;
                break;

            case ("KillWarpOnly"):
                KACAction = KACWrapper.KACAPI.AlarmActionEnum.KillWarpOnly;
                break;

            case ("MessageOnly"):
                KACAction = KACWrapper.KACAPI.AlarmActionEnum.MessageOnly;
                break;

            case ("PauseGame"):
                KACAction = KACWrapper.KACAPI.AlarmActionEnum.PauseGame;
                break;

            default:
                KACAction = KACWrapper.KACAPI.AlarmActionEnum.KillWarp;
                break;
            }
            ;

            if (settings.HasNode("ShipInfo"))
            {
                var node = settings.GetNode("ShipInfo");
                ExShipInfo.LoadSettings(node);
            }

            if (settings.HasNode("BuildWindow"))
            {
                var node = settings.GetNode("BuildWindow");
                ExBuildWindow.LoadSettings(node);
            }

            if (CompatibilityChecker.IsWin64())
            {
                enabled = false;
            }
            else
            {
                if (HighLogic.LoadedScene == GameScenes.SPACECENTER)
                {
                    enabled = true;
                }
            }
        }