From 20063ff6982b93df4dbbe0d3f08b1c54fb55d75a Mon Sep 17 00:00:00 2001 From: FreezeDriedMangoes Date: Fri, 16 Sep 2022 23:03:38 -0400 Subject: [PATCH 01/15] first attempt at getting configs to print instead of save --- NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs b/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs index 52c1b9bd..164f8768 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs @@ -330,6 +330,11 @@ namespace NewHorizons.Utility.DebugMenu internal override void PreSave(DebugMenu menu) { + foreach(var body in _dpp.GetPropsConfigByBody()) + { + Debug.Log(body.Key.name + "\n" + JsonUtility.ToJson(body.Value)); + } + UpdateLoadedConfigsForRecentSystem(menu); } From 32850b93598d9efb08b9b1e075f272652b028093 Mon Sep 17 00:00:00 2001 From: FreezeDriedMangoes Date: Fri, 16 Sep 2022 23:26:46 -0400 Subject: [PATCH 02/15] make printing callable from unity editor --- NewHorizons/Utility/DebugMenu/DebugMenu.cs | 5 +++++ NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Utility/DebugMenu/DebugMenu.cs b/NewHorizons/Utility/DebugMenu/DebugMenu.cs index ca54f738..d4db0c03 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenu.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenu.cs @@ -45,6 +45,11 @@ namespace NewHorizons.Utility.DebugMenu Formatting = Formatting.Indented, }; + public void PrintMahStuff() + { + (submenus[0] as DebugMenuPropPlacer).PrintMahStuff(); + } + private void Awake() { submenus = new List() diff --git a/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs b/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs index 164f8768..27700e76 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs @@ -330,12 +330,17 @@ namespace NewHorizons.Utility.DebugMenu internal override void PreSave(DebugMenu menu) { + PrintMahStuff(); + UpdateLoadedConfigsForRecentSystem(menu); + } + + public void PrintMahStuff() + { + Debug.Log("Printin mah stuff"); foreach(var body in _dpp.GetPropsConfigByBody()) { Debug.Log(body.Key.name + "\n" + JsonUtility.ToJson(body.Value)); } - - UpdateLoadedConfigsForRecentSystem(menu); } private void UpdateLoadedConfigsForRecentSystem(DebugMenu menu) From fc4ae7d3c787c6464c93279965c7db53f2f98f6e Mon Sep 17 00:00:00 2001 From: FreezeDriedMangoes Date: Sat, 17 Sep 2022 10:33:18 -0400 Subject: [PATCH 03/15] switched debug log for logger log --- NewHorizons/Utility/DebugMenu/DebugMenu.cs | 5 +++-- NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/NewHorizons/Utility/DebugMenu/DebugMenu.cs b/NewHorizons/Utility/DebugMenu/DebugMenu.cs index d4db0c03..5f9a5a6c 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenu.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenu.cs @@ -38,15 +38,16 @@ namespace NewHorizons.Utility.DebugMenu private List submenus; private int activeSubmenu = 0; - private static JsonSerializerSettings jsonSettings = new JsonSerializerSettings + internal static JsonSerializerSettings jsonSettings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore, - Formatting = Formatting.Indented, + Formatting = Formatting.None, }; public void PrintMahStuff() { + Logger.Log("Printin mah stuff please"); (submenus[0] as DebugMenuPropPlacer).PrintMahStuff(); } diff --git a/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs b/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs index 27700e76..5d55afcb 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs @@ -1,6 +1,7 @@ using NewHorizons.External.Configs; using NewHorizons.External.Modules; using NewHorizons.Utility.DebugUtilities; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; @@ -336,10 +337,12 @@ namespace NewHorizons.Utility.DebugMenu public void PrintMahStuff() { - Debug.Log("Printin mah stuff"); + Logger.Log("Printin mah stuff"); foreach(var body in _dpp.GetPropsConfigByBody()) { - Debug.Log(body.Key.name + "\n" + JsonUtility.ToJson(body.Value)); + var json = ""; + json = String.Join(",\n", body.Value.Select(detail => " "+ JsonConvert.SerializeObject(detail, DebugMenu.jsonSettings))); + Logger.Log($"{body.Key.name} ({body.Value.Length})\n[\n{json}\n]"); } } From 67a2200920251e3b9e943b2ca7743634eaf7a62a Mon Sep 17 00:00:00 2001 From: FreezeDriedMangoes Date: Mon, 14 Nov 2022 21:43:51 -0500 Subject: [PATCH 04/15] added log for helping placing props floating in zero 0 --- .../Utility/DebugUtilities/DebugPropPlacer.cs | 22 +++++++++++++++++++ .../Utility/DebugUtilities/DebugRaycaster.cs | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/NewHorizons/Utility/DebugUtilities/DebugPropPlacer.cs b/NewHorizons/Utility/DebugUtilities/DebugPropPlacer.cs index 70e85fcc..ff8f48a4 100644 --- a/NewHorizons/Utility/DebugUtilities/DebugPropPlacer.cs +++ b/NewHorizons/Utility/DebugUtilities/DebugPropPlacer.cs @@ -108,6 +108,28 @@ namespace NewHorizons.Utility.DebugUtilities DebugRaycastData data = _rc.Raycast(); PlaceObject(data, this.gameObject.transform.position); + //use DropItem logic to make props not clip through the ground when placed + +//public virtual void DropItem(Vector3 position, Vector3 normal, Transform parent, Sector sector, IItemDropTarget customDropTarget) +//{ +// base.transform.SetParent(parent); +// base.transform.localScale = Vector3.one; +// Quaternion quaternion = Quaternion.FromToRotation(base.transform.TransformDirection(_localDropNormal), normal); +// base.transform.rotation = quaternion * base.transform.rotation; +// base.transform.position = position + base.transform.TransformDirection(_localDropOffset); +// if (_parentFragment != null) +// { +// _parentFragment.OnChangeSector -= OnParentFragmentChangeSector; +// } +// _parentFragment = customDropTarget as DetachableFragment; +// if (_parentFragment != null) +// { +// _parentFragment.OnChangeSector += OnParentFragmentChangeSector; +// } +// SetSector(sector); +// SetColliderActivation(active: true); +//} + if (!hasAddedCurrentObjectToRecentsList) { hasAddedCurrentObjectToRecentsList = true; diff --git a/NewHorizons/Utility/DebugUtilities/DebugRaycaster.cs b/NewHorizons/Utility/DebugUtilities/DebugRaycaster.cs index 16f502e8..9813f78e 100644 --- a/NewHorizons/Utility/DebugUtilities/DebugRaycaster.cs +++ b/NewHorizons/Utility/DebugUtilities/DebugRaycaster.cs @@ -95,6 +95,10 @@ namespace NewHorizons.Utility.DebugUtilities _planeDownRightSphere.transform.localPosition = data.plane.origin + data.plane.u*1*planeSize + data.plane.v*-1*planeSize; Logger.Log($"Raycast hit \"position\": {posText}, \"normal\": {normText} on [{data.bodyName}] at [{data.bodyPath}]"); + var ppos = data.hitBodyGameObject.GetComponent().GetRootSector().transform.InverseTransformPoint(Locator.GetPlayerTransform().position); + posText = $"{{\"x\": {ppos.x}, \"y\": {ppos.y}, \"z\": {ppos.z}}}"; + Logger.Log($"Player, relative to raycasted sector \"position\": {posText} on [{data.bodyName}] at [{data.bodyPath}]"); + } internal DebugRaycastData Raycast() { From 707692797574d7142620e8d8415878577dbd826b Mon Sep 17 00:00:00 2001 From: Ben C Date: Tue, 15 Nov 2022 13:28:47 -0500 Subject: [PATCH 05/15] Update update_schemas.yml --- .github/workflows/update_schemas.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update_schemas.yml b/.github/workflows/update_schemas.yml index f98394f8..6bbf8da7 100644 --- a/.github/workflows/update_schemas.yml +++ b/.github/workflows/update_schemas.yml @@ -18,7 +18,9 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 + with: + token: ${{ secrets.SCHEMAS_TOKEN }} - name: Download Artifact uses: actions/download-artifact@v3 @@ -28,13 +30,13 @@ jobs: - name: Commit Schemas run: | - git config --local user.email "github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" + git config --local user.email "bwc9876@gmail.com" + git config --local user.name "Ben C" git add NewHorizons/Schemas/** git commit -m "Updated Schemas" - name: Push Schemas uses: ad-m/github-push-action@master with: - github_token: ${{ secrets.github_token }} + github_token: ${{ secrets.SCHEMAS_TOKEN }} branch: ${{ github.ref }} From 127b77ab07233fca51a8d025efc69641ce288978 Mon Sep 17 00:00:00 2001 From: FreezeDriedMangoes Date: Wed, 30 Nov 2022 22:12:00 -0500 Subject: [PATCH 06/15] added a method to DebugSubmenu for printing changes, rather than saving them to file, and implemented them on all submenu types --- NewHorizons/Utility/DebugMenu/DebugMenu.cs | 6 ---- .../Utility/DebugMenu/DebugMenuNomaiText.cs | 5 ++++ .../Utility/DebugMenu/DebugMenuPropPlacer.cs | 22 +++++++-------- .../Utility/DebugMenu/DebugMenuShipLogs.cs | 28 +++++++++++++------ NewHorizons/Utility/DebugMenu/DebugSubmenu.cs | 2 +- 5 files changed, 35 insertions(+), 28 deletions(-) diff --git a/NewHorizons/Utility/DebugMenu/DebugMenu.cs b/NewHorizons/Utility/DebugMenu/DebugMenu.cs index 5f9a5a6c..f2ff856d 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenu.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenu.cs @@ -45,12 +45,6 @@ namespace NewHorizons.Utility.DebugMenu Formatting = Formatting.None, }; - public void PrintMahStuff() - { - Logger.Log("Printin mah stuff please"); - (submenus[0] as DebugMenuPropPlacer).PrintMahStuff(); - } - private void Awake() { submenus = new List() diff --git a/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs b/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs index 522751c0..e3837d1a 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs @@ -521,5 +521,10 @@ namespace NewHorizons.Utility.DebugMenu // metadata.spiral.zRotation = metadata.spiral.zRotation; //}); } + + internal override void PrintNewConfigSection(DebugMenu menu) + { + throw new NotImplementedException(); + } } } diff --git a/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs b/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs index 5d55afcb..072f39ea 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs @@ -331,21 +331,9 @@ namespace NewHorizons.Utility.DebugMenu internal override void PreSave(DebugMenu menu) { - PrintMahStuff(); UpdateLoadedConfigsForRecentSystem(menu); } - public void PrintMahStuff() - { - Logger.Log("Printin mah stuff"); - foreach(var body in _dpp.GetPropsConfigByBody()) - { - var json = ""; - json = String.Join(",\n", body.Value.Select(detail => " "+ JsonConvert.SerializeObject(detail, DebugMenu.jsonSettings))); - Logger.Log($"{body.Key.name} ({body.Value.Length})\n[\n{json}\n]"); - } - } - private void UpdateLoadedConfigsForRecentSystem(DebugMenu menu) { var newDetails = _dpp.GetPropsConfigByBody(); @@ -397,5 +385,15 @@ namespace NewHorizons.Utility.DebugMenu menu.loadedConfigFiles[filepath] = config; } } + + internal override void PrintNewConfigSection(DebugMenu menu) + { + foreach(var body in _dpp.GetPropsConfigByBody()) + { + var json = ""; + json = String.Join(",\n", body.Value.Select(detail => " "+ JsonConvert.SerializeObject(detail, DebugMenu.jsonSettings))); + Logger.Log($"{body.Key.name} ({body.Value.Length})\n[\n{json}\n]"); + } + } } } diff --git a/NewHorizons/Utility/DebugMenu/DebugMenuShipLogs.cs b/NewHorizons/Utility/DebugMenu/DebugMenuShipLogs.cs index 94630fe4..7825203c 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenuShipLogs.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenuShipLogs.cs @@ -35,19 +35,24 @@ namespace NewHorizons.Utility.DebugMenu { } + private string GetEntryPositionsJSON() + { + return String.Join("\n", + Resources + .FindObjectsOfTypeAll() + .ToList() + .Select(go => + ("{ \"id\": \"" +go.name+ "\", \"position\": {\"x\": "+go.transform.localPosition.x+", \"y\": "+go.transform.localPosition.y+" } ") + ) + .ToList() + ); + } + internal override void OnGUI(DebugMenu menu) { if (GUILayout.Button("Print Ship Log Positions")) { - entryPositionsText = String.Join("\n", - Resources - .FindObjectsOfTypeAll() - .ToList() - .Select(go => - ("{ \"id\": \"" +go.name+ "\", \"position\": {\"x\": "+go.transform.localPosition.x+", \"y\": "+go.transform.localPosition.y+" } ") - ) - .ToList() - ); + entryPositionsText = GetEntryPositionsJSON(); } GUILayout.TextArea(entryPositionsText); @@ -67,5 +72,10 @@ namespace NewHorizons.Utility.DebugMenu { return "Ship Log"; } + + internal override void PrintNewConfigSection(DebugMenu menu) + { + Logger.Log(GetEntryPositionsJSON()); + } } } diff --git a/NewHorizons/Utility/DebugMenu/DebugSubmenu.cs b/NewHorizons/Utility/DebugMenu/DebugSubmenu.cs index d49d2daf..85e12e65 100644 --- a/NewHorizons/Utility/DebugMenu/DebugSubmenu.cs +++ b/NewHorizons/Utility/DebugMenu/DebugSubmenu.cs @@ -11,6 +11,7 @@ namespace NewHorizons.Utility.DebugMenu { internal abstract void OnAwake(DebugMenu menu); internal abstract void OnGUI(DebugMenu menu); + internal abstract void PrintNewConfigSection(DebugMenu menu); internal abstract void PreSave(DebugMenu menu); internal abstract void OnInit(DebugMenu menu); internal abstract void LoadConfigFile(DebugMenu menu, PlanetConfig config); @@ -21,6 +22,5 @@ namespace NewHorizons.Utility.DebugMenu internal abstract void GainActive(); internal abstract void LoseActive(); - } } From b6e45a77b1d6f34c4c1dbc631606ac944b019ce5 Mon Sep 17 00:00:00 2001 From: FreezeDriedMangoes Date: Wed, 30 Nov 2022 22:14:33 -0500 Subject: [PATCH 07/15] added a button to the debug tools menu for printing changes --- NewHorizons/Utility/DebugMenu/DebugMenu.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/NewHorizons/Utility/DebugMenu/DebugMenu.cs b/NewHorizons/Utility/DebugMenu/DebugMenu.cs index f2ff856d..5138492c 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenu.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenu.cs @@ -158,6 +158,12 @@ namespace NewHorizons.Utility.DebugMenu } GUI.enabled = true; GUILayout.EndHorizontal(); + + if (GUILayout.Button("Print config changes for your mod")) + { + PrintLoadedConfigChangesForRecentSystem(); + saveButtonUnlocked = false; + } } GUILayout.Space(20); @@ -267,6 +273,14 @@ namespace NewHorizons.Utility.DebugMenu } } + private void PrintLoadedConfigChangesForRecentSystem() + { + foreach(DebugSubmenu menu in submenus) + { + menu.PrintNewConfigSection(this); + } + } + private void InitMenu() { if (_editorMenuStyle != null) return; From fdaf80332138483e79e65885895148ceb5e8fbc4 Mon Sep 17 00:00:00 2001 From: FreezeDriedMangoes Date: Wed, 30 Nov 2022 22:39:20 -0500 Subject: [PATCH 08/15] added print stuff for spiral placer --- .../Utility/DebugMenu/DebugMenuNomaiText.cs | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs b/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs index 92585c5c..5e6abe04 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs @@ -524,7 +524,39 @@ namespace NewHorizons.Utility.DebugMenu internal override void PrintNewConfigSection(DebugMenu menu) { - throw new NotImplementedException(); + var conversationsJSON = conversations + .GroupBy(conversation => conversation.planetConfig.name) + .Select(allConversationsOnBody => + allConversationsOnBody.Key + + "\n[" + + allConversationsOnBody.Select(conversation => + $"\t{{\n" + + $"\t\t\"position\": {conversation.conversation.position},\n" + + $"\t\t\"normal\": {conversation.conversation.normal} \n" + + $"\t\t\"parentPath\": {conversation.conversation.parentPath} \n" + + $"\t\t\"location\": {conversation.conversation.location} \n" + + $"\t\t\"rotation\": {conversation.conversation.rotation} \n" + + $"\t\t\"rename\": {conversation.conversation.rename} \n" + + $"\t\t\"seed\": {conversation.conversation.seed} \n" + + $"\t\t\"type\": {conversation.conversation.type} \n" + + $"\t\t\"xmlFile\": {conversation.conversation.xmlFile} \n" + + $"\t\t\"arcInfo\": [\n" + + String.Join(",\n", conversation.spirals.Select(spiral => + $"\t\t\t{{" + + $"\"position\": {spiral.spiral.position}, " + + $"\"zRotation\": {spiral.spiral.zRotation}}}, " + + $"\"mirror\": {spiral.spiral.mirror}, " + + $"\"type\": {spiral.spiral.type}, " + + $"\"variation\": {spiral.spiral.variation}" + + $"}}" + )) + ) + );; + + foreach(string json in conversationsJSON) + { + Logger.Log(json); + } } } } From 55512655618991dfeedf61c3c0f438070fc14dcf Mon Sep 17 00:00:00 2001 From: FreezeDriedMangoes Date: Wed, 30 Nov 2022 22:47:15 -0500 Subject: [PATCH 09/15] cleaned up for PR --- NewHorizons/Utility/DebugMenu/DebugMenu.cs | 6 ++--- .../Utility/DebugUtilities/DebugPropPlacer.cs | 23 ++----------------- .../Utility/DebugUtilities/DebugRaycaster.cs | 5 ---- 3 files changed, 5 insertions(+), 29 deletions(-) diff --git a/NewHorizons/Utility/DebugMenu/DebugMenu.cs b/NewHorizons/Utility/DebugMenu/DebugMenu.cs index 5138492c..f36da64f 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenu.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenu.cs @@ -37,12 +37,12 @@ namespace NewHorizons.Utility.DebugMenu // Submenus private List submenus; private int activeSubmenu = 0; - - internal static JsonSerializerSettings jsonSettings = new JsonSerializerSettings + + private static JsonSerializerSettings jsonSettings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore, - Formatting = Formatting.None, + Formatting = Formatting.Indented, }; private void Awake() diff --git a/NewHorizons/Utility/DebugUtilities/DebugPropPlacer.cs b/NewHorizons/Utility/DebugUtilities/DebugPropPlacer.cs index ff8f48a4..49c356e4 100644 --- a/NewHorizons/Utility/DebugUtilities/DebugPropPlacer.cs +++ b/NewHorizons/Utility/DebugUtilities/DebugPropPlacer.cs @@ -108,27 +108,8 @@ namespace NewHorizons.Utility.DebugUtilities DebugRaycastData data = _rc.Raycast(); PlaceObject(data, this.gameObject.transform.position); - //use DropItem logic to make props not clip through the ground when placed - -//public virtual void DropItem(Vector3 position, Vector3 normal, Transform parent, Sector sector, IItemDropTarget customDropTarget) -//{ -// base.transform.SetParent(parent); -// base.transform.localScale = Vector3.one; -// Quaternion quaternion = Quaternion.FromToRotation(base.transform.TransformDirection(_localDropNormal), normal); -// base.transform.rotation = quaternion * base.transform.rotation; -// base.transform.position = position + base.transform.TransformDirection(_localDropOffset); -// if (_parentFragment != null) -// { -// _parentFragment.OnChangeSector -= OnParentFragmentChangeSector; -// } -// _parentFragment = customDropTarget as DetachableFragment; -// if (_parentFragment != null) -// { -// _parentFragment.OnChangeSector += OnParentFragmentChangeSector; -// } -// SetSector(sector); -// SetColliderActivation(active: true); -//} + //TODO: use DropItem logic to make props not clip through the ground when placed + //public virtual void DropItem(Vector3 position, Vector3 normal, Transform parent, Sector sector, IItemDropTarget customDropTarget) if (!hasAddedCurrentObjectToRecentsList) { diff --git a/NewHorizons/Utility/DebugUtilities/DebugRaycaster.cs b/NewHorizons/Utility/DebugUtilities/DebugRaycaster.cs index 5d498f2d..31c388c2 100644 --- a/NewHorizons/Utility/DebugUtilities/DebugRaycaster.cs +++ b/NewHorizons/Utility/DebugUtilities/DebugRaycaster.cs @@ -104,11 +104,6 @@ namespace NewHorizons.Utility.DebugUtilities _planeDownLeftSphere .transform.localPosition = data.plane.origin + data.plane.u*-1*planeSize + data.plane.v*-1*planeSize; _planeDownRightSphere.transform.localPosition = data.plane.origin + data.plane.u*1*planeSize + data.plane.v*-1*planeSize; - //Logger.Log($"Raycast hit \"position\": {posText}, \"normal\": {normText} on [{data.bodyName}] at [{data.bodyPath}]"); - //var ppos = data.hitBodyGameObject.GetComponent().GetRootSector().transform.InverseTransformPoint(Locator.GetPlayerTransform().position); - //posText = $"{{\"x\": {ppos.x}, \"y\": {ppos.y}, \"z\": {ppos.z}}}"; - //Logger.Log($"Player, relative to raycasted sector \"position\": {posText} on [{data.bodyName}] at [{data.bodyPath}]"); - Logger.Log($"Raycast hit \"position\": {posText}, \"normal\": {normText} on collider [{data.colliderPath}] " + (data.bodyPath != null? $"at rigidbody [{data.bodyPath}]" : "not attached to a rigidbody")); } From 425fb30bdb8b23ccf9041a87cca546e6319630b6 Mon Sep 17 00:00:00 2001 From: FreezeDriedMangoes Date: Wed, 30 Nov 2022 22:54:21 -0500 Subject: [PATCH 10/15] fixed commas --- .../Utility/DebugMenu/DebugMenuNomaiText.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs b/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs index f4b8de31..03a2ae4d 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs @@ -532,14 +532,14 @@ namespace NewHorizons.Utility.DebugMenu allConversationsOnBody.Select(conversation => $"\t{{\n" + $"\t\t\"position\": {conversation.conversation.position},\n" + - $"\t\t\"normal\": {conversation.conversation.normal} \n" + - $"\t\t\"parentPath\": {conversation.conversation.parentPath} \n" + - $"\t\t\"location\": {conversation.conversation.location} \n" + - $"\t\t\"rotation\": {conversation.conversation.rotation} \n" + - $"\t\t\"rename\": {conversation.conversation.rename} \n" + - $"\t\t\"seed\": {conversation.conversation.seed} \n" + - $"\t\t\"type\": {conversation.conversation.type} \n" + - $"\t\t\"xmlFile\": {conversation.conversation.xmlFile} \n" + + $"\t\t\"normal\": {conversation.conversation.normal}, \n" + + $"\t\t\"parentPath\": {conversation.conversation.parentPath}, \n" + + $"\t\t\"location\": {conversation.conversation.location}, \n" + + $"\t\t\"rotation\": {conversation.conversation.rotation}, \n" + + $"\t\t\"rename\": {conversation.conversation.rename}, \n" + + $"\t\t\"seed\": {conversation.conversation.seed}, \n" + + $"\t\t\"type\": {conversation.conversation.type}, \n" + + $"\t\t\"xmlFile\": {conversation.conversation.xmlFile}, \n" + $"\t\t\"arcInfo\": [\n" + String.Join(",\n", conversation.spirals.Select(spiral => $"\t\t\t{{" + From 6315557b074c98be68e63654c6401465fdcea6cf Mon Sep 17 00:00:00 2001 From: FreezeDriedMangoes Date: Wed, 30 Nov 2022 22:59:20 -0500 Subject: [PATCH 11/15] fixed variable accessibility --- NewHorizons/Utility/DebugMenu/DebugMenu.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Utility/DebugMenu/DebugMenu.cs b/NewHorizons/Utility/DebugMenu/DebugMenu.cs index f36da64f..207c51e6 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenu.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenu.cs @@ -38,7 +38,7 @@ namespace NewHorizons.Utility.DebugMenu private List submenus; private int activeSubmenu = 0; - private static JsonSerializerSettings jsonSettings = new JsonSerializerSettings + internal static JsonSerializerSettings jsonSettings = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore, From eb842e0932474e52db92358b586d18712ef4fe3e Mon Sep 17 00:00:00 2001 From: FreezeDriedMangoes Date: Wed, 30 Nov 2022 23:07:34 -0500 Subject: [PATCH 12/15] style and other minor issues --- NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs | 7 ++++--- NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs | 3 +-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs b/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs index 03a2ae4d..dfb98af1 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs @@ -531,7 +531,7 @@ namespace NewHorizons.Utility.DebugMenu "\n[" + allConversationsOnBody.Select(conversation => $"\t{{\n" + - $"\t\t\"position\": {conversation.conversation.position},\n" + + $"\t\t\"position\": {conversation.conversation.position}, \n" + $"\t\t\"normal\": {conversation.conversation.normal}, \n" + $"\t\t\"parentPath\": {conversation.conversation.parentPath}, \n" + $"\t\t\"location\": {conversation.conversation.location}, \n" + @@ -549,9 +549,10 @@ namespace NewHorizons.Utility.DebugMenu $"\"type\": {spiral.spiral.type}, " + $"\"variation\": {spiral.spiral.variation}" + $"}}" - )) + )) + + $"\t\t]" ) - );; + ); foreach(string json in conversationsJSON) { diff --git a/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs b/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs index 072f39ea..933c7a62 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs @@ -390,8 +390,7 @@ namespace NewHorizons.Utility.DebugMenu { foreach(var body in _dpp.GetPropsConfigByBody()) { - var json = ""; - json = String.Join(",\n", body.Value.Select(detail => " "+ JsonConvert.SerializeObject(detail, DebugMenu.jsonSettings))); + let json = String.Join(",\n", body.Value.Select(detail => " "+ JsonConvert.SerializeObject(detail, DebugMenu.jsonSettings))); Logger.Log($"{body.Key.name} ({body.Value.Length})\n[\n{json}\n]"); } } From 8f4ef6606cced6c1ba82cddeee281803bd2b01d4 Mon Sep 17 00:00:00 2001 From: FreezeDriedMangoes Date: Wed, 30 Nov 2022 23:14:55 -0500 Subject: [PATCH 13/15] added checks for default values --- .../Utility/DebugMenu/DebugMenuNomaiText.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs b/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs index dfb98af1..8c91a570 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs @@ -533,21 +533,21 @@ namespace NewHorizons.Utility.DebugMenu $"\t{{\n" + $"\t\t\"position\": {conversation.conversation.position}, \n" + $"\t\t\"normal\": {conversation.conversation.normal}, \n" + - $"\t\t\"parentPath\": {conversation.conversation.parentPath}, \n" + - $"\t\t\"location\": {conversation.conversation.location}, \n" + - $"\t\t\"rotation\": {conversation.conversation.rotation}, \n" + - $"\t\t\"rename\": {conversation.conversation.rename}, \n" + - $"\t\t\"seed\": {conversation.conversation.seed}, \n" + - $"\t\t\"type\": {conversation.conversation.type}, \n" + - $"\t\t\"xmlFile\": {conversation.conversation.xmlFile}, \n" + + (conversation.conversation.parentPath == "" ? "" : $"\t\t\"parentPath\": \"{conversation.conversation.parentPath}\", \n") + + (conversation.conversation.location == NomaiTextInfo.NomaiTextLocation.UNSPECIFIED ? "" : $"\t\t\"location\": {conversation.conversation.location}, \n") + + (conversation.conversation.rotation == new MVector3(0, 0, 0) ? "" : $"\t\t\"rotation\": {conversation.conversation.rotation}, \n") + + (conversation.conversation.rename == "" ? "" : $"\t\t\"rename\": \"{conversation.conversation.rename}\", \n") + + (conversation.conversation.seed == 0 ? "" : $"\t\t\"seed\": {conversation.conversation.seed}, \n") + + (conversation.conversation.type == NomaiTextInfo.NomaiTextType.Wall ? "" : $"\t\t\"type\": \"{conversation.conversation.type}\", \n") + + $"\t\t\"xmlFile\": \"{conversation.conversation.xmlFile}\", \n" + $"\t\t\"arcInfo\": [\n" + String.Join(",\n", conversation.spirals.Select(spiral => $"\t\t\t{{" + $"\"position\": {spiral.spiral.position}, " + $"\"zRotation\": {spiral.spiral.zRotation}}}, " + - $"\"mirror\": {spiral.spiral.mirror}, " + - $"\"type\": {spiral.spiral.type}, " + - $"\"variation\": {spiral.spiral.variation}" + + (spiral.spiral.mirror == false ? "" : $"\"mirror\": {spiral.spiral.mirror}, ") + + (spiral.spiral.type == NomaiTextArcInfo.NomaiTextArcType.Adult ? "" : $"\"type\": \"{spiral.spiral.type}\", ") + + (spiral.spiral.variation == -1 ? "" : $"\"variation\": {spiral.spiral.variation}" + $"}}" )) + $"\t\t]" From d8b4fed8489df9033ca3f048c3b7e3977fddc1c8 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Wed, 30 Nov 2022 20:46:35 -0800 Subject: [PATCH 14/15] fix formatting even more --- .../Utility/DebugMenu/DebugMenuNomaiText.cs | 32 +++++++++---------- .../Utility/DebugMenu/DebugMenuPropPlacer.cs | 2 +- .../Utility/DebugMenu/DebugMenuShipLogs.cs | 6 ++-- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs b/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs index dfb98af1..6b6c6431 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs @@ -530,27 +530,27 @@ namespace NewHorizons.Utility.DebugMenu allConversationsOnBody.Key + "\n[" + allConversationsOnBody.Select(conversation => - $"\t{{\n" + - $"\t\t\"position\": {conversation.conversation.position}, \n" + - $"\t\t\"normal\": {conversation.conversation.normal}, \n" + - $"\t\t\"parentPath\": {conversation.conversation.parentPath}, \n" + - $"\t\t\"location\": {conversation.conversation.location}, \n" + - $"\t\t\"rotation\": {conversation.conversation.rotation}, \n" + - $"\t\t\"rename\": {conversation.conversation.rename}, \n" + - $"\t\t\"seed\": {conversation.conversation.seed}, \n" + - $"\t\t\"type\": {conversation.conversation.type}, \n" + - $"\t\t\"xmlFile\": {conversation.conversation.xmlFile}, \n" + - $"\t\t\"arcInfo\": [\n" + - String.Join(",\n", conversation.spirals.Select(spiral => - $"\t\t\t{{" + + "\t{\n" + + $"\t\t\"position\": {conversation.conversation.position},\n" + + $"\t\t\"normal\": {conversation.conversation.normal},\n" + + $"\t\t\"parentPath\": {conversation.conversation.parentPath},\n" + + $"\t\t\"location\": {conversation.conversation.location},\n" + + $"\t\t\"rotation\": {conversation.conversation.rotation},\n" + + $"\t\t\"rename\": {conversation.conversation.rename},\n" + + $"\t\t\"seed\": {conversation.conversation.seed},\n" + + $"\t\t\"type\": {conversation.conversation.type},\n" + + $"\t\t\"xmlFile\": {conversation.conversation.xmlFile},\n" + + "\t\t\"arcInfo\": [\n" + + string.Join(",\n", conversation.spirals.Select(spiral => + "\t\t\t{" + $"\"position\": {spiral.spiral.position}, " + - $"\"zRotation\": {spiral.spiral.zRotation}}}, " + + $"\"zRotation\": {spiral.spiral.zRotation}, " + $"\"mirror\": {spiral.spiral.mirror}, " + $"\"type\": {spiral.spiral.type}, " + $"\"variation\": {spiral.spiral.variation}" + - $"}}" + "}" )) + - $"\t\t]" + "\t\t]" ) ); diff --git a/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs b/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs index 933c7a62..1e35f040 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs @@ -390,7 +390,7 @@ namespace NewHorizons.Utility.DebugMenu { foreach(var body in _dpp.GetPropsConfigByBody()) { - let json = String.Join(",\n", body.Value.Select(detail => " "+ JsonConvert.SerializeObject(detail, DebugMenu.jsonSettings))); + var json = string.Join(",\n", body.Value.Select(detail => "\t"+ JsonConvert.SerializeObject(detail, DebugMenu.jsonSettings))); Logger.Log($"{body.Key.name} ({body.Value.Length})\n[\n{json}\n]"); } } diff --git a/NewHorizons/Utility/DebugMenu/DebugMenuShipLogs.cs b/NewHorizons/Utility/DebugMenu/DebugMenuShipLogs.cs index 7825203c..3ce5a468 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenuShipLogs.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenuShipLogs.cs @@ -37,14 +37,12 @@ namespace NewHorizons.Utility.DebugMenu private string GetEntryPositionsJSON() { - return String.Join("\n", + return string.Join(",\n", Resources .FindObjectsOfTypeAll() - .ToList() .Select(go => - ("{ \"id\": \"" +go.name+ "\", \"position\": {\"x\": "+go.transform.localPosition.x+", \"y\": "+go.transform.localPosition.y+" } ") + "{ \"id\": \"" +go.name+ "\", \"position\": {\"x\": "+go.transform.localPosition.x+", \"y\": "+go.transform.localPosition.y+" } " ) - .ToList() ); } From fb94bed8dd4fcae7dfbe95867bd8be1435b70d36 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Wed, 30 Nov 2022 21:04:53 -0800 Subject: [PATCH 15/15] use actual default values --- NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs b/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs index d5a877df..cc1f237c 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs +++ b/NewHorizons/Utility/DebugMenu/DebugMenuNomaiText.cs @@ -533,11 +533,11 @@ namespace NewHorizons.Utility.DebugMenu "\t{\n" + $"\t\t\"position\": {conversation.conversation.position},\n" + $"\t\t\"normal\": {conversation.conversation.normal},\n" + - (conversation.conversation.parentPath == "" ? "" : $"\t\t\"parentPath\": \"{conversation.conversation.parentPath}\",\n") + + (conversation.conversation.parentPath == default ? "" : $"\t\t\"parentPath\": \"{conversation.conversation.parentPath}\",\n") + (conversation.conversation.location == NomaiTextInfo.NomaiTextLocation.UNSPECIFIED ? "" : $"\t\t\"location\": {conversation.conversation.location},\n") + - (conversation.conversation.rotation == new MVector3(0, 0, 0) ? "" : $"\t\t\"rotation\": {conversation.conversation.rotation},\n") + - (conversation.conversation.rename == "" ? "" : $"\t\t\"rename\": \"{conversation.conversation.rename}\",\n") + - (conversation.conversation.seed == 0 ? "" : $"\t\t\"seed\": {conversation.conversation.seed},\n") + + (conversation.conversation.rotation == default ? "" : $"\t\t\"rotation\": {conversation.conversation.rotation},\n") + + (conversation.conversation.rename == default ? "" : $"\t\t\"rename\": \"{conversation.conversation.rename}\",\n") + + (conversation.conversation.seed == default ? "" : $"\t\t\"seed\": {conversation.conversation.seed},\n") + (conversation.conversation.type == NomaiTextInfo.NomaiTextType.Wall ? "" : $"\t\t\"type\": \"{conversation.conversation.type}\",\n") + $"\t\t\"xmlFile\": \"{conversation.conversation.xmlFile}\",\n" + "\t\t\"arcInfo\": [\n" + @@ -545,9 +545,9 @@ namespace NewHorizons.Utility.DebugMenu "\t\t\t{" + $"\"position\": {spiral.spiral.position}, " + $"\"zRotation\": {spiral.spiral.zRotation}, " + - (spiral.spiral.mirror == false ? "" : $"\"mirror\": {spiral.spiral.mirror}, ") + + (spiral.spiral.mirror == default ? "" : $"\"mirror\": {spiral.spiral.mirror}, ") + (spiral.spiral.type == NomaiTextArcInfo.NomaiTextArcType.Adult ? "" : $"\"type\": \"{spiral.spiral.type}\", ") + - (spiral.spiral.variation == -1 ? "" : $"\"variation\": {spiral.spiral.variation}" + + (spiral.spiral.variation == -1 ? "" : $"\"variation\": {spiral.spiral.variation}") + "}" )) + "\t\t]"