diff --git a/NewHorizons/Builder/Atmosphere/EffectsBuilder.cs b/NewHorizons/Builder/Atmosphere/EffectsBuilder.cs index b4c74b78..8be43327 100644 --- a/NewHorizons/Builder/Atmosphere/EffectsBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/EffectsBuilder.cs @@ -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); + + /// + /// Nullable surface height for backwards compat + /// + /// + /// + /// + /// + 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; diff --git a/NewHorizons/Builder/Props/DetailBuilder.cs b/NewHorizons/Builder/Props/DetailBuilder.cs index 0f510106..0fa79b84 100644 --- a/NewHorizons/Builder/Props/DetailBuilder.cs +++ b/NewHorizons/Builder/Props/DetailBuilder.cs @@ -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) diff --git a/NewHorizons/Handlers/SystemCreationHandler.cs b/NewHorizons/Handlers/SystemCreationHandler.cs index d0c576f9..debd14e7 100644 --- a/NewHorizons/Handlers/SystemCreationHandler.cs +++ b/NewHorizons/Handlers/SystemCreationHandler.cs @@ -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(); diff --git a/NewHorizons/OtherMods/OtherModUtil.cs b/NewHorizons/OtherMods/OtherModUtil.cs new file mode 100644 index 00000000..6843158d --- /dev/null +++ b/NewHorizons/OtherMods/OtherModUtil.cs @@ -0,0 +1,6 @@ +namespace NewHorizons.OtherMods; + +public static class OtherModUtil +{ + public static bool IsEnabled(string modName) => Main.Instance.ModHelper.Interaction.ModExists(modName); +} diff --git a/NewHorizons/Utility/OuterWilds/TimeLoopUtilities.cs b/NewHorizons/Utility/OuterWilds/TimeLoopUtilities.cs index 4566487c..f9c40831 100644 --- a/NewHorizons/Utility/OuterWilds/TimeLoopUtilities.cs +++ b/NewHorizons/Utility/OuterWilds/TimeLoopUtilities.cs @@ -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; diff --git a/NewHorizons/manifest.json b/NewHorizons/manifest.json index 7755e5ee..45285f35 100644 --- a/NewHorizons/manifest.json +++ b/NewHorizons/manifest.json @@ -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" ],