From 17abc1e670e0625befe91994c4deddb77ffc9f2e Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sun, 15 May 2022 10:49:02 -0400 Subject: [PATCH 1/5] Manually add source to signal's field. --- NewHorizons/Builder/Props/SignalBuilder.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NewHorizons/Builder/Props/SignalBuilder.cs b/NewHorizons/Builder/Props/SignalBuilder.cs index 56a6fe28..f3970175 100644 --- a/NewHorizons/Builder/Props/SignalBuilder.cs +++ b/NewHorizons/Builder/Props/SignalBuilder.cs @@ -147,10 +147,12 @@ namespace NewHorizons.Builder.Props var source = signalGO.AddComponent(); var owAudioSource = signalGO.AddComponent(); + owAudioSource._audioSource = source; AudioSignal audioSignal; if (info.InsideCloak) audioSignal = signalGO.AddComponent(); else audioSignal = signalGO.AddComponent(); + audioSignal._owAudioSource = owAudioSource; var frequency = StringToFrequency(info.Frequency); var name = StringToSignalName(info.Name); From faa5345afe104c455bbc3d25f28b9bccab1f3a0b Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Wed, 18 May 2022 23:22:37 -0400 Subject: [PATCH 2/5] Remove Null Signals Fixes https://github.com/xen-42/outer-wilds-new-horizons/issues/115 --- NewHorizons/Patches/AudioSignalPatches.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NewHorizons/Patches/AudioSignalPatches.cs b/NewHorizons/Patches/AudioSignalPatches.cs index ed7cbdde..33b00d4f 100644 --- a/NewHorizons/Patches/AudioSignalPatches.cs +++ b/NewHorizons/Patches/AudioSignalPatches.cs @@ -130,5 +130,12 @@ namespace NewHorizons.Patches } return true; } + + [HarmonyPrefix] + [HarmonyPatch(typeof(TravelerAudioManager), nameof(TravelerAudioManager.Update))] + public static void TravelerAudioManager_Update(TravelerAudioManager __instance) + { + __instance._signals.RemoveAll(signal => signal == null || signal.gameObject == null || signal._owAudioSource == null || signal._owAudioSource._audioSource == null); + } } } From 33850a3cee2907f7495248c95a15a109fbccf068 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Wed, 18 May 2022 23:23:00 -0400 Subject: [PATCH 3/5] Add AntiTravelMusicRuleset https://github.com/xen-42/outer-wilds-new-horizons/issues/139 --- NewHorizons/Builder/Atmosphere/VolumesBuilder.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NewHorizons/Builder/Atmosphere/VolumesBuilder.cs b/NewHorizons/Builder/Atmosphere/VolumesBuilder.cs index bb27a514..09da02c8 100644 --- a/NewHorizons/Builder/Atmosphere/VolumesBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/VolumesBuilder.cs @@ -36,6 +36,8 @@ namespace NewHorizons.Builder.Atmosphere PR._useMinimap = useMiniMap; PR._useAltimeter = useMiniMap; + rulesetGO.AddComponent(); + EffectRuleset ER = rulesetGO.AddComponent(); ER._type = EffectRuleset.BubbleType.Underwater; var gdRuleset = GameObject.Find("GiantsDeep_Body/Sector_GD/Volumes_GD/RulesetVolumes_GD").GetComponent(); From f6c601a208d8c31f3ebf71058ab5fec36197944b Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Wed, 18 May 2022 23:40:43 -0400 Subject: [PATCH 4/5] Customizable Ambient Light Intensity https://github.com/xen-42/outer-wilds-new-horizons/issues/130 --- NewHorizons/Builder/General/AmbientLightBuilder.cs | 4 ++-- NewHorizons/External/Modules/BaseModule.cs | 2 ++ NewHorizons/Handlers/PlanetCreationHandler.cs | 6 +++++- NewHorizons/Schemas/body_schema.json | 8 ++++---- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/NewHorizons/Builder/General/AmbientLightBuilder.cs b/NewHorizons/Builder/General/AmbientLightBuilder.cs index 932c6858..307683fa 100644 --- a/NewHorizons/Builder/General/AmbientLightBuilder.cs +++ b/NewHorizons/Builder/General/AmbientLightBuilder.cs @@ -3,7 +3,7 @@ namespace NewHorizons.Builder.General { public static class AmbientLightBuilder { - public static void Make(GameObject planetGO, Sector sector, float scale) + public static void Make(GameObject planetGO, Sector sector, float scale, float intensity = 0.5f) { GameObject lightGO = GameObject.Instantiate(GameObject.Find("BrittleHollow_Body/AmbientLight_BH_Surface"), sector?.transform ?? planetGO.transform); lightGO.transform.position = planetGO.transform.position; @@ -19,7 +19,7 @@ namespace NewHorizons.Builder.General light.color = new Color(0.0f, 0.0f, 0.8f, 0.0225f); light.range = scale; - light.intensity = 0.5f; + light.intensity = intensity; } } } diff --git a/NewHorizons/External/Modules/BaseModule.cs b/NewHorizons/External/Modules/BaseModule.cs index 39e14eaf..6454a5ad 100644 --- a/NewHorizons/External/Modules/BaseModule.cs +++ b/NewHorizons/External/Modules/BaseModule.cs @@ -4,7 +4,9 @@ namespace NewHorizons.External.Modules public class BaseModule { public bool HasMapMarker { get; set; } + [System.Obsolete("HasAmbientLight is deprecated, please use AmbientLight instead")] public bool HasAmbientLight { get; set; } + public float AmbientLight { get; set; } public float SurfaceGravity { get; set; } public string GravityFallOff { get; set; } = "linear"; public float SurfaceSize { get; set; } diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index 25d0527d..c15db259 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -378,7 +378,11 @@ namespace NewHorizons.Handlers { var sphereOfInfluence = GetSphereOfInfluence(body); - if (body.Config.Base.HasAmbientLight) + if (body.Config.Base.AmbientLight != 0) + { + AmbientLightBuilder.Make(go, sector, sphereOfInfluence, body.Config.Base.AmbientLight); + } + else if (body.Config.Base.HasAmbientLight) { AmbientLightBuilder.Make(go, sector, sphereOfInfluence); } diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 3235336b..65675b66 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -209,10 +209,10 @@ "default": false, "description": "If the body should have a marker on the map screen." }, - "hasAmbientLight": { - "type": "boolean", - "default": false, - "description": "If the dark side of the body should have some slight amount of light" + "ambientLight": { + "type": "number", + "default": 0, + "description": "The intensity of light the dark side of the body should have. Timber Hearth has 1.4 for reference" }, "surfaceGravity": { "type": "number", From 7ad2d01a108f1fa906d25e2a515fb051684ad714 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Thu, 19 May 2022 00:37:36 -0400 Subject: [PATCH 5/5] Untarget when switching states https://github.com/xen-42/outer-wilds-new-horizons/issues/134 --- NewHorizons/Components/QuantumPlanet.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/NewHorizons/Components/QuantumPlanet.cs b/NewHorizons/Components/QuantumPlanet.cs index 9627540e..4b932df9 100644 --- a/NewHorizons/Components/QuantumPlanet.cs +++ b/NewHorizons/Components/QuantumPlanet.cs @@ -107,6 +107,8 @@ namespace NewHorizons.Components if (newState.orbit != null && newState.orbit != oldState.orbit) SetNewOrbit(primaryBody, orbitalParams); _currentIndex = newIndex; + + GlobalMessenger.FireEvent("QuantumMoonChangeState", _rb); } // Be completely sure we move the visibility tracker back to our planet