From 1754303208e426a3ecaf0aa12c18c29e59931be6 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Mon, 7 Oct 2024 19:02:35 -0400 Subject: [PATCH 1/3] Properly handle no DLC props --- NewHorizons/Builder/Props/DetailBuilder.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/NewHorizons/Builder/Props/DetailBuilder.cs b/NewHorizons/Builder/Props/DetailBuilder.cs index e49feeee..f4009e7c 100644 --- a/NewHorizons/Builder/Props/DetailBuilder.cs +++ b/NewHorizons/Builder/Props/DetailBuilder.cs @@ -271,6 +271,14 @@ namespace NewHorizons.Builder.Props } if (!detail.keepLoaded) GroupsBuilder.Make(prop, sector); + + // For DLC related props + // Make sure to do this before its set active + if (detail.path.ToLowerInvariant().StartsWith("ringworld") || detail.path.ToLowerInvariant().StartsWith("dreamworld")) + { + prop.AddComponent()._destroyOnDLCNotOwned = true; + } + prop.SetActive(true); if (detail.hasPhysics) From 0698e1f5ce82cf9d1770cffebce61893963610bf Mon Sep 17 00:00:00 2001 From: xen-42 Date: Mon, 7 Oct 2024 23:01:47 -0400 Subject: [PATCH 2/3] Do not destroy dreamworld ever --- NewHorizons/Builder/Props/DetailBuilder.cs | 3 +- NewHorizons/Handlers/DreamHandler.cs | 56 ------------------- .../Handlers/PlanetDestructionHandler.cs | 8 ++- 3 files changed, 9 insertions(+), 58 deletions(-) diff --git a/NewHorizons/Builder/Props/DetailBuilder.cs b/NewHorizons/Builder/Props/DetailBuilder.cs index f4009e7c..14560b16 100644 --- a/NewHorizons/Builder/Props/DetailBuilder.cs +++ b/NewHorizons/Builder/Props/DetailBuilder.cs @@ -274,7 +274,8 @@ namespace NewHorizons.Builder.Props // For DLC related props // Make sure to do this before its set active - if (detail.path.ToLowerInvariant().StartsWith("ringworld") || detail.path.ToLowerInvariant().StartsWith("dreamworld")) + if (!string.IsNullOrEmpty(detail?.path) && + (detail.path.ToLowerInvariant().StartsWith("ringworld") || detail.path.ToLowerInvariant().StartsWith("dreamworld"))) { prop.AddComponent()._destroyOnDLCNotOwned = true; } diff --git a/NewHorizons/Handlers/DreamHandler.cs b/NewHorizons/Handlers/DreamHandler.cs index d96e6457..9098170d 100644 --- a/NewHorizons/Handlers/DreamHandler.cs +++ b/NewHorizons/Handlers/DreamHandler.cs @@ -2,10 +2,6 @@ using NewHorizons.Utility; using NewHorizons.Utility.OWML; using OWML.Utils; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using UnityEngine; namespace NewHorizons.Handlers @@ -32,57 +28,5 @@ namespace NewHorizons.Handlers return DreamArrivalPoint.Location.Undefined; } } - - public static void MigrateDreamWorldController() - { - // Create new DreamWorldController instance since the existing one is disabled - var managerObj = new GameObject("DreamWorldManager"); - managerObj.SetActive(false); - var oldDWC = Locator.GetDreamWorldController(); - var dwc = managerObj.AddComponent(); - - var simRootObj = MigrateCopy(oldDWC._primarySimulationRoot.gameObject, managerObj); - - dwc._primarySimulationRoot = simRootObj.transform; - dwc._simulationRoots = new Transform[] { simRootObj.transform }; - dwc._simulationCamera = simRootObj.FindChild("Camera_Simulation").GetComponent(); - dwc._simulationSphere = simRootObj.FindChild("SimulationSphere").GetComponent(); - - dwc._tempSkyboxColor = oldDWC._tempSkyboxColor; - dwc._sarcophagusController = oldDWC._sarcophagusController; - dwc._prisonerDirector = oldDWC._prisonerDirector; - - // These should correspond to the arrival point's attached body - dwc._dreamBody = null; - dwc._dreamWorldSector = null; - dwc._dreamWorldVolume = null; - - // These should correspond to the campfire's attached body - dwc._planetBody = null; - dwc._ringWorldController = null; - - managerObj.SetActive(true); - - // Run after Start() completes - Delay.FireOnNextUpdate(() => - { - dwc._dreamBody = null; - dwc._dreamWorldSector = null; - dwc._dreamWorldVolume = null; - dwc._planetBody = null; - dwc._ringWorldController = null; - - // Dreamworld has a giant plane for simulation water, we don't want that in our custom world - dwc._primarySimulationRoot.Find("water_simulation").gameObject.SetActive(false); - }); - - } - - private static GameObject MigrateCopy(GameObject go, GameObject newParent) - { - var clone = GameObject.Instantiate(go); - clone.transform.SetParent(newParent.transform, false); - return clone; - } } } diff --git a/NewHorizons/Handlers/PlanetDestructionHandler.cs b/NewHorizons/Handlers/PlanetDestructionHandler.cs index 65152541..01b5fabe 100644 --- a/NewHorizons/Handlers/PlanetDestructionHandler.cs +++ b/NewHorizons/Handlers/PlanetDestructionHandler.cs @@ -93,7 +93,13 @@ namespace NewHorizons.Handlers private static void DreamWorldRemoved() { - DreamHandler.MigrateDreamWorldController(); + // No you didn't + // Needs to stay alive so that custom Dreamworlds can use its Dreamworld controller + // We had a separate dreamworld controller solution before, but that broke Eyes of the Past somehow + Locator.GetAstroObject(AstroObject.Name.DreamWorld).gameObject.SetActive(true); + // We thought of disabling the children for consistency: However this broke the tronworld for some reason + // Basically, leaving the real Dreamworld in is fine since as long as you don't place your own custom dreamworld on top + // of it, you'll never have it appear when you dont want it to } private static void SunRemoved() From 20d3aedf27f22f8aea40aca59cd355c3fade50e2 Mon Sep 17 00:00:00 2001 From: xen-42 Date: Mon, 7 Oct 2024 23:02:04 -0400 Subject: [PATCH 3/3] Update manifest.json --- NewHorizons/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/manifest.json b/NewHorizons/manifest.json index f8d4dec5..d0f8f94d 100644 --- a/NewHorizons/manifest.json +++ b/NewHorizons/manifest.json @@ -4,7 +4,7 @@ "author": "xen, Bwc9876, JohnCorby, MegaPiggy, Trifid, and friends", "name": "New Horizons", "uniqueName": "xen.NewHorizons", - "version": "1.23.0", + "version": "1.23.1", "owmlVersion": "2.12.1", "dependencies": [ "JohnCorby.VanillaFix", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ], "conflicts": [ "PacificEngine.OW_CommonResources" ],