diff --git a/NewHorizons/Components/ShipLog/ShipLogStarChartMode.cs b/NewHorizons/Components/ShipLog/ShipLogStarChartMode.cs index f7788542..03510628 100644 --- a/NewHorizons/Components/ShipLog/ShipLogStarChartMode.cs +++ b/NewHorizons/Components/ShipLog/ShipLogStarChartMode.cs @@ -2,6 +2,7 @@ using NewHorizons.Handlers; using NewHorizons.Utility; using System; using System.Collections.Generic; +using System.IO; using System.Linq; using UnityEngine; using UnityEngine.UI; @@ -131,7 +132,7 @@ namespace NewHorizons.Components.ShipLog } else { - var path = $"planets/{uniqueID}.png"; + var path = Path.Combine("planets", uniqueID + ".png"); Logger.LogVerbose($"ShipLogStarChartManager - Trying to load {path}"); texture = ImageUtilities.GetTexture(Main.SystemDict[uniqueID].Mod, path); } diff --git a/NewHorizons/External/NewHorizonsData.cs b/NewHorizons/External/NewHorizonsData.cs index 52a8cbf1..2a2c8c5d 100644 --- a/NewHorizons/External/NewHorizonsData.cs +++ b/NewHorizons/External/NewHorizonsData.cs @@ -25,7 +25,7 @@ namespace NewHorizons.External try { - _saveFile = Main.Instance.ModHelper.Storage.Load(FileName); + _saveFile = Main.Instance.ModHelper.Storage.Load(FileName, false); if (!_saveFile.Profiles.ContainsKey(_activeProfileName)) _saveFile.Profiles.Add(_activeProfileName, new NewHorizonsProfile()); _activeProfile = _saveFile.Profiles[_activeProfileName]; diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index dc72b08d..4f74a553 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -582,7 +582,7 @@ namespace NewHorizons Logger.LogVerbose($"Loading system {name}"); var relativePath = file.Replace(folder, ""); - var starSystemConfig = mod.ModHelper.Storage.Load(relativePath); + var starSystemConfig = mod.ModHelper.Storage.Load(relativePath, false); starSystemConfig.Migrate(); starSystemConfig.FixCoordinates(); @@ -656,7 +656,7 @@ namespace NewHorizons { Logger.LogVerbose($"Loading addon manifest for {mod.ModHelper.Manifest.Name}"); - var addonConfig = mod.ModHelper.Storage.Load(file); + var addonConfig = mod.ModHelper.Storage.Load(file, false); if (addonConfig.achievements != null) { @@ -706,7 +706,7 @@ namespace NewHorizons NewHorizonsBody body = null; try { - var config = mod.ModHelper.Storage.Load(relativePath); + var config = mod.ModHelper.Storage.Load(relativePath, false); if (config == null) { Logger.LogError($"Couldn't load {relativePath}. Is your Json formatted correctly?"); @@ -719,7 +719,7 @@ namespace NewHorizons if (!SystemDict.ContainsKey(config.starSystem)) { // Since we didn't load it earlier there shouldn't be a star system config - var starSystemConfig = mod.ModHelper.Storage.Load($"systems/{config.starSystem}.json"); + var starSystemConfig = mod.ModHelper.Storage.Load(Path.Combine("systems", config.starSystem + ".json"), false); if (starSystemConfig == null) starSystemConfig = new StarSystemConfig(); else Logger.LogWarning($"Loaded system config for {config.starSystem}. Why wasn't this loaded earlier?"); diff --git a/NewHorizons/Patches/ShipLogPatches.cs b/NewHorizons/Patches/ShipLogPatches.cs index 6f45cd2f..8fe329c1 100644 --- a/NewHorizons/Patches/ShipLogPatches.cs +++ b/NewHorizons/Patches/ShipLogPatches.cs @@ -97,7 +97,7 @@ namespace NewHorizons.Patches { foreach (KeyValuePair keyValuePair in __instance._factDict) { - if (ShipLogHandler.IsVanillaAstroID(__instance.GetEntry(keyValuePair.Value.GetEntryID()).GetAstroObjectID()) && !keyValuePair.Value.IsRumor() && !keyValuePair.Value.IsRevealed() && !keyValuePair.Key.Equals("TH_VILLAGE_X3") && !keyValuePair.Key.Equals("GD_GABBRO_ISLAND_X1") && __instance.GetEntry(keyValuePair.Value.GetEntryID()).GetCuriosityName() != CuriosityName.InvisiblePlanet) + if (!ShipLogHandler.IsModdedFact(keyValuePair.Key) && !keyValuePair.Value.IsRumor() && !keyValuePair.Value.IsRevealed() && !keyValuePair.Key.Equals("TH_VILLAGE_X3") && !keyValuePair.Key.Equals("GD_GABBRO_ISLAND_X1") && __instance.GetEntry(keyValuePair.Value.GetEntryID()).GetCuriosityName() != CuriosityName.InvisiblePlanet) { return false; } diff --git a/NewHorizons/Utility/DebugUtilities/DebugRaycastData.cs b/NewHorizons/Utility/DebugUtilities/DebugRaycastData.cs index e222a14a..5128bd35 100644 --- a/NewHorizons/Utility/DebugUtilities/DebugRaycastData.cs +++ b/NewHorizons/Utility/DebugUtilities/DebugRaycastData.cs @@ -14,7 +14,7 @@ namespace NewHorizons.Utility.DebugUtilities public Vector3 norm; public DebugRaycastPlane plane; - public string bodyName; + public string colliderPath; public string bodyPath; public GameObject hitBodyGameObject; public GameObject hitObject; diff --git a/NewHorizons/Utility/DebugUtilities/DebugRaycaster.cs b/NewHorizons/Utility/DebugUtilities/DebugRaycaster.cs index 6f4e23fa..31c388c2 100644 --- a/NewHorizons/Utility/DebugUtilities/DebugRaycaster.cs +++ b/NewHorizons/Utility/DebugUtilities/DebugRaycaster.cs @@ -104,7 +104,8 @@ namespace NewHorizons.Utility.DebugUtilities _planeDownLeftSphere .transform.localPosition = data.plane.origin + data.plane.u*-1*planeSize + data.plane.v*-1*planeSize; _planeDownRightSphere.transform.localPosition = data.plane.origin + data.plane.u*1*planeSize + data.plane.v*-1*planeSize; - Logger.Log($"Raycast hit \"position\": {posText}, \"normal\": {normText} on [{data.bodyName}] at [{data.bodyPath}]"); + Logger.Log($"Raycast hit \"position\": {posText}, \"normal\": {normText} on collider [{data.colliderPath}] " + + (data.bodyPath != null? $"at rigidbody [{data.bodyPath}]" : "not attached to a rigidbody")); } internal DebugRaycastData Raycast() { @@ -124,8 +125,8 @@ namespace NewHorizons.Utility.DebugUtilities var hitAstroObject = o.GetComponent() ?? o.GetComponentInParent(); - data.bodyName = o.name; - data.bodyPath = o.transform.GetPath(); + data.colliderPath = hitInfo.collider.transform.GetPath(); + data.bodyPath = hitInfo.rigidbody?.transform.GetPath(); data.hitObject = o; data.hitBodyGameObject = hitAstroObject?.gameObject ?? o; data.plane = ConstructPlane(data);