## Improvements
- StopTime and SlowTime mods will now effect the time loop in new
systems

## Bug fixes
- Re-added missing method signatures that were breaking Dreamstalker
This commit is contained in:
Noah Pilarski 2024-01-01 22:46:28 -05:00 committed by GitHub
commit 7ed6f7d1f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 52 additions and 5 deletions

View File

@ -1,6 +1,7 @@
using NewHorizons.External.Configs;
using NewHorizons.External.Modules;
using NewHorizons.Utility;
using System;
using UnityEngine;
namespace NewHorizons.Builder.Atmosphere
@ -52,7 +53,26 @@ namespace NewHorizons.Builder.Atmosphere
if (_fogEmitterPrefab == null) _fogEmitterPrefab = SearchUtilities.Find("DB_EscapePodDimension_Body/Sector_EscapePodDimension/Effects_EscapePodDimension/Effects_DB_Fog (1)").InstantiateInactive().Rename("Prefab_Effects_Fog").DontDestroyOnLoad();
}
#region obsolete
// Never change method signatures, people directly reference the NH dll and it can break backwards compatability
// Dreamstalker needed this one
[Obsolete]
public static void Make(GameObject planetGO, Sector sector, PlanetConfig config, float surfaceHeight)
=> Make(planetGO, sector, config, surfaceHeight);
#endregion
public static void Make(GameObject planetGO, Sector sector, PlanetConfig config)
=> Make(planetGO, sector, config, null);
/// <summary>
/// Nullable surface height for backwards compat
/// </summary>
/// <param name="planetGO"></param>
/// <param name="sector"></param>
/// <param name="config"></param>
/// <param name="surfaceHeight"></param>
private static void Make(GameObject planetGO, Sector sector, PlanetConfig config, float? surfaceHeight)
{
InitPrefabs();
@ -69,11 +89,13 @@ namespace NewHorizons.Builder.Atmosphere
sectorCullGroup._waitForStreaming = false;
var (minHeight, maxHeight) = GetDefaultHeightRange(config);
// min height override for backwards compat
minHeight = surfaceHeight ?? minHeight;
foreach (var particleField in config.ParticleFields)
{
var prefab = GetPrefabByType(particleField.type);
var emitter = Object.Instantiate(prefab, effectsGO.transform);
var emitter = GameObject.Instantiate(prefab, effectsGO.transform);
emitter.name = !string.IsNullOrWhiteSpace(particleField.rename) ? particleField.rename : prefab.name.Replace("Prefab_", "");
emitter.transform.position = planetGO.transform.position;

View File

@ -32,7 +32,12 @@ namespace NewHorizons.Builder.Props
// In particular, Outer Wives needs this method signature
[Obsolete]
public static GameObject Make(GameObject go, Sector sector, GameObject prefab, DetailInfo detail)
=> Make(go, sector, null, prefab, detail);
=> Make(go, sector, mod: null, prefab, detail);
// Dreamstalker needed this one
[Obsolete]
public static GameObject Make(GameObject go, Sector sector, DetailInfo detail)
=> Make(go, sector, mod: null, detail);
#endregion
private static void SceneManager_sceneUnloaded(Scene scene)

View File

@ -7,6 +7,8 @@ using NewHorizons.Utility.OWML;
using NewHorizons.Utility.OuterWilds;
using UnityEngine;
using Object = UnityEngine.Object;
using NewHorizons.OtherMods;
namespace NewHorizons.Handlers
{
public static class SystemCreationHandler
@ -31,7 +33,8 @@ namespace NewHorizons.Handlers
// No time loop or travel audio at the eye
if (Main.Instance.CurrentStarSystem == "EyeOfTheUniverse") return;
if (system.Config.enableTimeLoop)
// Small mod compat change for StopTime - do nothing if it's enabled
if (system.Config.enableTimeLoop && !OtherModUtil.IsEnabled("_nebula.StopTime"))
{
var timeLoopController = new GameObject("TimeLoopController");
timeLoopController.AddComponent<TimeLoopController>();

View File

@ -0,0 +1,6 @@
namespace NewHorizons.OtherMods;
public static class OtherModUtil
{
public static bool IsEnabled(string modName) => Main.Instance.ModHelper.Interaction.ModExists(modName);
}

View File

@ -1,3 +1,4 @@
using NewHorizons.OtherMods;
using UnityEngine;
namespace NewHorizons.Utility.OuterWilds
@ -5,7 +6,17 @@ namespace NewHorizons.Utility.OuterWilds
public static class TimeLoopUtilities
{
public const float LOOP_DURATION_IN_SECONDS = TimeLoop.LOOP_DURATION_IN_MINUTES * 60;
public static void SetLoopDuration(float minutes) => TimeLoop._loopDuration = minutes * 60f;
public static void SetLoopDuration(float minutes)
{
TimeLoop._loopDuration = minutes * 60f;
// If slow time mod is on give them at least an hour
// This won't slow down time based events like sand sizes but oh well
if (OtherModUtil.IsEnabled("dnlwtsn.SlowTime"))
{
TimeLoop._loopDuration = Mathf.Max(TimeLoop._loopDuration, 60f * 60f);
}
}
public static void SetSecondsElapsed(float secondsElapsed) => TimeLoop._timeOffset = secondsElapsed - Time.timeSinceLevelLoad;
public static void SetMinutesRemaining(float minutes) => TimeLoop.SetSecondsRemaining(minutes * 60);
public static float GetMinutesRemaining() => TimeLoop.GetSecondsRemaining() / 60f;

View File

@ -4,7 +4,7 @@
"author": "xen, Bwc9876, clay, MegaPiggy, John, Trifid, Hawkbar, Book",
"name": "New Horizons",
"uniqueName": "xen.NewHorizons",
"version": "1.18.0",
"version": "1.18.1",
"owmlVersion": "2.9.8",
"dependencies": [ "JohnCorby.VanillaFix", "_nebula.MenuFramework", "xen.CommonCameraUtility", "dgarro.CustomShipLogModes" ],
"conflicts": [ "Raicuparta.QuantumSpaceBuddies", "PacificEngine.OW_CommonResources" ],