Example #1
0
        public void LateUpdate()
        {
            FARAeroUtil.ResetEditorParts();
            FARBaseAerodynamics.GlobalCoLReady = false;

            if (EditorLogic.fetch)
            {
                if (editorGUI == null)
                {
                    editorGUI = new FAREditorGUI();
                    //editorGUI.LoadGUIParameters();
                    editorGUI.RestartCtrlGUI();
                }
                if (EditorLogic.startPod != null)
                {
                    var editorShip = FARAeroUtil.AllEditorParts;


                    if (FARAeroUtil.EditorAboutToAttach() && count++ >= 10)
                    {
                        EditorPartsChanged = true;
                        count = 0;
                    }

                    if (part_count_all != editorShip.Count || part_count_ship != EditorLogic.SortedShipList.Count || EditorPartsChanged)
                    {
                        FindPartsWithoutFARModel(editorShip);
                        foreach (Part p in editorShip)
                        {
                            foreach (PartModule m in p.Modules)
                            {
                                if (m is FARBaseAerodynamics)
                                {
                                    (m as FARBaseAerodynamics).ClearShielding();
                                }
                            }
                        }

                        foreach (Part p in editorShip)
                        {
                            foreach (PartModule m in p.Modules)
                            {
                                if (m is FARPartModule)
                                {
                                    (m as FARPartModule).ForceOnVesselPartsChange();
                                }
                            }
                        }

                        part_count_all     = editorShip.Count;
                        part_count_ship    = EditorLogic.SortedShipList.Count;
                        EditorPartsChanged = false;
                    }
                }
            }
        }
Example #2
0
        public void LateUpdate()
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                return;
            }

            FARAeroUtil.ResetEditorParts();
            FARBaseAerodynamics.GlobalCoLReady = false;

            if (EditorLogic.fetch)
            {
                if (editorGUI == null)
                {
                    editorGUI = new FAREditorGUI();
                    //editorGUI.LoadGUIParameters();
                    editorGUI.RestartCtrlGUI();
                    GameEvents.onEditorUndo.Add(editorGUI.ResetAll);
                    GameEvents.onEditorRedo.Add(editorGUI.ResetAll);
                }
                if (EditorLogic.RootPart != null)
                {
                    editorShip = FARAeroUtil.AllEditorParts;

                    if (buttonsNeedInitializing)
                    {
                        InitializeButtons();
                    }

                    /*if (EditorLogic.RootPart != lastRootPart)
                     * {
                     *  lastRootPart = EditorLogic.RootPart;
                     *  EditorPartsChanged = true;
                     * }*/

                    if (FARAeroUtil.EditorAboutToAttach() && count++ >= 20)
                    {
                        EditorPartsChanged = true;
                        count = 0;
                    }

                    if (part_count_all != editorShip.Count || part_count_ship != EditorLogic.SortedShipList.Count || EditorPartsChanged)
                    {
                        UpdateEditorShipModules();
                    }
                }
                else if (!buttonsNeedInitializing)
                {
                    DestroyButtons();
                }
            }
        }
        public static void SaveConfigs()
        {
            config.SetValue("displayForces", FARDebugValues.displayForces.ToString());
            config.SetValue("displayCoefficients", FARDebugValues.displayCoefficients.ToString());
            config.SetValue("displayShielding", FARDebugValues.displayShielding.ToString());

            config.SetValue("useSplinesForSupersonicMath", FARDebugValues.useSplinesForSupersonicMath.ToString());
            config.SetValue("allowStructuralFailures", FARDebugValues.allowStructuralFailures.ToString());

            config.SetValue("useBlizzyToolbar", FARDebugValues.useBlizzyToolbar.ToString());

            FARDebugValues.useBlizzyToolbar &= ToolbarManager.ToolbarAvailable;

            FARAeroUtil.SaveCustomAeroDataToConfig();
            FARPartClassification.SaveCustomClassificationTemplates();
            FARAeroStress.SaveCustomStressTemplates();
            FARActionGroupConfiguration.SaveConfigruration();
            FAREditorGUI.SaveCustomColors();
            config.save();
        }
        public static void LoadConfigs()
        {
            config = KSP.IO.PluginConfiguration.CreateForType <FARDebugOptions>();
            config.load();
            FARDebugValues.displayForces               = Convert.ToBoolean(config.GetValue("displayForces", "false"));
            FARDebugValues.displayCoefficients         = Convert.ToBoolean(config.GetValue("displayCoefficients", "false"));
            FARDebugValues.displayShielding            = Convert.ToBoolean(config.GetValue("displayShielding", "false"));
            FARDebugValues.useSplinesForSupersonicMath = Convert.ToBoolean(config.GetValue("useSplinesForSupersonicMath", "true"));
            FARDebugValues.allowStructuralFailures     = Convert.ToBoolean(config.GetValue("allowStructuralFailures", "true"));

            FARDebugValues.useBlizzyToolbar = Convert.ToBoolean(config.GetValue("useBlizzyToolbar", "false"));

            FARAeroStress.LoadStressTemplates();
            FARPartClassification.LoadClassificationTemplates();
            FARAeroUtil.LoadAeroDataFromConfig();
            FARActionGroupConfiguration.LoadConfiguration();
            FAREditorGUI.LoadColors();
            ReColorTexture(ref FAREditorGUI.clColor, ref cLTexture);
            ReColorTexture(ref FAREditorGUI.cdColor, ref cDTexture);
            ReColorTexture(ref FAREditorGUI.cmColor, ref cMTexture);
            ReColorTexture(ref FAREditorGUI.l_DColor, ref l_DTexture);
        }
        public void LateUpdate()
        {
            if (!CompatibilityChecker.IsAllCompatible())
            {
                return;
            }

            FARAeroUtil.ResetEditorParts();
            FARBaseAerodynamics.GlobalCoLReady = false;

            if (EditorLogic.fetch)
            {
                if (editorGUI == null)
                {
                    editorGUI = new FAREditorGUI();
                    //editorGUI.LoadGUIParameters();
                    editorGUI.RestartCtrlGUI();
                }
                if (EditorLogic.startPod != null)
                {
                    var editorShip = FARAeroUtil.AllEditorParts;


                    if (FARAeroUtil.EditorAboutToAttach() && count++ >= 10)
                    {
                        EditorPartsChanged = true;
                        count = 0;
                    }

                    if (part_count_all != editorShip.Count || part_count_ship != EditorLogic.SortedShipList.Count || EditorPartsChanged)
                    {
                        FindPartsWithoutFARModel(editorShip);
                        for (int i = 0; i < editorShip.Count; i++)
                        {
                            Part p = editorShip[i];
                            for (int j = 0; j < p.Modules.Count; j++)
                            {
                                PartModule m = p.Modules[j];
                                if (m is FARBaseAerodynamics)
                                {
                                    (m as FARBaseAerodynamics).ClearShielding();
                                }
                            }
                        }

                        for (int i = 0; i < editorShip.Count; i++)
                        {
                            Part p = editorShip[i];
                            for (int j = 0; j < p.Modules.Count; j++)
                            {
                                PartModule m = p.Modules[j];
                                if (m is FARPartModule)
                                {
                                    (m as FARPartModule).ForceOnVesselPartsChange();
                                }
                            }
                        }
                        part_count_all     = editorShip.Count;
                        part_count_ship    = EditorLogic.SortedShipList.Count;
                        EditorPartsChanged = false;
                    }
                }
            }
        }