## Bug fixes
- Fix a bug breaking Eyes of the Past and Band Together
- Better handle when a mod tries using DLC props when the DLC is not
installed
This commit is contained in:
xen-42 2024-10-08 11:51:57 -04:00 committed by GitHub
commit d530957b1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 58 deletions

View File

@ -271,6 +271,15 @@ 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 (!string.IsNullOrEmpty(detail?.path) &&
(detail.path.ToLowerInvariant().StartsWith("ringworld") || detail.path.ToLowerInvariant().StartsWith("dreamworld")))
{
prop.AddComponent<DestroyOnDLC>()._destroyOnDLCNotOwned = true;
}
prop.SetActive(true);
if (detail.hasPhysics)

View File

@ -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<DreamWorldController>();
var simRootObj = MigrateCopy(oldDWC._primarySimulationRoot.gameObject, managerObj);
dwc._primarySimulationRoot = simRootObj.transform;
dwc._simulationRoots = new Transform[] { simRootObj.transform };
dwc._simulationCamera = simRootObj.FindChild("Camera_Simulation").GetComponent<SimulationCamera>();
dwc._simulationSphere = simRootObj.FindChild("SimulationSphere").GetComponent<OWRenderer>();
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;
}
}
}

View File

@ -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()

View File

@ -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" ],