mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Implement StopTime, SlowTime mod compat
This commit is contained in:
parent
8e0fbbb69d
commit
cb2d83e026
@ -7,6 +7,8 @@ using NewHorizons.Utility.OWML;
|
|||||||
using NewHorizons.Utility.OuterWilds;
|
using NewHorizons.Utility.OuterWilds;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Object = UnityEngine.Object;
|
using Object = UnityEngine.Object;
|
||||||
|
using NewHorizons.OtherMods;
|
||||||
|
|
||||||
namespace NewHorizons.Handlers
|
namespace NewHorizons.Handlers
|
||||||
{
|
{
|
||||||
public static class SystemCreationHandler
|
public static class SystemCreationHandler
|
||||||
@ -31,7 +33,8 @@ namespace NewHorizons.Handlers
|
|||||||
// No time loop or travel audio at the eye
|
// No time loop or travel audio at the eye
|
||||||
if (Main.Instance.CurrentStarSystem == "EyeOfTheUniverse") return;
|
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");
|
var timeLoopController = new GameObject("TimeLoopController");
|
||||||
timeLoopController.AddComponent<TimeLoopController>();
|
timeLoopController.AddComponent<TimeLoopController>();
|
||||||
|
|||||||
6
NewHorizons/OtherMods/OtherModUtil.cs
Normal file
6
NewHorizons/OtherMods/OtherModUtil.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
namespace NewHorizons.OtherMods;
|
||||||
|
|
||||||
|
public static class OtherModUtil
|
||||||
|
{
|
||||||
|
public static bool IsEnabled(string modName) => Main.Instance.ModHelper.Interaction.ModExists(modName);
|
||||||
|
}
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
using NewHorizons.OtherMods;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace NewHorizons.Utility.OuterWilds
|
namespace NewHorizons.Utility.OuterWilds
|
||||||
@ -5,7 +6,17 @@ namespace NewHorizons.Utility.OuterWilds
|
|||||||
public static class TimeLoopUtilities
|
public static class TimeLoopUtilities
|
||||||
{
|
{
|
||||||
public const float LOOP_DURATION_IN_SECONDS = TimeLoop.LOOP_DURATION_IN_MINUTES * 60;
|
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 SetSecondsElapsed(float secondsElapsed) => TimeLoop._timeOffset = secondsElapsed - Time.timeSinceLevelLoad;
|
||||||
public static void SetMinutesRemaining(float minutes) => TimeLoop.SetSecondsRemaining(minutes * 60);
|
public static void SetMinutesRemaining(float minutes) => TimeLoop.SetSecondsRemaining(minutes * 60);
|
||||||
public static float GetMinutesRemaining() => TimeLoop.GetSecondsRemaining() / 60f;
|
public static float GetMinutesRemaining() => TimeLoop.GetSecondsRemaining() / 60f;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user