From 5691985775098c7d2a60485c9f5567d025a3401d Mon Sep 17 00:00:00 2001 From: Nick Date: Mon, 23 May 2022 13:33:44 -0400 Subject: [PATCH 01/24] Set up Achievements+ support, rename Assets folder --- .../AchievementsPlus/AchievementHandler.cs | 50 +++++++++ NewHorizons/AchievementsPlus/IAchievements.cs | 12 +++ .../NH/EatenOutsideBrambleAchievement.cs | 24 +++++ .../NH/MultipleSystemAchievement.cs | 40 +++++++ .../NH/NewFrequencyAchievement.cs | 23 ++++ .../NH/ProbeLostAchievement.cs | 23 ++++ .../NH/WarpDriveAchievement.cs | 24 +++++ .../DefaultMapModNoAtmo.png | Bin .../DefaultMapModePlanet.png | Bin .../DefaultMapModeStar.png | Bin .../WarpDriveConfig.json | 2 +- .../WarpDriveDialogue.xml | 0 .../hearthian system.png | Bin .../textures/Clouds_Bottom_ramp.png | Bin .../textures/Effects_SUN_Supernova_d.png | Bin .../textures/FogColorRamp.png | Bin .../textures/OceanEntry_PlayerShip_d.png | Bin .../OceanEntry_PlayerShip_d_greyscale.png | Bin .../textures/OceanExit_PlayerShip_d.png | Bin .../OceanExit_PlayerShip_d_greyscale.png | Bin .../textures/Splash_GD_Island2_d.png | Bin .../textures/StarColorOverTime.png | Bin .../textures/Tornado_BH_CycloneDetail_d.png | Bin .../textures/Tornado_BH_Cyclone_02_d.png | Bin .../translations/english.json | 24 ++++- .../translations/french.json | 0 .../translations/german.json | 0 .../translations/russian.json | 0 .../translations/spanish_la.json | 0 .../{AssetBundle => Assets}/xen.newhorizons | Bin .../Builder/Atmosphere/CloudsBuilder.cs | 2 +- NewHorizons/Builder/Atmosphere/FogBuilder.cs | 2 +- NewHorizons/Builder/Body/StarBuilder.cs | 4 +- .../Builder/General/RFVolumeBuilder.cs | 52 ++++----- NewHorizons/Builder/Props/TornadoBuilder.cs | 4 +- NewHorizons/Builder/ShipLog/MapModeBuilder.cs | 6 +- .../Components/BlackHoleDestructionVolume.cs | 5 +- .../Components/ShipLogStarChartMode.cs | 2 +- NewHorizons/Icons/New Horizons.png | Bin 0 -> 5048 bytes NewHorizons/Main.cs | 25 +++-- NewHorizons/NewHorizons.csproj | 101 +++++++++--------- NewHorizons/Patches/PlayerDataPatches.cs | 4 +- NewHorizons/Patches/RaftPatches.cs | 11 +- 43 files changed, 330 insertions(+), 110 deletions(-) create mode 100644 NewHorizons/AchievementsPlus/AchievementHandler.cs create mode 100644 NewHorizons/AchievementsPlus/IAchievements.cs create mode 100644 NewHorizons/AchievementsPlus/NH/EatenOutsideBrambleAchievement.cs create mode 100644 NewHorizons/AchievementsPlus/NH/MultipleSystemAchievement.cs create mode 100644 NewHorizons/AchievementsPlus/NH/NewFrequencyAchievement.cs create mode 100644 NewHorizons/AchievementsPlus/NH/ProbeLostAchievement.cs create mode 100644 NewHorizons/AchievementsPlus/NH/WarpDriveAchievement.cs rename NewHorizons/{AssetBundle => Assets}/DefaultMapModNoAtmo.png (100%) rename NewHorizons/{AssetBundle => Assets}/DefaultMapModePlanet.png (100%) rename NewHorizons/{AssetBundle => Assets}/DefaultMapModeStar.png (100%) rename NewHorizons/{AssetBundle => Assets}/WarpDriveConfig.json (89%) rename NewHorizons/{AssetBundle => Assets}/WarpDriveDialogue.xml (100%) rename NewHorizons/{AssetBundle => Assets}/hearthian system.png (100%) rename NewHorizons/{AssetBundle => Assets}/textures/Clouds_Bottom_ramp.png (100%) rename NewHorizons/{AssetBundle => Assets}/textures/Effects_SUN_Supernova_d.png (100%) rename NewHorizons/{AssetBundle => Assets}/textures/FogColorRamp.png (100%) rename NewHorizons/{AssetBundle => Assets}/textures/OceanEntry_PlayerShip_d.png (100%) rename NewHorizons/{AssetBundle => Assets}/textures/OceanEntry_PlayerShip_d_greyscale.png (100%) rename NewHorizons/{AssetBundle => Assets}/textures/OceanExit_PlayerShip_d.png (100%) rename NewHorizons/{AssetBundle => Assets}/textures/OceanExit_PlayerShip_d_greyscale.png (100%) rename NewHorizons/{AssetBundle => Assets}/textures/Splash_GD_Island2_d.png (100%) rename NewHorizons/{AssetBundle => Assets}/textures/StarColorOverTime.png (100%) rename NewHorizons/{AssetBundle => Assets}/textures/Tornado_BH_CycloneDetail_d.png (100%) rename NewHorizons/{AssetBundle => Assets}/textures/Tornado_BH_Cyclone_02_d.png (100%) rename NewHorizons/{AssetBundle => Assets}/translations/english.json (53%) rename NewHorizons/{AssetBundle => Assets}/translations/french.json (100%) rename NewHorizons/{AssetBundle => Assets}/translations/german.json (100%) rename NewHorizons/{AssetBundle => Assets}/translations/russian.json (100%) rename NewHorizons/{AssetBundle => Assets}/translations/spanish_la.json (100%) rename NewHorizons/{AssetBundle => Assets}/xen.newhorizons (100%) create mode 100644 NewHorizons/Icons/New Horizons.png diff --git a/NewHorizons/AchievementsPlus/AchievementHandler.cs b/NewHorizons/AchievementsPlus/AchievementHandler.cs new file mode 100644 index 00000000..b493a7d0 --- /dev/null +++ b/NewHorizons/AchievementsPlus/AchievementHandler.cs @@ -0,0 +1,50 @@ +using NewHorizons.Utility; +using OWML.ModHelper; +using System; + +namespace NewHorizons.AchievementsPlus +{ + public static class AchievementHandler + { + private static bool _enabled; + private static IAchievements API; + + public static void Init() + { + try + { + API = Main.Instance.ModHelper.Interaction.GetModApi("xen.AchievementTracker"); + _enabled = true; + } + catch (Exception) + { + Logger.Log("Achievements+ isn't installed"); + _enabled = false; + return; + } + + // Register base NH achievements + NH.WarpDriveAchievement.Init(); + NH.MultipleSystemAchievement.Init(); + NH.EatenOutsideBrambleAchievement.Init(); + NH.NewFrequencyAchievement.Init(); + NH.ProbeLostAchievement.Init(); + + API.RegisterTranslationsFromFiles(Main.Instance, "Assets/translations"); + } + + public static void Earn(string unique_id) + { + if (!_enabled) return; + + API.EarnAchievement(unique_id); + } + + public static void Register(string unique_id, bool secret, ModBehaviour mod) + { + if (!_enabled) return; + + API.RegisterAchievement(unique_id, secret, mod); + } + } +} diff --git a/NewHorizons/AchievementsPlus/IAchievements.cs b/NewHorizons/AchievementsPlus/IAchievements.cs new file mode 100644 index 00000000..351acbbf --- /dev/null +++ b/NewHorizons/AchievementsPlus/IAchievements.cs @@ -0,0 +1,12 @@ +using OWML.ModHelper; + +namespace NewHorizons.AchievementsPlus +{ + public interface IAchievements + { + void RegisterAchievement(string uniqueID, bool secret, ModBehaviour mod); + void RegisterTranslation(string uniqueID, TextTranslation.Language language, string name, string description); + void RegisterTranslationsFromFiles(ModBehaviour mod, string folderPath); + void EarnAchievement(string uniqueID); + } +} diff --git a/NewHorizons/AchievementsPlus/NH/EatenOutsideBrambleAchievement.cs b/NewHorizons/AchievementsPlus/NH/EatenOutsideBrambleAchievement.cs new file mode 100644 index 00000000..8df509ce --- /dev/null +++ b/NewHorizons/AchievementsPlus/NH/EatenOutsideBrambleAchievement.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NewHorizons.AchievementsPlus.NH +{ + public static class EatenOutsideBrambleAchievement + { + public static readonly string UNIQUE_ID = "NH_EATEN_OUTSIDE_BRAMBLE"; + + public static void Init() + { + AchievementHandler.Register(UNIQUE_ID, false, Main.Instance); + GlobalMessenger.AddListener("PlayerDeath", OnPlayerDeath); + } + + public static void OnPlayerDeath(DeathType death) + { + if (death == DeathType.Digestion && !PlayerState.InBrambleDimension()) AchievementHandler.Earn(UNIQUE_ID); + } + } +} diff --git a/NewHorizons/AchievementsPlus/NH/MultipleSystemAchievement.cs b/NewHorizons/AchievementsPlus/NH/MultipleSystemAchievement.cs new file mode 100644 index 00000000..f2ae29c5 --- /dev/null +++ b/NewHorizons/AchievementsPlus/NH/MultipleSystemAchievement.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NewHorizons.AchievementsPlus.NH +{ + public static class MultipleSystemAchievement + { + public static readonly string UNIQUE_ID = "NH_MULTIPLE_SYSTEM"; + + private static List _uniqueSystems = new List(); + + public static void Init() + { + AchievementHandler.Register(UNIQUE_ID, false, Main.Instance); + Main.Instance.OnChangeStarSystem.AddListener(OnChangeStarSystem); + GlobalMessenger.AddListener("PlayerDeath", OnPlayerDeath); + } + + public static void OnPlayerDeath(DeathType _) + { + if (Main.Instance.IsChangingStarSystem) return; + + _uniqueSystems.Clear(); + } + + public static void OnChangeStarSystem(string system) + { + if (_uniqueSystems.Contains(system)) return; + _uniqueSystems.Add(system); + if(_uniqueSystems.Count > 5) + { + AchievementHandler.Earn(UNIQUE_ID); + _uniqueSystems.Clear(); + } + } + } +} diff --git a/NewHorizons/AchievementsPlus/NH/NewFrequencyAchievement.cs b/NewHorizons/AchievementsPlus/NH/NewFrequencyAchievement.cs new file mode 100644 index 00000000..7cde8861 --- /dev/null +++ b/NewHorizons/AchievementsPlus/NH/NewFrequencyAchievement.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NewHorizons.AchievementsPlus.NH +{ + public static class NewFrequencyAchievement + { + public static readonly string UNIQUE_ID = "NH_NEW_FREQ"; + + public static void Init() + { + AchievementHandler.Register(UNIQUE_ID, false, Main.Instance); + } + + public static void Earn() + { + AchievementHandler.Earn(UNIQUE_ID); + } + } +} diff --git a/NewHorizons/AchievementsPlus/NH/ProbeLostAchievement.cs b/NewHorizons/AchievementsPlus/NH/ProbeLostAchievement.cs new file mode 100644 index 00000000..9ddef4b8 --- /dev/null +++ b/NewHorizons/AchievementsPlus/NH/ProbeLostAchievement.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NewHorizons.AchievementsPlus.NH +{ + public static class ProbeLostAchievement + { + public static readonly string UNIQUE_ID = "NH_PROBE_LOST"; + + public static void Init() + { + AchievementHandler.Register(UNIQUE_ID, false, Main.Instance); + } + + public static void Earn() + { + AchievementHandler.Earn(UNIQUE_ID); + } + } +} diff --git a/NewHorizons/AchievementsPlus/NH/WarpDriveAchievement.cs b/NewHorizons/AchievementsPlus/NH/WarpDriveAchievement.cs new file mode 100644 index 00000000..e697891b --- /dev/null +++ b/NewHorizons/AchievementsPlus/NH/WarpDriveAchievement.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace NewHorizons.AchievementsPlus.NH +{ + public static class WarpDriveAchievement + { + public static readonly string UNIQUE_ID = "NH_WARP_DRIVE"; + + public static void Init() + { + AchievementHandler.Register(UNIQUE_ID, false, Main.Instance); + Main.Instance.OnChangeStarSystem.AddListener(OnChangeStarSystem); + } + + private static void OnChangeStarSystem(string system) + { + if (Main.Instance.IsWarping) AchievementHandler.Earn(UNIQUE_ID); + } + } +} diff --git a/NewHorizons/AssetBundle/DefaultMapModNoAtmo.png b/NewHorizons/Assets/DefaultMapModNoAtmo.png similarity index 100% rename from NewHorizons/AssetBundle/DefaultMapModNoAtmo.png rename to NewHorizons/Assets/DefaultMapModNoAtmo.png diff --git a/NewHorizons/AssetBundle/DefaultMapModePlanet.png b/NewHorizons/Assets/DefaultMapModePlanet.png similarity index 100% rename from NewHorizons/AssetBundle/DefaultMapModePlanet.png rename to NewHorizons/Assets/DefaultMapModePlanet.png diff --git a/NewHorizons/AssetBundle/DefaultMapModeStar.png b/NewHorizons/Assets/DefaultMapModeStar.png similarity index 100% rename from NewHorizons/AssetBundle/DefaultMapModeStar.png rename to NewHorizons/Assets/DefaultMapModeStar.png diff --git a/NewHorizons/AssetBundle/WarpDriveConfig.json b/NewHorizons/Assets/WarpDriveConfig.json similarity index 89% rename from NewHorizons/AssetBundle/WarpDriveConfig.json rename to NewHorizons/Assets/WarpDriveConfig.json index 982af456..1821c6e3 100644 --- a/NewHorizons/AssetBundle/WarpDriveConfig.json +++ b/NewHorizons/Assets/WarpDriveConfig.json @@ -8,7 +8,7 @@ "position":{"x": -0.3071011, "y": 2.741472, "z": -4.005298}, "radius": 0, "remoteTriggerRadius": 1, - "xmlFile":"AssetBundle/WarpDriveDialogue.xml", + "xmlFile":"Assets/WarpDriveDialogue.xml", "remoteTriggerPosition": {"x": -0.05656214, "y": 0.5362684, "z": 0.5467669}, "blockAfterPersistentCondition" : "KnowsAboutWarpDrive" } diff --git a/NewHorizons/AssetBundle/WarpDriveDialogue.xml b/NewHorizons/Assets/WarpDriveDialogue.xml similarity index 100% rename from NewHorizons/AssetBundle/WarpDriveDialogue.xml rename to NewHorizons/Assets/WarpDriveDialogue.xml diff --git a/NewHorizons/AssetBundle/hearthian system.png b/NewHorizons/Assets/hearthian system.png similarity index 100% rename from NewHorizons/AssetBundle/hearthian system.png rename to NewHorizons/Assets/hearthian system.png diff --git a/NewHorizons/AssetBundle/textures/Clouds_Bottom_ramp.png b/NewHorizons/Assets/textures/Clouds_Bottom_ramp.png similarity index 100% rename from NewHorizons/AssetBundle/textures/Clouds_Bottom_ramp.png rename to NewHorizons/Assets/textures/Clouds_Bottom_ramp.png diff --git a/NewHorizons/AssetBundle/textures/Effects_SUN_Supernova_d.png b/NewHorizons/Assets/textures/Effects_SUN_Supernova_d.png similarity index 100% rename from NewHorizons/AssetBundle/textures/Effects_SUN_Supernova_d.png rename to NewHorizons/Assets/textures/Effects_SUN_Supernova_d.png diff --git a/NewHorizons/AssetBundle/textures/FogColorRamp.png b/NewHorizons/Assets/textures/FogColorRamp.png similarity index 100% rename from NewHorizons/AssetBundle/textures/FogColorRamp.png rename to NewHorizons/Assets/textures/FogColorRamp.png diff --git a/NewHorizons/AssetBundle/textures/OceanEntry_PlayerShip_d.png b/NewHorizons/Assets/textures/OceanEntry_PlayerShip_d.png similarity index 100% rename from NewHorizons/AssetBundle/textures/OceanEntry_PlayerShip_d.png rename to NewHorizons/Assets/textures/OceanEntry_PlayerShip_d.png diff --git a/NewHorizons/AssetBundle/textures/OceanEntry_PlayerShip_d_greyscale.png b/NewHorizons/Assets/textures/OceanEntry_PlayerShip_d_greyscale.png similarity index 100% rename from NewHorizons/AssetBundle/textures/OceanEntry_PlayerShip_d_greyscale.png rename to NewHorizons/Assets/textures/OceanEntry_PlayerShip_d_greyscale.png diff --git a/NewHorizons/AssetBundle/textures/OceanExit_PlayerShip_d.png b/NewHorizons/Assets/textures/OceanExit_PlayerShip_d.png similarity index 100% rename from NewHorizons/AssetBundle/textures/OceanExit_PlayerShip_d.png rename to NewHorizons/Assets/textures/OceanExit_PlayerShip_d.png diff --git a/NewHorizons/AssetBundle/textures/OceanExit_PlayerShip_d_greyscale.png b/NewHorizons/Assets/textures/OceanExit_PlayerShip_d_greyscale.png similarity index 100% rename from NewHorizons/AssetBundle/textures/OceanExit_PlayerShip_d_greyscale.png rename to NewHorizons/Assets/textures/OceanExit_PlayerShip_d_greyscale.png diff --git a/NewHorizons/AssetBundle/textures/Splash_GD_Island2_d.png b/NewHorizons/Assets/textures/Splash_GD_Island2_d.png similarity index 100% rename from NewHorizons/AssetBundle/textures/Splash_GD_Island2_d.png rename to NewHorizons/Assets/textures/Splash_GD_Island2_d.png diff --git a/NewHorizons/AssetBundle/textures/StarColorOverTime.png b/NewHorizons/Assets/textures/StarColorOverTime.png similarity index 100% rename from NewHorizons/AssetBundle/textures/StarColorOverTime.png rename to NewHorizons/Assets/textures/StarColorOverTime.png diff --git a/NewHorizons/AssetBundle/textures/Tornado_BH_CycloneDetail_d.png b/NewHorizons/Assets/textures/Tornado_BH_CycloneDetail_d.png similarity index 100% rename from NewHorizons/AssetBundle/textures/Tornado_BH_CycloneDetail_d.png rename to NewHorizons/Assets/textures/Tornado_BH_CycloneDetail_d.png diff --git a/NewHorizons/AssetBundle/textures/Tornado_BH_Cyclone_02_d.png b/NewHorizons/Assets/textures/Tornado_BH_Cyclone_02_d.png similarity index 100% rename from NewHorizons/AssetBundle/textures/Tornado_BH_Cyclone_02_d.png rename to NewHorizons/Assets/textures/Tornado_BH_Cyclone_02_d.png diff --git a/NewHorizons/AssetBundle/translations/english.json b/NewHorizons/Assets/translations/english.json similarity index 53% rename from NewHorizons/AssetBundle/translations/english.json rename to NewHorizons/Assets/translations/english.json index 5de572c5..ce66e2a9 100644 --- a/NewHorizons/AssetBundle/translations/english.json +++ b/NewHorizons/Assets/translations/english.json @@ -12,5 +12,27 @@ "FREQ_STATUE" : "Nomai Statue", "FREQ_WARP_CORE" : "Anti-Graviton Flux", "FREQ_UNKNOWN" : "???" - } + }, + "AchievementTranslations": { + "NH_EATEN_OUTSIDE_BRAMBLE" : { + "Name": "Containment Breach", + "Description": "Get eaten outside of Dark Bramble" + }, + "NH_MULTIPLE_SYSTEM" : { + "Name": "Traveller", + "Description": "Visit 5 unique star systems in a row." + }, + "NH_NEW_FREQ" : { + "Name": "Anomalous Frequencies", + "Description": "Discover a new frequency." + }, + "NH_PROBE_LOST" : { + "Name": "Connection Lost", + "Description": "Lose your little scout." + }, + "NH_WARP_DRIVE": { + "Name": "Lore Inaccurate", + "Description": "Use your ship's warp drive." + } + } } \ No newline at end of file diff --git a/NewHorizons/AssetBundle/translations/french.json b/NewHorizons/Assets/translations/french.json similarity index 100% rename from NewHorizons/AssetBundle/translations/french.json rename to NewHorizons/Assets/translations/french.json diff --git a/NewHorizons/AssetBundle/translations/german.json b/NewHorizons/Assets/translations/german.json similarity index 100% rename from NewHorizons/AssetBundle/translations/german.json rename to NewHorizons/Assets/translations/german.json diff --git a/NewHorizons/AssetBundle/translations/russian.json b/NewHorizons/Assets/translations/russian.json similarity index 100% rename from NewHorizons/AssetBundle/translations/russian.json rename to NewHorizons/Assets/translations/russian.json diff --git a/NewHorizons/AssetBundle/translations/spanish_la.json b/NewHorizons/Assets/translations/spanish_la.json similarity index 100% rename from NewHorizons/AssetBundle/translations/spanish_la.json rename to NewHorizons/Assets/translations/spanish_la.json diff --git a/NewHorizons/AssetBundle/xen.newhorizons b/NewHorizons/Assets/xen.newhorizons similarity index 100% rename from NewHorizons/AssetBundle/xen.newhorizons rename to NewHorizons/Assets/xen.newhorizons diff --git a/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs b/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs index 43e7dc89..0ad83319 100644 --- a/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs @@ -22,7 +22,7 @@ namespace NewHorizons.Builder.Atmosphere public static void Make(GameObject planetGO, Sector sector, AtmosphereModule atmo, IModBehaviour mod) { if (_lightningPrefab == null) _lightningPrefab = GameObject.Find("GiantsDeep_Body/Sector_GD/Clouds_GD/LightningGenerator_GD"); - if (_colorRamp == null) _colorRamp = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/textures/Clouds_Bottom_ramp.png"); + if (_colorRamp == null) _colorRamp = ImageUtilities.GetTexture(Main.Instance, "Assets/textures/Clouds_Bottom_ramp.png"); GameObject cloudsMainGO = new GameObject("Clouds"); cloudsMainGO.SetActive(false); diff --git a/NewHorizons/Builder/Atmosphere/FogBuilder.cs b/NewHorizons/Builder/Atmosphere/FogBuilder.cs index 2bf6c9a8..329023b3 100644 --- a/NewHorizons/Builder/Atmosphere/FogBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/FogBuilder.cs @@ -9,7 +9,7 @@ namespace NewHorizons.Builder.Atmosphere public static void Make(GameObject planetGO, Sector sector, AtmosphereModule atmo) { - if (_ramp == null) _ramp = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/textures/FogColorRamp.png"); + if (_ramp == null) _ramp = ImageUtilities.GetTexture(Main.Instance, "Assets/textures/FogColorRamp.png"); GameObject fogGO = new GameObject("FogSphere"); fogGO.SetActive(false); diff --git a/NewHorizons/Builder/Body/StarBuilder.cs b/NewHorizons/Builder/Body/StarBuilder.cs index c173eb35..6765e630 100644 --- a/NewHorizons/Builder/Body/StarBuilder.cs +++ b/NewHorizons/Builder/Body/StarBuilder.cs @@ -160,7 +160,7 @@ namespace NewHorizons.Builder.Body public static GameObject MakeStarGraphics(GameObject rootObject, Sector sector, StarModule starModule) { - if (_colorOverTime == null) _colorOverTime = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/textures/StarColorOverTime.png"); + if (_colorOverTime == null) _colorOverTime = ImageUtilities.GetTexture(Main.Instance, "Assets/textures/StarColorOverTime.png"); var starGO = new GameObject("Star"); starGO.transform.parent = sector?.transform ?? rootObject.transform; @@ -236,7 +236,7 @@ namespace NewHorizons.Builder.Body var colour = starModule.SupernovaTint.ToColor(); var supernovaMaterial = new Material(supernova._supernovaMaterial); - var ramp = ImageUtilities.LerpGreyscaleImage(ImageUtilities.GetTexture(Main.Instance, "AssetBundle/textures/Effects_SUN_Supernova_d.png"), Color.white, colour); + var ramp = ImageUtilities.LerpGreyscaleImage(ImageUtilities.GetTexture(Main.Instance, "Assets/textures/Effects_SUN_Supernova_d.png"), Color.white, colour); supernovaMaterial.SetTexture(ColorRamp, ramp); supernova._supernovaMaterial = supernovaMaterial; diff --git a/NewHorizons/Builder/General/RFVolumeBuilder.cs b/NewHorizons/Builder/General/RFVolumeBuilder.cs index 892aae9a..80e827d0 100644 --- a/NewHorizons/Builder/General/RFVolumeBuilder.cs +++ b/NewHorizons/Builder/General/RFVolumeBuilder.cs @@ -1,4 +1,4 @@ -using NewHorizons.External.Configs; +using NewHorizons.External.Configs; using UnityEngine; namespace NewHorizons.Builder.General { @@ -6,37 +6,37 @@ namespace NewHorizons.Builder.General { public static void Make(GameObject planetGO, OWRigidbody owRigidBody, float sphereOfInfluence) { - var rfGO = new GameObject("RFVolume"); - rfGO.transform.parent = planetGO.transform; - rfGO.transform.localPosition = Vector3.zero; - rfGO.layer = 19; - rfGO.SetActive(false); + var referenceFrameGO = new GameObject("RFVolume"); + referenceFrameGO.transform.parent = planetGO.transform; + referenceFrameGO.transform.localPosition = Vector3.zero; + referenceFrameGO.layer = 19; + referenceFrameGO.SetActive(false); - var SC = rfGO.AddComponent(); - SC.isTrigger = true; - SC.radius = sphereOfInfluence * 2; + var sphereCollider = referenceFrameGO.AddComponent(); + sphereCollider.isTrigger = true; + sphereCollider.radius = sphereOfInfluence * 2; - var RFV = rfGO.AddComponent(); + var referenceFrameVolume = referenceFrameGO.AddComponent(); - var RV = new ReferenceFrame(owRigidBody); - RV._minSuitTargetDistance = sphereOfInfluence; - RV._maxTargetDistance = 0; - RV._autopilotArrivalDistance = 2.0f * sphereOfInfluence; - RV._autoAlignmentDistance = sphereOfInfluence * 1.5f; + var referenceFrame = new ReferenceFrame(owRigidBody); + referenceFrame._minSuitTargetDistance = sphereOfInfluence; + referenceFrame._maxTargetDistance = 0; + referenceFrame._autopilotArrivalDistance = 2.0f * sphereOfInfluence; + referenceFrame._autoAlignmentDistance = sphereOfInfluence * 1.5f; - RV._hideLandingModePrompt = false; - RV._matchAngularVelocity = true; - RV._minMatchAngularVelocityDistance = 70; - RV._maxMatchAngularVelocityDistance = 400; - RV._bracketsRadius = sphereOfInfluence; + referenceFrame._hideLandingModePrompt = false; + referenceFrame._matchAngularVelocity = true; + referenceFrame._minMatchAngularVelocityDistance = 70; + referenceFrame._maxMatchAngularVelocityDistance = 400; + referenceFrame._bracketsRadius = sphereOfInfluence; - RFV._referenceFrame = RV; - RFV._minColliderRadius = sphereOfInfluence; - RFV._maxColliderRadius = sphereOfInfluence * 2f; - RFV._isPrimaryVolume = true; - RFV._isCloseRangeVolume = false; + referenceFrameVolume._referenceFrame = referenceFrame; + referenceFrameVolume._minColliderRadius = sphereOfInfluence; + referenceFrameVolume._maxColliderRadius = sphereOfInfluence * 2f; + referenceFrameVolume._isPrimaryVolume = true; + referenceFrameVolume._isCloseRangeVolume = false; - rfGO.SetActive(true); + referenceFrameGO.SetActive(true); } } } diff --git a/NewHorizons/Builder/Props/TornadoBuilder.cs b/NewHorizons/Builder/Props/TornadoBuilder.cs index 85088554..6ca0fcec 100644 --- a/NewHorizons/Builder/Props/TornadoBuilder.cs +++ b/NewHorizons/Builder/Props/TornadoBuilder.cs @@ -55,11 +55,11 @@ namespace NewHorizons.Builder.Props } if (_mainTexture == null) { - _mainTexture = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/textures/Tornado_BH_Cyclone_02_d.png"); + _mainTexture = ImageUtilities.GetTexture(Main.Instance, "Assets/textures/Tornado_BH_Cyclone_02_d.png"); } if (_detailTexture == null) { - _detailTexture = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/textures/Tornado_BH_CycloneDetail_d.png"); + _detailTexture = ImageUtilities.GetTexture(Main.Instance, "Assets/textures/Tornado_BH_CycloneDetail_d.png"); } Vector3 position; diff --git a/NewHorizons/Builder/ShipLog/MapModeBuilder.cs b/NewHorizons/Builder/ShipLog/MapModeBuilder.cs index 19081f08..71039cc7 100644 --- a/NewHorizons/Builder/ShipLog/MapModeBuilder.cs +++ b/NewHorizons/Builder/ShipLog/MapModeBuilder.cs @@ -495,9 +495,9 @@ namespace NewHorizons.Builder.ShipLog { Texture2D texture; - if (body.Config.Star != null) texture = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/DefaultMapModeStar.png"); - else if (body.Config.Atmosphere != null) texture = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/DefaultMapModNoAtmo.png"); - else texture = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/DefaultMapModePlanet.png"); + if (body.Config.Star != null) texture = ImageUtilities.GetTexture(Main.Instance, "Assets/DefaultMapModeStar.png"); + else if (body.Config.Atmosphere != null) texture = ImageUtilities.GetTexture(Main.Instance, "Assets/DefaultMapModNoAtmo.png"); + else texture = ImageUtilities.GetTexture(Main.Instance, "Assets/DefaultMapModePlanet.png"); var color = GetDominantPlanetColor(body); var darkColor = new Color(color.r / 3f, color.g / 3f, color.b / 3f); diff --git a/NewHorizons/Components/BlackHoleDestructionVolume.cs b/NewHorizons/Components/BlackHoleDestructionVolume.cs index 8a24f510..4ed3d759 100644 --- a/NewHorizons/Components/BlackHoleDestructionVolume.cs +++ b/NewHorizons/Components/BlackHoleDestructionVolume.cs @@ -1,4 +1,6 @@ -namespace NewHorizons.Components +using NewHorizons.AchievementsPlus.NH; + +namespace NewHorizons.Components { public class BlackHoleDestructionVolume : DestructionVolume { @@ -14,6 +16,7 @@ if (requiredComponent.IsLaunched()) { UnityEngine.Object.Destroy(requiredComponent.gameObject); + ProbeLostAchievement.Earn(); } } } diff --git a/NewHorizons/Components/ShipLogStarChartMode.cs b/NewHorizons/Components/ShipLogStarChartMode.cs index 986d097b..c64199c6 100644 --- a/NewHorizons/Components/ShipLogStarChartMode.cs +++ b/NewHorizons/Components/ShipLogStarChartMode.cs @@ -161,7 +161,7 @@ namespace NewHorizons.Components { if (uniqueID.Equals("SolarSystem")) { - texture = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/hearthian system.png"); + texture = ImageUtilities.GetTexture(Main.Instance, "Assets/hearthian system.png"); } else { diff --git a/NewHorizons/Icons/New Horizons.png b/NewHorizons/Icons/New Horizons.png new file mode 100644 index 0000000000000000000000000000000000000000..aa2b86f86c5e7ec7aa31b381f9f65f449156c9d5 GIT binary patch literal 5048 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 O0000.AddListener("PlayerDeath", OnDeath); GlobalMessenger.AddListener("WakeUp", new Callback(OnWakeUp)); - NHAssetBundle = ModHelper.Assets.LoadBundle("AssetBundle/xen.newhorizons"); + NHAssetBundle = ModHelper.Assets.LoadBundle("Assets/xen.newhorizons"); ResetConfigs(resetTranslation: false); @@ -143,6 +144,8 @@ namespace NewHorizons Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => OnSceneLoaded(SceneManager.GetActiveScene(), LoadSceneMode.Single)); Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => _firstLoad = false); Instance.ModHelper.Menus.PauseMenu.OnInit += DebugReload.InitializePauseMenu; + + AchievementsPlus.AchievementHandler.Init(); } public void OnDestroy() @@ -173,7 +176,7 @@ namespace NewHorizons Logger.Log($"Scene Loaded: {scene.name} {mode}"); // Set time loop stuff if its enabled and if we're warping to a new place - if (_isChangingStarSystem && (SystemDict[_currentStarSystem].Config.enableTimeLoop || _currentStarSystem == "SolarSystem") && SecondsLeftInLoop > 0f) + if (IsChangingStarSystem && (SystemDict[_currentStarSystem].Config.enableTimeLoop || _currentStarSystem == "SolarSystem") && SecondsLeftInLoop > 0f) { TimeLoop.SetSecondsRemaining(SecondsLeftInLoop); // Prevent the OPC from firing @@ -194,7 +197,7 @@ namespace NewHorizons // Reset this SecondsLeftInLoop = -1; - _isChangingStarSystem = false; + IsChangingStarSystem = false; if (scene.name == "TitleScreen" && _useCustomTitleScreen) { @@ -230,7 +233,7 @@ namespace NewHorizons OWAssetHandler.Init(); PlanetCreationHandler.Init(BodyDict[CurrentStarSystem]); SystemCreationHandler.LoadSystem(SystemDict[CurrentStarSystem]); - LoadTranslations(ModHelper.Manifest.ModFolderPath + "AssetBundle/", this); + LoadTranslations(ModHelper.Manifest.ModFolderPath + "Assets/", this); // Warp drive StarChartHandler.Init(SystemDict.Values.ToArray()); @@ -280,7 +283,7 @@ namespace NewHorizons public void EnableWarpDrive() { Logger.Log("Setting up warp drive"); - PlanetCreationHandler.LoadBody(LoadConfig(this, "AssetBundle/WarpDriveConfig.json")); + PlanetCreationHandler.LoadBody(LoadConfig(this, "Assets/WarpDriveConfig.json")); HasWarpDrive = true; } @@ -425,14 +428,14 @@ namespace NewHorizons #region Change star system public void ChangeCurrentStarSystem(string newStarSystem, bool warp = false) { - if (_isChangingStarSystem) return; + if (IsChangingStarSystem) return; + IsWarping = warp; OnChangeStarSystem?.Invoke(newStarSystem); Logger.Log($"Warping to {newStarSystem}"); if (warp && _shipWarpController) _shipWarpController.WarpOut(); - _isChangingStarSystem = true; - IsWarping = warp; + IsChangingStarSystem = true; WearingSuit = PlayerState.IsWearingSuit(); // We kill them so they don't move as much @@ -461,7 +464,7 @@ namespace NewHorizons void OnDeath(DeathType _) { // We reset the solar system on death (unless we just killed the player) - if (!_isChangingStarSystem) + if (!IsChangingStarSystem) { // If the override is a valid system then we go there if (SystemDict.Keys.Contains(_defaultSystemOverride)) diff --git a/NewHorizons/NewHorizons.csproj b/NewHorizons/NewHorizons.csproj index 981e2526..ec54c2d8 100644 --- a/NewHorizons/NewHorizons.csproj +++ b/NewHorizons/NewHorizons.csproj @@ -1,50 +1,53 @@ - - - {8A39F9E7-1A89-430C-9C3E-BDFB3B7E17DF} - net48 - Build - NewHorizons - NewHorizons - Copyright © 2020 - true - false - - - portable - - - none - - - - - - - - - Always - - - Always - - - Always - - - - - - - - True - True - Settings.settings - - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - + + + {8A39F9E7-1A89-430C-9C3E-BDFB3B7E17DF} + net48 + Build + NewHorizons + NewHorizons + Copyright © 2020 + true + false + + + portable + + + none + + + + + + + + + Always + + + Always + + + Always + + + Always + + + + + + + + True + True + Settings.settings + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + \ No newline at end of file diff --git a/NewHorizons/Patches/PlayerDataPatches.cs b/NewHorizons/Patches/PlayerDataPatches.cs index 1bcf18fd..176b9547 100644 --- a/NewHorizons/Patches/PlayerDataPatches.cs +++ b/NewHorizons/Patches/PlayerDataPatches.cs @@ -1,4 +1,5 @@ -using HarmonyLib; +using HarmonyLib; +using NewHorizons.AchievementsPlus.NH; using NewHorizons.Builder.Props; using NewHorizons.External; using NewHorizons.Handlers; @@ -31,6 +32,7 @@ namespace NewHorizons.Patches if (freqString != null && freqString != "") { NewHorizonsData.LearnFrequency(freqString); + NewFrequencyAchievement.Earn(); return false; } return true; diff --git a/NewHorizons/Patches/RaftPatches.cs b/NewHorizons/Patches/RaftPatches.cs index 3ecdf0f7..23ff888a 100644 --- a/NewHorizons/Patches/RaftPatches.cs +++ b/NewHorizons/Patches/RaftPatches.cs @@ -1,4 +1,4 @@ -using HarmonyLib; +using HarmonyLib; using NewHorizons.Components; using UnityEngine; namespace NewHorizons.Patches @@ -104,14 +104,5 @@ namespace NewHorizons.Patches return false; } - - /* For debugging - [HarmonyPrefix] - [HarmonyPatch(typeof(FluidDetector), nameof(FluidDetector.AddVolume), new Type[] { typeof(EffectVolume) })] - public static void FluidDetector_AddVolume(FluidDetector __instance, EffectVolume eVol) - { - Logger.Log($"[{__instance}] : AddVolume [{eVol}]"); - } - */ } } From 4030ebbdf683a8bde7b524abc4cd95aa0b6b5497 Mon Sep 17 00:00:00 2001 From: Ben C Date: Mon, 13 Jun 2022 15:19:17 -0700 Subject: [PATCH 02/24] Fix missing semicolon in api.md --- docs/content/pages/tutorials/api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/content/pages/tutorials/api.md b/docs/content/pages/tutorials/api.md index f1a774e4..8689943c 100644 --- a/docs/content/pages/tutorials/api.md +++ b/docs/content/pages/tutorials/api.md @@ -20,7 +20,7 @@ public interface INewHorizons UnityEvent GetStarSystemLoadedEvent(); - GameObject SpawnObject(GameObject planet, Sector sector, string propToCopyPath, Vector3 position, Vector3 eulerAngles, float scale, bool alignWithNormal) + GameObject SpawnObject(GameObject planet, Sector sector, string propToCopyPath, Vector3 position, Vector3 eulerAngles, float scale, bool alignWithNormal); string[] GetInstalledAddons(); } From cf5f74ecc826a73319d68a5a3f9a6f71d35e3123 Mon Sep 17 00:00:00 2001 From: Ben C Date: Tue, 14 Jun 2022 09:40:57 -0400 Subject: [PATCH 03/24] Put descriptions for recursive references in docs --- docs/Pipfile.lock | 58 +++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/docs/Pipfile.lock b/docs/Pipfile.lock index f5fd8bf3..c1fa2170 100644 --- a/docs/Pipfile.lock +++ b/docs/Pipfile.lock @@ -30,7 +30,7 @@ "sha256:58d5c3d29f5a36ffeb94f02f0d786cd53014cf9b3b3951d42e0080d8a9498d30", "sha256:ad9aa55b65ef2808eb405f46cf74df7fcb7044d5cbc26487f96eb2ef2e436693" ], - "markers": "python_version >= '3.6'", + "markers": "python_full_version >= '3.6.0'", "version": "==4.11.1" }, "certifi": { @@ -38,7 +38,7 @@ "sha256:9c5705e395cd70084351dd8ad5c41e65655e08ce46f2ec9cf6c2c08390f71eb7", "sha256:f1d53542ee8cbedbe2118b5686372fb33c297fcd6379b050cca0ef13a597382a" ], - "markers": "python_version >= '3.6'", + "markers": "python_full_version >= '3.6.0'", "version": "==2022.5.18.1" }, "charset-normalizer": { @@ -46,7 +46,7 @@ "sha256:2857e29ff0d34db842cd7ca3230549d1a697f96ee6d3fb071cfa6c7393832597", "sha256:6881edbebdb17b39b4eaaa821b438bf6eddffb4468cf344f09f89def34a8b1df" ], - "markers": "python_version >= '3'", + "markers": "python_version >= '3.5'", "version": "==2.0.12" }, "click": { @@ -70,16 +70,16 @@ "sha256:bc285b5f892094c3a53d558858a88553dd6a61a11ab1a8128a0e554385dcc5dd", "sha256:c2c11bc8214fbf709ffc369d11446ff6945254a7f09128154a7620613d8fda90" ], - "markers": "python_version >= '3.6'", + "markers": "python_full_version >= '3.6.0'", "version": "==0.5.7" }, "elementpath": { "hashes": [ - "sha256:07f2a34bac7a2a909d745da1cb3c7b8cd43ca1d7d1134546db41ffb997bcb11c", - "sha256:25368810a76a5d9e464c0e721a12645409fc8c113ffde9e01d88557b4a7663d3" + "sha256:5ef1d51e8daa670f007914ff0f78ca7b2ecaa47e0ea0c5c699a29e6bc5f50385", + "sha256:b8aeb6f27dddc10fb9201b62090628a846cbae8577f3544cb1075fa38d0817f6" ], "markers": "python_version >= '3.7'", - "version": "==2.5.2" + "version": "==2.5.3" }, "htmlmin": { "hashes": [ @@ -92,7 +92,7 @@ "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff", "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d" ], - "markers": "python_version >= '3'", + "markers": "python_version >= '3.5'", "version": "==3.3" }, "jinja2": { @@ -120,11 +120,11 @@ }, "jsonschema": { "hashes": [ - "sha256:71b5e39324422543546572954ce71c67728922c104902cb7ce252e522235b33f", - "sha256:7c6d882619340c3347a1bf7315e147e6d3dae439033ae6383d6acb908c101dfc" + "sha256:1c92d2db1900b668201f1797887d66453ab1fbfea51df8e4b46236689c427baf", + "sha256:9d6397ba4a6c0bf0300736057f649e3e12ecbc07d3e81a0dacb72de4e9801957" ], "markers": "python_version >= '3.7'", - "version": "==4.5.1" + "version": "==4.6.0" }, "libsass": { "hashes": [ @@ -146,7 +146,7 @@ "sha256:cbb516f16218e643d8e0a95b309f77eb118cb138d39a4f27851e6a63581db874", "sha256:f5da449a6e1c989a4cea2631aa8ee67caa5a2ef855d551c88f9e309f4634c621" ], - "markers": "python_version >= '3.6'", + "markers": "python_full_version >= '3.6.0'", "version": "==3.3.7" }, "markdown2": { @@ -205,11 +205,11 @@ }, "marshmallow": { "hashes": [ - "sha256:2aaaab4f01ef4f5a011a21319af9fce17ab13bf28a026d1252adab0e035648d5", - "sha256:ff79885ed43b579782f48c251d262e062bce49c65c52412458769a4fb57ac30f" + "sha256:53a1e0ee69f79e1f3e80d17393b25cfc917eda52f859e8183b4af72c3390c1f1", + "sha256:a762c1d8b2bcb0e5c8e964850d03f9f3bffd6a12b626f3c14b9d6b1841999af5" ], "markers": "python_version >= '3.7'", - "version": "==3.15.0" + "version": "==3.16.0" }, "marshmallow-enum": { "hashes": [ @@ -220,11 +220,11 @@ }, "menagerie-docs": { "hashes": [ - "sha256:5f02204f4c8a6a3eee947ee4c91266159b567fd8e22d69be43531ef2e4a99f6a", - "sha256:ad69a97a65a73ad3f2be0f28638b74d1a6af68a5ce00c7b9726a9e0e89bb3d82" + "sha256:689f21de2b7c5b87457d7081e549ada2e5fcc39437b13f8e2158ac5be9864757", + "sha256:a6375d949f53f2fd918efb11bbea6ecd3fa1913a2610be417511db62361d775f" ], "index": "pypi", - "version": "==0.1.8" + "version": "==0.1.9" }, "mypy-extensions": { "hashes": [ @@ -246,7 +246,7 @@ "sha256:dd47c42927d89ab911e606518907cc2d3a1f38bbd026385970643f9c5b8ecfeb", "sha256:ef103e05f519cdc783ae24ea4e2e0f508a9c99b2d4969652eed6a2e1ea5bd522" ], - "markers": "python_version >= '3.6'", + "markers": "python_full_version >= '3.6.0'", "version": "==21.3" }, "pillow": { @@ -298,7 +298,7 @@ "sha256:5eb116118f9612ff1ee89ac96437bb6b49e8f04d8a13b514ba26f620208e26eb", "sha256:dc9c10fb40944260f6ed4c688ece0cd2048414940f1cea51b8b226318411c519" ], - "markers": "python_version >= '3.6'", + "markers": "python_full_version >= '3.6.0'", "version": "==2.12.0" }, "pyparsing": { @@ -379,7 +379,7 @@ "sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174", "sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5" ], - "markers": "python_version >= '3.6'", + "markers": "python_full_version >= '3.6.0'", "version": "==6.0" }, "rcssmin": { @@ -409,11 +409,11 @@ }, "requests": { "hashes": [ - "sha256:68d7c56fd5a8999887728ef304a6d12edc7be74f1cfa47714fc8b414525c9a61", - "sha256:f22fa1e554c9ddfd16e6e41ac79759e17be9e492b3587efa038054674760e72d" + "sha256:bc7861137fbce630f17b03d3ad02ad0bf978c844f3536d0edda6499dafce2b6f", + "sha256:d568723a7ebd25875d8d1eaf5dfa068cd2fc8194b2e483d7b1f7c81918dbec6b" ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'", - "version": "==2.27.1" + "markers": "python_version >= '3.7' and python_version < '4.0'", + "version": "==2.28.0" }, "rjsmin": { "hashes": [ @@ -453,7 +453,7 @@ "sha256:3b2503d3c7084a42b1ebd08116e5f81aadfaea95863628c80a3b774a11b7c759", "sha256:fc53893b3da2c33de295667a0e19f078c14bf86544af307354de5fcf12a3f30d" ], - "markers": "python_version >= '3.6'", + "markers": "python_full_version >= '3.6.0'", "version": "==2.3.2.post1" }, "typing-extensions": { @@ -482,11 +482,11 @@ }, "xmlschema": { "hashes": [ - "sha256:319f5e3e77beb6ab3b4166f699d9dafd59141487bd1a07675fd01af6483211a4", - "sha256:8ed246d97e7ab0393cf435ca98c8da6a0d2ab2f4e81949e149d8b2c97ec89357" + "sha256:0706c84de20686c940fa07e2b88425cff1471c89544a49e9365b9636236ccd2f", + "sha256:e6f8d1d44f8d95d8693698154d57c4a0557825483ccbedaca78eca2cd98ba6e7" ], "markers": "python_version >= '3.7'", - "version": "==1.11.0" + "version": "==1.11.2" } } } From 2a23ac47a3897a430a0a5ab140ffb69a41d4df40 Mon Sep 17 00:00:00 2001 From: Nick Date: Tue, 14 Jun 2022 21:24:44 -0400 Subject: [PATCH 04/24] TravelAudioFilePath doesn't work --- NewHorizons/Handlers/SystemCreationHandler.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/NewHorizons/Handlers/SystemCreationHandler.cs b/NewHorizons/Handlers/SystemCreationHandler.cs index f4c0ca99..eb9fcdbb 100644 --- a/NewHorizons/Handlers/SystemCreationHandler.cs +++ b/NewHorizons/Handlers/SystemCreationHandler.cs @@ -2,6 +2,7 @@ using NewHorizons.Builder.StarSystem; using NewHorizons.Components; using NewHorizons.Utility; using UnityEngine; +using Logger = NewHorizons.Utility.Logger; using Object = UnityEngine.Object; namespace NewHorizons.Handlers { @@ -28,21 +29,23 @@ namespace NewHorizons.Handlers } AudioClip clip = null; - if (system.Config.travelAudioClip != null) clip = SearchUtilities.FindResourceOfTypeAndName(system.Config.travelAudioClip); - else if (system.Config.travelAudioFilePath != null) + if (!string.IsNullOrEmpty(system.Config.travelAudioClip)) + { + clip = SearchUtilities.FindResourceOfTypeAndName(system.Config.travelAudioClip); + } + else if (!string.IsNullOrEmpty(system.Config.travelAudioFilePath)) { try { clip = AudioUtilities.LoadAudio(system.Mod.ModHelper.Manifest.ModFolderPath + "/" + system.Config.travelAudioFilePath); } - catch (System.Exception e) - { - Utility.Logger.LogError($"Couldn't load audio file {system.Config.travelAudioFilePath} : {e.Message}"); - } + catch { } } if (clip != null) { + Logger.LogError($"Couldn't get audio from clip [{system.Config.travelAudioClip}] or file [{system.Config.travelAudioFilePath}]"); + var travelSource = Locator.GetGlobalMusicController()._travelSource; travelSource._audioLibraryClip = AudioType.None; travelSource._clipArrayIndex = 0; From 6095a33a52c4d4d031bcf5b70ac66fda3e3066b9 Mon Sep 17 00:00:00 2001 From: Nick Date: Tue, 14 Jun 2022 21:26:25 -0400 Subject: [PATCH 05/24] Bump version number --- NewHorizons/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/manifest.json b/NewHorizons/manifest.json index 129a60c2..b0bf4eb0 100644 --- a/NewHorizons/manifest.json +++ b/NewHorizons/manifest.json @@ -3,7 +3,7 @@ "author": "xen, Bwc9876, & Book", "name": "New Horizons", "uniqueName": "xen.NewHorizons", - "version": "1.2.5", + "version": "1.3.0", "owmlVersion": "2.3.3", "conflicts": [ "Raicuparta.QuantumSpaceBuddies", "Vesper.AutoResume", "PacificEngine.OW_Randomizer" ], "pathsToPreserve": [ "planets", "systems", "translations" ] From 8fcc64e44636c17363b7d6cb7cc8f5acc78a2d2e Mon Sep 17 00:00:00 2001 From: Nick Date: Tue, 14 Jun 2022 21:29:38 -0400 Subject: [PATCH 06/24] Logged in the wrong place --- NewHorizons/Handlers/SystemCreationHandler.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Handlers/SystemCreationHandler.cs b/NewHorizons/Handlers/SystemCreationHandler.cs index eb9fcdbb..fd3fd408 100644 --- a/NewHorizons/Handlers/SystemCreationHandler.cs +++ b/NewHorizons/Handlers/SystemCreationHandler.cs @@ -44,8 +44,6 @@ namespace NewHorizons.Handlers if (clip != null) { - Logger.LogError($"Couldn't get audio from clip [{system.Config.travelAudioClip}] or file [{system.Config.travelAudioFilePath}]"); - var travelSource = Locator.GetGlobalMusicController()._travelSource; travelSource._audioLibraryClip = AudioType.None; travelSource._clipArrayIndex = 0; @@ -53,6 +51,10 @@ namespace NewHorizons.Handlers travelSource._clipSelectionOnPlay = OWAudioSource.ClipSelectionOnPlay.MANUAL; travelSource.clip = clip; } + else + { + Logger.LogError($"Couldn't get audio from clip [{system.Config.travelAudioClip}] or file [{system.Config.travelAudioFilePath}]"); + } } } } From 90b5a05f41f58c1daec0b5954db7dfb1ea1eab98 Mon Sep 17 00:00:00 2001 From: Nick Date: Tue, 14 Jun 2022 21:32:51 -0400 Subject: [PATCH 07/24] Update SystemCreationHandler.cs --- NewHorizons/Handlers/SystemCreationHandler.cs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/NewHorizons/Handlers/SystemCreationHandler.cs b/NewHorizons/Handlers/SystemCreationHandler.cs index fd3fd408..6eb51621 100644 --- a/NewHorizons/Handlers/SystemCreationHandler.cs +++ b/NewHorizons/Handlers/SystemCreationHandler.cs @@ -32,6 +32,11 @@ namespace NewHorizons.Handlers if (!string.IsNullOrEmpty(system.Config.travelAudioClip)) { clip = SearchUtilities.FindResourceOfTypeAndName(system.Config.travelAudioClip); + + if (clip == null) + { + Logger.LogError($"Couldn't get audio from clip [{system.Config.travelAudioClip}]"); + } } else if (!string.IsNullOrEmpty(system.Config.travelAudioFilePath)) { @@ -40,6 +45,11 @@ namespace NewHorizons.Handlers clip = AudioUtilities.LoadAudio(system.Mod.ModHelper.Manifest.ModFolderPath + "/" + system.Config.travelAudioFilePath); } catch { } + + if (clip == null) + { + Logger.LogError($"Couldn't get audio from file [{system.Config.travelAudioFilePath}]"); + } } if (clip != null) @@ -51,10 +61,6 @@ namespace NewHorizons.Handlers travelSource._clipSelectionOnPlay = OWAudioSource.ClipSelectionOnPlay.MANUAL; travelSource.clip = clip; } - else - { - Logger.LogError($"Couldn't get audio from clip [{system.Config.travelAudioClip}] or file [{system.Config.travelAudioFilePath}]"); - } } } } From 73f819218a7048a66e5a853e24fefe176e492f96 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Tue, 14 Jun 2022 21:49:00 -0400 Subject: [PATCH 08/24] Change to IsNullOrEmpty --- NewHorizons/Builder/Body/CloakBuilder.cs | 4 ++-- NewHorizons/Builder/Props/SignalBuilder.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/NewHorizons/Builder/Body/CloakBuilder.cs b/NewHorizons/Builder/Body/CloakBuilder.cs index ab18f6bf..2325dca2 100644 --- a/NewHorizons/Builder/Body/CloakBuilder.cs +++ b/NewHorizons/Builder/Body/CloakBuilder.cs @@ -12,8 +12,8 @@ namespace NewHorizons.Builder.Body var radius = module.radius; AudioClip clip = null; - if (module.audioClip != null) clip = SearchUtilities.FindResourceOfTypeAndName(module.audioClip); - else if (module.audioFilePath != null) + if (!string.IsNullOrEmpty(module.audioClip)) clip = SearchUtilities.FindResourceOfTypeAndName(module.audioClip); + else if (!string.IsNullOrEmpty(module.audioFilePath)) { try { diff --git a/NewHorizons/Builder/Props/SignalBuilder.cs b/NewHorizons/Builder/Props/SignalBuilder.cs index 097ea6cb..37e28b8d 100644 --- a/NewHorizons/Builder/Props/SignalBuilder.cs +++ b/NewHorizons/Builder/Props/SignalBuilder.cs @@ -153,8 +153,8 @@ namespace NewHorizons.Builder.Props var name = StringToSignalName(info.name); AudioClip clip = null; - if (info.audioClip != null) clip = SearchUtilities.FindResourceOfTypeAndName(info.audioClip); - else if (info.audioFilePath != null) + if (!string.IsNullOrEmpty(info.audioClip)) clip = SearchUtilities.FindResourceOfTypeAndName(info.audioClip); + else if (!string.IsNullOrEmpty(info.audioFilePath)) { try { From 60e03376486139cb7fe6373e96556407f555bdc4 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Tue, 14 Jun 2022 21:51:21 -0400 Subject: [PATCH 09/24] Change to match SystemCreationHandler --- NewHorizons/Builder/Body/CloakBuilder.cs | 16 +++++++++++++--- NewHorizons/Builder/Props/SignalBuilder.cs | 5 +---- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/NewHorizons/Builder/Body/CloakBuilder.cs b/NewHorizons/Builder/Body/CloakBuilder.cs index 2325dca2..ddb60013 100644 --- a/NewHorizons/Builder/Body/CloakBuilder.cs +++ b/NewHorizons/Builder/Body/CloakBuilder.cs @@ -12,16 +12,26 @@ namespace NewHorizons.Builder.Body var radius = module.radius; AudioClip clip = null; - if (!string.IsNullOrEmpty(module.audioClip)) clip = SearchUtilities.FindResourceOfTypeAndName(module.audioClip); + if (!string.IsNullOrEmpty(module.audioClip)) + { + clip = SearchUtilities.FindResourceOfTypeAndName(module.audioClip); + + if (clip == null) + { + Utility.Logger.LogError($"Couldn't get audio from clip [{module.audioClip}]"); + } + } else if (!string.IsNullOrEmpty(module.audioFilePath)) { try { clip = AudioUtilities.LoadAudio(mod.ModHelper.Manifest.ModFolderPath + "/" + module.audioFilePath); } - catch (System.Exception e) + catch { } + + if (clip == null) { - Utility.Logger.LogError($"Couldn't load audio file {module.audioFilePath} : {e.Message}"); + Utility.Logger.LogError($"Couldn't get audio from file [{module.audioFilePath}]"); } } diff --git a/NewHorizons/Builder/Props/SignalBuilder.cs b/NewHorizons/Builder/Props/SignalBuilder.cs index 37e28b8d..856e57d6 100644 --- a/NewHorizons/Builder/Props/SignalBuilder.cs +++ b/NewHorizons/Builder/Props/SignalBuilder.cs @@ -160,10 +160,7 @@ namespace NewHorizons.Builder.Props { clip = AudioUtilities.LoadAudio(mod.ModHelper.Manifest.ModFolderPath + "/" + info.audioFilePath); } - catch (Exception e) - { - Logger.LogError($"Couldn't load audio file {info.audioFilePath} : {e.Message}"); - } + catch { } } if (clip == null) From 29a9c239f37da68e624c67f4c863c4020ff5dbe8 Mon Sep 17 00:00:00 2001 From: Noah Pilarski Date: Tue, 14 Jun 2022 22:02:43 -0400 Subject: [PATCH 10/24] Change travel music on next update --- NewHorizons/Handlers/SystemCreationHandler.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/NewHorizons/Handlers/SystemCreationHandler.cs b/NewHorizons/Handlers/SystemCreationHandler.cs index 6eb51621..af59fb81 100644 --- a/NewHorizons/Handlers/SystemCreationHandler.cs +++ b/NewHorizons/Handlers/SystemCreationHandler.cs @@ -54,12 +54,15 @@ namespace NewHorizons.Handlers if (clip != null) { - var travelSource = Locator.GetGlobalMusicController()._travelSource; - travelSource._audioLibraryClip = AudioType.None; - travelSource._clipArrayIndex = 0; - travelSource._clipArrayLength = 0; - travelSource._clipSelectionOnPlay = OWAudioSource.ClipSelectionOnPlay.MANUAL; - travelSource.clip = clip; + Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => + { + var travelSource = Locator.GetGlobalMusicController()._travelSource; + travelSource._audioLibraryClip = AudioType.None; + travelSource._clipArrayIndex = 0; + travelSource._clipArrayLength = 0; + travelSource._clipSelectionOnPlay = OWAudioSource.ClipSelectionOnPlay.MANUAL; + travelSource.clip = clip; + }); } } } From 58aa9ccebd61fac4361ef012a6f757c91ff31684 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Tue, 14 Jun 2022 23:23:08 -0700 Subject: [PATCH 11/24] hee hee typo --- 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 940577cb..b65efd08 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -125,7 +125,7 @@ namespace NewHorizons.External.Modules public bool alignToNormal; /// - /// Relative filepath to an asset-bundle to load the prefab defined in `path` from/ + /// Relative filepath to an asset-bundle to load the prefab defined in `path` from /// public string assetBundle; From 0f6ed62fc81f558a4adce9902fb65cc4e7a4a725 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Tue, 14 Jun 2022 23:23:47 -0700 Subject: [PATCH 12/24] another typo --- 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 b65efd08..bd618145 100644 --- a/NewHorizons/External/Modules/PropModule.cs +++ b/NewHorizons/External/Modules/PropModule.cs @@ -76,7 +76,7 @@ namespace NewHorizons.External.Modules public class ScatterInfo { /// - /// Relative filepath to an asset-bundle" + /// Relative filepath to an asset-bundle /// public string assetBundle; From 2b64f0c73b2e50b5fd7f0ec5eb0172a91dd682e4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 15 Jun 2022 06:26:51 +0000 Subject: [PATCH 13/24] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index fff468c4..f2640e7a 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -821,7 +821,7 @@ }, "assetBundle": { "type": "string", - "description": "Relative filepath to an asset-bundle to load the prefab defined in `path` from/" + "description": "Relative filepath to an asset-bundle to load the prefab defined in `path` from" }, "path": { "type": "string", @@ -1096,7 +1096,7 @@ "properties": { "assetBundle": { "type": "string", - "description": "Relative filepath to an asset-bundle\"" + "description": "Relative filepath to an asset-bundle" }, "count": { "type": "integer", From 31361cb045a8e731bdc0fbec048d3eb5054b20ea Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 15 Jun 2022 12:02:04 -0400 Subject: [PATCH 14/24] Set distances next frame --- NewHorizons/Builder/Props/TornadoBuilder.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/NewHorizons/Builder/Props/TornadoBuilder.cs b/NewHorizons/Builder/Props/TornadoBuilder.cs index 9009cd37..ac3893e7 100644 --- a/NewHorizons/Builder/Props/TornadoBuilder.cs +++ b/NewHorizons/Builder/Props/TornadoBuilder.cs @@ -117,8 +117,11 @@ namespace NewHorizons.Builder.Props // Resize the distance it can be heard from to match roughly with the size var maxDistance = info.audioDistance == 0 ? 10 * scale : info.audioDistance; - audioSource.maxDistance = maxDistance; - audioSource.minDistance = maxDistance / 10f; + Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => + { + audioSource.maxDistance = maxDistance; + audioSource.minDistance = maxDistance / 10f; + }); var controller = tornadoGO.GetComponent(); controller.SetSector(sector); From eaaf5cf74674ed413f43fd3ed8f6249300dedd09 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 15 Jun 2022 12:19:31 -0400 Subject: [PATCH 15/24] idk --- NewHorizons/Builder/Props/TornadoBuilder.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Props/TornadoBuilder.cs b/NewHorizons/Builder/Props/TornadoBuilder.cs index ac3893e7..f24ff427 100644 --- a/NewHorizons/Builder/Props/TornadoBuilder.cs +++ b/NewHorizons/Builder/Props/TornadoBuilder.cs @@ -116,7 +116,8 @@ namespace NewHorizons.Builder.Props tornadoGO.transform.localScale = Vector3.one * scale; // Resize the distance it can be heard from to match roughly with the size - var maxDistance = info.audioDistance == 0 ? 10 * scale : info.audioDistance; + var maxDistance = info.audioDistance; + if (maxDistance <= 0) maxDistance = info.height; Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => { audioSource.maxDistance = maxDistance; From c2d145c6d7e83f426429127986370c1dfa2e8870 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 15 Jun 2022 12:23:57 -0400 Subject: [PATCH 16/24] Update OWML version --- NewHorizons/AchievementsPlus/AchievementHandler.cs | 11 +++++------ NewHorizons/NewHorizons.csproj | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/NewHorizons/AchievementsPlus/AchievementHandler.cs b/NewHorizons/AchievementsPlus/AchievementHandler.cs index b493a7d0..12fe2f6d 100644 --- a/NewHorizons/AchievementsPlus/AchievementHandler.cs +++ b/NewHorizons/AchievementsPlus/AchievementHandler.cs @@ -11,18 +11,17 @@ namespace NewHorizons.AchievementsPlus public static void Init() { - try - { - API = Main.Instance.ModHelper.Interaction.GetModApi("xen.AchievementTracker"); - _enabled = true; - } - catch (Exception) + API = Main.Instance.ModHelper.Interaction.TryGetModApi("xen.AchievementTracker"); + + if (API == null) { Logger.Log("Achievements+ isn't installed"); _enabled = false; return; } + _enabled = true; + // Register base NH achievements NH.WarpDriveAchievement.Init(); NH.MultipleSystemAchievement.Init(); diff --git a/NewHorizons/NewHorizons.csproj b/NewHorizons/NewHorizons.csproj index 88134ae1..72b21de4 100644 --- a/NewHorizons/NewHorizons.csproj +++ b/NewHorizons/NewHorizons.csproj @@ -16,7 +16,7 @@ - + From b02da60590f438148e544904c322da5980ccdbfd Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 15 Jun 2022 12:47:10 -0400 Subject: [PATCH 17/24] Update TornadoBuilder.cs --- NewHorizons/Builder/Props/TornadoBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Props/TornadoBuilder.cs b/NewHorizons/Builder/Props/TornadoBuilder.cs index f24ff427..2624206b 100644 --- a/NewHorizons/Builder/Props/TornadoBuilder.cs +++ b/NewHorizons/Builder/Props/TornadoBuilder.cs @@ -117,7 +117,7 @@ namespace NewHorizons.Builder.Props // Resize the distance it can be heard from to match roughly with the size var maxDistance = info.audioDistance; - if (maxDistance <= 0) maxDistance = info.height; + if (maxDistance <= 0) maxDistance = scale * 10f; Main.Instance.ModHelper.Events.Unity.FireOnNextUpdate(() => { audioSource.maxDistance = maxDistance; From 6e5c381cc7862f7c099cb26b86427dfb1976442e Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 15 Jun 2022 12:49:20 -0400 Subject: [PATCH 18/24] Update TornadoBuilder.cs --- NewHorizons/Builder/Props/TornadoBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Props/TornadoBuilder.cs b/NewHorizons/Builder/Props/TornadoBuilder.cs index 2624206b..22b8ff20 100644 --- a/NewHorizons/Builder/Props/TornadoBuilder.cs +++ b/NewHorizons/Builder/Props/TornadoBuilder.cs @@ -109,7 +109,7 @@ namespace NewHorizons.Builder.Props var audioSpreadController = soundGO.GetComponentInChildren(); audioSpreadController.SetSector(sector); - var audioSource = audioRail._audioTransform.GetComponent(); + var audioSource = audioRail._audioTransform.GetComponent(); audioSource.playOnAwake = true; var scale = info.height == 0 ? 1 : info.height / 10f; From c0632e96242fd43c19715ec7976ea272d4484efb Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Wed, 15 Jun 2022 09:53:49 -0700 Subject: [PATCH 19/24] upgrade njsonschema package --- SchemaExporter/SchemaExporter.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SchemaExporter/SchemaExporter.csproj b/SchemaExporter/SchemaExporter.csproj index c55b8e38..af626a17 100644 --- a/SchemaExporter/SchemaExporter.csproj +++ b/SchemaExporter/SchemaExporter.csproj @@ -19,7 +19,7 @@ PreserveNewest - + From 85964d631536b9e3615cb4c0cb30ae78343c19a6 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 15 Jun 2022 13:07:25 -0400 Subject: [PATCH 20/24] Fix bad path --- NewHorizons/Builder/Atmosphere/CloudsBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs b/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs index 5a5a1bfe..fce3ada5 100644 --- a/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs @@ -23,7 +23,7 @@ namespace NewHorizons.Builder.Atmosphere public static void Make(GameObject planetGO, Sector sector, AtmosphereModule atmo, IModBehaviour mod) { if (_lightningPrefab == null) _lightningPrefab = SearchUtilities.Find("GiantsDeep_Body/Sector_GD/Clouds_GD/LightningGenerator_GD"); - if (_colorRamp == null) _colorRamp = ImageUtilities.GetTexture(Main.Instance, "AssetBundle/textures/Clouds_Bottom_ramp.png"); + if (_colorRamp == null) _colorRamp = ImageUtilities.GetTexture(Main.Instance, "Assets/textures/Clouds_Bottom_ramp.png"); GameObject cloudsMainGO = new GameObject("Clouds"); cloudsMainGO.SetActive(false); From e833512bdad3a8f59f80c9528facf6b5e564a6c9 Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 15 Jun 2022 14:06:34 -0400 Subject: [PATCH 21/24] Rename sphereOfInfluence to soiOverride --- NewHorizons/Builder/General/GravityBuilder.cs | 2 +- .../Builder/Orbital/FocalPointBuilder.cs | 2 +- NewHorizons/External/Configs/PlanetConfig.cs | 494 +++++++++--------- NewHorizons/External/Modules/BaseModule.cs | 5 +- NewHorizons/Handlers/PlanetCreationHandler.cs | 2 +- 5 files changed, 255 insertions(+), 250 deletions(-) diff --git a/NewHorizons/Builder/General/GravityBuilder.cs b/NewHorizons/Builder/General/GravityBuilder.cs index 95f8a886..1a61f0f3 100644 --- a/NewHorizons/Builder/General/GravityBuilder.cs +++ b/NewHorizons/Builder/General/GravityBuilder.cs @@ -18,7 +18,7 @@ namespace NewHorizons.Builder.General // To let you actually orbit things the way you would expect we cap this at 4x the diameter if its not a star or black hole (this is what giants deep has) if (config.Star == null && config.Singularity == null) gravityRadius = Mathf.Min(gravityRadius, 4 * config.Base.surfaceSize); else gravityRadius = Mathf.Min(gravityRadius, 15 * config.Base.surfaceSize); - if (config.Base.sphereOfInfluence != 0f) gravityRadius = config.Base.sphereOfInfluence; + if (config.Base.soiOverride != 0f) gravityRadius = config.Base.soiOverride; var gravityGO = new GameObject("GravityWell"); gravityGO.transform.parent = planetGO.transform; diff --git a/NewHorizons/Builder/Orbital/FocalPointBuilder.cs b/NewHorizons/Builder/Orbital/FocalPointBuilder.cs index 98a51bd9..18b055f1 100644 --- a/NewHorizons/Builder/Orbital/FocalPointBuilder.cs +++ b/NewHorizons/Builder/Orbital/FocalPointBuilder.cs @@ -57,7 +57,7 @@ namespace NewHorizons.Builder.Orbital // Other stuff to make the fake barycenter not interact with anything in any way fakeMassConfig.name = config.name + "_FakeBarycenterMass"; - fakeMassConfig.Base.sphereOfInfluence = 0; + fakeMassConfig.Base.soiOverride = 0; fakeMassConfig.Base.hasMapMarker = false; fakeMassConfig.ReferenceFrame.hideInMap = true; diff --git a/NewHorizons/External/Configs/PlanetConfig.cs b/NewHorizons/External/Configs/PlanetConfig.cs index 98876470..5ab65904 100644 --- a/NewHorizons/External/Configs/PlanetConfig.cs +++ b/NewHorizons/External/Configs/PlanetConfig.cs @@ -1,250 +1,252 @@ -using System; -using System.ComponentModel; -using System.ComponentModel.DataAnnotations; -using NewHorizons.External.Modules; -using NewHorizons.External.Modules.VariableSize; -using Newtonsoft.Json; - -namespace NewHorizons.External.Configs -{ - /// - /// Describes a body to generate - /// - [JsonObject(Title = "Celestial Body")] - public class PlanetConfig - { - /// - /// Generate asteroids around this body - /// - public AsteroidBeltModule AsteroidBelt; - - /// - /// Describes this Body's atmosphere - /// - public AtmosphereModule Atmosphere; - - /// - /// Base Properties of this Body - /// - public BaseModule Base; - - /// - /// Set to a higher number if you wish for this body to be built sooner - /// - [DefaultValue(-1)] public int buildPriority = -1; - - /// - /// Should this planet ever be shown on the title screen? - /// - public bool canShowOnTitle = true; - - #region Obsolete - - [Obsolete("ChildrenToDestroy is deprecated, please use RemoveChildren instead")] - public string[] childrenToDestroy; - - #endregion Obsolete - - /// - /// Add a cloaking field to this planet - /// - public CloakModule Cloak; - - /// - /// `true` if you want to delete this planet - /// - public bool destroy; - - /// - /// Make this body into a focal point (barycenter) - /// - public FocalPointModule FocalPoint; - - /// - /// Add funnel from this planet to another - /// - public FunnelModule Funnel; - - /// - /// Generate the surface of this planet using a heightmap - /// - public HeightMapModule HeightMap; - - /// - /// Does this config describe a quantum state of a custom planet defined in another file? - /// - public bool isQuantumState; - - /// - /// Add lava to this planet - /// - public LavaModule Lava; - - /// - /// Unique name of your planet - /// - [Required] - public string name; - - /// - /// Describes this Body's orbit (or lack there of) - /// - public OrbitModule Orbit; - - /// - /// Procedural Generation - /// - public ProcGenModule ProcGen; - - /// - /// Spawn various objects on this body - /// - public PropModule Props; - - /// - /// Reference frame properties of this body - /// - public ReferenceFrameModule ReferenceFrame; - - /// - /// A list of paths to child GameObjects to destroy on this planet - /// - public string[] removeChildren; - - /// - /// Creates a ring around the planet - /// - public RingModule Ring; - - /// - /// Add sand to this planet - /// - public SandModule Sand; - - /// - /// Add ship log entries to this planet and describe how it looks in map mode - /// - public ShipLogModule ShipLog; - - /// - /// Add signals that can be heard via the signal-scope to this planet - /// - public SignalModule Signal; - - /// - /// Add a black or white hole to this planet - /// - public SingularityModule Singularity; - - /// - /// Spawn the player at this planet - /// - public SpawnModule Spawn; - - /// - /// Make this body a star - /// - public StarModule Star; - - /// - /// Unique star system containing your planet - /// - [DefaultValue("SolarSystem")] public string starSystem = "SolarSystem"; - - /// - /// Version of New Horizons this config is using (Doesn't do anything) - /// - public string version; - - /// - /// Add water to this planet - /// - public WaterModule Water; - - public PlanetConfig() - { - // Always have to have a base module - if (Base == null) Base = new BaseModule(); - if (Orbit == null) Orbit = new OrbitModule(); - if (ShipLog == null) ShipLog = new ShipLogModule(); - if (ReferenceFrame == null) ReferenceFrame = new ReferenceFrameModule(); - } - - public void MigrateAndValidate() - { - // Validate - if (Base.centerOfSolarSystem) Orbit.isStatic = true; - if (Atmosphere?.clouds?.lightningGradient != null) Atmosphere.clouds.hasLightning = true; - - // Backwards compatability - // Should be the only place that obsolete things are referenced -#pragma warning disable 612, 618 - if (Base.waterSize != 0) - Water = new WaterModule - { - size = Base.waterSize, - tint = Base.waterTint - }; - - if (Base.lavaSize != 0) - Lava = new LavaModule - { - size = Base.lavaSize - }; - - if (Base.blackHoleSize != 0) - Singularity = new SingularityModule - { - type = SingularityModule.SingularityType.BlackHole, - size = Base.blackHoleSize - }; - - if (Base.isSatellite) Base.showMinimap = false; - - if (!Base.hasReferenceFrame) ReferenceFrame.hideInMap = true; - - if (childrenToDestroy != null) removeChildren = childrenToDestroy; - - if (Base.cloakRadius != 0) - Cloak = new CloakModule - { - radius = Base.cloakRadius - }; - - if (Base.hasAmbientLight) Base.ambientLight = 0.5f; - - if (Atmosphere != null) - { - if (!string.IsNullOrEmpty(Atmosphere.cloud)) - Atmosphere.clouds = new AtmosphereModule.CloudInfo - { - outerCloudRadius = Atmosphere.size, - innerCloudRadius = Atmosphere.size * 0.9f, - tint = Atmosphere.cloudTint, - texturePath = Atmosphere.cloud, - capPath = Atmosphere.cloudCap, - rampPath = Atmosphere.cloudRamp, - fluidType = Atmosphere.fluidType, - useBasicCloudShader = Atmosphere.useBasicCloudShader, - unlit = !Atmosphere.shadowsOnClouds - }; - - // Validate - if (Atmosphere.clouds?.lightningGradient != null) Atmosphere.clouds.hasLightning = true; - - // Former is obsolete, latter is to validate - if (Atmosphere.hasAtmosphere || Atmosphere.atmosphereTint != null) +using System; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using NewHorizons.External.Modules; +using NewHorizons.External.Modules.VariableSize; +using Newtonsoft.Json; + +namespace NewHorizons.External.Configs +{ + /// + /// Describes a body to generate + /// + [JsonObject(Title = "Celestial Body")] + public class PlanetConfig + { + /// + /// Generate asteroids around this body + /// + public AsteroidBeltModule AsteroidBelt; + + /// + /// Describes this Body's atmosphere + /// + public AtmosphereModule Atmosphere; + + /// + /// Base Properties of this Body + /// + public BaseModule Base; + + /// + /// Set to a higher number if you wish for this body to be built sooner + /// + [DefaultValue(-1)] public int buildPriority = -1; + + /// + /// Should this planet ever be shown on the title screen? + /// + public bool canShowOnTitle = true; + + #region Obsolete + + [Obsolete("ChildrenToDestroy is deprecated, please use RemoveChildren instead")] + public string[] childrenToDestroy; + + #endregion Obsolete + + /// + /// Add a cloaking field to this planet + /// + public CloakModule Cloak; + + /// + /// `true` if you want to delete this planet + /// + public bool destroy; + + /// + /// Make this body into a focal point (barycenter) + /// + public FocalPointModule FocalPoint; + + /// + /// Add funnel from this planet to another + /// + public FunnelModule Funnel; + + /// + /// Generate the surface of this planet using a heightmap + /// + public HeightMapModule HeightMap; + + /// + /// Does this config describe a quantum state of a custom planet defined in another file? + /// + public bool isQuantumState; + + /// + /// Add lava to this planet + /// + public LavaModule Lava; + + /// + /// Unique name of your planet + /// + [Required] + public string name; + + /// + /// Describes this Body's orbit (or lack there of) + /// + public OrbitModule Orbit; + + /// + /// Procedural Generation + /// + public ProcGenModule ProcGen; + + /// + /// Spawn various objects on this body + /// + public PropModule Props; + + /// + /// Reference frame properties of this body + /// + public ReferenceFrameModule ReferenceFrame; + + /// + /// A list of paths to child GameObjects to destroy on this planet + /// + public string[] removeChildren; + + /// + /// Creates a ring around the planet + /// + public RingModule Ring; + + /// + /// Add sand to this planet + /// + public SandModule Sand; + + /// + /// Add ship log entries to this planet and describe how it looks in map mode + /// + public ShipLogModule ShipLog; + + /// + /// Add signals that can be heard via the signal-scope to this planet + /// + public SignalModule Signal; + + /// + /// Add a black or white hole to this planet + /// + public SingularityModule Singularity; + + /// + /// Spawn the player at this planet + /// + public SpawnModule Spawn; + + /// + /// Make this body a star + /// + public StarModule Star; + + /// + /// Unique star system containing your planet + /// + [DefaultValue("SolarSystem")] public string starSystem = "SolarSystem"; + + /// + /// Version of New Horizons this config is using (Doesn't do anything) + /// + public string version; + + /// + /// Add water to this planet + /// + public WaterModule Water; + + public PlanetConfig() + { + // Always have to have a base module + if (Base == null) Base = new BaseModule(); + if (Orbit == null) Orbit = new OrbitModule(); + if (ShipLog == null) ShipLog = new ShipLogModule(); + if (ReferenceFrame == null) ReferenceFrame = new ReferenceFrameModule(); + } + + public void MigrateAndValidate() + { + // Validate + if (Base.centerOfSolarSystem) Orbit.isStatic = true; + if (Atmosphere?.clouds?.lightningGradient != null) Atmosphere.clouds.hasLightning = true; + + // Backwards compatability + // Should be the only place that obsolete things are referenced +#pragma warning disable 612, 618 + if (Base.waterSize != 0) + Water = new WaterModule + { + size = Base.waterSize, + tint = Base.waterTint + }; + + if (Base.lavaSize != 0) + Lava = new LavaModule + { + size = Base.lavaSize + }; + + if (Base.blackHoleSize != 0) + Singularity = new SingularityModule + { + type = SingularityModule.SingularityType.BlackHole, + size = Base.blackHoleSize + }; + + if (Base.isSatellite) Base.showMinimap = false; + + if (!Base.hasReferenceFrame) ReferenceFrame.hideInMap = true; + + if (childrenToDestroy != null) removeChildren = childrenToDestroy; + + if (Base.cloakRadius != 0) + Cloak = new CloakModule + { + radius = Base.cloakRadius + }; + + if (Base.hasAmbientLight) Base.ambientLight = 0.5f; + + if (Atmosphere != null) + { + if (!string.IsNullOrEmpty(Atmosphere.cloud)) + Atmosphere.clouds = new AtmosphereModule.CloudInfo + { + outerCloudRadius = Atmosphere.size, + innerCloudRadius = Atmosphere.size * 0.9f, + tint = Atmosphere.cloudTint, + texturePath = Atmosphere.cloud, + capPath = Atmosphere.cloudCap, + rampPath = Atmosphere.cloudRamp, + fluidType = Atmosphere.fluidType, + useBasicCloudShader = Atmosphere.useBasicCloudShader, + unlit = !Atmosphere.shadowsOnClouds + }; + + // Validate + if (Atmosphere.clouds?.lightningGradient != null) Atmosphere.clouds.hasLightning = true; + + // Former is obsolete, latter is to validate + if (Atmosphere.hasAtmosphere || Atmosphere.atmosphereTint != null) Atmosphere.useAtmosphereShader = true; // useBasicCloudShader is obsolete - if (Atmosphere.clouds != null && Atmosphere.clouds.useBasicCloudShader) - Atmosphere.clouds.cloudsPrefab = CloudPrefabType.Basic; - } - - if (Props?.tornados != null) - foreach (var tornado in Props.tornados) - if (tornado.downwards) - tornado.type = PropModule.TornadoInfo.TornadoType.Downwards; - } - } + if (Atmosphere.clouds != null && Atmosphere.clouds.useBasicCloudShader) + Atmosphere.clouds.cloudsPrefab = CloudPrefabType.Basic; + } + + if (Props?.tornados != null) + foreach (var tornado in Props.tornados) + if (tornado.downwards) + tornado.type = PropModule.TornadoInfo.TornadoType.Downwards; + + if (Base.sphereOfInfluence != 0f) Base.soiOverride = Base.sphereOfInfluence; + } + } } \ No newline at end of file diff --git a/NewHorizons/External/Modules/BaseModule.cs b/NewHorizons/External/Modules/BaseModule.cs index 27858633..8c8e0ede 100644 --- a/NewHorizons/External/Modules/BaseModule.cs +++ b/NewHorizons/External/Modules/BaseModule.cs @@ -69,7 +69,7 @@ namespace NewHorizons.External.Modules /// /// An override for the radius of the planet's gravitational sphere of influence. Optional /// - public float sphereOfInfluence; + public float soiOverride; /// /// The acceleration due to gravity felt as the surfaceSize. Timber Hearth has 12 for reference @@ -112,6 +112,9 @@ namespace NewHorizons.External.Modules [Obsolete("CloakRadius is deprecated, please use CloakModule instead")] public float cloakRadius; + [Obsolete("SphereOfInfluence is deprecated, please use soiOverride instead")] + public float sphereOfInfluence; + #endregion Obsolete } } \ No newline at end of file diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index 1470b5f6..4b9c8ff4 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -365,7 +365,7 @@ namespace NewHorizons.Handlers { var atmoSize = body.Config.Atmosphere != null ? body.Config.Atmosphere.size : 0f; float sphereOfInfluence = Mathf.Max(Mathf.Max(atmoSize, 50), body.Config.Base.surfaceSize * 2f); - var overrideSOI = body.Config.Base.sphereOfInfluence; + var overrideSOI = body.Config.Base.soiOverride; if (overrideSOI != 0) sphereOfInfluence = overrideSOI; return sphereOfInfluence; } From 9de6f493f797ced421f455b46f9da340df74eb75 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 15 Jun 2022 18:11:03 +0000 Subject: [PATCH 22/24] 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 f2640e7a..1a0578ac 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -436,7 +436,7 @@ "description": "Do we show the minimap when walking around this planet?", "default": true }, - "sphereOfInfluence": { + "soiOverride": { "type": "number", "description": "An override for the radius of the planet's gravitational sphere of influence. Optional", "format": "float" From c0ad3a0fa74708a24e653fe390483e2f9598db2e Mon Sep 17 00:00:00 2001 From: Nick Date: Wed, 15 Jun 2022 14:37:25 -0400 Subject: [PATCH 23/24] Made maxTargetDistance accurate and added targetColliderRadius --- NewHorizons/Builder/General/RFVolumeBuilder.cs | 6 ++++-- NewHorizons/External/Modules/ReferenceFrameModule.cs | 11 ++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/NewHorizons/Builder/General/RFVolumeBuilder.cs b/NewHorizons/Builder/General/RFVolumeBuilder.cs index 178234e4..1d4815a9 100644 --- a/NewHorizons/Builder/General/RFVolumeBuilder.cs +++ b/NewHorizons/Builder/General/RFVolumeBuilder.cs @@ -15,6 +15,7 @@ namespace NewHorizons.Builder.General var SC = rfGO.AddComponent(); SC.isTrigger = true; + // This radius ends up being set by min and max collider radius on the RFV but we set it anyway because why fix what aint broke SC.radius = sphereOfInfluence * 2; var RFV = rfGO.AddComponent(); @@ -23,7 +24,8 @@ namespace NewHorizons.Builder.General var RV = new ReferenceFrame(owrb); RV._minSuitTargetDistance = minTargetDistance; - RV._maxTargetDistance = 0; + // The game raycasts to 100km, but if the target is farther than this max distance it ignores it + RV._maxTargetDistance = module.maxTargetDistance; RV._autopilotArrivalDistance = 2.0f * sphereOfInfluence; RV._autoAlignmentDistance = sphereOfInfluence * 1.5f; @@ -35,7 +37,7 @@ namespace NewHorizons.Builder.General RFV._referenceFrame = RV; RFV._minColliderRadius = minTargetDistance; - RFV._maxColliderRadius = module.maxTargetDistance > -1 ? module.maxTargetDistance : sphereOfInfluence * 2f; + RFV._maxColliderRadius = module.targetColliderRadius > 0 ? module.targetColliderRadius : sphereOfInfluence * 2f; RFV._isPrimaryVolume = true; RFV._isCloseRangeVolume = false; diff --git a/NewHorizons/External/Modules/ReferenceFrameModule.cs b/NewHorizons/External/Modules/ReferenceFrameModule.cs index 793bb5f0..88adda68 100644 --- a/NewHorizons/External/Modules/ReferenceFrameModule.cs +++ b/NewHorizons/External/Modules/ReferenceFrameModule.cs @@ -16,7 +16,7 @@ namespace NewHorizons.External.Modules public bool hideInMap; /// - /// Radius of the brackets that show up when you target this. Defaults to the sphereOfInfluence. + /// Radius of the brackets that show up when you target this. Defaults to the sphere of influence. /// [DefaultValue(-1)] public float bracketRadius = -1; @@ -26,8 +26,13 @@ namespace NewHorizons.External.Modules public bool targetWhenClose; /// - /// The maximum distance that the reference frame can be targeted from. Defaults to double the sphereOfInfluence. + /// The maximum distance that the reference frame can be targeted from. Defaults to 100km and cannot be greater than that. /// - [DefaultValue(-1)] public float maxTargetDistance = -1; + public float maxTargetDistance; // If it's less than or equal to zero the game makes it 100km + + /// + /// 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; } } \ No newline at end of file From 5414ea2d414b8fa5fbd47f3eb5ae766fa5da1c4b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 15 Jun 2022 18:39:53 +0000 Subject: [PATCH 24/24] Updated Schemas --- NewHorizons/Schemas/body_schema.json | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/NewHorizons/Schemas/body_schema.json b/NewHorizons/Schemas/body_schema.json index 1a0578ac..8d1966ad 100644 --- a/NewHorizons/Schemas/body_schema.json +++ b/NewHorizons/Schemas/body_schema.json @@ -1354,7 +1354,7 @@ }, "bracketRadius": { "type": "number", - "description": "Radius of the brackets that show up when you target this. Defaults to the sphereOfInfluence.", + "description": "Radius of the brackets that show up when you target this. Defaults to the sphere of influence.", "format": "float", "default": -1 }, @@ -1364,9 +1364,13 @@ }, "maxTargetDistance": { "type": "number", - "description": "The maximum distance that the reference frame can be targeted from. Defaults to double the sphereOfInfluence.", - "format": "float", - "default": -1 + "description": "The maximum distance that the reference frame can be targeted from. Defaults to 100km and cannot be greater than that.", + "format": "float" + }, + "targetColliderRadius": { + "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" } } },