diff --git a/AGExt/AGExt.csproj b/AGExt/AGExt.csproj index 5c0ad77..a7ffc5a 100644 --- a/AGExt/AGExt.csproj +++ b/AGExt/AGExt.csproj @@ -25,30 +25,18 @@ pdbonly false - ..\..\..\1.1 Dev\GameData\Diazo\AGExt\ + ..\..\..\1.2 Dev\GameData\Diazo\AGExt\ TRACE prompt 4 - ..\..\..\1.1 Dev\KSP_x64_Data\Managed\Assembly-CSharp.dll + ..\..\..\1.2 Dev\KSP_x64_Data\Managed\Assembly-CSharp.dll False - ..\..\..\1.1 Dev\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll - False - - - ..\..\..\1.1 Dev\KSP_x64_Data\Managed\KSPAssets.dll - False - - - ..\..\..\1.1 Dev\KSP_x64_Data\Managed\KSPCore.dll - False - - - ..\..\..\1.1 Dev\KSP_x64_Data\Managed\KSPUtil.dll + ..\..\..\1.2 Dev\KSP_x64_Data\Managed\Assembly-CSharp-firstpass.dll False @@ -58,11 +46,11 @@ - ..\..\..\1.1 Dev\KSP_x64_Data\Managed\UnityEngine.dll + ..\..\..\1.2 Dev\KSP_x64_Data\Managed\UnityEngine.dll False - ..\..\..\1.1 Dev\KSP_x64_Data\Managed\UnityEngine.UI.dll + ..\..\..\1.2 Dev\KSP_x64_Data\Managed\UnityEngine.UI.dll False diff --git a/AGExt/CommonMethods.cs b/AGExt/CommonMethods.cs index 4c1cbb3..92fbb10 100644 --- a/AGExt/CommonMethods.cs +++ b/AGExt/CommonMethods.cs @@ -1079,7 +1079,8 @@ public static AGXAction LoadAGXActionVer2(ConfigNode actNode, Part actPart, bool foreach (PartModule pmSensor in actPart.Modules.OfType()) { ModuleEnviroSensor mesSensor = (ModuleEnviroSensor)pmSensor; - if (mesSensor.sensorType == sensorType) + if (mesSensor.sensorType.ToString() == sensorType) //.sensorType changed from String to Enum in KSP 1.2, did not change save code as this should never run per note above + { actsToCompare.AddRange(mesSensor.Actions); } diff --git a/AGExt/Editor.cs b/AGExt/Editor.cs index ac9c3aa..8dda018 100644 --- a/AGExt/Editor.cs +++ b/AGExt/Editor.cs @@ -339,7 +339,7 @@ public void Start() //print("b"); if ((string)AGExtNode.GetValue("OverrideCareer") == "1") { - //print("c"); + //print("AGX 0"); showCareerCustomAGs = true; showCareerStockAGs = true; } @@ -362,19 +362,19 @@ public void Start() if (GameVariables.Instance.UnlockedActionGroupsCustom(facilityLevel, inVAB)) { - // print("g"); + //print("AGX 1"); showCareerStockAGs = true; showCareerCustomAGs = true; } else if (GameVariables.Instance.UnlockedActionGroupsStock(facilityLevel, inVAB)) { - //print("h"); + //print("AGX 2"); showCareerStockAGs = true; showCareerCustomAGs = false; } else { - //print("i"); + //print("AGX 3"); showCareerStockAGs = false; showCareerCustomAGs = false; } @@ -765,43 +765,49 @@ public void onLeftButtonClick() //Debug.Log("AGX nods editor" + EditorLogic.fetch.editorScreen); try { - if (EditorLogic.fetch.editorScreen != EditorScreen.Actions) + if (showCareerStockAGs) { - if (EditorLogic.SortedShipList.Count > 0) + if (EditorLogic.fetch.editorScreen != EditorScreen.Actions) { - EditorLogic.fetch.SelectPanelActions(); - } - //Debug.Log("AGX no editor"); - //if (EditorLogic.SortedShipList.Count > 0 && showCareerStockAGs) - //{ + if (EditorLogic.SortedShipList.Count > 0) + { + EditorLogic.fetch.SelectPanelActions(); + } + //Debug.Log("AGX no editor"); + //if (EditorLogic.SortedShipList.Count > 0 && showCareerStockAGs) + //{ - // EditorLogic.fetch.SelectPanelActions(); - // StartCoroutine("DelayPanelsMovement"); - //} + // EditorLogic.fetch.SelectPanelActions(); + // StartCoroutine("DelayPanelsMovement"); + //} - } - else - { - //Debug.Log("AGX iseditor"); - if (AGXShow) - { - //UIPanelList.First().Translate(new Vector3(500f, 0, 0), UIPanelList.First().parent.transform); //hide UI panel - AGXShow = false; - AGExtNode.SetValue("EditShow", "0"); - //EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions); - //StartCoroutine("DelayPanelsMovement"); } else { - // UIPanelList.First().Translate(new Vector3(-500f, 0, 0), UIPanelList.First().parent.transform); //show UI panel - AGXShow = true; - AGExtNode.SetValue("EditShow", "1"); - //EditorPanels.Instance.panelManager.Dismiss(); - //StartCoroutine("DelayPanelsMovement"); + //Debug.Log("AGX iseditor"); + if (AGXShow) + { + //UIPanelList.First().Translate(new Vector3(500f, 0, 0), UIPanelList.First().parent.transform); //hide UI panel + AGXShow = false; + AGExtNode.SetValue("EditShow", "0"); + //EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions); + //StartCoroutine("DelayPanelsMovement"); + } + else + { + // UIPanelList.First().Translate(new Vector3(-500f, 0, 0), UIPanelList.First().parent.transform); //show UI panel + AGXShow = true; + AGExtNode.SetValue("EditShow", "1"); + //EditorPanels.Instance.panelManager.Dismiss(); + //StartCoroutine("DelayPanelsMovement"); + } + AGXStaticData.SaveBaseConfigNode(AGExtNode); } - AGXStaticData.SaveBaseConfigNode(AGExtNode); } - + else + { + ScreenMessages.PostScreenMessage("Action Groups Unavailable. Facility Upgrade Required."); + } } catch { @@ -836,7 +842,12 @@ public void PartAttaching(GameEvents.HostTargetAction host_target) // ErrLine = "5"; // } ErrLine = "6"; - + //Debug.Log("AGX 1 " + host_target.host.name); + //Debug.Log("AGX 2 " + host_target.host.Modules.Count); + //foreach(PartModule pm in host_target.host.Modules) + //{ + // Debug.Log("AGX 3 " + pm.moduleName); + //} ErrLine = "7"; ModuleAGX agxMod = host_target.host.Modules.OfType().First(); ErrLine = "8"; @@ -1133,11 +1144,11 @@ public static void LoadGroupVisibility(string LoadString) //} - public void OnActionButtonClick(IUIObject obj) //reset EditorPanel if needed, note AGX button on toolbar hooks this method as well - { - //Debug.Log("act button click"); - StartCoroutine("DelayPanelsMovement"); - } + //public void OnActionButtonClick(IUIObject obj) //reset EditorPanel if needed, note AGX button on toolbar hooks this method as well + //{ + // //Debug.Log("act button click"); + // StartCoroutine("DelayPanelsMovement"); + //} public void ImmediatePanelsMovement() { @@ -1250,11 +1261,11 @@ public void ActualPanelsMovement() } - public void OnPartButtonClick(IUIObject obj) //reset EditorPanel if needed - { - //Debug.Log("Part button click"); - StartCoroutine("DelayPanelsMovement"); - } + //public void OnPartButtonClick(IUIObject obj) //reset EditorPanel if needed + //{ + // //Debug.Log("Part button click"); + // StartCoroutine("DelayPanelsMovement"); + //} //public void OnPartButtonClick(IUIObject obj) //reset EditorPanel if needed //{ // if(agxWindowsShowing) @@ -1268,57 +1279,57 @@ public void ActualPanelsMovement() // EditorLogic.fetch.SetBackup(); //} - public void OnCrewButtonClick(IUIObject obj) //reset EditorPanel if needed - { - StartCoroutine("DelayPanelsMovement"); - } + //public void OnCrewButtonClick(IUIObject obj) //reset EditorPanel if needed + //{ + // StartCoroutine("DelayPanelsMovement"); + //} - public void OnLoadClick(IUIObject obj) //reset EditorPanel if needed - { - if (EditorLogic.fetch.editorScreen == EditorScreen.Actions) - { - EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions); - } - //StartCoroutine("DelayPanelsMovement"); - } + //public void OnLoadClick(IUIObject obj) //reset EditorPanel if needed + //{ + // if (EditorLogic.fetch.editorScreen == EditorScreen.Actions) + // { + // EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions); + // } + // //StartCoroutine("DelayPanelsMovement"); + //} - public void OnSaveButtonClick(IUIObject obj) //reset EditorPanel if needed - { - //save button actually doesn't affect the visible UI, do nothing - } + //public void OnSaveButtonClick(IUIObject obj) //reset EditorPanel if needed + //{ + // //save button actually doesn't affect the visible UI, do nothing + //} - public void OnLaunchButtonClick(IUIObject obj) //reset EditorPanel if needed - { - if (EditorLogic.fetch.editorScreen == EditorScreen.Actions) - { - EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions); - } - //StartCoroutine("DelayPanelsMovement"); - } + //public void OnLaunchButtonClick(IUIObject obj) //reset EditorPanel if needed + //{ + // if (EditorLogic.fetch.editorScreen == EditorScreen.Actions) + // { + // EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions); + // } + // //StartCoroutine("DelayPanelsMovement"); + //} - public void OnExitButtonClick(IUIObject obj) //reset EditorPanel if needed - { - if (EditorLogic.fetch.editorScreen == EditorScreen.Actions) - { - EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions); - } - // StartCoroutine("DelayPanelsMovement"); + //public void OnExitButtonClick(IUIObject obj) //reset EditorPanel if needed + //{ + // if (EditorLogic.fetch.editorScreen == EditorScreen.Actions) + // { + // EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions); + // } + // // StartCoroutine("DelayPanelsMovement"); - } + //} - public void OnNewButtonClick(IUIObject obj) //reset EditorPanel if needed - { - if(EditorLogic.fetch.editorScreen == EditorScreen.Actions) - { - EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions); - } - //StartCoroutine("DelayPanelsMovement"); - } + //public void OnNewButtonClick(IUIObject obj) //reset EditorPanel if needed + //{ + // if(EditorLogic.fetch.editorScreen == EditorScreen.Actions) + // { + // EditorPanels.Instance.panelManager.BringIn(EditorPanels.Instance.actions); + // } + // //StartCoroutine("DelayPanelsMovement"); + //} - public void OnActionPanelsUIChanged(IUIObject obj) //reset EditorPanel if needed - { - //StartCoroutine("DelayPanelsMovement"); - } + //public void OnActionPanelsUIChanged(IUIObject obj) //reset EditorPanel if needed + //{ + // //StartCoroutine("DelayPanelsMovement"); + //} //public void OnOtherButtonClick(IUIObject obj) //reset EditorPanel if needed //{ @@ -1500,24 +1511,36 @@ public void LeavingEditor(GameScenes gScn) public void OnDisable() { - + string errLine = "1"; + try + { LoadFinished = false; + errLine = "2"; SaveCurrentKeyBindings(); + errLine = "3"; SaveWindowPositions(); + errLine = "4"; if (ToolbarManager.ToolbarAvailable) //if toolbar loaded, destroy button on leaving scene { + errLine = "5"; AGXBtn.Destroy(); } else { + errLine = "6"; ApplicationLauncher.Instance.RemoveModApplication(AGXAppEditorButton); } //EditorSaveToFile(); //some of my data has already been deleted by this point + errLine = "7"; GameEvents.onPartAttach.Remove(PartAttaching); + errLine = "8"; GameEvents.onPartRemove.Remove(PartRemove); + errLine = "9"; GameEvents.onEditorPartEvent.Remove(OnPartEvent); + errLine = "10"; //GameEvents.onEditorShipModified.Remove(VesselChanged); GameEvents.onEditorLoad.Remove(OnShipLoad); + errLine = "11"; //GameEvents.onGameStateSave.Remove(OnSaveTest); //GameEvents.onGameSceneLoadRequested.Remove(LeavingEditor); //GameEvents.onEditorLoad(OnEditorLoadCall); @@ -1541,8 +1564,16 @@ public void OnDisable() //EditorLogic.fetch.launchBtn.RemoveValueChangedDelegate(OnLaunchButtonClick); //EditorLogic.fetch.exitBtn.RemoveValueChangedDelegate(OnExitButtonClick); //EditorLogic.fetch.newBtn.RemoveValueChangedDelegate(OnNewButtonClick); - EditorLogic.fetch.Unlock("AGXLock"); + //EditorLogic.fetch.Unlock("AGXLock"); + InputLockManager.RemoveControlLock("AGXLock"); + errLine = "12"; StaticData.CurrentVesselActions.Clear(); + errLine = "13"; + } + catch(Exception e) + { + Debug.Log("AGX Editor.OnDestroy " + errLine + "|" + e); + } } diff --git a/AGExt/Flight.cs b/AGExt/Flight.cs index 7adc352..4291b78 100644 --- a/AGExt/Flight.cs +++ b/AGExt/Flight.cs @@ -234,7 +234,14 @@ public void onRightButtonStockClick() public void onLeftButtonClick() { - ShowAGXMod = !ShowAGXMod; + if (showCareerStockAGs) + { + ShowAGXMod = !ShowAGXMod; + } + else + { + ScreenMessages.PostScreenMessage("Action Groups Unavailable. VAB/SPH Facility Upgrade Required."); + } } public void RefreshDefaultActionsListType() @@ -4871,7 +4878,11 @@ public void Update() foreach (Part p in rootAGX.vessel.parts) { errLine = "7h14"; - missionIDs.Add(p.missionID); + if (!p.Modules.Contains("KerbalEVA")) + { + errLine = "7h14a"; + missionIDs.Add(p.missionID); + } } // Debug.Log("agx not root " + missionIDs.Count); errLine = "7h15"; @@ -7682,22 +7693,6 @@ public static List CheckActionsActiveActualCode(List actsL } } - if (agAct.ba.listParent.module.moduleName == "ModuleWheelActions") - { - agAct.activated = true; - foreach (ModuleWheel mWheel in agAct.ba.listParent.part.Modules.OfType()) - { - BaseAction whlBrakes = mWheel.Actions.Find(ba => ba.name == "BrakesAction"); - if ((whlBrakes.actionGroup & KSPActionGroup.Brakes) == KSPActionGroup.Brakes) - { - agAct.activated = true; - } - else - { - agAct.activated = false; - } - } - } if (agAct.ba.listParent.module.moduleName == "USI_ModuleAsteroidDrill") { agAct.activated = false; diff --git a/AGExt/Instantly.cs b/AGExt/Instantly.cs index 092f635..4403fef 100644 --- a/AGExt/Instantly.cs +++ b/AGExt/Instantly.cs @@ -13,7 +13,7 @@ public class AGXMainMenu :PartModule //abandoned module, no longer needed for key rebinding public void Start() { - print("AGExt Ver. 2.0b loaded"); + print("AGExt Ver. 2.1 loaded"); } diff --git a/AGExt/Notes.cs b/AGExt/Notes.cs index 91556fe..95db498 100644 --- a/AGExt/Notes.cs +++ b/AGExt/Notes.cs @@ -15,3 +15,5 @@ // public static Dictionary AGXguiMod1Keys; // public static Dictionary AGXguiMod2Keys; // public static Dictionary AGXguiModBothKeys; + +// KSP 1.2 to do: implement toggle monitoring on new brakes