mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Do not destroy dreamworld ever
This commit is contained in:
parent
46d4480bdc
commit
0698e1f5ce
@ -274,7 +274,8 @@ namespace NewHorizons.Builder.Props
|
|||||||
|
|
||||||
// For DLC related props
|
// For DLC related props
|
||||||
// Make sure to do this before its set active
|
// 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<DestroyOnDLC>()._destroyOnDLCNotOwned = true;
|
prop.AddComponent<DestroyOnDLC>()._destroyOnDLCNotOwned = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,10 +2,6 @@ using NewHorizons.Utility;
|
|||||||
using NewHorizons.Utility.OWML;
|
using NewHorizons.Utility.OWML;
|
||||||
using OWML.Utils;
|
using OWML.Utils;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NewHorizons.Handlers
|
namespace NewHorizons.Handlers
|
||||||
@ -32,57 +28,5 @@ namespace NewHorizons.Handlers
|
|||||||
return DreamArrivalPoint.Location.Undefined;
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -93,7 +93,13 @@ namespace NewHorizons.Handlers
|
|||||||
|
|
||||||
private static void DreamWorldRemoved()
|
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()
|
private static void SunRemoved()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user