This commit is contained in:
Nick 2022-10-20 21:18:56 -04:00
commit d1964098a8
6 changed files with 13 additions and 11 deletions

View File

@ -2,6 +2,7 @@ using NewHorizons.Handlers;
using NewHorizons.Utility; using NewHorizons.Utility;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
using UnityEngine.UI; using UnityEngine.UI;
@ -131,7 +132,7 @@ namespace NewHorizons.Components.ShipLog
} }
else else
{ {
var path = $"planets/{uniqueID}.png"; var path = Path.Combine("planets", uniqueID + ".png");
Logger.LogVerbose($"ShipLogStarChartManager - Trying to load {path}"); Logger.LogVerbose($"ShipLogStarChartManager - Trying to load {path}");
texture = ImageUtilities.GetTexture(Main.SystemDict[uniqueID].Mod, path); texture = ImageUtilities.GetTexture(Main.SystemDict[uniqueID].Mod, path);
} }

View File

@ -25,7 +25,7 @@ namespace NewHorizons.External
try try
{ {
_saveFile = Main.Instance.ModHelper.Storage.Load<NewHorizonsSaveFile>(FileName); _saveFile = Main.Instance.ModHelper.Storage.Load<NewHorizonsSaveFile>(FileName, false);
if (!_saveFile.Profiles.ContainsKey(_activeProfileName)) if (!_saveFile.Profiles.ContainsKey(_activeProfileName))
_saveFile.Profiles.Add(_activeProfileName, new NewHorizonsProfile()); _saveFile.Profiles.Add(_activeProfileName, new NewHorizonsProfile());
_activeProfile = _saveFile.Profiles[_activeProfileName]; _activeProfile = _saveFile.Profiles[_activeProfileName];

View File

@ -582,7 +582,7 @@ namespace NewHorizons
Logger.LogVerbose($"Loading system {name}"); Logger.LogVerbose($"Loading system {name}");
var relativePath = file.Replace(folder, ""); var relativePath = file.Replace(folder, "");
var starSystemConfig = mod.ModHelper.Storage.Load<StarSystemConfig>(relativePath); var starSystemConfig = mod.ModHelper.Storage.Load<StarSystemConfig>(relativePath, false);
starSystemConfig.Migrate(); starSystemConfig.Migrate();
starSystemConfig.FixCoordinates(); starSystemConfig.FixCoordinates();
@ -656,7 +656,7 @@ namespace NewHorizons
{ {
Logger.LogVerbose($"Loading addon manifest for {mod.ModHelper.Manifest.Name}"); Logger.LogVerbose($"Loading addon manifest for {mod.ModHelper.Manifest.Name}");
var addonConfig = mod.ModHelper.Storage.Load<AddonConfig>(file); var addonConfig = mod.ModHelper.Storage.Load<AddonConfig>(file, false);
if (addonConfig.achievements != null) if (addonConfig.achievements != null)
{ {
@ -706,7 +706,7 @@ namespace NewHorizons
NewHorizonsBody body = null; NewHorizonsBody body = null;
try try
{ {
var config = mod.ModHelper.Storage.Load<PlanetConfig>(relativePath); var config = mod.ModHelper.Storage.Load<PlanetConfig>(relativePath, false);
if (config == null) if (config == null)
{ {
Logger.LogError($"Couldn't load {relativePath}. Is your Json formatted correctly?"); Logger.LogError($"Couldn't load {relativePath}. Is your Json formatted correctly?");
@ -719,7 +719,7 @@ namespace NewHorizons
if (!SystemDict.ContainsKey(config.starSystem)) if (!SystemDict.ContainsKey(config.starSystem))
{ {
// Since we didn't load it earlier there shouldn't be a star system config // Since we didn't load it earlier there shouldn't be a star system config
var starSystemConfig = mod.ModHelper.Storage.Load<StarSystemConfig>($"systems/{config.starSystem}.json"); var starSystemConfig = mod.ModHelper.Storage.Load<StarSystemConfig>(Path.Combine("systems", config.starSystem + ".json"), false);
if (starSystemConfig == null) starSystemConfig = new StarSystemConfig(); if (starSystemConfig == null) starSystemConfig = new StarSystemConfig();
else Logger.LogWarning($"Loaded system config for {config.starSystem}. Why wasn't this loaded earlier?"); else Logger.LogWarning($"Loaded system config for {config.starSystem}. Why wasn't this loaded earlier?");

View File

@ -97,7 +97,7 @@ namespace NewHorizons.Patches
{ {
foreach (KeyValuePair<string, ShipLogFact> keyValuePair in __instance._factDict) foreach (KeyValuePair<string, ShipLogFact> 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; return false;
} }

View File

@ -14,7 +14,7 @@ namespace NewHorizons.Utility.DebugUtilities
public Vector3 norm; public Vector3 norm;
public DebugRaycastPlane plane; public DebugRaycastPlane plane;
public string bodyName; public string colliderPath;
public string bodyPath; public string bodyPath;
public GameObject hitBodyGameObject; public GameObject hitBodyGameObject;
public GameObject hitObject; public GameObject hitObject;

View File

@ -104,7 +104,8 @@ namespace NewHorizons.Utility.DebugUtilities
_planeDownLeftSphere .transform.localPosition = data.plane.origin + data.plane.u*-1*planeSize + data.plane.v*-1*planeSize; _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; _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() internal DebugRaycastData Raycast()
{ {
@ -124,8 +125,8 @@ namespace NewHorizons.Utility.DebugUtilities
var hitAstroObject = o.GetComponent<AstroObject>() ?? o.GetComponentInParent<AstroObject>(); var hitAstroObject = o.GetComponent<AstroObject>() ?? o.GetComponentInParent<AstroObject>();
data.bodyName = o.name; data.colliderPath = hitInfo.collider.transform.GetPath();
data.bodyPath = o.transform.GetPath(); data.bodyPath = hitInfo.rigidbody?.transform.GetPath();
data.hitObject = o; data.hitObject = o;
data.hitBodyGameObject = hitAstroObject?.gameObject ?? o; data.hitBodyGameObject = hitAstroObject?.gameObject ?? o;
data.plane = ConstructPlane(data); data.plane = ConstructPlane(data);