From 37b3e14b2b73fbc9fcae748076bd5990ba41ac60 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 16 Jul 2022 18:21:38 -0400 Subject: [PATCH 01/38] Set ColorTime --- .../Components/SizeControllers/StarEvolutionController.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs index 42398c2b..fb210e87 100644 --- a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs +++ b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs @@ -159,15 +159,18 @@ namespace NewHorizons.Components.SizeControllers { _currentColour = Color.Lerp(_startColour, _endColour, t); supernova._surface._materials[0].Lerp(_startSurfaceMaterial, _endSurfaceMaterial, t); + supernova._surface._materials[0].SetFloat("_ColorTime", t); } else { _currentColour = _endColour; + supernova._surface._materials[0].SetFloat("_ColorTime", 1); } } else { _currentColour = _startColour; + supernova._surface._materials[0].SetFloat("_ColorTime", 0); } if (_flareEmitter != null) _flareEmitter._tint = _currentColour; From 72d5bc196e41940a2610632b22a62a32b44236f4 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 16 Jul 2022 18:21:52 -0400 Subject: [PATCH 02/38] Set collapse time to 10 --- .../Components/SizeControllers/StarEvolutionController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs index fb210e87..a60cccbb 100644 --- a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs +++ b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs @@ -34,7 +34,7 @@ namespace NewHorizons.Components.SizeControllers private float _collapseStartSize; private float _collapseTimer; - public float collapseTime = 5f; // seconds + public float collapseTime = 10f; // seconds public float lifespan = 22f; // minutes private float _age; From fedb3c90572991e3e7137b3664e1e59f0acd86d6 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 16 Jul 2022 20:01:06 -0400 Subject: [PATCH 03/38] Use property id --- .../SizeControllers/StarEvolutionController.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs index a60cccbb..13a6522d 100644 --- a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs +++ b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs @@ -55,6 +55,7 @@ namespace NewHorizons.Components.SizeControllers private float maxScale; private float minScale; private static readonly int ColorRamp = Shader.PropertyToID("_ColorRamp"); + private static readonly int ColorTime = Shader.PropertyToID("_ColorTime"); private Color _currentColour; @@ -159,18 +160,20 @@ namespace NewHorizons.Components.SizeControllers { _currentColour = Color.Lerp(_startColour, _endColour, t); supernova._surface._materials[0].Lerp(_startSurfaceMaterial, _endSurfaceMaterial, t); - supernova._surface._materials[0].SetFloat("_ColorTime", t); + supernova._surface._materials[0].SetFloat(ColorTime, t); } else { _currentColour = _endColour; - supernova._surface._materials[0].SetFloat("_ColorTime", 1); + supernova._surface._materials[0].Lerp(_startSurfaceMaterial, _endSurfaceMaterial, 1); + supernova._surface._materials[0].SetFloat(ColorTime, 1); } } else { _currentColour = _startColour; - supernova._surface._materials[0].SetFloat("_ColorTime", 0); + supernova._surface._materials[0].Lerp(_startSurfaceMaterial, _endSurfaceMaterial, 0); + supernova._surface._materials[0].SetFloat(ColorTime, 0); } if (_flareEmitter != null) _flareEmitter._tint = _currentColour; From f88c16a2366f946aa336ca0e2bd3b373e33dec54 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Sat, 16 Jul 2022 17:20:02 -0700 Subject: [PATCH 04/38] keep the walls batched collider instead of the walls one --- NewHorizons/Builder/Body/BrambleDimensionBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs b/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs index 4dce6bc3..a96988dd 100644 --- a/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs +++ b/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs @@ -85,7 +85,7 @@ namespace NewHorizons.Builder.Body // remove default vines var geoBatchedGroup = geometry.FindChild("BatchedGroup"); - var collider = geoBatchedGroup.FindChild("BatchedMeshColliders_1"); + var collider = geoBatchedGroup.FindChild("BatchedMeshColliders_0"); collider.transform.parent = geometry.transform; GameObject.Destroy(geoBatchedGroup); From 8b1a9f3deeae32dcf187576b714afa831dcb5f0d Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Sat, 16 Jul 2022 17:23:54 -0700 Subject: [PATCH 05/38] use property id more --- .../SizeControllers/StarEvolutionController.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs index 13a6522d..9c877267 100644 --- a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs +++ b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs @@ -56,6 +56,9 @@ namespace NewHorizons.Components.SizeControllers private float minScale; private static readonly int ColorRamp = Shader.PropertyToID("_ColorRamp"); private static readonly int ColorTime = Shader.PropertyToID("_ColorTime"); + private static readonly int InnerRadius = Shader.PropertyToID("_InnerRadius"); + private static readonly int OuterRadius = Shader.PropertyToID("_OuterRadius"); + private static readonly int SkyColor = Shader.PropertyToID("_SkyColor"); private Color _currentColour; @@ -276,9 +279,9 @@ namespace NewHorizons.Components.SizeControllers { foreach (var lod in _atmosphereRenderers) { - lod.material.SetFloat("_InnerRadius", CurrentScale); - lod.material.SetFloat("_OuterRadius", CurrentScale * StarBuilder.OuterRadiusRatio); - lod.material.SetColor("_SkyColor", _currentColour); + lod.material.SetFloat(InnerRadius, CurrentScale); + lod.material.SetFloat(OuterRadius, CurrentScale * StarBuilder.OuterRadiusRatio); + lod.material.SetColor(SkyColor, _currentColour); } } } From bb0dc7f2339f63f715ea697f7028ce47c7bb0e12 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Sat, 16 Jul 2022 17:24:27 -0700 Subject: [PATCH 06/38] you dont need to check count here --- .../Components/SizeControllers/StarEvolutionController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs index 9c877267..1a364431 100644 --- a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs +++ b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs @@ -275,7 +275,7 @@ namespace NewHorizons.Components.SizeControllers _fog._fogTint = fogColour; } - if (_atmosphereRenderers != null && _atmosphereRenderers.Count() > 0) + if (_atmosphereRenderers != null) { foreach (var lod in _atmosphereRenderers) { From 1b4fdcb2657696c78b36ec104aa3f40dbffa259e Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 16 Jul 2022 22:23:13 -0400 Subject: [PATCH 07/38] Better fog ramp --- NewHorizons/Assets/textures/FogColorRamp.png | Bin 233 -> 129 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/NewHorizons/Assets/textures/FogColorRamp.png b/NewHorizons/Assets/textures/FogColorRamp.png index 5bc8a0b9b180e7bffd36c905d46699f812e0ad6c..4fbb2da678c3ef59c25c240c3143f63b8c503fcc 100644 GIT binary patch delta 63 zcmaFK*vL4+)8Zfl1K&Z$9TT(PGB7ZRdAc};XapypIDNYM Date: Sat, 16 Jul 2022 22:43:45 -0400 Subject: [PATCH 08/38] Carry over tinted ramp --- NewHorizons/Builder/Body/StarBuilder.cs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/NewHorizons/Builder/Body/StarBuilder.cs b/NewHorizons/Builder/Body/StarBuilder.cs index 8266b9d4..d3c2812c 100644 --- a/NewHorizons/Builder/Body/StarBuilder.cs +++ b/NewHorizons/Builder/Body/StarBuilder.cs @@ -24,6 +24,7 @@ namespace NewHorizons.Builder.Body public static StarController Make(GameObject planetGO, Sector sector, StarModule starModule, IModBehaviour mod) { var starGO = MakeStarGraphics(planetGO, sector, starModule, mod); + var ramp = starGO.GetComponentInChildren().sharedMaterial.GetTexture(ColorRamp); var sunAudio = Object.Instantiate(SearchUtilities.Find("Sun_Body/Sector_SUN/Audio_SUN"), starGO.transform); sunAudio.transform.localPosition = Vector3.zero; @@ -140,15 +141,10 @@ namespace NewHorizons.Builder.Body controller.StartColour = starModule.tint; controller.EndColour = starModule.endTint; controller.WillExplode = starModule.goSupernova; - if (!string.IsNullOrEmpty(starModule.starRampTexture)) - { - var ramp = ImageUtilities.GetTexture(mod, starModule.starRampTexture); - controller.normalRamp = ramp; - } + controller.normalRamp = !string.IsNullOrEmpty(starModule.starRampTexture) ? ImageUtilities.GetTexture(mod, starModule.starRampTexture) : ramp; if (!string.IsNullOrEmpty(starModule.starCollapseRampTexture)) { - var ramp = ImageUtilities.GetTexture(mod, starModule.starCollapseRampTexture); - controller.collapseRamp = ramp; + controller.collapseRamp = ImageUtilities.GetTexture(mod, starModule.starCollapseRampTexture); } surfaceAudio.SetStarEvolutionController(controller); starGO.SetActive(true); From 2014195d2a31bab77358d0af0b45226013664b2c Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Sat, 16 Jul 2022 23:05:22 -0400 Subject: [PATCH 09/38] Add stop for collapse and supernova --- .../StarEvolutionController.cs | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs index 1a364431..1ae2d0d9 100644 --- a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs +++ b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs @@ -45,6 +45,7 @@ namespace NewHorizons.Components.SizeControllers private Material _collapseEndSurfaceMaterial; private Material _startSurfaceMaterial; private Material _endSurfaceMaterial; + private Material _surfaceMaterial; private Texture _normalRamp; private Texture _collapseRamp; @@ -62,7 +63,7 @@ namespace NewHorizons.Components.SizeControllers private Color _currentColour; - void Start() + private void Start() { var sun = GameObject.FindObjectOfType(); _collapseStartSurfaceMaterial = new Material(sun._collapseStartSurfaceMaterial); @@ -137,6 +138,7 @@ namespace NewHorizons.Components.SizeControllers } _flareEmitter = GetComponentInChildren(); + _surfaceMaterial = supernova._surface._materials[0]; } public void OnDestroy() @@ -226,7 +228,17 @@ namespace NewHorizons.Components.SizeControllers if (_proxy != null) _proxy.StartCollapse(); } - private void StartSupernova() + public void StopCollapse() + { + Logger.LogVerbose($"{gameObject.transform.root.name} stopped collapse"); + + _isCollapsing = false; + supernova._surface._materials[0].CopyPropertiesFromMaterial(_endSurfaceMaterial); + + if (_proxy != null) _proxy.StopCollapse(); + } + + public void StartSupernova() { Logger.LogVerbose($"{gameObject.transform.root.name} started supernova"); @@ -238,6 +250,25 @@ namespace NewHorizons.Components.SizeControllers if (_destructionVolume != null) _destructionVolume._deathType = DeathType.Supernova; } + public void StopSupernova() + { + Logger.LogVerbose($"{gameObject.transform.root.name} stopped supernova"); + + supernova.enabled = false; + _isSupernova = false; + if (atmosphere != null) atmosphere.SetActive(true); + if (_destructionVolume != null) + { + _destructionVolume._deathType = DeathType.Energy; + _destructionVolume.transform.localScale = Vector3.one; + } + if (_heatVolume != null) _heatVolume.transform.localScale = Vector3.one; + gameObject.SetActive(true); + transform.localScale = Vector3.one; + supernova._surface._materials[0] = _surfaceMaterial; + supernova._surface.transform.localScale = Vector3.one; + } + protected new void FixedUpdate() { _age += Time.deltaTime; From 24f785a02566213ef0c63c5f69f5beca3769fbb5 Mon Sep 17 00:00:00 2001 From: Joshua Thome Date: Sun, 17 Jul 2022 18:15:05 -0500 Subject: [PATCH 10/38] Fix signal scope breaking at eye --- NewHorizons/Builder/Props/SignalBuilder.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Props/SignalBuilder.cs b/NewHorizons/Builder/Props/SignalBuilder.cs index 4ccb7311..f3502d8e 100644 --- a/NewHorizons/Builder/Props/SignalBuilder.cs +++ b/NewHorizons/Builder/Props/SignalBuilder.cs @@ -102,7 +102,9 @@ namespace NewHorizons.Builder.Props } public static string GetCustomFrequencyName(SignalFrequency frequencyName) - { + { + // Can happen if NH not initialized because we loaded into Eye first or smth + if (_customFrequencyNames == null) return null; _customFrequencyNames.TryGetValue(frequencyName, out string name); return name; } From 84b00e58c900485e65c18faa2d5961c13fc1e276 Mon Sep 17 00:00:00 2001 From: Joshua Thome Date: Sun, 17 Jul 2022 19:31:48 -0500 Subject: [PATCH 11/38] Replace looked up signal rolloff curve with hard-coded curve --- NewHorizons/Builder/Props/SignalBuilder.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/NewHorizons/Builder/Props/SignalBuilder.cs b/NewHorizons/Builder/Props/SignalBuilder.cs index f3502d8e..5d7e9485 100644 --- a/NewHorizons/Builder/Props/SignalBuilder.cs +++ b/NewHorizons/Builder/Props/SignalBuilder.cs @@ -102,9 +102,7 @@ namespace NewHorizons.Builder.Props } public static string GetCustomFrequencyName(SignalFrequency frequencyName) - { - // Can happen if NH not initialized because we loaded into Eye first or smth - if (_customFrequencyNames == null) return null; + { _customFrequencyNames.TryGetValue(frequencyName, out string name); return name; } @@ -166,9 +164,17 @@ namespace NewHorizons.Builder.Props source.velocityUpdateMode = AudioVelocityUpdateMode.Fixed; source.rolloffMode = AudioRolloffMode.Custom; - if (_customCurve == null) - _customCurve = SearchUtilities.Find("Moon_Body/Sector_THM/Characters_THM/Villager_HEA_Esker/Signal_Whistling").GetComponent().GetCustomCurve(AudioSourceCurveType.CustomRolloff); - + if (_customCurve == null) + { + _customCurve = new AnimationCurve( + new Keyframe(0.0333f, 1f, -30.012f, -30.012f, 0.3333f, 0.3333f), + new Keyframe(0.0667f, 0.5f, -7.503f, -7.503f, 0.3333f, 0.3333f), + new Keyframe(0.1333f, 0.25f, -1.8758f, -1.8758f, 0.3333f, 0.3333f), + new Keyframe(0.2667f, 0.125f, -0.4689f, -0.4689f, 0.3333f, 0.3333f), + new Keyframe(0.5333f, 0.0625f, -0.1172f, -0.1172f, 0.3333f, 0.3333f), + new Keyframe(1f, 0f, -0.0333f, -0.0333f, 0.3333f, 0.3333f)); + } + source.SetCustomCurve(AudioSourceCurveType.CustomRolloff, _customCurve); // If it can be heard regularly then we play it immediately source.playOnAwake = !info.onlyAudibleToScope; From 86e37c5fd49d4873c024bcf8425677e06924b817 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Mon, 18 Jul 2022 14:03:12 -0400 Subject: [PATCH 12/38] Does not exist --- NewHorizons/Handlers/PlanetDestructionHandler.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/NewHorizons/Handlers/PlanetDestructionHandler.cs b/NewHorizons/Handlers/PlanetDestructionHandler.cs index ee3b9535..97bd55de 100644 --- a/NewHorizons/Handlers/PlanetDestructionHandler.cs +++ b/NewHorizons/Handlers/PlanetDestructionHandler.cs @@ -92,9 +92,6 @@ namespace NewHorizons.Handlers DisableBody(SearchUtilities.Find("FocalBody"), delete); DisableBody(SearchUtilities.Find("SandFunnel_Body"), delete); break; - case AstroObject.Name.MapSatellite: - DisableBody(SearchUtilities.Find("MapSatellite_Body"), delete); - break; case AstroObject.Name.GiantsDeep: // Might prevent leftover jellyfish from existing // Might also prevent people from using their own jellyfish however From 613cd45ebc1dfb512c25e2a2619737314636db64 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Mon, 18 Jul 2022 14:05:07 -0400 Subject: [PATCH 13/38] No need for the warn --- NewHorizons/Handlers/PlanetDestructionHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Handlers/PlanetDestructionHandler.cs b/NewHorizons/Handlers/PlanetDestructionHandler.cs index 97bd55de..7e04ef30 100644 --- a/NewHorizons/Handlers/PlanetDestructionHandler.cs +++ b/NewHorizons/Handlers/PlanetDestructionHandler.cs @@ -90,7 +90,7 @@ namespace NewHorizons.Handlers case AstroObject.Name.CaveTwin: case AstroObject.Name.TowerTwin: DisableBody(SearchUtilities.Find("FocalBody"), delete); - DisableBody(SearchUtilities.Find("SandFunnel_Body"), delete); + DisableBody(SearchUtilities.Find("SandFunnel_Body", false), delete); break; case AstroObject.Name.GiantsDeep: // Might prevent leftover jellyfish from existing From b2fb622bbb8947e62bfbc007da4a08e7959ed198 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Mon, 18 Jul 2022 12:13:58 -0700 Subject: [PATCH 14/38] you want arcInfo != null instead of arcInfo == null --- NewHorizons/Builder/Props/NomaiTextBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Props/NomaiTextBuilder.cs b/NewHorizons/Builder/Props/NomaiTextBuilder.cs index 02cc532e..1c5324ed 100644 --- a/NewHorizons/Builder/Props/NomaiTextBuilder.cs +++ b/NewHorizons/Builder/Props/NomaiTextBuilder.cs @@ -365,7 +365,7 @@ namespace NewHorizons.Builder.Props { GameObject arc; var type = arcInfo != null ? arcInfo.type : PropModule.NomaiTextArcInfo.NomaiTextArcType.Adult; - var variation = arcInfo == null ? arcInfo.variation : -1; + var variation = arcInfo != null ? arcInfo.variation : -1; switch (type) { case PropModule.NomaiTextArcInfo.NomaiTextArcType.Child: From cdc4086cce649b273e3dc64ed33b871b84ffca49 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Mon, 18 Jul 2022 15:30:37 -0400 Subject: [PATCH 15/38] Stop the audio error log from happening No more "Audio source track is Undefined, moving to Menu track" --- NewHorizons/Components/ShipWarpController.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Components/ShipWarpController.cs b/NewHorizons/Components/ShipWarpController.cs index 9a9f1aad..ed08e79e 100644 --- a/NewHorizons/Components/ShipWarpController.cs +++ b/NewHorizons/Components/ShipWarpController.cs @@ -37,9 +37,13 @@ namespace NewHorizons.Components MakeWhiteHole(); _isWarpingIn = false; - - _oneShotSource = gameObject.AddComponent(); + + var audioObject = new GameObject("WarpOneShot"); + audioObject.transform.parent = transform; + audioObject.SetActive(false); + _oneShotSource = audioObject.AddComponent(); _oneShotSource._track = OWAudioMixer.TrackName.Ship; + audioObject.SetActive(true); GlobalMessenger.AddListener("FinishOpenEyes", new Callback(OnFinishOpenEyes)); } From b5ed5cddc60e83069c4fcb8400fbf00790893860 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Mon, 18 Jul 2022 15:44:39 -0400 Subject: [PATCH 16/38] Remove (Clone) from name --- NewHorizons/Builder/Props/DetailBuilder.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/NewHorizons/Builder/Props/DetailBuilder.cs b/NewHorizons/Builder/Props/DetailBuilder.cs index 49a7d0b2..de0a86c4 100644 --- a/NewHorizons/Builder/Props/DetailBuilder.cs +++ b/NewHorizons/Builder/Props/DetailBuilder.cs @@ -106,6 +106,7 @@ namespace NewHorizons.Builder.Props if (prefab == null) return null; GameObject prop = prefab.InstantiateInactive(); + prop.name = prefab.name; prop.transform.parent = sector?.transform ?? planetGO.transform; StreamingHandler.SetUpStreaming(prop, sector); From d80305b46467698400bddf306d2418463ccbf774 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Mon, 18 Jul 2022 16:52:50 -0400 Subject: [PATCH 17/38] Add audio track property --- NewHorizons/Builder/Props/AudioVolumeBuilder.cs | 1 + NewHorizons/External/Modules/PropModule.cs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/NewHorizons/Builder/Props/AudioVolumeBuilder.cs b/NewHorizons/Builder/Props/AudioVolumeBuilder.cs index 91d1d3f6..e29d8f76 100644 --- a/NewHorizons/Builder/Props/AudioVolumeBuilder.cs +++ b/NewHorizons/Builder/Props/AudioVolumeBuilder.cs @@ -27,6 +27,7 @@ namespace NewHorizons.Builder.Props var owAudioSource = go.AddComponent(); owAudioSource._audioSource = audioSource; owAudioSource.loop = true; + owAudioSource.SetTrack(info.track); AudioUtilities.SetAudioClip(owAudioSource, info.audio, mod); var audioVolume = go.AddComponent(); diff --git a/NewHorizons/External/Modules/PropModule.cs b/NewHorizons/External/Modules/PropModule.cs index afc24cb2..58b20b1f 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -741,6 +741,11 @@ namespace NewHorizons.External.Modules /// The radius of this audio volume /// public string audio; + + /// + /// The audio track of this audio volume + /// + public OWAudioMixer.TrackName track = OWAudioMixer.TrackName.Environment; } } } \ No newline at end of file From 397d9ec4c86dd62165f16e224f4750ac96a62c05 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Mon, 18 Jul 2022 17:02:01 -0400 Subject: [PATCH 18/38] Don't use game's enum --- .../Builder/Props/AudioVolumeBuilder.cs | 2 +- NewHorizons/External/Modules/PropModule.cs | 23 ++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Builder/Props/AudioVolumeBuilder.cs b/NewHorizons/Builder/Props/AudioVolumeBuilder.cs index e29d8f76..78217884 100644 --- a/NewHorizons/Builder/Props/AudioVolumeBuilder.cs +++ b/NewHorizons/Builder/Props/AudioVolumeBuilder.cs @@ -27,7 +27,7 @@ namespace NewHorizons.Builder.Props var owAudioSource = go.AddComponent(); owAudioSource._audioSource = audioSource; owAudioSource.loop = true; - owAudioSource.SetTrack(info.track); + owAudioSource.SetTrack((OWAudioMixer.TrackName)Enum.Parse(typeof(OWAudioMixer.TrackName), Enum.GetName(typeof(AudioMixerTrackName), info.track))); AudioUtilities.SetAudioClip(owAudioSource, info.audio, mod); var audioVolume = go.AddComponent(); diff --git a/NewHorizons/External/Modules/PropModule.cs b/NewHorizons/External/Modules/PropModule.cs index 58b20b1f..7d2a06a9 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -745,7 +745,28 @@ namespace NewHorizons.External.Modules /// /// The audio track of this audio volume /// - public OWAudioMixer.TrackName track = OWAudioMixer.TrackName.Environment; + public AudioMixerTrackName track = AudioMixerTrackName.Environment; } } + + [JsonConverter(typeof(StringEnumConverter))] + public enum AudioMixerTrackName + { + [EnumMember(Value = @"undefined")] Undefined = 0, + [EnumMember(Value = @"menu")] Menu = 1, + [EnumMember(Value = @"music")] Music = 2, + [EnumMember(Value = @"environment")] Environment = 4, + [EnumMember(Value = @"environmentUnfiltered")] Environment_Unfiltered = 5, + [EnumMember(Value = @"endTimesSfx")] EndTimes_SFX = 8, + [EnumMember(Value = @"signal")] Signal = 16, + [EnumMember(Value = @"death")] Death = 32, + [EnumMember(Value = @"player")] Player = 64, + [EnumMember(Value = @"playerExternal")] Player_External = 65, + [EnumMember(Value = @"ship")] Ship = 128, + [EnumMember(Value = @"map")] Map = 256, + [EnumMember(Value = @"endTimesMusic")] EndTimes_Music = 512, + [EnumMember(Value = @"muffleWhileRafting")] MuffleWhileRafting = 1024, + [EnumMember(Value = @"muffleIndoors")] MuffleIndoors = 2048, + [EnumMember(Value = @"slideReelMusic")] SlideReelMusic = 4096, + } } \ No newline at end of file From ecbb44bcd8c3641834916387a143f090d0a967f3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 18 Jul 2022 21:05:13 +0000 Subject: [PATCH 19/38] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 5281c3ab..f33e2015 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -1650,9 +1650,53 @@ "audio": { "type": "string", "description": "The radius of this audio volume" + }, + "track": { + "description": "The audio track of this audio volume", + "$ref": "#/definitions/AudioMixerTrackName" } } }, + "AudioMixerTrackName": { + "type": "string", + "description": "", + "x-enumNames": [ + "Undefined", + "Menu", + "Music", + "Environment", + "Environment_Unfiltered", + "EndTimes_SFX", + "Signal", + "Death", + "Player", + "Player_External", + "Ship", + "Map", + "EndTimes_Music", + "MuffleWhileRafting", + "MuffleIndoors", + "SlideReelMusic" + ], + "enum": [ + "undefined", + "menu", + "music", + "environment", + "environmentUnfiltered", + "endTimesSfx", + "signal", + "death", + "player", + "playerExternal", + "ship", + "map", + "endTimesMusic", + "muffleWhileRafting", + "muffleIndoors", + "slideReelMusic" + ] + }, "SignalInfo": { "type": "object", "additionalProperties": false, From 00e14d78863355783dca973913fe4a3be2f2f642 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Mon, 18 Jul 2022 17:11:43 -0400 Subject: [PATCH 20/38] Add defaults to enums --- NewHorizons/External/Modules/AtmosphereModule.cs | 2 +- NewHorizons/External/Modules/BaseModule.cs | 2 +- NewHorizons/External/Modules/PropModule.cs | 12 ++++++------ .../External/Modules/VariableSize/FunnelModule.cs | 5 +++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/NewHorizons/External/Modules/AtmosphereModule.cs b/NewHorizons/External/Modules/AtmosphereModule.cs index b0f31bc9..a4b83c07 100644 --- a/NewHorizons/External/Modules/AtmosphereModule.cs +++ b/NewHorizons/External/Modules/AtmosphereModule.cs @@ -112,7 +112,7 @@ namespace NewHorizons.External.Modules /// /// Fluid type for sounds/effects when colliding with this cloud. /// - public CloudFluidType fluidType = CloudFluidType.Cloud; + [DefaultValue(CloudFluidType.Cloud)] public CloudFluidType fluidType = CloudFluidType.Cloud; /// /// Add lightning to this planet like on Giant's Deep. diff --git a/NewHorizons/External/Modules/BaseModule.cs b/NewHorizons/External/Modules/BaseModule.cs index 8c8e0ede..062401c5 100644 --- a/NewHorizons/External/Modules/BaseModule.cs +++ b/NewHorizons/External/Modules/BaseModule.cs @@ -38,7 +38,7 @@ namespace NewHorizons.External.Modules /// /// How gravity falls off with distance. Most planets use linear but the sun and some moons use inverseSquared. /// - public GravityFallOff gravityFallOff = GravityFallOff.Linear; + [DefaultValue(GravityFallOff.Linear)] public GravityFallOff gravityFallOff = GravityFallOff.Linear; /// /// Radius of a simple sphere used as the ground for the planet. If you want to use more complex terrain, leave this as diff --git a/NewHorizons/External/Modules/PropModule.cs b/NewHorizons/External/Modules/PropModule.cs index 7d2a06a9..f6cc1104 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -248,7 +248,7 @@ namespace NewHorizons.External.Modules /// /// What type of cyclone should this be? Upwards and downwards are both tornados and will push in that direction. /// - public TornadoType type = TornadoType.Downwards; + [DefaultValue(TornadoType.Downwards)] public TornadoType type = TornadoType.Downwards; /// /// Angular distance from the starting position that it will wander, in terms of the angle around the x-axis. @@ -409,7 +409,7 @@ namespace NewHorizons.External.Modules /// /// What needs to be done to the volume to unlock the facts /// - public RevealVolumeType revealOn = RevealVolumeType.Enter; + [DefaultValue(RevealVolumeType.Enter)] public RevealVolumeType revealOn = RevealVolumeType.Enter; /// /// A list of facts to reveal @@ -489,7 +489,7 @@ namespace NewHorizons.External.Modules /// /// The type of object this is. /// - public NomaiTextType type = NomaiTextType.Wall; + [DefaultValue(NomaiTextType.Wall)] public NomaiTextType type = NomaiTextType.Wall; /// /// The relative path to the xml file for this object. @@ -523,7 +523,7 @@ namespace NewHorizons.External.Modules /// /// The type of text to display. /// - public NomaiTextArcType type = NomaiTextArcType.Adult; + [DefaultValue(NomaiTextArcType.Adult)] public NomaiTextArcType type = NomaiTextArcType.Adult; /// /// Which variation of the chosen type to place. If not specified, a random variation will be selected based on the seed provided in the parent module. @@ -575,7 +575,7 @@ namespace NewHorizons.External.Modules /// /// The type of object this is. /// - public SlideShowType type = SlideShowType.SlideReel; + [DefaultValue(SlideShowType.SlideReel)] public SlideShowType type = SlideShowType.SlideReel; } [JsonObject] @@ -745,7 +745,7 @@ namespace NewHorizons.External.Modules /// /// The audio track of this audio volume /// - public AudioMixerTrackName track = AudioMixerTrackName.Environment; + [DefaultValue(AudioMixerTrackName.Environment)] public AudioMixerTrackName track = AudioMixerTrackName.Environment; } } diff --git a/NewHorizons/External/Modules/VariableSize/FunnelModule.cs b/NewHorizons/External/Modules/VariableSize/FunnelModule.cs index 81a21dee..f030c3e8 100644 --- a/NewHorizons/External/Modules/VariableSize/FunnelModule.cs +++ b/NewHorizons/External/Modules/VariableSize/FunnelModule.cs @@ -1,4 +1,5 @@ -using System.Runtime.Serialization; +using System.ComponentModel; +using System.Runtime.Serialization; using NewHorizons.Utility; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -33,6 +34,6 @@ namespace NewHorizons.External.Modules.VariableSize /// /// Type of fluid the funnel transfers /// - public FunnelType type = FunnelType.Sand; + [DefaultValue(FunnelType.Sand)] public FunnelType type = FunnelType.Sand; } } \ No newline at end of file From c6572028f6b4d4fa154da09fed97ea29cc1b7988 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 18 Jul 2022 21:14:00 +0000 Subject: [PATCH 21/38] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index f33e2015..2e6f3de5 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -315,6 +315,7 @@ }, "fluidType": { "description": "Fluid type for sounds/effects when colliding with this cloud.", + "default": "Cloud", "$ref": "#/definitions/CloudFluidType" }, "hasLightning": { @@ -420,6 +421,7 @@ }, "gravityFallOff": { "description": "How gravity falls off with distance. Most planets use linear but the sun and some moons use inverseSquared.", + "default": "Linear", "$ref": "#/definitions/GravityFallOff" }, "groundSize": { @@ -644,6 +646,7 @@ }, "type": { "description": "Type of fluid the funnel transfers", + "default": "Sand", "$ref": "#/definitions/FunnelType" } } @@ -1101,6 +1104,7 @@ }, "type": { "description": "The type of object this is.", + "default": "Wall", "$ref": "#/definitions/NomaiTextType" }, "xmlFile": { @@ -1123,6 +1127,7 @@ }, "type": { "description": "The type of text to display.", + "default": "Adult", "$ref": "#/definitions/NomaiTextArcType" }, "variation": { @@ -1223,6 +1228,7 @@ }, "revealOn": { "description": "What needs to be done to the volume to unlock the facts", + "default": "Enter", "$ref": "#/definitions/RevealVolumeType" }, "reveals": { @@ -1317,6 +1323,7 @@ }, "type": { "description": "The type of object this is.", + "default": "SlideReel", "$ref": "#/definitions/SlideShowType" } } @@ -1491,6 +1498,7 @@ }, "type": { "description": "What type of cyclone should this be? Upwards and downwards are both tornados and will push in that direction.", + "default": "Downwards", "$ref": "#/definitions/TornadoType" }, "wanderDegreesX": { @@ -1653,6 +1661,7 @@ }, "track": { "description": "The audio track of this audio volume", + "default": "Environment", "$ref": "#/definitions/AudioMixerTrackName" } } From 895a9867bf5eb9e02a9bf84ca0a176775db27335 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Mon, 18 Jul 2022 17:22:49 -0400 Subject: [PATCH 22/38] Try to use EnumMember value instead --- NewHorizons/External/Modules/AtmosphereModule.cs | 2 +- NewHorizons/External/Modules/BaseModule.cs | 2 +- NewHorizons/External/Modules/PropModule.cs | 12 ++++++------ .../External/Modules/VariableSize/FunnelModule.cs | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/NewHorizons/External/Modules/AtmosphereModule.cs b/NewHorizons/External/Modules/AtmosphereModule.cs index a4b83c07..5c3167bd 100644 --- a/NewHorizons/External/Modules/AtmosphereModule.cs +++ b/NewHorizons/External/Modules/AtmosphereModule.cs @@ -112,7 +112,7 @@ namespace NewHorizons.External.Modules /// /// Fluid type for sounds/effects when colliding with this cloud. /// - [DefaultValue(CloudFluidType.Cloud)] public CloudFluidType fluidType = CloudFluidType.Cloud; + [DefaultValue("cloud")] public CloudFluidType fluidType = CloudFluidType.Cloud; /// /// Add lightning to this planet like on Giant's Deep. diff --git a/NewHorizons/External/Modules/BaseModule.cs b/NewHorizons/External/Modules/BaseModule.cs index 062401c5..2d434f66 100644 --- a/NewHorizons/External/Modules/BaseModule.cs +++ b/NewHorizons/External/Modules/BaseModule.cs @@ -38,7 +38,7 @@ namespace NewHorizons.External.Modules /// /// How gravity falls off with distance. Most planets use linear but the sun and some moons use inverseSquared. /// - [DefaultValue(GravityFallOff.Linear)] public GravityFallOff gravityFallOff = GravityFallOff.Linear; + [DefaultValue("linear")] public GravityFallOff gravityFallOff = GravityFallOff.Linear; /// /// Radius of a simple sphere used as the ground for the planet. If you want to use more complex terrain, leave this as diff --git a/NewHorizons/External/Modules/PropModule.cs b/NewHorizons/External/Modules/PropModule.cs index f6cc1104..8b7656ff 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -248,7 +248,7 @@ namespace NewHorizons.External.Modules /// /// What type of cyclone should this be? Upwards and downwards are both tornados and will push in that direction. /// - [DefaultValue(TornadoType.Downwards)] public TornadoType type = TornadoType.Downwards; + [DefaultValue("downwards")] public TornadoType type = TornadoType.Downwards; /// /// Angular distance from the starting position that it will wander, in terms of the angle around the x-axis. @@ -409,7 +409,7 @@ namespace NewHorizons.External.Modules /// /// What needs to be done to the volume to unlock the facts /// - [DefaultValue(RevealVolumeType.Enter)] public RevealVolumeType revealOn = RevealVolumeType.Enter; + [DefaultValue("enter")] public RevealVolumeType revealOn = RevealVolumeType.Enter; /// /// A list of facts to reveal @@ -489,7 +489,7 @@ namespace NewHorizons.External.Modules /// /// The type of object this is. /// - [DefaultValue(NomaiTextType.Wall)] public NomaiTextType type = NomaiTextType.Wall; + [DefaultValue("wall")] public NomaiTextType type = NomaiTextType.Wall; /// /// The relative path to the xml file for this object. @@ -523,7 +523,7 @@ namespace NewHorizons.External.Modules /// /// The type of text to display. /// - [DefaultValue(NomaiTextArcType.Adult)] public NomaiTextArcType type = NomaiTextArcType.Adult; + [DefaultValue("adult")] public NomaiTextArcType type = NomaiTextArcType.Adult; /// /// Which variation of the chosen type to place. If not specified, a random variation will be selected based on the seed provided in the parent module. @@ -575,7 +575,7 @@ namespace NewHorizons.External.Modules /// /// The type of object this is. /// - [DefaultValue(SlideShowType.SlideReel)] public SlideShowType type = SlideShowType.SlideReel; + [DefaultValue("slideReel")] public SlideShowType type = SlideShowType.SlideReel; } [JsonObject] @@ -745,7 +745,7 @@ namespace NewHorizons.External.Modules /// /// The audio track of this audio volume /// - [DefaultValue(AudioMixerTrackName.Environment)] public AudioMixerTrackName track = AudioMixerTrackName.Environment; + [DefaultValue("environment")] public AudioMixerTrackName track = AudioMixerTrackName.Environment; } } diff --git a/NewHorizons/External/Modules/VariableSize/FunnelModule.cs b/NewHorizons/External/Modules/VariableSize/FunnelModule.cs index f030c3e8..5c49da12 100644 --- a/NewHorizons/External/Modules/VariableSize/FunnelModule.cs +++ b/NewHorizons/External/Modules/VariableSize/FunnelModule.cs @@ -34,6 +34,6 @@ namespace NewHorizons.External.Modules.VariableSize /// /// Type of fluid the funnel transfers /// - [DefaultValue(FunnelType.Sand)] public FunnelType type = FunnelType.Sand; + [DefaultValue("sand")] public FunnelType type = FunnelType.Sand; } } \ No newline at end of file From 290af007afc20f99896940ed34a9c14f563195d6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 18 Jul 2022 21:24:27 +0000 Subject: [PATCH 23/38] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 2e6f3de5..7da9645a 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -315,7 +315,7 @@ }, "fluidType": { "description": "Fluid type for sounds/effects when colliding with this cloud.", - "default": "Cloud", + "default": "cloud", "$ref": "#/definitions/CloudFluidType" }, "hasLightning": { @@ -421,7 +421,7 @@ }, "gravityFallOff": { "description": "How gravity falls off with distance. Most planets use linear but the sun and some moons use inverseSquared.", - "default": "Linear", + "default": "linear", "$ref": "#/definitions/GravityFallOff" }, "groundSize": { @@ -646,7 +646,7 @@ }, "type": { "description": "Type of fluid the funnel transfers", - "default": "Sand", + "default": "sand", "$ref": "#/definitions/FunnelType" } } @@ -1104,7 +1104,7 @@ }, "type": { "description": "The type of object this is.", - "default": "Wall", + "default": "wall", "$ref": "#/definitions/NomaiTextType" }, "xmlFile": { @@ -1127,7 +1127,7 @@ }, "type": { "description": "The type of text to display.", - "default": "Adult", + "default": "adult", "$ref": "#/definitions/NomaiTextArcType" }, "variation": { @@ -1228,7 +1228,7 @@ }, "revealOn": { "description": "What needs to be done to the volume to unlock the facts", - "default": "Enter", + "default": "enter", "$ref": "#/definitions/RevealVolumeType" }, "reveals": { @@ -1323,7 +1323,7 @@ }, "type": { "description": "The type of object this is.", - "default": "SlideReel", + "default": "slideReel", "$ref": "#/definitions/SlideShowType" } } @@ -1498,7 +1498,7 @@ }, "type": { "description": "What type of cyclone should this be? Upwards and downwards are both tornados and will push in that direction.", - "default": "Downwards", + "default": "downwards", "$ref": "#/definitions/TornadoType" }, "wanderDegreesX": { @@ -1661,7 +1661,7 @@ }, "track": { "description": "The audio track of this audio volume", - "default": "Environment", + "default": "environment", "$ref": "#/definitions/AudioMixerTrackName" } } From 54d29aa534e85bf400e7a260a23f822df462ae05 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Tue, 19 Jul 2022 00:48:34 -0400 Subject: [PATCH 24/38] Fix summary --- NewHorizons/External/Modules/PropModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/External/Modules/PropModule.cs b/NewHorizons/External/Modules/PropModule.cs index 8b7656ff..a6afacd5 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -738,7 +738,7 @@ namespace NewHorizons.External.Modules public float radius; /// - /// The radius of this audio volume + /// The audio to use. Can be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list. /// public string audio; From 78d7012cfb57a3e57165c5cd1f5cff8bd09a5900 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Tue, 19 Jul 2022 04:50:57 +0000 Subject: [PATCH 25/38] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 7da9645a..741b82dc 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -1657,7 +1657,7 @@ }, "audio": { "type": "string", - "description": "The radius of this audio volume" + "description": "The audio to use. Can be a path to a .wav/.ogg/.mp3 file, or taken from the AudioClip list." }, "track": { "description": "The audio track of this audio volume", From 93be971d6874ccc67cc9c0b93b7602286a4a004c Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Tue, 19 Jul 2022 00:57:58 -0400 Subject: [PATCH 26/38] Set override --- NewHorizons/Builder/Props/AudioVolumeBuilder.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/NewHorizons/Builder/Props/AudioVolumeBuilder.cs b/NewHorizons/Builder/Props/AudioVolumeBuilder.cs index 78217884..8e45efc8 100644 --- a/NewHorizons/Builder/Props/AudioVolumeBuilder.cs +++ b/NewHorizons/Builder/Props/AudioVolumeBuilder.cs @@ -37,6 +37,7 @@ namespace NewHorizons.Builder.Props var owTriggerVolume = go.AddComponent(); owTriggerVolume._shape = shape; + audioVolume._triggerVolumeOverride = owTriggerVolume; go.SetActive(true); From a3a96653c852d7edf2f67197e700fc82800be439 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Tue, 19 Jul 2022 19:28:39 -0400 Subject: [PATCH 27/38] AlignWithTargetBody shouldn't use physics on static bodies --- NewHorizons/Builder/General/AstroObjectBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Builder/General/AstroObjectBuilder.cs b/NewHorizons/Builder/General/AstroObjectBuilder.cs index 667ff4bd..43c92a28 100644 --- a/NewHorizons/Builder/General/AstroObjectBuilder.cs +++ b/NewHorizons/Builder/General/AstroObjectBuilder.cs @@ -37,7 +37,7 @@ namespace NewHorizons.Builder.General { var alignment = body.AddComponent(); alignment.SetTargetBody(primaryBody?.GetAttachedOWRigidbody()); - alignment._usePhysicsToRotate = true; + alignment._usePhysicsToRotate = !config.Orbit.isStatic; if (config.Orbit.alignmentAxis == null) { alignment._localAlignmentAxis = new Vector3(0, -1, 0); From 99394fc8fca0e72a08b139c8137896a6415fd1fc Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Wed, 20 Jul 2022 12:08:19 -0700 Subject: [PATCH 28/38] geysers: ability to disable individual particle systems --- NewHorizons/Builder/Props/GeyserBuilder.cs | 11 ++++++----- NewHorizons/External/Modules/PropModule.cs | 5 +++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/NewHorizons/Builder/Props/GeyserBuilder.cs b/NewHorizons/Builder/Props/GeyserBuilder.cs index 54e478a4..e205e7a6 100644 --- a/NewHorizons/Builder/Props/GeyserBuilder.cs +++ b/NewHorizons/Builder/Props/GeyserBuilder.cs @@ -7,8 +7,7 @@ namespace NewHorizons.Builder.Props { public static void Make(GameObject planetGO, Sector sector, PropModule.GeyserInfo info) { - var original = SearchUtilities.Find("TimberHearth_Body/Sector_TH/Interactables_TH/Geysers/Geyser_Village"); - GameObject geyserGO = original.InstantiateInactive(); + var geyserGO = SearchUtilities.Find("TimberHearth_Body/Sector_TH/Interactables_TH/Geysers/Geyser_Village").InstantiateInactive(); geyserGO.transform.parent = sector?.transform ?? planetGO.transform; geyserGO.name = "Geyser"; @@ -25,7 +24,9 @@ namespace NewHorizons.Builder.Props var up = planetGO.transform.TransformPoint(pos) - planetGO.transform.position; geyserGO.transform.rotation = Quaternion.FromToRotation(geyserGO.transform.up, up) * geyserGO.transform.rotation; - var controller = geyserGO.GetComponent(); + if (info.disableBubbles) geyserGO.FindChild("GeyserParticles/GeyserBubbles").SetActive(false); + if (info.disableShaft) geyserGO.FindChild("GeyserParticles/GeyserShaft").SetActive(false); + if (info.disableSpout) geyserGO.FindChild("GeyserParticles/GeyserSpout").SetActive(false); geyserGO.SetActive(true); @@ -34,8 +35,8 @@ namespace NewHorizons.Builder.Props // Do this after awake Delay.FireOnNextUpdate(() => geyserFluidVolume._maxHeight = 1); - geyserFluidVolume.enabled = true; - geyserGO.transform.Find("FluidVolume_Geyser").GetComponent().enabled = true; + geyserFluidVolume.enabled = true; // why do we enable this? idk + geyserFluidVolume.GetComponent().enabled = true; // i think this is already enabled but wtv } } } diff --git a/NewHorizons/External/Modules/PropModule.cs b/NewHorizons/External/Modules/PropModule.cs index a6afacd5..1724b3e0 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -208,6 +208,11 @@ namespace NewHorizons.External.Modules /// Position of the geyser /// public MVector3 position; + + /// + /// Disable the individual particle systems of the geyser + /// + public bool disableBubbles, disableShaft, disableSpout; } [JsonObject] From 13b6c18475948b28732ae6ced7ba216e009c058b Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Wed, 20 Jul 2022 12:11:09 -0700 Subject: [PATCH 29/38] remove goofy parenthesis yo mama --- NewHorizons/Builder/Props/GeyserBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Props/GeyserBuilder.cs b/NewHorizons/Builder/Props/GeyserBuilder.cs index e205e7a6..7d45635c 100644 --- a/NewHorizons/Builder/Props/GeyserBuilder.cs +++ b/NewHorizons/Builder/Props/GeyserBuilder.cs @@ -11,7 +11,7 @@ namespace NewHorizons.Builder.Props geyserGO.transform.parent = sector?.transform ?? planetGO.transform; geyserGO.name = "Geyser"; - var pos = ((Vector3)info.position); + var pos = (Vector3)info.position; // Want half of it to be underground var length = pos.magnitude - 65; From fa66b1b0533a3abfe86ea5ac8fd34060b1670f36 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 20 Jul 2022 19:13:42 +0000 Subject: [PATCH 30/38] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 741b82dc..577f7698 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -1071,6 +1071,18 @@ "position": { "description": "Position of the geyser", "$ref": "#/definitions/MVector3" + }, + "disableBubbles": { + "type": "boolean", + "description": "Disable the individual particle systems of the geyser" + }, + "disableShaft": { + "type": "boolean", + "description": "Disable the individual particle systems of the geyser" + }, + "disableSpout": { + "type": "boolean", + "description": "Disable the individual particle systems of the geyser" } } }, From e0975be83ffc86f636c37e28e6a206e2a67856a8 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Wed, 20 Jul 2022 14:05:39 -0700 Subject: [PATCH 31/38] remove OnProjectionComplete when exit trigger oops --- NewHorizons/Patches/VisionTorchPatches.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/NewHorizons/Patches/VisionTorchPatches.cs b/NewHorizons/Patches/VisionTorchPatches.cs index 88fc1956..6140c26a 100644 --- a/NewHorizons/Patches/VisionTorchPatches.cs +++ b/NewHorizons/Patches/VisionTorchPatches.cs @@ -35,6 +35,18 @@ namespace NewHorizons.Patches return true; } + + [HarmonyPrefix] + [HarmonyPatch(typeof(MindProjectorTrigger), nameof(MindProjectorTrigger.OnTriggerVolumeExit))] + private static bool MindProjectorTrigger_OnTriggerVolumeExit(MindProjectorTrigger __instance, GameObject hitObj) + { + var t = hitObj.GetComponent(); + if (t != null) //(hitObj.CompareTag("PrisonerDetector")) + { + __instance._mindProjector.OnProjectionComplete -= t.onSlidesComplete; + } + return true; + } } [HarmonyPatch] From 6754dfddae244d9f534e7fa115e2a4d4b284a717 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Wed, 20 Jul 2022 16:17:47 -0700 Subject: [PATCH 32/38] typo --- NewHorizons/Builder/Props/BrambleNodeBuilder.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Builder/Props/BrambleNodeBuilder.cs b/NewHorizons/Builder/Props/BrambleNodeBuilder.cs index 811ccd05..c8c30c4b 100644 --- a/NewHorizons/Builder/Props/BrambleNodeBuilder.cs +++ b/NewHorizons/Builder/Props/BrambleNodeBuilder.cs @@ -80,7 +80,7 @@ namespace NewHorizons.Builder.Props return outerFogWarpVolume; } - private static void PropogateSignals() + private static void PropagateSignals() { // The purpose of this function is to determine which signals any given node should play, based on which dimension it links to // you know how the main dark bramble node, the one that forms the core of the planet, plays Feldspar's harmonica signal, even though Feldspar isn't in the dimension that the node links directly to? @@ -289,7 +289,7 @@ namespace NewHorizons.Builder.Props } // Make signals - if (_propogatedSignals == null) PropogateSignals(); + if (_propogatedSignals == null) PropagateSignals(); foreach (var signalConfig in _propogatedSignals[config.linksTo]) { var signalGO = SignalBuilder.Make(go, sector, signalConfig, mod); From 02845778bd7ecd32254e78f8c15ca34068df4ba8 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Wed, 20 Jul 2022 16:21:14 -0700 Subject: [PATCH 33/38] more typo --- .../Builder/Props/BrambleNodeBuilder.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/NewHorizons/Builder/Props/BrambleNodeBuilder.cs b/NewHorizons/Builder/Props/BrambleNodeBuilder.cs index c8c30c4b..15e4f668 100644 --- a/NewHorizons/Builder/Props/BrambleNodeBuilder.cs +++ b/NewHorizons/Builder/Props/BrambleNodeBuilder.cs @@ -23,7 +23,7 @@ namespace NewHorizons.Builder.Props // values are all nodes' warp controllers that link to a given dimension // unpairedNodes[name of dimension that doesn't exist yet] => List{warp controller for node that links to that dimension, ...} private static Dictionary> _unpairedNodes = new(); - private static Dictionary> _propogatedSignals = null; + private static Dictionary> _propagatedSignals = null; public static Dictionary NamedNodes { get; private set; } public static Dictionary BuiltBrambleNodes { get; private set; } @@ -34,7 +34,7 @@ namespace NewHorizons.Builder.Props public static void Init() { _unpairedNodes = new(); - _propogatedSignals = null; + _propagatedSignals = null; NamedNodes = new(); BuiltBrambleNodes = new(); } @@ -88,7 +88,7 @@ namespace NewHorizons.Builder.Props // New Strategy (thanks Damian): // 1) Run Floyd-Warshall on the dimensions (where each dimension is a vertex and each node is an edge) - // 2) For each dimension A, if it's possible to reach dimension B, add dimension B's signals to the list propogatedSignals[A] + // 2) For each dimension A, if it's possible to reach dimension B, add dimension B's signals to the list propagatedSignals[A] var allDimensions = PlanetCreationHandler.allBodies.Where(body => body?.Config?.Bramble?.dimension != null).Select(body => body.Config).ToList(); @@ -129,11 +129,11 @@ namespace NewHorizons.Builder.Props // // this dictionary lists all the signals a given node should have, depending on the dimension it links to - // ie, if a node links to "dimension1", then that node should spawn all of the signals in the list propogatedSignals["dimension1"] - _propogatedSignals = new Dictionary>(); + // ie, if a node links to "dimension1", then that node should spawn all of the signals in the list propagatedSignals["dimension1"] + _propagatedSignals = new Dictionary>(); foreach (var dimension in allDimensions) { - _propogatedSignals[dimension.name] = new(); + _propagatedSignals[dimension.name] = new(); var dimensionIndex = dimensionNameToIndex[dimension.name]; foreach (var destinationDimension in allDimensions) @@ -143,7 +143,7 @@ namespace NewHorizons.Builder.Props var destinationIndex = dimensionNameToIndex[destinationDimension.name]; if (access[dimensionIndex, destinationIndex]) { - _propogatedSignals[dimension.name].AddRange(destinationDimension.Props.signals); + _propagatedSignals[dimension.name].AddRange(destinationDimension.Props.signals); } } } @@ -289,8 +289,8 @@ namespace NewHorizons.Builder.Props } // Make signals - if (_propogatedSignals == null) PropagateSignals(); - foreach (var signalConfig in _propogatedSignals[config.linksTo]) + if (_propagatedSignals == null) PropagateSignals(); + foreach (var signalConfig in _propagatedSignals[config.linksTo]) { var signalGO = SignalBuilder.Make(go, sector, signalConfig, mod); signalGO.GetComponent()._identificationDistance = 0; From 648f9b70681fa9a8685a93a9b2acf1ab90056edb Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Thu, 21 Jul 2022 01:39:31 -0400 Subject: [PATCH 34/38] Add local position to reference frame --- NewHorizons/Builder/General/RFVolumeBuilder.cs | 7 +++++++ NewHorizons/External/Modules/ReferenceFrameModule.cs | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/NewHorizons/Builder/General/RFVolumeBuilder.cs b/NewHorizons/Builder/General/RFVolumeBuilder.cs index c5826e44..814563ac 100644 --- a/NewHorizons/Builder/General/RFVolumeBuilder.cs +++ b/NewHorizons/Builder/General/RFVolumeBuilder.cs @@ -41,6 +41,13 @@ namespace NewHorizons.Builder.General RFV._isPrimaryVolume = true; RFV._isCloseRangeVolume = false; + if (module.localPosition != null) + { + rfGO.transform.localPosition = module.localPosition; + RV._localPosition = module.localPosition; + RV._useCenterOfMass = false; + } + owrb.SetAttachedReferenceFrameVolume(RFV); if (!module.enabled) GameObject.Destroy(rfGO); diff --git a/NewHorizons/External/Modules/ReferenceFrameModule.cs b/NewHorizons/External/Modules/ReferenceFrameModule.cs index 0704366a..ea744d14 100644 --- a/NewHorizons/External/Modules/ReferenceFrameModule.cs +++ b/NewHorizons/External/Modules/ReferenceFrameModule.cs @@ -39,5 +39,10 @@ namespace NewHorizons.External.Modules /// The radius of the sphere around the planet which you can click on to target it. Defaults to twice the sphere of influence. /// public float targetColliderRadius; + + /// + /// Position that the reference frame relative to the object. + /// + public MVector3 localPosition; } } \ No newline at end of file From eca292e2959748be3a7b67b338dcf1122f123bdf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 21 Jul 2022 05:41:22 +0000 Subject: [PATCH 35/38] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 577f7698..0c531497 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -1805,6 +1805,10 @@ "type": "number", "description": "The radius of the sphere around the planet which you can click on to target it. Defaults to twice the sphere of influence.", "format": "float" + }, + "localPosition": { + "description": "Position that the reference frame relative to the object.", + "$ref": "#/definitions/MVector3" } } }, From 27021266cfd26ec325f0bd3e350ed22738d92ba7 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Thu, 21 Jul 2022 01:53:33 -0400 Subject: [PATCH 36/38] I don't know english --- NewHorizons/External/Modules/ReferenceFrameModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/External/Modules/ReferenceFrameModule.cs b/NewHorizons/External/Modules/ReferenceFrameModule.cs index ea744d14..12254866 100644 --- a/NewHorizons/External/Modules/ReferenceFrameModule.cs +++ b/NewHorizons/External/Modules/ReferenceFrameModule.cs @@ -41,7 +41,7 @@ namespace NewHorizons.External.Modules public float targetColliderRadius; /// - /// Position that the reference frame relative to the object. + /// Position of the reference frame relative to the object. /// public MVector3 localPosition; } From e90cb72edc6266a661892ae322941ee130386e13 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 21 Jul 2022 05:55:39 +0000 Subject: [PATCH 37/38] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 0c531497..f2b57706 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -1807,7 +1807,7 @@ "format": "float" }, "localPosition": { - "description": "Position that the reference frame relative to the object.", + "description": "Position of the reference frame relative to the object.", "$ref": "#/definitions/MVector3" } } From 4392d914f41fd28d97a85634887b7f3f3788879e Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 21 Jul 2022 19:02:12 -0400 Subject: [PATCH 38/38] Update NomaiTextBuilder.cs --- NewHorizons/Builder/Props/NomaiTextBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Props/NomaiTextBuilder.cs b/NewHorizons/Builder/Props/NomaiTextBuilder.cs index 02cc532e..5209c364 100644 --- a/NewHorizons/Builder/Props/NomaiTextBuilder.cs +++ b/NewHorizons/Builder/Props/NomaiTextBuilder.cs @@ -97,7 +97,7 @@ namespace NewHorizons.Builder.Props { if (_scrollPrefab == null) InitPrefabs(); - var xmlPath = System.IO.File.ReadAllText(mod.ModHelper.Manifest.ModFolderPath + info.xmlFile); + var xmlPath = File.ReadAllText(mod.ModHelper.Manifest.ModFolderPath + info.xmlFile); switch (info.type) {