From 6a8299f4cca2de7d89be0ecc2c49bd23a5ef1bb2 Mon Sep 17 00:00:00 2001 From: TerrificTrifid <99054745+TerrificTrifid@users.noreply.github.com> Date: Tue, 25 Apr 2023 21:54:53 -0500 Subject: [PATCH 1/7] Don't normalize stretch height --- NewHorizons/Builder/Body/Geometry/CubeSphere.cs | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/NewHorizons/Builder/Body/Geometry/CubeSphere.cs b/NewHorizons/Builder/Body/Geometry/CubeSphere.cs index 922ae552..75d4ebc0 100644 --- a/NewHorizons/Builder/Body/Geometry/CubeSphere.cs +++ b/NewHorizons/Builder/Body/Geometry/CubeSphere.cs @@ -9,22 +9,6 @@ namespace NewHorizons.Builder.Body.Geometry Mesh mesh = new Mesh(); mesh.name = "CubeSphere"; - float max = 1; - if (stretch.x > stretch.y && stretch.x > stretch.z) - max = stretch.x; - else if (stretch.y > stretch.x && stretch.y > stretch.z) - max = stretch.y; - else if (stretch.z > stretch.x && stretch.z > stretch.y) - max = stretch.z; - else if (stretch.y == stretch.z && stretch.x > stretch.y) - max = stretch.x; - else if (stretch.x == stretch.z && stretch.y > stretch.x) - max = stretch.y; - else if (stretch.x == stretch.y && stretch.z > stretch.x) - max = stretch.z; - minHeight /= max; - maxHeight /= max; - CreateVertices(mesh, resolution, heightMap, minHeight, maxHeight); StretchVertices(mesh, stretch); CreateTriangles(mesh, resolution); From 262fc1687e4922b3f85dabefc37efda8a36d2494 Mon Sep 17 00:00:00 2001 From: TerrificTrifid <99054745+TerrificTrifid@users.noreply.github.com> Date: Tue, 25 Apr 2023 22:07:11 -0500 Subject: [PATCH 2/7] _radius --- NewHorizons/Components/AddPhysics.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Components/AddPhysics.cs b/NewHorizons/Components/AddPhysics.cs index 7cbc20cb..5d5338e5 100644 --- a/NewHorizons/Components/AddPhysics.cs +++ b/NewHorizons/Components/AddPhysics.cs @@ -46,7 +46,7 @@ public class AddPhysics : MonoBehaviour bodyGo.AddComponent().radius = Radius; var shape = bodyGo.AddComponent(); shape._collisionMode = Shape.CollisionMode.Detector; - shape.radius = Radius; + shape._radius = Radius; bodyGo.AddComponent(); var fluidDetector = bodyGo.AddComponent(); fluidDetector._buoyancy = Locator.GetProbe().GetOWRigidbody()._attachedFluidDetector._buoyancy; From 6244fb70d4903f787e8703dc40d708eb9b9f7de2 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Tue, 25 Apr 2023 20:08:51 -0700 Subject: [PATCH 3/7] _layerMask --- NewHorizons/Components/AddPhysics.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/NewHorizons/Components/AddPhysics.cs b/NewHorizons/Components/AddPhysics.cs index 5d5338e5..6f987255 100644 --- a/NewHorizons/Components/AddPhysics.cs +++ b/NewHorizons/Components/AddPhysics.cs @@ -46,6 +46,7 @@ public class AddPhysics : MonoBehaviour bodyGo.AddComponent().radius = Radius; var shape = bodyGo.AddComponent(); shape._collisionMode = Shape.CollisionMode.Detector; + shape._layerMask = (int)(Shape.Layer.Default | Shape.Layer.Gravity); shape._radius = Radius; bodyGo.AddComponent(); var fluidDetector = bodyGo.AddComponent(); From 53be7efe1ed74facb35e94cdaa872f986581b610 Mon Sep 17 00:00:00 2001 From: TerrificTrifid <99054745+TerrificTrifid@users.noreply.github.com> Date: Tue, 25 Apr 2023 22:17:04 -0500 Subject: [PATCH 4/7] Increase detector list size --- NewHorizons/Patches/ShapeManagerPatches.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Patches/ShapeManagerPatches.cs b/NewHorizons/Patches/ShapeManagerPatches.cs index ea6a6190..d50b6740 100644 --- a/NewHorizons/Patches/ShapeManagerPatches.cs +++ b/NewHorizons/Patches/ShapeManagerPatches.cs @@ -12,8 +12,8 @@ namespace NewHorizons.Patches { ShapeManager._exists = true; - ShapeManager._detectors = new ShapeManager.Layer(256); - for (int index = 0; index < 256; ++index) + ShapeManager._detectors = new ShapeManager.Layer(1024); + for (int index = 0; index < 1024; ++index) ShapeManager._detectors[index].contacts = new List(64); ShapeManager._volumes = new ShapeManager.Layer[4]; From ee2c6dc2d3f8a2753f132c7e7402a1d13e8cf252 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Wed, 26 Apr 2023 16:40:46 -0700 Subject: [PATCH 5/7] ShapeManagerPatches.cs: make the fact that we're multiplying the base game capacities more obvious --- NewHorizons/Patches/ShapeManagerPatches.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NewHorizons/Patches/ShapeManagerPatches.cs b/NewHorizons/Patches/ShapeManagerPatches.cs index d50b6740..c44c94db 100644 --- a/NewHorizons/Patches/ShapeManagerPatches.cs +++ b/NewHorizons/Patches/ShapeManagerPatches.cs @@ -12,13 +12,13 @@ namespace NewHorizons.Patches { ShapeManager._exists = true; - ShapeManager._detectors = new ShapeManager.Layer(1024); - for (int index = 0; index < 1024; ++index) + ShapeManager._detectors = new ShapeManager.Layer(256 * 4); + for (int index = 0; index < 256 * 4; ++index) ShapeManager._detectors[index].contacts = new List(64); ShapeManager._volumes = new ShapeManager.Layer[4]; for (int index = 0; index < 4; ++index) - ShapeManager._volumes[index] = new ShapeManager.Layer(2048); + ShapeManager._volumes[index] = new ShapeManager.Layer(1024 * 2); ShapeManager._locked = false; ShapeManager._frameFlag = false; From 605d34da4759e34eb8e602a92e44a82b003e085e Mon Sep 17 00:00:00 2001 From: TerrificTrifid <99054745+TerrificTrifid@users.noreply.github.com> Date: Mon, 1 May 2023 22:18:45 -0500 Subject: [PATCH 6/7] Initialize ShapeManager after patching --- NewHorizons/Main.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index bc36264e..dcaec51c 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -189,6 +189,7 @@ namespace NewHorizons { // Patches Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly()); + ShapeManager.Initialize(); SceneManager.sceneLoaded += OnSceneLoaded; SceneManager.sceneUnloaded += OnSceneUnloaded; From ade3320167a1f4d747cc53d4a336915920b956a1 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Mon, 1 May 2023 20:33:44 -0700 Subject: [PATCH 7/7] explan --- NewHorizons/Main.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index dcaec51c..1b431a0e 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -189,6 +189,7 @@ namespace NewHorizons { // Patches Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly()); + // the campfire on the title screen calls this from RegisterShape before it gets patched, so we have to call it again. lol ShapeManager.Initialize(); SceneManager.sceneLoaded += OnSceneLoaded;