mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
1.12.4 (#642)
## Bug fixes - Fixes dying on spawn in Evacuation - Fixes the player seeing objects loading out when changing star system - Fixes a NRE on reload without the Stranger - No longer get burned by the sun when spawning in (for real this time) This time without introducing a bug that breaks systems with only a single planet!
This commit is contained in:
commit
6557286eba
@ -1,3 +1,4 @@
|
||||
using NewHorizons.Components;
|
||||
using NewHorizons.Components.Orbital;
|
||||
using NewHorizons.External.Configs;
|
||||
using NewHorizons.Utility.OWML;
|
||||
@ -62,6 +63,8 @@ namespace NewHorizons.Builder.General
|
||||
() => Locator._centerOfTheUniverse != null,
|
||||
() => Locator._centerOfTheUniverse._staticReferenceFrame = astroObject.GetComponent<OWRigidbody>()
|
||||
);
|
||||
|
||||
PreserveActiveCenterOfTheUniverse.Apply(astroObject.gameObject);
|
||||
}
|
||||
|
||||
return astroObject;
|
||||
|
||||
@ -65,6 +65,9 @@ namespace NewHorizons.Builder.General
|
||||
ship.GetRequiredComponent<MatchInitialMotion>().SetBodyToMatch(owRigidBody);
|
||||
}
|
||||
spawnGO.SetActive(true);
|
||||
|
||||
// Ship doesn't get activated sometimes
|
||||
Delay.RunWhen(() => Main.IsSystemReady, () => ship.gameObject.SetActive(true));
|
||||
}
|
||||
|
||||
if ((Main.Instance.IsWarpingFromVessel || (!Main.Instance.IsWarpingFromShip && (module.playerSpawn?.startWithSuit ?? false))) && !suitUpQueued)
|
||||
|
||||
@ -80,7 +80,7 @@ namespace NewHorizons.Builder.Orbital
|
||||
}
|
||||
else
|
||||
{
|
||||
NHLogger.LogError($"No primary gravity or focal point for {primaryBody}");
|
||||
NHLogger.LogError($"Trying to put {secondaryBody.name} around {primaryBody.name} but found no primary gravity or focal point.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
26
NewHorizons/Components/PreserveActiveCenterOfTheUniverse.cs
Normal file
26
NewHorizons/Components/PreserveActiveCenterOfTheUniverse.cs
Normal file
@ -0,0 +1,26 @@
|
||||
using NewHorizons.Utility.OWML;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NewHorizons.Components
|
||||
{
|
||||
// Prevents the center of the universe being deactivated
|
||||
public class PreserveActiveCenterOfTheUniverse : MonoBehaviour
|
||||
{
|
||||
private GameObject _centerOfTheUniverse;
|
||||
|
||||
public static void Apply(GameObject center)
|
||||
{
|
||||
var go = new GameObject(nameof(PreserveActiveCenterOfTheUniverse));
|
||||
go.AddComponent<PreserveActiveCenterOfTheUniverse>()._centerOfTheUniverse = center;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (!_centerOfTheUniverse.activeInHierarchy)
|
||||
{
|
||||
NHLogger.LogWarning("Center of the universe cannot be inactive.");
|
||||
_centerOfTheUniverse.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -49,6 +49,8 @@ namespace NewHorizons.Components.Stars
|
||||
|
||||
public static void RemoveStar(StarController star)
|
||||
{
|
||||
if (Instance == null) return;
|
||||
|
||||
NHLogger.LogVerbose($"Removing star from list: {star?.gameObject?.name}");
|
||||
if (Instance._stars.Contains(star))
|
||||
{
|
||||
@ -74,7 +76,7 @@ namespace NewHorizons.Components.Stars
|
||||
|
||||
public static void RemoveStarLight(Light light)
|
||||
{
|
||||
if (light != null && Instance._lights.Contains(light))
|
||||
if (Instance != null && light != null && Instance._lights.Contains(light))
|
||||
{
|
||||
Instance._lights.Remove(light);
|
||||
}
|
||||
|
||||
@ -245,20 +245,10 @@ namespace NewHorizons.Handlers
|
||||
try
|
||||
{
|
||||
NHLogger.Log($"Creating [{body.Config.name}]");
|
||||
var planetObject = GenerateBody(body, defaultPrimaryToSun);
|
||||
try
|
||||
{
|
||||
planetObject?.SetActive(true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
NHLogger.LogError($"Error when activating new planet [{body.Config.name}] - {e}");
|
||||
}
|
||||
if (planetObject == null)
|
||||
{
|
||||
body.UnloadCache();
|
||||
return false;
|
||||
}
|
||||
var planetObject = GenerateBody(body, defaultPrimaryToSun)
|
||||
?? throw new NullReferenceException("Something went wrong when generating the body but no errors were logged.");
|
||||
|
||||
planetObject.SetActive(true);
|
||||
|
||||
var ao = planetObject.GetComponent<NHAstroObject>();
|
||||
|
||||
|
||||
@ -54,10 +54,11 @@ namespace NewHorizons.Handlers
|
||||
|
||||
public static void RemoveSolarSystem()
|
||||
{
|
||||
// Stop the sun from killing the player
|
||||
// Stop the sun from killing the player if they spawn at the center of the solar system
|
||||
var sunVolumes = SearchUtilities.Find("Sun_Body/Sector_SUN/Volumes_SUN");
|
||||
sunVolumes.SetActive(false);
|
||||
|
||||
// Random shit breaks if we don't wait idk why
|
||||
foreach (var name in _solarSystemBodies)
|
||||
{
|
||||
var ao = AstroObjectLocator.GetAstroObject(name);
|
||||
@ -65,7 +66,7 @@ namespace NewHorizons.Handlers
|
||||
else NHLogger.LogError($"Couldn't find [{name}]");
|
||||
}
|
||||
|
||||
// Bring the sun back because why not
|
||||
// Bring the sun back
|
||||
Delay.FireInNUpdates(() => { if (Locator.GetAstroObject(AstroObject.Name.Sun).gameObject.activeInHierarchy) { sunVolumes.SetActive(true); } }, 3);
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
using HarmonyLib;
|
||||
using NewHorizons.Utility.OWML;
|
||||
|
||||
namespace NewHorizons.Patches.PlayerPatches
|
||||
{
|
||||
[HarmonyPatch(typeof(HazardDetector))]
|
||||
public static class PlayerHazardDetectorPatches
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(nameof(HazardDetector.Awake))]
|
||||
public static void HazardDetector_Awake(HazardDetector __instance)
|
||||
{
|
||||
// Prevent the player detector from being hurt while the solar system is being set up
|
||||
if (__instance._isPlayerDetector && !Main.IsSystemReady)
|
||||
{
|
||||
__instance.enabled = false;
|
||||
Delay.RunWhen(() => Main.IsSystemReady, () => __instance.enabled = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4,7 +4,7 @@
|
||||
"author": "xen, Bwc9876, clay, MegaPiggy, John, Trifid, Hawkbar, Book",
|
||||
"name": "New Horizons",
|
||||
"uniqueName": "xen.NewHorizons",
|
||||
"version": "1.12.3",
|
||||
"version": "1.12.4",
|
||||
"owmlVersion": "2.9.3",
|
||||
"dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
|
||||
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_CommonResources" ],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user