diff --git a/NewHorizons/Builder/Atmosphere/AirBuilder.cs b/NewHorizons/Builder/Atmosphere/AirBuilder.cs index b7a3bd3e..33912f0a 100644 --- a/NewHorizons/Builder/Atmosphere/AirBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/AirBuilder.cs @@ -1,5 +1,5 @@ using NewHorizons.External.Configs; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; using UnityEngine; namespace NewHorizons.Builder.Atmosphere { diff --git a/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs b/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs index d7dde4c8..7ddbe7d5 100644 --- a/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/CloudsBuilder.cs @@ -1,13 +1,14 @@ -using NewHorizons.External.Modules; using NewHorizons.Components; +using NewHorizons.External.Modules; using NewHorizons.Utility; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OuterWilds; +using NewHorizons.Utility.OWML; using OWML.Common; using System; -using UnityEngine; -using Logger = NewHorizons.Utility.Logger; using System.Collections.Generic; using Tessellation; -using NewHorizons.Utility.OWUtilities; +using UnityEngine; namespace NewHorizons.Builder.Atmosphere { @@ -206,7 +207,7 @@ namespace NewHorizons.Builder.Atmosphere } catch (Exception e) { - Logger.LogError($"Couldn't load Cloud textures for [{atmo.clouds.texturePath}]:\n{e}"); + NHLogger.LogError($"Couldn't load Cloud textures for [{atmo.clouds.texturePath}]:\n{e}"); return null; } @@ -282,7 +283,7 @@ namespace NewHorizons.Builder.Atmosphere } catch (Exception e) { - Logger.LogError($"Couldn't load Cloud texture for [{atmo.clouds.texturePath}]:\n{e}"); + NHLogger.LogError($"Couldn't load Cloud texture for [{atmo.clouds.texturePath}]:\n{e}"); return null; } diff --git a/NewHorizons/Builder/Atmosphere/FogBuilder.cs b/NewHorizons/Builder/Atmosphere/FogBuilder.cs index 74718229..c453dfea 100644 --- a/NewHorizons/Builder/Atmosphere/FogBuilder.cs +++ b/NewHorizons/Builder/Atmosphere/FogBuilder.cs @@ -1,5 +1,6 @@ using NewHorizons.External.Modules; using NewHorizons.Utility; +using NewHorizons.Utility.Files; using UnityEngine; namespace NewHorizons.Builder.Atmosphere { diff --git a/NewHorizons/Builder/Body/AsteroidBeltBuilder.cs b/NewHorizons/Builder/Body/AsteroidBeltBuilder.cs index 7aad5af9..6ed7aa8f 100644 --- a/NewHorizons/Builder/Body/AsteroidBeltBuilder.cs +++ b/NewHorizons/Builder/Body/AsteroidBeltBuilder.cs @@ -1,11 +1,13 @@ +using NewHorizons.External; using NewHorizons.External.Configs; using NewHorizons.External.Modules; +using NewHorizons.External.Modules.SerializableData; using NewHorizons.Handlers; -using NewHorizons.Utility; +using NewHorizons.Utility.OWML; using OWML.Common; using UnityEngine; using Random = UnityEngine.Random; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Builder.Body { public static class AsteroidBeltBuilder @@ -20,7 +22,7 @@ namespace NewHorizons.Builder.Body if (belt.amount >= 0) count = belt.amount; if (count > 200) count = 200; - Logger.Log($"Generating {count} asteroid belt around {bodyName}"); + NHLogger.Log($"Generating {count} asteroid belt around {bodyName}"); Random.InitState(belt.randomSeed); diff --git a/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs b/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs index e278bedd..3ad3473b 100644 --- a/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs +++ b/NewHorizons/Builder/Body/BrambleDimensionBuilder.cs @@ -1,10 +1,11 @@ using NewHorizons.Builder.Props; using NewHorizons.Components; using NewHorizons.Components.Orbital; +using NewHorizons.External; using NewHorizons.External.Modules; using NewHorizons.External.Modules.Props; using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; +using NewHorizons.Utility.OWML; using System.Collections.Generic; using System.Linq; using UnityEngine; diff --git a/NewHorizons/Builder/Body/CloakBuilder.cs b/NewHorizons/Builder/Body/CloakBuilder.cs index 33804959..dd1ece55 100644 --- a/NewHorizons/Builder/Body/CloakBuilder.cs +++ b/NewHorizons/Builder/Body/CloakBuilder.cs @@ -1,10 +1,11 @@ using NewHorizons.Components; using NewHorizons.External.Modules; using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OWML; using OWML.Common; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Builder.Body { @@ -19,7 +20,7 @@ namespace NewHorizons.Builder.Body _prefab = SearchUtilities.Find("RingWorld_Body/CloakingField_IP")?.InstantiateInactive()?.Rename("CloakingField")?.DontDestroyOnLoad(); if (_prefab == null) { - Logger.LogWarning($"Tried to make a cloak but couldn't. Do you have the DLC installed?"); + NHLogger.LogWarning($"Tried to make a cloak but couldn't. Do you have the DLC installed?"); return; } else diff --git a/NewHorizons/Builder/Body/FunnelBuilder.cs b/NewHorizons/Builder/Body/FunnelBuilder.cs index fc31d4a3..a9311a72 100644 --- a/NewHorizons/Builder/Body/FunnelBuilder.cs +++ b/NewHorizons/Builder/Body/FunnelBuilder.cs @@ -1,10 +1,10 @@ using NewHorizons.Utility; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + using NewHorizons.External.Modules.VariableSize; using NewHorizons.Components.Orbital; -using NewHorizons.Utility.OWMLUtilities; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OWML; +using NewHorizons.Utility.OuterWilds; using NewHorizons.Components.SizeControllers; namespace NewHorizons.Builder.Body @@ -200,8 +200,8 @@ namespace NewHorizons.Builder.Body var target = targetAO?.GetAttachedOWRigidbody(); if (target == null) { - if (targetAO != null) Logger.LogError($"Found funnel target ({targetAO.name}) but couldn't find rigidbody for the funnel {funnelGO.name}"); - else Logger.LogError($"Couldn't find the target ({module.target}) for the funnel {funnelGO.name}"); + if (targetAO != null) NHLogger.LogError($"Found funnel target ({targetAO.name}) but couldn't find rigidbody for the funnel {funnelGO.name}"); + else NHLogger.LogError($"Couldn't find the target ({module.target}) for the funnel {funnelGO.name}"); return; } diff --git a/NewHorizons/Builder/Body/HeightMapBuilder.cs b/NewHorizons/Builder/Body/HeightMapBuilder.cs index 4662cb22..835095d2 100644 --- a/NewHorizons/Builder/Body/HeightMapBuilder.cs +++ b/NewHorizons/Builder/Body/HeightMapBuilder.cs @@ -1,11 +1,13 @@ using NewHorizons.Builder.Body.Geometry; using NewHorizons.External.Modules; using NewHorizons.Utility; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OWML; using OWML.Common; using System; using System.IO; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Builder.Body { public static class HeightMapBuilder @@ -23,17 +25,17 @@ namespace NewHorizons.Builder.Body { if (!string.IsNullOrEmpty(module.heightMap) && !File.Exists(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, module.heightMap))) { - Logger.LogError($"Bad path for {planetGO.name} heightMap: {module.heightMap} couldn't be found."); + NHLogger.LogError($"Bad path for {planetGO.name} heightMap: {module.heightMap} couldn't be found."); module.heightMap = null; } if (!string.IsNullOrEmpty(module.textureMap) && !File.Exists(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, module.textureMap))) { - Logger.LogError($"Bad path for {planetGO.name} textureMap: {module.textureMap} couldn't be found."); + NHLogger.LogError($"Bad path for {planetGO.name} textureMap: {module.textureMap} couldn't be found."); module.textureMap = null; } if (!string.IsNullOrEmpty(module.emissionMap) && !File.Exists(Path.Combine(mod.ModHelper.Manifest.ModFolderPath, module.emissionMap))) { - Logger.LogError($"Bad path for {planetGO.name} emissionMap: {module.emissionMap} couldn't be found."); + NHLogger.LogError($"Bad path for {planetGO.name} emissionMap: {module.emissionMap} couldn't be found."); module.emissionMap = null; } @@ -74,7 +76,7 @@ namespace NewHorizons.Builder.Body } catch (Exception e) { - Logger.LogError($"Couldn't load HeightMap textures:\n{e}"); + NHLogger.LogError($"Couldn't load HeightMap textures:\n{e}"); return null; } diff --git a/NewHorizons/Builder/Body/ProxyBuilder.cs b/NewHorizons/Builder/Body/ProxyBuilder.cs index f2a76bce..15e6953e 100644 --- a/NewHorizons/Builder/Body/ProxyBuilder.cs +++ b/NewHorizons/Builder/Body/ProxyBuilder.cs @@ -2,12 +2,13 @@ using NewHorizons.Builder.Atmosphere; using NewHorizons.Builder.Props; using NewHorizons.Components; using NewHorizons.Components.SizeControllers; +using NewHorizons.External; using NewHorizons.External.Modules.VariableSize; using NewHorizons.Handlers; using NewHorizons.Utility; +using NewHorizons.Utility.OWML; using System; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Builder.Body { @@ -61,7 +62,7 @@ namespace NewHorizons.Builder.Body // Add remnants if (remnant != null) { - Logger.LogVerbose($"Making custom remnant proxy"); + NHLogger.LogVerbose($"Making custom remnant proxy"); var remnantGO = new GameObject("Remnant"); remnantGO.transform.parent = proxy.transform; @@ -73,7 +74,7 @@ namespace NewHorizons.Builder.Body } else if (body.Config.Star != null && StellarRemnantBuilder.HasRemnant(body.Config.Star)) { - Logger.LogVerbose($"Making remnant proxy"); + NHLogger.LogVerbose($"Making remnant proxy"); var remnantGO = new GameObject("Remnant"); remnantGO.transform.parent = proxy.transform; @@ -251,7 +252,7 @@ namespace NewHorizons.Builder.Body } catch (Exception ex) { - Logger.LogError($"Exception thrown when generating proxy for [{body.Config.name}]:\n{ex}"); + NHLogger.LogError($"Exception thrown when generating proxy for [{body.Config.name}]:\n{ex}"); return false; } } diff --git a/NewHorizons/Builder/Body/RingBuilder.cs b/NewHorizons/Builder/Body/RingBuilder.cs index 477c78a5..d727e173 100644 --- a/NewHorizons/Builder/Body/RingBuilder.cs +++ b/NewHorizons/Builder/Body/RingBuilder.cs @@ -3,11 +3,12 @@ using NewHorizons.Components.SizeControllers; using NewHorizons.Components.Volumes; using NewHorizons.External.Modules; using NewHorizons.Utility; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OuterWilds; +using NewHorizons.Utility.OWML; using OWML.Common; using System.Collections.Generic; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Builder.Body { @@ -67,7 +68,7 @@ namespace NewHorizons.Builder.Body if (ringTexture == null) { - Logger.LogError($"Couldn't load Ring texture [{ring.texture}]"); + NHLogger.LogError($"Couldn't load Ring texture [{ring.texture}]"); return null; } diff --git a/NewHorizons/Builder/Body/SingularityBuilder.cs b/NewHorizons/Builder/Body/SingularityBuilder.cs index 2a473588..d8f19786 100644 --- a/NewHorizons/Builder/Body/SingularityBuilder.cs +++ b/NewHorizons/Builder/Body/SingularityBuilder.cs @@ -2,14 +2,15 @@ using NewHorizons.External.Configs; using NewHorizons.Utility; using NewHorizons.External.Modules.VariableSize; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + using System.Collections.Generic; using NewHorizons.Components.SizeControllers; using Color = UnityEngine.Color; using NewHorizons.Components.Volumes; using NewHorizons.Builder.Props; -using NewHorizons.Utility.OWMLUtilities; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OWML; +using NewHorizons.Utility.OuterWilds; +using NewHorizons.External.Modules.SerializableData; namespace NewHorizons.Builder.Body { @@ -111,27 +112,27 @@ namespace NewHorizons.Builder.Body var (blackHoleID, whiteHoleID) = pair; if (!_singularitiesByID.TryGetValue(blackHoleID, out GameObject blackHole)) { - Logger.LogWarning($"Black hole [{blackHoleID}] is missing."); + NHLogger.LogWarning($"Black hole [{blackHoleID}] is missing."); break; } if (!_singularitiesByID.TryGetValue(whiteHoleID, out GameObject whiteHole)) { - Logger.LogWarning($"White hole [{whiteHoleID}] is missing."); + NHLogger.LogWarning($"White hole [{whiteHoleID}] is missing."); break; } var whiteHoleVolume = whiteHole.GetComponentInChildren(); var blackHoleVolume = blackHole.GetComponentInChildren(); if (whiteHoleVolume == null || blackHoleVolume == null) { - Logger.LogWarning($"Singularities [{blackHoleID}] and [{whiteHoleID}] do not have compatible polarities."); + NHLogger.LogWarning($"Singularities [{blackHoleID}] and [{whiteHoleID}] do not have compatible polarities."); break; } if (blackHoleVolume._whiteHole != null && blackHoleVolume._whiteHole != whiteHoleVolume) { - Logger.LogWarning($"Black hole [{blackHoleID}] has already been linked!"); + NHLogger.LogWarning($"Black hole [{blackHoleID}] has already been linked!"); break; } - Logger.LogVerbose($"Pairing singularities [{blackHoleID}], [{whiteHoleID}]"); + NHLogger.LogVerbose($"Pairing singularities [{blackHoleID}], [{whiteHoleID}]"); blackHoleVolume._whiteHole = whiteHoleVolume; } } diff --git a/NewHorizons/Builder/Body/StarBuilder.cs b/NewHorizons/Builder/Body/StarBuilder.cs index 5e4dd9a2..9d44cf90 100644 --- a/NewHorizons/Builder/Body/StarBuilder.cs +++ b/NewHorizons/Builder/Body/StarBuilder.cs @@ -5,7 +5,8 @@ using NewHorizons.External.Modules.VariableSize; using OWML.Common; using System.Linq; using NewHorizons.Components.Stars; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; +using NewHorizons.Utility.Files; namespace NewHorizons.Builder.Body { diff --git a/NewHorizons/Builder/Body/StellarRemnantBuilder.cs b/NewHorizons/Builder/Body/StellarRemnantBuilder.cs index f7636b23..b38ebe1e 100644 --- a/NewHorizons/Builder/Body/StellarRemnantBuilder.cs +++ b/NewHorizons/Builder/Body/StellarRemnantBuilder.cs @@ -1,11 +1,13 @@ using NewHorizons.Builder.General; +using NewHorizons.External; +using NewHorizons.External.Modules.SerializableData; using NewHorizons.External.Modules.VariableSize; using NewHorizons.Utility; +using NewHorizons.Utility.OWML; using OWML.Common; using System; using UnityEngine; using Color = UnityEngine.Color; -using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Builder.Body { @@ -21,7 +23,7 @@ namespace NewHorizons.Builder.Body try { - Logger.Log($"Creating stellar remnant for [{star.Config.name}]"); + NHLogger.Log($"Creating stellar remnant for [{star.Config.name}]"); var sector = SectorBuilder.Make(go, rb, soi); sector.name = "StellarRemnant"; @@ -58,7 +60,7 @@ namespace NewHorizons.Builder.Body } catch (Exception ex) { - Logger.LogError($"Couldn't make stellar remnant for [{star.Config.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make stellar remnant for [{star.Config.name}]:\n{ex}"); return null; } } @@ -149,7 +151,7 @@ namespace NewHorizons.Builder.Body case StellarRemnantType.BlackHole: return MakeBlackhole(planet, null, progenitor, proxy); default: - Logger.LogError($"Couldn't make proxy remnant for {planet.name}"); + NHLogger.LogError($"Couldn't make proxy remnant for {planet.name}"); return null; } } diff --git a/NewHorizons/Builder/Body/SupernovaEffectBuilder.cs b/NewHorizons/Builder/Body/SupernovaEffectBuilder.cs index c74273bf..edc92b25 100644 --- a/NewHorizons/Builder/Body/SupernovaEffectBuilder.cs +++ b/NewHorizons/Builder/Body/SupernovaEffectBuilder.cs @@ -4,6 +4,7 @@ using NewHorizons.External.Configs; using NewHorizons.Components; using System.Linq; using OWML.Common; +using NewHorizons.Utility.Files; namespace NewHorizons.Builder.Body { diff --git a/NewHorizons/Builder/Body/WaterBuilder.cs b/NewHorizons/Builder/Body/WaterBuilder.cs index fb0e25ec..97ffc100 100644 --- a/NewHorizons/Builder/Body/WaterBuilder.cs +++ b/NewHorizons/Builder/Body/WaterBuilder.cs @@ -3,8 +3,8 @@ using NewHorizons.Utility; using UnityEngine; using NewHorizons.External.Modules.VariableSize; using Tessellation; -using NewHorizons.Utility.OWMLUtilities; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OWML; +using NewHorizons.Utility.OuterWilds; namespace NewHorizons.Builder.Body { diff --git a/NewHorizons/Builder/General/AmbientLightBuilder.cs b/NewHorizons/Builder/General/AmbientLightBuilder.cs index 5586f26b..a235a7ba 100644 --- a/NewHorizons/Builder/General/AmbientLightBuilder.cs +++ b/NewHorizons/Builder/General/AmbientLightBuilder.cs @@ -1,6 +1,7 @@ using UnityEngine; using NewHorizons.Utility; using NewHorizons.External.Modules; +using NewHorizons.Utility.Files; namespace NewHorizons.Builder.General { diff --git a/NewHorizons/Builder/General/AstroObjectBuilder.cs b/NewHorizons/Builder/General/AstroObjectBuilder.cs index c1120159..a2777a4c 100644 --- a/NewHorizons/Builder/General/AstroObjectBuilder.cs +++ b/NewHorizons/Builder/General/AstroObjectBuilder.cs @@ -1,8 +1,8 @@ using NewHorizons.Components.Orbital; using NewHorizons.External.Configs; -using NewHorizons.Utility.OWMLUtilities; +using NewHorizons.Utility.OWML; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Builder.General { public static class AstroObjectBuilder @@ -54,7 +54,7 @@ namespace NewHorizons.Builder.General if (config.Base.centerOfSolarSystem) { - Logger.Log($"Setting center of universe to {config.name}"); + NHLogger.Log($"Setting center of universe to {config.name}"); Delay.RunWhen( () => Locator._centerOfTheUniverse != null, diff --git a/NewHorizons/Builder/General/DetectorBuilder.cs b/NewHorizons/Builder/General/DetectorBuilder.cs index 3610da32..9da557ec 100644 --- a/NewHorizons/Builder/General/DetectorBuilder.cs +++ b/NewHorizons/Builder/General/DetectorBuilder.cs @@ -1,10 +1,11 @@ using NewHorizons.Components.Orbital; using NewHorizons.External.Configs; using NewHorizons.Utility; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; +using NewHorizons.Utility.OWML; using System.Collections.Generic; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Builder.General { public static class DetectorBuilder @@ -154,7 +155,7 @@ namespace NewHorizons.Builder.General private static void SetBinaryForceDetectableFields(BinaryFocalPoint point, ConstantForceDetector primaryCFD, ConstantForceDetector secondaryCFD) { - Logger.Log($"Setting up binary focal point for {point.name}"); + NHLogger.Log($"Setting up binary focal point for {point.name}"); var primary = point.Primary; var secondary = point.Secondary; @@ -165,7 +166,7 @@ namespace NewHorizons.Builder.General if (primaryGV._falloffType != secondaryGV._falloffType) { - Logger.LogError($"Binaries must have the same gravity falloff! {primaryGV._falloffType} != {secondaryGV._falloffType}"); + NHLogger.LogError($"Binaries must have the same gravity falloff! {primaryGV._falloffType} != {secondaryGV._falloffType}"); return; } diff --git a/NewHorizons/Builder/General/GravityBuilder.cs b/NewHorizons/Builder/General/GravityBuilder.cs index 29ad88ba..2023f78e 100644 --- a/NewHorizons/Builder/General/GravityBuilder.cs +++ b/NewHorizons/Builder/General/GravityBuilder.cs @@ -1,6 +1,6 @@ using NewHorizons.External.Configs; using NewHorizons.External.Modules; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; using UnityEngine; namespace NewHorizons.Builder.General { diff --git a/NewHorizons/Builder/General/GroupsBuilder.cs b/NewHorizons/Builder/General/GroupsBuilder.cs index e37e7eab..b2252f5e 100644 --- a/NewHorizons/Builder/General/GroupsBuilder.cs +++ b/NewHorizons/Builder/General/GroupsBuilder.cs @@ -1,5 +1,5 @@ -using UnityEngine; -using Logger = NewHorizons.Utility.Logger; +using NewHorizons.Utility.OWML; +using UnityEngine; namespace NewHorizons.Builder.General; @@ -13,12 +13,12 @@ public static class GroupsBuilder { if (!sector) { - Logger.LogWarning($"tried to put groups on {go.name} when sector is null"); + NHLogger.LogWarning($"tried to put groups on {go.name} when sector is null"); return; } if (go.activeInHierarchy) { - Logger.LogWarning($"tried to put groups on an active gameobject {go.name}"); + NHLogger.LogWarning($"tried to put groups on an active gameobject {go.name}"); return; } diff --git a/NewHorizons/Builder/General/RFVolumeBuilder.cs b/NewHorizons/Builder/General/RFVolumeBuilder.cs index bfc30385..5b274386 100644 --- a/NewHorizons/Builder/General/RFVolumeBuilder.cs +++ b/NewHorizons/Builder/General/RFVolumeBuilder.cs @@ -1,6 +1,7 @@ using NewHorizons.External.Modules; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; using UnityEngine; + namespace NewHorizons.Builder.General { public static class RFVolumeBuilder diff --git a/NewHorizons/Builder/General/SpawnPointBuilder.cs b/NewHorizons/Builder/General/SpawnPointBuilder.cs index 2a19a206..bac09f22 100644 --- a/NewHorizons/Builder/General/SpawnPointBuilder.cs +++ b/NewHorizons/Builder/General/SpawnPointBuilder.cs @@ -1,12 +1,12 @@ using NewHorizons.Builder.Props; using NewHorizons.External.Modules; using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OWML; +using NewHorizons.Utility.OuterWilds; using System; using System.Reflection; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Builder.General { public static class SpawnPointBuilder @@ -51,7 +51,7 @@ namespace NewHorizons.Builder.General if (Main.Instance.IsWarpingFromShip) { - Logger.LogVerbose("Overriding player spawn to be inside ship"); + NHLogger.LogVerbose("Overriding player spawn to be inside ship"); GameObject playerSpawnGO = new GameObject("PlayerSpawnPoint"); playerSpawnGO.transform.parent = ship.transform; playerSpawnGO.layer = Layer.PlayerSafetyCollider; @@ -71,7 +71,7 @@ namespace NewHorizons.Builder.General Delay.RunWhen(() => Main.IsSystemReady, () => SuitUp()); } - Logger.Log($"Made spawnpoint on [{planetGO.name}]"); + NHLogger.Log($"Made spawnpoint on [{planetGO.name}]"); return playerSpawn; } diff --git a/NewHorizons/Builder/Orbital/FocalPointBuilder.cs b/NewHorizons/Builder/Orbital/FocalPointBuilder.cs index a4d462e7..90aebab3 100644 --- a/NewHorizons/Builder/Orbital/FocalPointBuilder.cs +++ b/NewHorizons/Builder/Orbital/FocalPointBuilder.cs @@ -1,11 +1,12 @@ using NewHorizons.Components.Orbital; +using NewHorizons.External; using NewHorizons.External.Configs; using NewHorizons.External.Modules; -using NewHorizons.Utility; +using NewHorizons.Utility.OWML; using OWML.Common; using System.Linq; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Builder.Orbital { public static class FocalPointBuilder @@ -39,7 +40,7 @@ namespace NewHorizons.Builder.Orbital if (primary == null || secondary == null) { - Logger.LogError($"Couldn't make focal point between [{module.primary} = {primary}] and [{module.secondary} = {secondary}]"); + NHLogger.LogError($"Couldn't make focal point between [{module.primary} = {primary}] and [{module.secondary} = {secondary}]"); return; } } diff --git a/NewHorizons/Builder/Orbital/InitialMotionBuilder.cs b/NewHorizons/Builder/Orbital/InitialMotionBuilder.cs index 188f9129..71fae84a 100644 --- a/NewHorizons/Builder/Orbital/InitialMotionBuilder.cs +++ b/NewHorizons/Builder/Orbital/InitialMotionBuilder.cs @@ -1,8 +1,9 @@ using NewHorizons.Components.Orbital; using NewHorizons.External.Modules; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; +using NewHorizons.Utility.OWML; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Builder.Orbital { public static class InitialMotionBuilder @@ -79,7 +80,7 @@ namespace NewHorizons.Builder.Orbital } else { - Logger.LogError($"No primary gravity or focal point for {primaryBody}"); + NHLogger.LogError($"No primary gravity or focal point for {primaryBody}"); } } @@ -98,7 +99,7 @@ namespace NewHorizons.Builder.Orbital private static void SetBinaryInitialMotion(AstroObject baryCenter, NHAstroObject primaryBody, NHAstroObject secondaryBody) { - Logger.LogVerbose($"Setting binary initial motion [{primaryBody.name}] [{secondaryBody.name}]"); + NHLogger.LogVerbose($"Setting binary initial motion [{primaryBody.name}] [{secondaryBody.name}]"); var primaryGravity = new Gravity(primaryBody._gravityVolume); var secondaryGravity = new Gravity(secondaryBody._gravityVolume); @@ -171,7 +172,7 @@ namespace NewHorizons.Builder.Orbital secondaryInitialMotion._cachedInitVelocity = baryCenterVelocity + secondaryVelocity; secondaryInitialMotion._isInitVelocityDirty = false; - Logger.LogVerbose($"Binary Initial Motion: {m1}, {m2}, {r1}, {r2}, {primaryVelocity}, {secondaryVelocity}"); + NHLogger.LogVerbose($"Binary Initial Motion: {m1}, {m2}, {r1}, {r2}, {primaryVelocity}, {secondaryVelocity}"); } } } diff --git a/NewHorizons/Builder/Orbital/OrbitlineBuilder.cs b/NewHorizons/Builder/Orbital/OrbitlineBuilder.cs index e0fa3a58..0ede52f2 100644 --- a/NewHorizons/Builder/Orbital/OrbitlineBuilder.cs +++ b/NewHorizons/Builder/Orbital/OrbitlineBuilder.cs @@ -1,7 +1,7 @@ using NewHorizons.Components.Orbital; using NewHorizons.External.Configs; using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; +using NewHorizons.Utility.OWML; using UnityEngine; namespace NewHorizons.Builder.Orbital { diff --git a/NewHorizons/Builder/Props/BrambleNodeBuilder.cs b/NewHorizons/Builder/Props/BrambleNodeBuilder.cs index 1c4a4469..4962cc46 100644 --- a/NewHorizons/Builder/Props/BrambleNodeBuilder.cs +++ b/NewHorizons/Builder/Props/BrambleNodeBuilder.cs @@ -2,15 +2,14 @@ using NewHorizons.Builder.Body; using NewHorizons.External.Configs; using NewHorizons.Handlers; using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; +using NewHorizons.Utility.OWML; using OWML.Common; using System.Collections.Generic; using System.Linq; using UnityEngine; using static NewHorizons.External.Modules.BrambleModule; using static NewHorizons.External.Modules.SignalModule; -using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Builder.Props { @@ -56,12 +55,12 @@ namespace NewHorizons.Builder.Props public static void FinishPairingNodesForDimension(string dimensionName, AstroObject dimensionAO = null) { - Logger.LogVerbose($"Pairing missed for {dimensionName}"); + NHLogger.LogVerbose($"Pairing missed for {dimensionName}"); if (!_unpairedNodes.ContainsKey(dimensionName)) return; foreach (var nodeWarpController in _unpairedNodes[dimensionName]) { - Logger.LogVerbose($"Pairing node {nodeWarpController.gameObject.name} links to {dimensionName}"); + NHLogger.LogVerbose($"Pairing node {nodeWarpController.gameObject.name} links to {dimensionName}"); PairEntrance(nodeWarpController, dimensionName, dimensionAO); } @@ -72,7 +71,7 @@ namespace NewHorizons.Builder.Props { if (!_unpairedNodes.ContainsKey(linksTo)) _unpairedNodes[linksTo] = new(); - Logger.LogVerbose($"Recording node {warpVolume.gameObject.name} links to {linksTo}"); + NHLogger.LogVerbose($"Recording node {warpVolume.gameObject.name} links to {linksTo}"); _unpairedNodes[linksTo].Add(warpVolume); } @@ -149,18 +148,18 @@ namespace NewHorizons.Builder.Props // Returns ture or false depending on if it succeeds private static bool PairEntrance(InnerFogWarpVolume nodeWarp, string destinationName, AstroObject dimensionAO = null) { - Logger.LogVerbose($"Pairing node {nodeWarp.gameObject.name} to {destinationName}"); + NHLogger.LogVerbose($"Pairing node {nodeWarp.gameObject.name} to {destinationName}"); var destinationAO = dimensionAO ?? AstroObjectLocator.GetAstroObject(destinationName); if (destinationAO == null) return false; - Logger.LogVerbose($"Found {destinationName} as gameobject {destinationAO.gameObject.name} (was passed in: {dimensionAO != null})"); + NHLogger.LogVerbose($"Found {destinationName} as gameobject {destinationAO.gameObject.name} (was passed in: {dimensionAO != null})"); // link the node's warp volume to the destination's var destination = GetOuterFogWarpVolumeFromAstroObject(destinationAO.gameObject); if (destination == null) return false; - Logger.LogVerbose($"Proceeding with pairing node {nodeWarp.gameObject.name} to {destinationName}. Path to outer fog warp volume: {destination.transform.GetPath()}"); + NHLogger.LogVerbose($"Proceeding with pairing node {nodeWarp.gameObject.name} to {destinationName}. Path to outer fog warp volume: {destination.transform.GetPath()}"); nodeWarp._linkedOuterWarpVolume = destination; destination.RegisterSenderWarp(nodeWarp); diff --git a/NewHorizons/Builder/Props/DetailBuilder.cs b/NewHorizons/Builder/Props/DetailBuilder.cs index eb1a0018..7192715e 100644 --- a/NewHorizons/Builder/Props/DetailBuilder.cs +++ b/NewHorizons/Builder/Props/DetailBuilder.cs @@ -3,14 +3,15 @@ using NewHorizons.Components; using NewHorizons.External.Modules.Props; using NewHorizons.Handlers; using NewHorizons.Utility; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OuterWilds; +using NewHorizons.Utility.OWML; using OWML.Common; using System; using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.SceneManagement; -using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Builder.Props { @@ -70,7 +71,7 @@ namespace NewHorizons.Builder.Props var prefab = SearchUtilities.Find(info.path); if (prefab == null) { - Logger.LogError($"Couldn't find detail {info.path}"); + NHLogger.LogError($"Couldn't find detail {info.path}"); return null; } else @@ -137,7 +138,7 @@ namespace NewHorizons.Builder.Props { if (t.GetComponents().Any(c => c == null)) { - Logger.LogError($"Failed to instantiate component at {t.GetPath()}. This usually means there's a missing script."); + NHLogger.LogError($"Failed to instantiate component at {t.GetPath()}. This usually means there's a missing script."); } } } @@ -163,7 +164,7 @@ namespace NewHorizons.Builder.Props childObj.gameObject.SetActive(false); } - if (flag) Logger.LogWarning($"Couldn't find \"{childPath}\"."); + if (flag) NHLogger.LogWarning($"Couldn't find \"{childPath}\"."); } } @@ -324,7 +325,7 @@ namespace NewHorizons.Builder.Props } catch (Exception e) { - Logger.LogError($"Couldn't update AnglerFish chase speed:\n{e}"); + NHLogger.LogError($"Couldn't update AnglerFish chase speed:\n{e}"); } } @@ -376,7 +377,7 @@ namespace NewHorizons.Builder.Props { var angler = GetComponent(); - Logger.LogVerbose("Fixing anglerfish animation"); + NHLogger.LogVerbose("Fixing anglerfish animation"); // Remove any event reference to its angler if (angler._anglerfishController) diff --git a/NewHorizons/Builder/Props/DialogueBuilder.cs b/NewHorizons/Builder/Props/DialogueBuilder.cs index a2827d1b..03fbc290 100644 --- a/NewHorizons/Builder/Props/DialogueBuilder.cs +++ b/NewHorizons/Builder/Props/DialogueBuilder.cs @@ -2,12 +2,12 @@ using NewHorizons.Components; using NewHorizons.External.Modules.Props.Dialogue; using NewHorizons.Handlers; using NewHorizons.Utility; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; +using NewHorizons.Utility.OWML; using OWML.Common; using System.IO; using System.Xml; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Builder.Props { @@ -132,7 +132,7 @@ namespace NewHorizons.Builder.Props if (character == null) { - Logger.LogError($"Couldn't find child of {go.transform.GetPath()} at {info.pathToAnimController}"); + NHLogger.LogError($"Couldn't find child of {go.transform.GetPath()} at {info.pathToAnimController}"); return; } diff --git a/NewHorizons/Builder/Props/GeneralPropBuilder.cs b/NewHorizons/Builder/Props/GeneralPropBuilder.cs index d80ca245..1ff551a3 100644 --- a/NewHorizons/Builder/Props/GeneralPropBuilder.cs +++ b/NewHorizons/Builder/Props/GeneralPropBuilder.cs @@ -1,8 +1,9 @@ using NewHorizons.External.Modules; +using NewHorizons.External.Modules.SerializableData; using NewHorizons.Utility; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; +using NewHorizons.Utility.OWML; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Builder.Props { @@ -28,7 +29,7 @@ namespace NewHorizons.Builder.Props } else { - Logger.LogError($"Cannot find parent body named {solarSystemInfo.parentBody}"); + NHLogger.LogError($"Cannot find parent body named {solarSystemInfo.parentBody}"); } } @@ -49,7 +50,7 @@ namespace NewHorizons.Builder.Props } else { - Logger.LogError($"Cannot find parent object at path: {planetGO.name}/{parentPath}"); + NHLogger.LogError($"Cannot find parent object at path: {planetGO.name}/{parentPath}"); } } diff --git a/NewHorizons/Builder/Props/GeyserBuilder.cs b/NewHorizons/Builder/Props/GeyserBuilder.cs index 3f19d5b5..8a60e8f7 100644 --- a/NewHorizons/Builder/Props/GeyserBuilder.cs +++ b/NewHorizons/Builder/Props/GeyserBuilder.cs @@ -1,6 +1,6 @@ using NewHorizons.External.Modules.Props; using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; +using NewHorizons.Utility.OWML; using UnityEngine; namespace NewHorizons.Builder.Props diff --git a/NewHorizons/Builder/Props/NomaiTextBuilder.cs b/NewHorizons/Builder/Props/NomaiTextBuilder.cs index 812c2e5d..193acf96 100644 --- a/NewHorizons/Builder/Props/NomaiTextBuilder.cs +++ b/NewHorizons/Builder/Props/NomaiTextBuilder.cs @@ -2,7 +2,7 @@ using NewHorizons.External.Modules.Props; using NewHorizons.External.Modules.TranslatorText; using NewHorizons.Handlers; using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; +using NewHorizons.Utility.OWML; using OWML.Common; using OWML.Utils; using System; @@ -11,7 +11,7 @@ using System.IO; using System.Linq; using System.Xml; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + using Random = UnityEngine.Random; namespace NewHorizons.Builder.Props @@ -45,7 +45,7 @@ namespace NewHorizons.Builder.Props public static GameObject GetSpawnedGameObjectByNomaiTextInfo(NomaiTextInfo convo) { - Logger.LogVerbose("Retrieving wall text obj for " + convo); + NHLogger.LogVerbose("Retrieving wall text obj for " + convo); if (!conversationInfoToCorrespondingSpawnedGameObject.ContainsKey(convo)) return null; return conversationInfoToCorrespondingSpawnedGameObject[convo]; } @@ -172,7 +172,7 @@ namespace NewHorizons.Builder.Props } else { - Logger.LogError($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}"); + NHLogger.LogError($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}"); } } @@ -268,7 +268,7 @@ namespace NewHorizons.Builder.Props } else { - Logger.LogError($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}"); + NHLogger.LogError($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}"); } } @@ -293,7 +293,7 @@ namespace NewHorizons.Builder.Props () => Main.IsSystemReady, () => { - Logger.LogVerbose("Fixing scroll!"); + NHLogger.LogVerbose("Fixing scroll!"); scrollItem._nomaiWallText = nomaiWallText; scrollItem.SetSector(sector); customScroll.transform.Find("Props_NOM_Scroll/Props_NOM_Scroll_Geo").GetComponent().enabled = true; @@ -330,7 +330,7 @@ namespace NewHorizons.Builder.Props } else { - Logger.LogError($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}"); + NHLogger.LogError($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}"); } } @@ -427,7 +427,7 @@ namespace NewHorizons.Builder.Props } else { - Logger.LogError($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}"); + NHLogger.LogError($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}"); } } @@ -529,7 +529,7 @@ namespace NewHorizons.Builder.Props } else { - Logger.LogError($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}"); + NHLogger.LogError($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}"); } } @@ -572,7 +572,7 @@ namespace NewHorizons.Builder.Props return trailmarkerObject; } default: - Logger.LogError($"Unsupported NomaiText type {info.type}"); + NHLogger.LogError($"Unsupported NomaiText type {info.type}"); return null; } } @@ -632,7 +632,7 @@ namespace NewHorizons.Builder.Props if (info.arcInfo != null && info.arcInfo.Count() != dict.Values.Count()) { - Logger.LogError($"Can't make NomaiWallText, arcInfo length [{info.arcInfo.Count()}] doesn't equal text entries [{dict.Values.Count()}]"); + NHLogger.LogError($"Can't make NomaiWallText, arcInfo length [{info.arcInfo.Count()}] doesn't equal text entries [{dict.Values.Count()}]"); return; } @@ -743,13 +743,13 @@ namespace NewHorizons.Builder.Props if (entryIDNode != null && !int.TryParse(entryIDNode.InnerText, out textEntryID)) { - Logger.LogError($"Couldn't parse int ID in [{entryIDNode?.InnerText}] for [{xmlPath}]"); + NHLogger.LogError($"Couldn't parse int ID in [{entryIDNode?.InnerText}] for [{xmlPath}]"); textEntryID = -1; } if (parentIDNode != null && !int.TryParse(parentIDNode.InnerText, out parentID)) { - Logger.LogError($"Couldn't parse int ParentID in [{parentIDNode?.InnerText}] for [{xmlPath}]"); + NHLogger.LogError($"Couldn't parse int ParentID in [{parentIDNode?.InnerText}] for [{xmlPath}]"); parentID = -1; } diff --git a/NewHorizons/Builder/Props/ProjectionBuilder.cs b/NewHorizons/Builder/Props/ProjectionBuilder.cs index 7900a346..cbc10091 100644 --- a/NewHorizons/Builder/Props/ProjectionBuilder.cs +++ b/NewHorizons/Builder/Props/ProjectionBuilder.cs @@ -2,13 +2,14 @@ using NewHorizons.External.Modules.Props; using NewHorizons.External.Modules.Props.EchoesOfTheEye; using NewHorizons.Handlers; using NewHorizons.Utility; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OWML; using OWML.Common; using System; using System.Collections.Generic; using System.IO; using System.Threading; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Builder.Props { @@ -32,7 +33,7 @@ namespace NewHorizons.Builder.Props { _slideReelPrefab = SearchUtilities.Find("RingWorld_Body/Sector_RingInterior/Sector_Zone1/Sector_SlideBurningRoom_Zone1/Interactables_SlideBurningRoom_Zone1/Prefab_IP_SecretAlcove/RotationPivot/SlideReelSocket/Prefab_IP_Reel_1_LibraryPath")?.gameObject?.InstantiateInactive()?.Rename("Prefab_IP_Reel")?.DontDestroyOnLoad(); if (_slideReelPrefab == null) - Logger.LogWarning($"Tried to make slide reel prefab but couldn't. Do you have the DLC installed?"); + NHLogger.LogWarning($"Tried to make slide reel prefab but couldn't. Do you have the DLC installed?"); else _slideReelPrefab.AddComponent()._destroyOnDLCNotOwned = true; } @@ -41,7 +42,7 @@ namespace NewHorizons.Builder.Props { _autoPrefab = SearchUtilities.Find("RingWorld_Body/Sector_RingInterior/Sector_Zone4/Sector_BlightedShore/Sector_JammingControlRoom_Zone4/Interactables_JammingControlRoom_Zone4/AutoProjector_SignalJammer/Prefab_IP_AutoProjector_SignalJammer")?.gameObject?.InstantiateInactive()?.Rename("Prefab_IP_AutoProjector")?.DontDestroyOnLoad(); if (_autoPrefab == null) - Logger.LogWarning($"Tried to make auto projector prefab but couldn't. Do you have the DLC installed?"); + NHLogger.LogWarning($"Tried to make auto projector prefab but couldn't. Do you have the DLC installed?"); else _autoPrefab.AddComponent()._destroyOnDLCNotOwned = true; } @@ -50,7 +51,7 @@ namespace NewHorizons.Builder.Props { _visionTorchDetectorPrefab = SearchUtilities.Find("DreamWorld_Body/Sector_DreamWorld/Sector_Underground/Sector_PrisonCell/Ghosts_PrisonCell/GhostDirector_Prisoner/Prefab_IP_GhostBird_Prisoner/Ghostbird_IP_ANIM/Ghostbird_Skin_01:Ghostbird_Rig_V01:Base/Ghostbird_Skin_01:Ghostbird_Rig_V01:Root/Ghostbird_Skin_01:Ghostbird_Rig_V01:Spine01/Ghostbird_Skin_01:Ghostbird_Rig_V01:Spine02/Ghostbird_Skin_01:Ghostbird_Rig_V01:Spine03/Ghostbird_Skin_01:Ghostbird_Rig_V01:Spine04/Ghostbird_Skin_01:Ghostbird_Rig_V01:Neck01/Ghostbird_Skin_01:Ghostbird_Rig_V01:Neck02/Ghostbird_Skin_01:Ghostbird_Rig_V01:Head/PrisonerHeadDetector")?.gameObject?.InstantiateInactive()?.Rename("Prefab_IP_VisionTorchDetector")?.DontDestroyOnLoad(); if (_visionTorchDetectorPrefab == null) - Logger.LogWarning($"Tried to make vision torch detector prefab but couldn't. Do you have the DLC installed?"); + NHLogger.LogWarning($"Tried to make vision torch detector prefab but couldn't. Do you have the DLC installed?"); else _visionTorchDetectorPrefab.AddComponent()._destroyOnDLCNotOwned = true; } @@ -59,7 +60,7 @@ namespace NewHorizons.Builder.Props { _standingVisionTorchPrefab = SearchUtilities.Find("RingWorld_Body/Sector_RingWorld/Sector_SecretEntrance/Interactibles_SecretEntrance/Experiment_1/VisionTorchApparatus/VisionTorchRoot/Prefab_IP_VisionTorchProjector")?.gameObject?.InstantiateInactive()?.Rename("Prefab_IP_VisionTorchProjector")?.DontDestroyOnLoad(); if (_standingVisionTorchPrefab == null) - Logger.LogWarning($"Tried to make standing vision torch prefab but couldn't. Do you have the DLC installed?"); + NHLogger.LogWarning($"Tried to make standing vision torch prefab but couldn't. Do you have the DLC installed?"); else _standingVisionTorchPrefab.AddComponent()._destroyOnDLCNotOwned = true; } @@ -82,7 +83,7 @@ namespace NewHorizons.Builder.Props MakeStandingVisionTorch(go, sector, info, mod); break; default: - Logger.LogError($"Invalid projection type {info.type}"); + NHLogger.LogError($"Invalid projection type {info.type}"); break; } } @@ -206,7 +207,7 @@ namespace NewHorizons.Builder.Props if (g == null) { - Logger.LogWarning($"Tried to make a vision torch target but couldn't. Do you have the DLC installed?"); + NHLogger.LogWarning($"Tried to make a vision torch target but couldn't. Do you have the DLC installed?"); return null; } @@ -243,7 +244,7 @@ namespace NewHorizons.Builder.Props if (standingTorch == null) { - Logger.LogWarning($"Tried to make a vision torch target but couldn't. Do you have the DLC installed?"); + NHLogger.LogWarning($"Tried to make a vision torch target but couldn't. Do you have the DLC installed?"); return null; } diff --git a/NewHorizons/Builder/Props/PropBuildManager.cs b/NewHorizons/Builder/Props/PropBuildManager.cs index 090c2ace..5c00d553 100644 --- a/NewHorizons/Builder/Props/PropBuildManager.cs +++ b/NewHorizons/Builder/Props/PropBuildManager.cs @@ -1,13 +1,14 @@ using NewHorizons.Builder.Body; using NewHorizons.Builder.Props.TranslatorText; using NewHorizons.Builder.ShipLog; +using NewHorizons.External; using NewHorizons.External.Configs; -using NewHorizons.Utility; +using NewHorizons.Utility.OWML; using OWML.Common; using System; using System.Collections.Generic; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Builder.Props { public static class PropBuildManager @@ -25,7 +26,7 @@ namespace NewHorizons.Builder.Props } catch (Exception ex) { - Logger.LogError($"Couldn't make planet scatter for [{go.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make planet scatter for [{go.name}]:\n{ex}"); } } if (config.Props.details != null) @@ -38,7 +39,7 @@ namespace NewHorizons.Builder.Props } catch (Exception ex) { - Logger.LogError($"Couldn't make planet detail [{detail.path}] for [{go.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make planet detail [{detail.path}] for [{go.name}]:\n{ex}"); } } } @@ -52,7 +53,7 @@ namespace NewHorizons.Builder.Props } catch (Exception ex) { - Logger.LogError($"Couldn't make geyser for [{go.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make geyser for [{go.name}]:\n{ex}"); } } } @@ -66,7 +67,7 @@ namespace NewHorizons.Builder.Props } catch (Exception ex) { - Logger.LogError($"Couldn't make raft for [{go.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make raft for [{go.name}]:\n{ex}"); } } } @@ -80,7 +81,7 @@ namespace NewHorizons.Builder.Props } catch (Exception ex) { - Logger.LogError($"Couldn't make tornado for [{go.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make tornado for [{go.name}]:\n{ex}"); } } } @@ -94,7 +95,7 @@ namespace NewHorizons.Builder.Props } catch (Exception ex) { - Logger.LogError($"Couldn't make volcano for [{go.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make volcano for [{go.name}]:\n{ex}"); } } } @@ -109,7 +110,7 @@ namespace NewHorizons.Builder.Props } catch (Exception ex) { - Logger.LogError($"Couldn't make dialogue [{dialogueInfo.xmlFile}] for [{go.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make dialogue [{dialogueInfo.xmlFile}] for [{go.name}]:\n{ex}"); } } } @@ -123,7 +124,7 @@ namespace NewHorizons.Builder.Props } catch (Exception ex) { - Logger.LogError($"Couldn't make entry location [{entryLocationInfo.id}] for [{go.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make entry location [{entryLocationInfo.id}] for [{go.name}]:\n{ex}"); } } } @@ -139,7 +140,7 @@ namespace NewHorizons.Builder.Props } catch (Exception ex) { - Logger.LogError($"Couldn't make text [{nomaiTextInfo.xmlFile}] for [{go.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make text [{nomaiTextInfo.xmlFile}] for [{go.name}]:\n{ex}"); } } @@ -155,7 +156,7 @@ namespace NewHorizons.Builder.Props } catch (Exception ex) { - Logger.LogError($"Couldn't make text [{nomaiTextInfo.xmlFile}] for [{go.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make text [{nomaiTextInfo.xmlFile}] for [{go.name}]:\n{ex}"); } } @@ -170,7 +171,7 @@ namespace NewHorizons.Builder.Props } catch (Exception ex) { - Logger.LogError($"Couldn't make slide reel for [{go.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make slide reel for [{go.name}]:\n{ex}"); } } } @@ -197,7 +198,7 @@ namespace NewHorizons.Builder.Props } catch (Exception ex) { - Logger.LogError($"Couldn't make quantum group \"{quantumGroup.id}\" for [{go.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make quantum group \"{quantumGroup.id}\" for [{go.name}]:\n{ex}"); } } } @@ -211,7 +212,7 @@ namespace NewHorizons.Builder.Props } catch (Exception ex) { - Logger.LogError($"Couldn't make singularity \"{(string.IsNullOrEmpty(singularity.uniqueID) ? config.name : singularity.uniqueID)}\" for [{go.name}]::\n{ex}"); + NHLogger.LogError($"Couldn't make singularity \"{(string.IsNullOrEmpty(singularity.uniqueID) ? config.name : singularity.uniqueID)}\" for [{go.name}]::\n{ex}"); } } } @@ -232,7 +233,7 @@ namespace NewHorizons.Builder.Props } catch (Exception ex) { - Logger.LogError($"Couldn't make remote [{remoteInfo.id}] for [{go.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make remote [{remoteInfo.id}] for [{go.name}]:\n{ex}"); } } } @@ -246,7 +247,7 @@ namespace NewHorizons.Builder.Props } catch (Exception ex) { - Logger.LogError($"Couldn't make warp receiver [{warpReceiver.frequency}] for [{go.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make warp receiver [{warpReceiver.frequency}] for [{go.name}]:\n{ex}"); } } } @@ -260,7 +261,7 @@ namespace NewHorizons.Builder.Props } catch (Exception ex) { - Logger.LogError($"Couldn't make warp transmitter [{warpTransmitter.frequency}] for [{go.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make warp transmitter [{warpTransmitter.frequency}] for [{go.name}]:\n{ex}"); } } } diff --git a/NewHorizons/Builder/Props/QuantumBuilder.cs b/NewHorizons/Builder/Props/QuantumBuilder.cs index 6d2dd77c..a2011a99 100644 --- a/NewHorizons/Builder/Props/QuantumBuilder.cs +++ b/NewHorizons/Builder/Props/QuantumBuilder.cs @@ -2,12 +2,12 @@ using NewHorizons.Components.Quantum; using NewHorizons.External.Configs; using NewHorizons.External.Modules.Props.Quantum; using NewHorizons.Utility.Geometry; +using NewHorizons.Utility.OWML; using OWML.Common; using System.Collections.Generic; using System.Linq; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; // BUGS THAT REQUIRE REWRITING MOBIUS CODE // 1) FIXED! - MultiStateQuantumObjects don't check to see if the new state would be visible before choosing it @@ -208,7 +208,7 @@ namespace NewHorizons.Builder.Props void Update() { - if (meshFilter == null && skinnedMeshRenderer == null) { Logger.LogVerbose("Useless BoxShapeFixer, destroying"); GameObject.DestroyImmediate(this); } + if (meshFilter == null && skinnedMeshRenderer == null) { NHLogger.LogVerbose("Useless BoxShapeFixer, destroying"); GameObject.DestroyImmediate(this); } Mesh sharedMesh = null; if (meshFilter != null) sharedMesh = meshFilter.sharedMesh; diff --git a/NewHorizons/Builder/Props/RaftBuilder.cs b/NewHorizons/Builder/Props/RaftBuilder.cs index 06c4feab..526ea745 100644 --- a/NewHorizons/Builder/Props/RaftBuilder.cs +++ b/NewHorizons/Builder/Props/RaftBuilder.cs @@ -1,8 +1,9 @@ using NewHorizons.External.Modules.Props.EchoesOfTheEye; using NewHorizons.Handlers; using NewHorizons.Utility; +using NewHorizons.Utility.OWML; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Builder.Props { public static class RaftBuilder @@ -16,7 +17,7 @@ namespace NewHorizons.Builder.Props _prefab = GameObject.FindObjectOfType()?.gameObject?.InstantiateInactive()?.Rename("Raft_Body_Prefab")?.DontDestroyOnLoad(); if (_prefab == null) { - Logger.LogWarning($"Tried to make a raft but couldn't. Do you have the DLC installed?"); + NHLogger.LogWarning($"Tried to make a raft but couldn't. Do you have the DLC installed?"); return; } else diff --git a/NewHorizons/Builder/Props/RemoteBuilder.cs b/NewHorizons/Builder/Props/RemoteBuilder.cs index 2c65cd99..644b1faa 100644 --- a/NewHorizons/Builder/Props/RemoteBuilder.cs +++ b/NewHorizons/Builder/Props/RemoteBuilder.cs @@ -1,14 +1,17 @@ using NewHorizons.Builder.Props.TranslatorText; +using NewHorizons.External; using NewHorizons.External.Modules.Props; using NewHorizons.External.Modules.Props.Remote; +using NewHorizons.External.Modules.SerializableData; using NewHorizons.External.Modules.TranslatorText; using NewHorizons.Handlers; using NewHorizons.Utility; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OuterWilds; +using NewHorizons.Utility.OWML; using OWML.Common; using System; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Builder.Props { @@ -128,7 +131,7 @@ namespace NewHorizons.Builder.Props Texture2D decal = Texture2D.whiteTexture; if (!string.IsNullOrWhiteSpace(info.decalPath)) decal = ImageUtilities.GetTexture(mod, info.decalPath, false, false); - else Logger.LogError($"Missing decal path on [{info.id}] for [{go.name}]"); + else NHLogger.LogError($"Missing decal path on [{info.id}] for [{go.name}]"); if (info.platform != null) { @@ -138,7 +141,7 @@ namespace NewHorizons.Builder.Props } catch (Exception ex) { - Logger.LogError($"Couldn't make remote platform [{info.id}] for [{go.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make remote platform [{info.id}] for [{go.name}]:\n{ex}"); } } @@ -150,7 +153,7 @@ namespace NewHorizons.Builder.Props } catch (Exception ex) { - Logger.LogError($"Couldn't make remote whiteboard [{info.id}] for [{go.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make remote whiteboard [{info.id}] for [{go.name}]:\n{ex}"); } } @@ -164,7 +167,7 @@ namespace NewHorizons.Builder.Props } catch (Exception ex) { - Logger.LogError($"Couldn't make remote stone [{info.id}] for [{go.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make remote stone [{info.id}] for [{go.name}]:\n{ex}"); } } } diff --git a/NewHorizons/Builder/Props/ScatterBuilder.cs b/NewHorizons/Builder/Props/ScatterBuilder.cs index 1a37015b..fdb1720d 100644 --- a/NewHorizons/Builder/Props/ScatterBuilder.cs +++ b/NewHorizons/Builder/Props/ScatterBuilder.cs @@ -1,8 +1,9 @@ using NewHorizons.External.Configs; using NewHorizons.External.Modules.Props; using NewHorizons.Utility; +using NewHorizons.Utility.Files; using NewHorizons.Utility.Geometry; -using NewHorizons.Utility.OWMLUtilities; +using NewHorizons.Utility.OWML; using OWML.Common; using System; using System.Collections.Generic; diff --git a/NewHorizons/Builder/Props/SignalBuilder.cs b/NewHorizons/Builder/Props/SignalBuilder.cs index 1ffe5254..4e220d3f 100644 --- a/NewHorizons/Builder/Props/SignalBuilder.cs +++ b/NewHorizons/Builder/Props/SignalBuilder.cs @@ -1,12 +1,13 @@ using NewHorizons.External.Modules; using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OWML; +using NewHorizons.Utility.OuterWilds; using OWML.Common; using OWML.Utils; using System.Collections.Generic; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Builder.Props { @@ -27,7 +28,7 @@ namespace NewHorizons.Builder.Props public static void Init() { - Logger.LogVerbose($"Initializing SignalBuilder"); + NHLogger.LogVerbose($"Initializing SignalBuilder"); _customSignalNames = new Dictionary(); _customFrequencyNames = new Dictionary() { { SignalFrequency.Statue, "FREQ_STATUE" }, @@ -59,11 +60,11 @@ namespace NewHorizons.Builder.Props var freq = CollectionUtilities.KeyByValue(_customFrequencyNames, str); if (freq != default) return freq; - Logger.Log($"Registering new frequency name [{str}]"); + NHLogger.Log($"Registering new frequency name [{str}]"); if (NumberOfFrequencies == 31) { - Logger.LogWarning($"Can't store any more frequencies, skipping [{str}]"); + NHLogger.LogWarning($"Can't store any more frequencies, skipping [{str}]"); return SignalFrequency.Default; } @@ -93,7 +94,7 @@ namespace NewHorizons.Builder.Props var name = CollectionUtilities.KeyByValue(_customSignalNames, str); if (name != default) return name; - Logger.Log($"Registering new signal name [{str}]"); + NHLogger.Log($"Registering new signal name [{str}]"); name = EnumUtilities.Create(str); _customSignalNames.Add(name, str); diff --git a/NewHorizons/Builder/Props/TornadoBuilder.cs b/NewHorizons/Builder/Props/TornadoBuilder.cs index b9c2ba4d..4d1907e4 100644 --- a/NewHorizons/Builder/Props/TornadoBuilder.cs +++ b/NewHorizons/Builder/Props/TornadoBuilder.cs @@ -2,9 +2,10 @@ using NewHorizons.Components; using NewHorizons.External.Modules.Props; using NewHorizons.Handlers; using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OWML; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + using Random = UnityEngine.Random; namespace NewHorizons.Builder.Props { @@ -88,7 +89,7 @@ namespace NewHorizons.Builder.Props } else { - Logger.LogError($"Need either a position or an elevation for tornados"); + NHLogger.LogError($"Need either a position or an elevation for tornados"); return; } diff --git a/NewHorizons/Builder/Props/TranslatorText/NomaiTextArcArranger.cs b/NewHorizons/Builder/Props/TranslatorText/NomaiTextArcArranger.cs index 17e44ce1..90a039cb 100644 --- a/NewHorizons/Builder/Props/TranslatorText/NomaiTextArcArranger.cs +++ b/NewHorizons/Builder/Props/TranslatorText/NomaiTextArcArranger.cs @@ -1,8 +1,8 @@ using NewHorizons.Utility.Geometry; +using NewHorizons.Utility.OWML; using System.Collections.Generic; using System.Linq; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Builder.Props.TranslatorText { @@ -149,7 +149,7 @@ namespace NewHorizons.Builder.Props.TranslatorText // if we couldn't put it inside the bounds, put it back how we found it (this increases stability of the rest of the spirals) if (s1.Mirrored != originalMirror) s1.Mirror(); s1.PlaceOnParentPoint(start); - Logger.LogVerbose("Unable to place spiral " + s1.gameObject.name + " within bounds."); + NHLogger.LogVerbose("Unable to place spiral " + s1.gameObject.name + " within bounds."); } } diff --git a/NewHorizons/Builder/Props/TranslatorText/TranslatorTextBuilder.cs b/NewHorizons/Builder/Props/TranslatorText/TranslatorTextBuilder.cs index 68f5d1f2..2cdaab30 100644 --- a/NewHorizons/Builder/Props/TranslatorText/TranslatorTextBuilder.cs +++ b/NewHorizons/Builder/Props/TranslatorText/TranslatorTextBuilder.cs @@ -1,9 +1,11 @@ +using NewHorizons.External; using NewHorizons.External.Modules.Props; +using NewHorizons.External.Modules.SerializableData; using NewHorizons.External.Modules.TranslatorText; using NewHorizons.Handlers; using NewHorizons.Utility; using NewHorizons.Utility.Geometry; -using NewHorizons.Utility.OWMLUtilities; +using NewHorizons.Utility.OWML; using Newtonsoft.Json; using OWML.Utils; using System; @@ -12,7 +14,7 @@ using System.IO; using System.Linq; using System.Xml; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + using Random = UnityEngine.Random; namespace NewHorizons.Builder.Props.TranslatorText @@ -42,7 +44,7 @@ namespace NewHorizons.Builder.Props.TranslatorText public static GameObject GetSpawnedGameObjectByTranslatorTextInfo(TranslatorTextInfo convo) { - Logger.LogVerbose("Retrieving wall text obj for " + convo); + NHLogger.LogVerbose("Retrieving wall text obj for " + convo); if (!conversationInfoToCorrespondingSpawnedGameObject.ContainsKey(convo)) return null; return conversationInfoToCorrespondingSpawnedGameObject[convo]; } @@ -125,7 +127,7 @@ namespace NewHorizons.Builder.Props.TranslatorText if (xmlContent == null && info.type != NomaiTextType.Whiteboard) { - Logger.LogError($"Failed to create translator text because {nameof(info.xmlFile)} was not set to a valid text .xml file path"); + NHLogger.LogError($"Failed to create translator text because {nameof(info.xmlFile)} was not set to a valid text .xml file path"); return null; } @@ -190,7 +192,7 @@ namespace NewHorizons.Builder.Props.TranslatorText Delay.FireOnNextUpdate( () => { - Logger.LogVerbose("Fixing scroll!"); + NHLogger.LogVerbose("Fixing scroll!"); scrollItem._nomaiWallText = nomaiWallText; scrollItem.SetSector(sector); customScroll.transform.Find("Props_NOM_Scroll/Props_NOM_Scroll_Geo").GetComponent().enabled = true; @@ -387,7 +389,7 @@ namespace NewHorizons.Builder.Props.TranslatorText return whiteboardObject; } default: - Logger.LogError($"Unsupported NomaiText type {info.type}"); + NHLogger.LogError($"Unsupported NomaiText type {info.type}"); return null; } } @@ -458,7 +460,7 @@ namespace NewHorizons.Builder.Props.TranslatorText if (info.arcInfo != null && info.arcInfo.Count() != dict.Values.Count()) { - Logger.LogError($"Can't make NomaiWallText, arcInfo length [{info.arcInfo.Count()}] doesn't equal text entries [{dict.Values.Count()}]"); + NHLogger.LogError($"Can't make NomaiWallText, arcInfo length [{info.arcInfo.Count()}] doesn't equal text entries [{dict.Values.Count()}]"); return; } @@ -501,7 +503,7 @@ namespace NewHorizons.Builder.Props.TranslatorText // no need to arrange if the cache exists if (cachedData == null) { - Logger.LogVerbose("Cache and/or cache entry was null, proceding with wall text arc arrangment."); + NHLogger.LogVerbose("Cache and/or cache entry was null, proceding with wall text arc arrangment."); // auto placement @@ -513,7 +515,7 @@ namespace NewHorizons.Builder.Props.TranslatorText for(var a = 0; a < 10; a++) arranger.FDGSimulationStep(); } - if (overlapFound) Logger.LogVerbose("Overlap resolution failed!"); + if (overlapFound) NHLogger.LogVerbose("Overlap resolution failed!"); // manual placement @@ -628,13 +630,13 @@ namespace NewHorizons.Builder.Props.TranslatorText if (entryIDNode != null && !int.TryParse(entryIDNode.InnerText, out textEntryID)) { - Logger.LogError($"Couldn't parse int ID in [{entryIDNode?.InnerText}] for [{xmlPath}]"); + NHLogger.LogError($"Couldn't parse int ID in [{entryIDNode?.InnerText}] for [{xmlPath}]"); textEntryID = -1; } if (parentIDNode != null && !int.TryParse(parentIDNode.InnerText, out parentID)) { - Logger.LogError($"Couldn't parse int ParentID in [{parentIDNode?.InnerText}] for [{xmlPath}]"); + NHLogger.LogError($"Couldn't parse int ParentID in [{parentIDNode?.InnerText}] for [{xmlPath}]"); parentID = -1; } diff --git a/NewHorizons/Builder/Props/VolcanoBuilder.cs b/NewHorizons/Builder/Props/VolcanoBuilder.cs index 7a0e6c62..e06c7a4c 100644 --- a/NewHorizons/Builder/Props/VolcanoBuilder.cs +++ b/NewHorizons/Builder/Props/VolcanoBuilder.cs @@ -1,6 +1,6 @@ using NewHorizons.External.Modules.Props; using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; +using NewHorizons.Utility.OWML; using UnityEngine; namespace NewHorizons.Builder.Props diff --git a/NewHorizons/Builder/Props/WarpPadBuilder.cs b/NewHorizons/Builder/Props/WarpPadBuilder.cs index b2df5390..86af6b78 100644 --- a/NewHorizons/Builder/Props/WarpPadBuilder.cs +++ b/NewHorizons/Builder/Props/WarpPadBuilder.cs @@ -2,10 +2,10 @@ using NewHorizons.Builder.Props.TranslatorText; using NewHorizons.External.Modules.Props; using NewHorizons.External.Modules.WarpPad; using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; +using NewHorizons.Utility.OWML; using OWML.Utils; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Builder.Props { @@ -88,7 +88,7 @@ namespace NewHorizons.Builder.Props var detailInfo = new DetailInfo(info); var receiverObject = DetailBuilder.Make(planetGO, sector, info.detailed ? _detailedReceiverPrefab : _receiverPrefab, detailInfo); - Logger.Log($"Position is {detailInfo.position} was {info.position}"); + NHLogger.Log($"Position is {detailInfo.position} was {info.position}"); var receiver = receiverObject.GetComponentInChildren(); diff --git a/NewHorizons/Builder/ShipLog/MapModeBuilder.cs b/NewHorizons/Builder/ShipLog/MapModeBuilder.cs index 8d01bf62..f1afd5f8 100644 --- a/NewHorizons/Builder/ShipLog/MapModeBuilder.cs +++ b/NewHorizons/Builder/ShipLog/MapModeBuilder.cs @@ -1,15 +1,17 @@ +using NewHorizons.Components.ShipLog; +using NewHorizons.External; using NewHorizons.External.Modules; +using NewHorizons.External.Modules.VariableSize; using NewHorizons.Handlers; using NewHorizons.Utility; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OuterWilds; +using NewHorizons.Utility.OWML; using System; using System.Collections.Generic; using System.Linq; -using NewHorizons.External.Modules.VariableSize; using UnityEngine; using UnityEngine.UI; -using Logger = NewHorizons.Utility.Logger; -using NewHorizons.Components.ShipLog; -using NewHorizons.Utility.OWUtilities; namespace NewHorizons.Builder.ShipLog { @@ -37,7 +39,7 @@ namespace NewHorizons.Builder.ShipLog flagManualPositionUsed = true; if (body.Config.ShipLog?.mapMode?.manualNavigationPosition == null) { - Logger.LogError("Navigation position is missing for: " + body.Config.name); + NHLogger.LogError("Navigation position is missing for: " + body.Config.name); return null; } } @@ -46,7 +48,7 @@ namespace NewHorizons.Builder.ShipLog if (flagManualPositionUsed) { if (flagAutoPositionUsed && flagManualPositionUsed) - Logger.LogWarning("Can't mix manual and automatic layout of ship log map mode, defaulting to manual"); + NHLogger.LogWarning("Can't mix manual and automatic layout of ship log map mode, defaulting to manual"); return ConstructMapModeManual(bodies, transformParent, greyScaleMaterial, currentNav, layer); } else if (flagAutoPositionUsed) @@ -101,7 +103,7 @@ namespace NewHorizons.Builder.ShipLog { const float unviewedIconOffset = 15; - Logger.LogVerbose($"Adding ship log astro object for {body.Config.name}"); + NHLogger.LogVerbose($"Adding ship log astro object for {body.Config.name}"); GameObject unviewedReference = SearchUtilities.Find(ShipLogHandler.PAN_ROOT_PATH + "/TimberHearth/UnviewedIcon"); @@ -148,9 +150,9 @@ namespace NewHorizons.Builder.ShipLog detailGameObject.SetActive(false); RectTransform detailTransform = detailGameObject.AddComponent(); - detailTransform.localPosition = (Vector2)(info.position ?? new MVector2(0, 0)); + detailTransform.localPosition = (Vector2)(info.position ?? Vector2.zero); detailTransform.localRotation = Quaternion.Euler(0f, 0f, info.rotation); - detailTransform.localScale = (Vector2)(info.scale ?? new MVector2(0, 0)); + detailTransform.localScale = (Vector2)(info.scale ?? Vector2.zero); Texture2D image; Texture2D outline; @@ -387,7 +389,7 @@ namespace NewHorizons.Builder.ShipLog newNode.children = ConstructChildrenNodes(newNode, bodies); return newNode; } - Logger.LogError("Couldn't find center of system!"); + NHLogger.LogError("Couldn't find center of system!"); return new MapModeObject(); } @@ -561,7 +563,7 @@ namespace NewHorizons.Builder.ShipLog } catch (Exception) { - Logger.LogWarning($"Something went wrong trying to pick the colour for {body.Config.name} but I'm too lazy to fix it."); + NHLogger.LogWarning($"Something went wrong trying to pick the colour for {body.Config.name} but I'm too lazy to fix it."); } return Color.white; diff --git a/NewHorizons/Builder/ShipLog/RevealBuilder.cs b/NewHorizons/Builder/ShipLog/RevealBuilder.cs index cde8deb2..41b5b4af 100644 --- a/NewHorizons/Builder/ShipLog/RevealBuilder.cs +++ b/NewHorizons/Builder/ShipLog/RevealBuilder.cs @@ -1,10 +1,11 @@ using NewHorizons.Builder.Props; using NewHorizons.Components.Achievement; using NewHorizons.External.Modules.Volumes.VolumeInfos; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; +using NewHorizons.Utility.OWML; using OWML.Common; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Builder.ShipLog { public static class RevealBuilder @@ -24,7 +25,7 @@ namespace NewHorizons.Builder.ShipLog MakeSnapshot(newRevealGO, sector, info, mod); break; default: - Logger.LogError("Invalid revealOn: " + info.revealOn); + NHLogger.LogError("Invalid revealOn: " + info.revealOn); break; } newRevealGO.SetActive(true); diff --git a/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs b/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs index cdba01fa..727f4c07 100644 --- a/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs +++ b/NewHorizons/Builder/ShipLog/RumorModeBuilder.cs @@ -1,15 +1,16 @@ +using NewHorizons.External; using NewHorizons.External.Configs; using NewHorizons.External.Modules; using NewHorizons.Handlers; -using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OWML; using OWML.Utils; using System; using System.Collections.Generic; using System.IO; using System.Xml.Linq; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Builder.ShipLog { public static class RumorModeBuilder @@ -57,7 +58,7 @@ namespace NewHorizons.Builder.ShipLog XElement astroBodyId = astroBodyFile.Element("ID"); if (astroBodyId == null) { - Logger.LogError("Failed to load ship logs for " + systemName + "!"); + NHLogger.LogError("Failed to load ship logs for " + systemName + "!"); } else { @@ -198,7 +199,7 @@ namespace NewHorizons.Builder.ShipLog } else { - Logger.LogError($"Couldn't find {raw}. Did you define the curiosity in a json config? Because you have to."); + NHLogger.LogError($"Couldn't find {raw}. Did you define the curiosity in a json config? Because you have to."); } } } @@ -215,7 +216,7 @@ namespace NewHorizons.Builder.ShipLog } catch (Exception) { - if (logError) Logger.LogError($"Couldn't load image for {entryId} at {relativePath}"); + if (logError) NHLogger.LogError($"Couldn't load image for {entryId} at {relativePath}"); return null; } } diff --git a/NewHorizons/Builder/StarSystem/SkyboxBuilder.cs b/NewHorizons/Builder/StarSystem/SkyboxBuilder.cs index c92b6520..368ec65d 100644 --- a/NewHorizons/Builder/StarSystem/SkyboxBuilder.cs +++ b/NewHorizons/Builder/StarSystem/SkyboxBuilder.cs @@ -1,10 +1,11 @@ using NewHorizons.External.Configs; using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OWML; +using NewHorizons.Utility.OuterWilds; using OWML.Common; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Builder.StarSystem { @@ -14,7 +15,7 @@ namespace NewHorizons.Builder.StarSystem public static void Make(StarSystemConfig.SkyboxModule module, IModBehaviour mod) { - Logger.Log("Building Skybox"); + NHLogger.Log("Building Skybox"); BuildSkySphere(module, mod); } @@ -50,7 +51,7 @@ namespace NewHorizons.Builder.StarSystem { if (!tex) { - Logger.LogError($"Failed to load texture for skybox {name.ToLower()} face"); + NHLogger.LogError($"Failed to load texture for skybox {name.ToLower()} face"); return null; } diff --git a/NewHorizons/Builder/Volumes/AudioVolumeBuilder.cs b/NewHorizons/Builder/Volumes/AudioVolumeBuilder.cs index 54ed8080..59a7b10c 100644 --- a/NewHorizons/Builder/Volumes/AudioVolumeBuilder.cs +++ b/NewHorizons/Builder/Volumes/AudioVolumeBuilder.cs @@ -1,7 +1,7 @@ using NewHorizons.Builder.Props; using NewHorizons.External.Modules.Volumes.VolumeInfos; -using NewHorizons.Utility; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OuterWilds; using OWML.Common; using OWML.Utils; using UnityEngine; diff --git a/NewHorizons/Builder/Volumes/HazardVolumeBuilder.cs b/NewHorizons/Builder/Volumes/HazardVolumeBuilder.cs index 8d995669..a4a7e795 100644 --- a/NewHorizons/Builder/Volumes/HazardVolumeBuilder.cs +++ b/NewHorizons/Builder/Volumes/HazardVolumeBuilder.cs @@ -1,6 +1,6 @@ using NewHorizons.Builder.Props; using NewHorizons.External.Modules.Volumes.VolumeInfos; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; using OWML.Common; using OWML.Utils; using System.Linq; diff --git a/NewHorizons/Builder/Volumes/NotificationVolumeBuilder.cs b/NewHorizons/Builder/Volumes/NotificationVolumeBuilder.cs index 6e52c5a8..18f51e69 100644 --- a/NewHorizons/Builder/Volumes/NotificationVolumeBuilder.cs +++ b/NewHorizons/Builder/Volumes/NotificationVolumeBuilder.cs @@ -1,6 +1,6 @@ using NewHorizons.Builder.Props; using NewHorizons.External.Modules.Volumes.VolumeInfos; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; using OWML.Common; using UnityEngine; using NHNotificationVolume = NewHorizons.Components.Volumes.NotificationVolume; diff --git a/NewHorizons/Builder/Volumes/Rulesets/PlayerImpactRulesetBuilder.cs b/NewHorizons/Builder/Volumes/Rulesets/PlayerImpactRulesetBuilder.cs index f6d7ed2e..f892ea07 100644 --- a/NewHorizons/Builder/Volumes/Rulesets/PlayerImpactRulesetBuilder.cs +++ b/NewHorizons/Builder/Volumes/Rulesets/PlayerImpactRulesetBuilder.cs @@ -1,5 +1,4 @@ using NewHorizons.External.Modules.Volumes; -using NewHorizons.External.Modules.Volumes.VolumeInfos; using UnityEngine; namespace NewHorizons.Builder.Volumes.Rulesets diff --git a/NewHorizons/Builder/Volumes/Rulesets/ProbeRulesetBuilder.cs b/NewHorizons/Builder/Volumes/Rulesets/ProbeRulesetBuilder.cs index 33dbdbbc..98823ffa 100644 --- a/NewHorizons/Builder/Volumes/Rulesets/ProbeRulesetBuilder.cs +++ b/NewHorizons/Builder/Volumes/Rulesets/ProbeRulesetBuilder.cs @@ -1,5 +1,4 @@ using NewHorizons.External.Modules.Volumes; -using NewHorizons.External.Modules.Volumes.VolumeInfos; using UnityEngine; namespace NewHorizons.Builder.Volumes.Rulesets diff --git a/NewHorizons/Builder/Volumes/Rulesets/ThrustRulesetBuilder.cs b/NewHorizons/Builder/Volumes/Rulesets/ThrustRulesetBuilder.cs index a3677511..8a49808d 100644 --- a/NewHorizons/Builder/Volumes/Rulesets/ThrustRulesetBuilder.cs +++ b/NewHorizons/Builder/Volumes/Rulesets/ThrustRulesetBuilder.cs @@ -1,5 +1,4 @@ using NewHorizons.External.Modules.Volumes; -using NewHorizons.External.Modules.Volumes.VolumeInfos; using UnityEngine; namespace NewHorizons.Builder.Volumes.Rulesets diff --git a/NewHorizons/Builder/Volumes/VanishVolumeBuilder.cs b/NewHorizons/Builder/Volumes/VanishVolumeBuilder.cs index b1a26287..48be7181 100644 --- a/NewHorizons/Builder/Volumes/VanishVolumeBuilder.cs +++ b/NewHorizons/Builder/Volumes/VanishVolumeBuilder.cs @@ -1,6 +1,6 @@ using NewHorizons.Builder.Props; using NewHorizons.External.Modules.Volumes.VolumeInfos; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; using UnityEngine; namespace NewHorizons.Builder.Volumes diff --git a/NewHorizons/Builder/Volumes/VisorEffects/VisorFrostEffectVolumeBuilder.cs b/NewHorizons/Builder/Volumes/VisorEffects/VisorFrostEffectVolumeBuilder.cs index 029b98c9..793d72b4 100644 --- a/NewHorizons/Builder/Volumes/VisorEffects/VisorFrostEffectVolumeBuilder.cs +++ b/NewHorizons/Builder/Volumes/VisorEffects/VisorFrostEffectVolumeBuilder.cs @@ -1,5 +1,4 @@ using NewHorizons.External.Modules.Volumes; -using NewHorizons.External.Modules.Volumes.VolumeInfos; using UnityEngine; namespace NewHorizons.Builder.Volumes.VisorEffects diff --git a/NewHorizons/Builder/Volumes/VisorEffects/VisorRainEffectVolumeBuilder.cs b/NewHorizons/Builder/Volumes/VisorEffects/VisorRainEffectVolumeBuilder.cs index 2f32f189..e07c95e6 100644 --- a/NewHorizons/Builder/Volumes/VisorEffects/VisorRainEffectVolumeBuilder.cs +++ b/NewHorizons/Builder/Volumes/VisorEffects/VisorRainEffectVolumeBuilder.cs @@ -1,5 +1,4 @@ using NewHorizons.External.Modules.Volumes; -using NewHorizons.External.Modules.Volumes.VolumeInfos; using UnityEngine; namespace NewHorizons.Builder.Volumes.VisorEffects diff --git a/NewHorizons/Builder/Volumes/VolumeBuilder.cs b/NewHorizons/Builder/Volumes/VolumeBuilder.cs index 760bc4c2..0ee5d0b7 100644 --- a/NewHorizons/Builder/Volumes/VolumeBuilder.cs +++ b/NewHorizons/Builder/Volumes/VolumeBuilder.cs @@ -1,6 +1,6 @@ using NewHorizons.Builder.Props; using NewHorizons.External.Modules.Volumes.VolumeInfos; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; using UnityEngine; namespace NewHorizons.Builder.Volumes diff --git a/NewHorizons/Builder/Volumes/VolumesBuildManager.cs b/NewHorizons/Builder/Volumes/VolumesBuildManager.cs index 2b0d07b5..88cfc622 100644 --- a/NewHorizons/Builder/Volumes/VolumesBuildManager.cs +++ b/NewHorizons/Builder/Volumes/VolumesBuildManager.cs @@ -3,10 +3,10 @@ using NewHorizons.Builder.Volumes.Rulesets; using NewHorizons.Builder.Volumes.VisorEffects; using NewHorizons.Components.Volumes; using NewHorizons.External.Configs; +using NewHorizons.Utility.OWML; using OWML.Common; using System; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Builder.Volumes { @@ -24,7 +24,7 @@ namespace NewHorizons.Builder.Volumes } catch (Exception ex) { - Logger.LogError($"Couldn't make reveal location [{revealInfo.reveals}] for [{go.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make reveal location [{revealInfo.reveals}] for [{go.name}]:\n{ex}"); } } } diff --git a/NewHorizons/Components/Achievement/AchievementObserveTrigger.cs b/NewHorizons/Components/Achievement/AchievementObserveTrigger.cs index 55d44e66..ed3e9dfe 100644 --- a/NewHorizons/Components/Achievement/AchievementObserveTrigger.cs +++ b/NewHorizons/Components/Achievement/AchievementObserveTrigger.cs @@ -1,5 +1,5 @@ using NewHorizons.OtherMods.AchievementsPlus; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; using UnityEngine; namespace NewHorizons.Components.Achievement diff --git a/NewHorizons/Components/AddPhysics.cs b/NewHorizons/Components/AddPhysics.cs index 683b5a3c..42f8342d 100644 --- a/NewHorizons/Components/AddPhysics.cs +++ b/NewHorizons/Components/AddPhysics.cs @@ -1,4 +1,4 @@ -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; using System.Collections; using UnityEngine; diff --git a/NewHorizons/Components/NHProxy.cs b/NewHorizons/Components/NHProxy.cs index 6df1383a..9562678c 100644 --- a/NewHorizons/Components/NHProxy.cs +++ b/NewHorizons/Components/NHProxy.cs @@ -1,6 +1,6 @@ using NewHorizons.Components.SizeControllers; using NewHorizons.Handlers; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; using System.Collections.Generic; using System.Linq; using UnityEngine; diff --git a/NewHorizons/Components/Orbital/NHOrbitLine.cs b/NewHorizons/Components/Orbital/NHOrbitLine.cs index 91dcfb24..2bd3f107 100644 --- a/NewHorizons/Components/Orbital/NHOrbitLine.cs +++ b/NewHorizons/Components/Orbital/NHOrbitLine.cs @@ -1,6 +1,7 @@ using System; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; +using NewHorizons.Utility.OWML; + namespace NewHorizons.Components.Orbital { public class NHOrbitLine : OrbitLine @@ -85,7 +86,7 @@ namespace NewHorizons.Components.Orbital } catch (Exception ex) { - Logger.LogError($"Exception in OrbitLine for [{_astroObject?.name}]:\n{ex}"); + NHLogger.LogError($"Exception in OrbitLine for [{_astroObject?.name}]:\n{ex}"); enabled = false; } } diff --git a/NewHorizons/Components/Orbital/TrackingOrbitLine.cs b/NewHorizons/Components/Orbital/TrackingOrbitLine.cs index 51e77344..f5a06674 100644 --- a/NewHorizons/Components/Orbital/TrackingOrbitLine.cs +++ b/NewHorizons/Components/Orbital/TrackingOrbitLine.cs @@ -1,6 +1,7 @@ -using System; +using System; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; +using NewHorizons.Utility.OWML; + namespace NewHorizons.Components.Orbital { public class TrackingOrbitLine : OrbitLine @@ -85,7 +86,7 @@ namespace NewHorizons.Components.Orbital } catch (Exception ex) { - Logger.LogError($"Exception in OrbitLine for [{_astroObject?.name}]:\n{ex}"); + NHLogger.LogError($"Exception in OrbitLine for [{_astroObject?.name}]:\n{ex}"); enabled = false; } } diff --git a/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs b/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs index 09b40638..56d3c3d3 100644 --- a/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs +++ b/NewHorizons/Components/Quantum/NHMultiStateQuantumObject.cs @@ -1,8 +1,7 @@ +using NewHorizons.Utility.OWML; using System.Collections.Generic; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; - namespace NewHorizons.Components.Quantum { public class NHMultiStateQuantumObject : MultiStateQuantumObject @@ -66,7 +65,7 @@ namespace NewHorizons.Components.Quantum if (previousIndex >= 0 && previousIndex < _states.Length) _states[previousIndex].SetVisible(visible: false); _states[_stateIndex].SetVisible(visible: true); - Logger.LogVerbose($"MultiStateQuantumObject - Trying to change state {_stateIndex}"); + NHLogger.LogVerbose($"MultiStateQuantumObject - Trying to change state {_stateIndex}"); indices.Remove(_stateIndex); } while (!CurrentStateIsValid() && indices.Count > 0); diff --git a/NewHorizons/Components/Quantum/QuantumPlanet.cs b/NewHorizons/Components/Quantum/QuantumPlanet.cs index d0997b8d..5e5a4ecf 100644 --- a/NewHorizons/Components/Quantum/QuantumPlanet.cs +++ b/NewHorizons/Components/Quantum/QuantumPlanet.cs @@ -2,12 +2,13 @@ using NewHorizons.Builder.General; using NewHorizons.Components.Orbital; using NewHorizons.External.Modules; using NewHorizons.Handlers; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; +using NewHorizons.Utility.OWML; using System.Collections.Generic; using System.Linq; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; using Random = UnityEngine.Random; + namespace NewHorizons.Components.Quantum { public class QuantumPlanet : QuantumObject @@ -66,7 +67,7 @@ namespace NewHorizons.Components.Quantum public override bool ChangeQuantumState(bool skipInstantVisibilityCheck) { - Logger.LogVerbose($"QuantumPlanet - Trying to change quantum state"); + NHLogger.LogVerbose($"QuantumPlanet - Trying to change quantum state"); if (states.Count <= 1) return false; diff --git a/NewHorizons/Components/ShipLog/ShipLogDetail.cs b/NewHorizons/Components/ShipLog/ShipLogDetail.cs index 3852ff88..db44ba61 100644 --- a/NewHorizons/Components/ShipLog/ShipLogDetail.cs +++ b/NewHorizons/Components/ShipLog/ShipLogDetail.cs @@ -1,7 +1,8 @@ using NewHorizons.External.Modules; +using NewHorizons.Utility.OWML; using UnityEngine; using UnityEngine.UI; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Components.ShipLog { public class ShipLogDetail : MonoBehaviour @@ -44,7 +45,7 @@ namespace NewHorizons.Components.ShipLog _outlineImage.enabled = false; break; default: - Logger.LogError("Invalid ShipLogEntryState for " + _revealedImage.transform.parent.parent.gameObject.name); + NHLogger.LogError("Invalid ShipLogEntryState for " + _revealedImage.transform.parent.parent.gameObject.name); break; } } diff --git a/NewHorizons/Components/ShipLog/ShipLogStarChartMode.cs b/NewHorizons/Components/ShipLog/ShipLogStarChartMode.cs index 8bc65710..afdf5f2e 100644 --- a/NewHorizons/Components/ShipLog/ShipLogStarChartMode.cs +++ b/NewHorizons/Components/ShipLog/ShipLogStarChartMode.cs @@ -1,13 +1,14 @@ using NewHorizons.Handlers; using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OWML; using System; using System.Collections.Generic; using System.IO; using System.Linq; using UnityEngine; using UnityEngine.UI; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Components.ShipLog { public class ShipLogStarChartMode : ShipLogMode @@ -134,7 +135,7 @@ namespace NewHorizons.Components.ShipLog else { var path = Path.Combine("planets", uniqueID + ".png"); - Logger.LogVerbose($"ShipLogStarChartManager - Trying to load {path}"); + NHLogger.LogVerbose($"ShipLogStarChartManager - Trying to load {path}"); texture = ImageUtilities.GetTexture(Main.SystemDict[uniqueID].Mod, path); } } diff --git a/NewHorizons/Components/ShipWarpController.cs b/NewHorizons/Components/ShipWarpController.cs index 8bfa4bee..3f4029c1 100644 --- a/NewHorizons/Components/ShipWarpController.cs +++ b/NewHorizons/Components/ShipWarpController.cs @@ -1,8 +1,8 @@ using NewHorizons.Builder.General; using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; +using NewHorizons.Utility.OWML; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Components { public class ShipWarpController : MonoBehaviour @@ -112,7 +112,7 @@ namespace NewHorizons.Components public void WarpIn(bool wearingSuit) { - Logger.LogVerbose("Starting warp-in"); + NHLogger.LogVerbose("Starting warp-in"); // Trying really hard to stop the player from dying while warping in _impactDeathSpeed = Locator.GetDeathManager()._impactDeathSpeed; Locator.GetDeathManager()._impactDeathSpeed = Mathf.Infinity; @@ -125,7 +125,7 @@ namespace NewHorizons.Components public void WarpOut() { - Logger.LogVerbose("Starting warp-out"); + NHLogger.LogVerbose("Starting warp-out"); _oneShotSource.PlayOneShot(global::AudioType.VesselSingularityCreate, 1f); _blackhole.Create(); } @@ -142,7 +142,7 @@ namespace NewHorizons.Components { if (Locator.GetPlayerTransform().TryGetComponent(out var resources) && resources._currentHealth < 100f) { - Logger.LogVerbose("Player died in a warp drive accident, reviving them"); + NHLogger.LogVerbose("Player died in a warp drive accident, reviving them"); // Means the player was killed meaning they weren't teleported in resources._currentHealth = 100f; if (!PlayerState.AtFlightConsole()) TeleportToShip(); @@ -164,7 +164,7 @@ namespace NewHorizons.Components private void StartWarpInEffect() { - Logger.LogVerbose("Starting warp-in effect"); + NHLogger.LogVerbose("Starting warp-in effect"); _oneShotSource.PlayOneShot(global::AudioType.VesselSingularityCollapse, 1f); Locator.GetDeathManager()._invincible = true; if (Main.Instance.CurrentStarSystem.Equals("SolarSystem")) TeleportToShip(); @@ -184,7 +184,7 @@ namespace NewHorizons.Components public void FinishWarpIn() { - Logger.LogVerbose("Finishing warp"); + NHLogger.LogVerbose("Finishing warp"); Locator.GetShipBody().GetComponentInChildren().OnPressInteract(); _waitingToBeSeated = false; Delay.FireInNUpdates(() => _whitehole.Collapse(), 30); diff --git a/NewHorizons/Components/SizeControllers/SingularitySizeController.cs b/NewHorizons/Components/SizeControllers/SingularitySizeController.cs index 121dbe8a..dc744bf8 100644 --- a/NewHorizons/Components/SizeControllers/SingularitySizeController.cs +++ b/NewHorizons/Components/SizeControllers/SingularitySizeController.cs @@ -1,5 +1,5 @@ using NewHorizons.Builder.Body; -using NewHorizons.Utility.OWMLUtilities; +using NewHorizons.Utility.OWML; using UnityEngine; namespace NewHorizons.Components.SizeControllers diff --git a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs index c0d6508e..5e62c3d8 100644 --- a/NewHorizons/Components/SizeControllers/StarEvolutionController.cs +++ b/NewHorizons/Components/SizeControllers/StarEvolutionController.cs @@ -1,15 +1,16 @@ using NewHorizons.Builder.Body; using NewHorizons.Components.Orbital; using NewHorizons.Components.Stars; +using NewHorizons.External.Modules.SerializableData; using NewHorizons.External.Modules.VariableSize; using NewHorizons.Handlers; using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; +using NewHorizons.Utility.OWML; using System; using System.Linq; using UnityEngine; using UnityEngine.Events; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Components.SizeControllers { @@ -351,7 +352,7 @@ namespace NewHorizons.Components.SizeControllers { if (_isCollapsing) return; - Logger.LogVerbose($"{gameObject.transform.root.name} started collapse"); + NHLogger.LogVerbose($"{gameObject.transform.root.name} started collapse"); CollapseStart.Invoke(); _isCollapsing = true; @@ -367,7 +368,7 @@ namespace NewHorizons.Components.SizeControllers { if (!_isCollapsing) return; - Logger.LogVerbose($"{gameObject.transform.root.name} stopped collapse"); + NHLogger.LogVerbose($"{gameObject.transform.root.name} stopped collapse"); CollapseStop.Invoke(); _isCollapsing = false; @@ -381,7 +382,7 @@ namespace NewHorizons.Components.SizeControllers if (supernova == null) return; if (_isSupernova) return; - Logger.LogVerbose($"{gameObject.transform.root.name} started supernova"); + NHLogger.LogVerbose($"{gameObject.transform.root.name} started supernova"); SupernovaStart.Invoke(); supernova.Activate(); @@ -399,7 +400,7 @@ namespace NewHorizons.Components.SizeControllers { if (!_isSupernova) return; - Logger.LogVerbose($"{gameObject.transform.root.name} stopped supernova"); + NHLogger.LogVerbose($"{gameObject.transform.root.name} stopped supernova"); SupernovaStop.Invoke(); if (supernova != null) supernova.Deactivate(); diff --git a/NewHorizons/Components/Stars/SunLightEffectsController.cs b/NewHorizons/Components/Stars/SunLightEffectsController.cs index 4e62b2d3..904bdf6a 100644 --- a/NewHorizons/Components/Stars/SunLightEffectsController.cs +++ b/NewHorizons/Components/Stars/SunLightEffectsController.cs @@ -1,7 +1,8 @@ using NewHorizons.Builder.Atmosphere; +using NewHorizons.Utility.OWML; using System.Collections.Generic; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Components.Stars { [RequireComponent(typeof(SunLightController))] @@ -42,13 +43,13 @@ namespace NewHorizons.Components.Stars { if (star == null) return; - Logger.LogVerbose($"Adding new star to list: {star.gameObject.name}"); + NHLogger.LogVerbose($"Adding new star to list: {star.gameObject.name}"); Instance._stars.Add(star); } public static void RemoveStar(StarController star) { - Logger.LogVerbose($"Removing star from list: {star?.gameObject?.name}"); + NHLogger.LogVerbose($"Removing star from list: {star?.gameObject?.name}"); if (Instance._stars.Contains(star)) { if (Instance._activeStar != null && Instance._activeStar.Equals(star)) @@ -169,7 +170,7 @@ namespace NewHorizons.Components.Stars if (_activeStar != null) _activeStar.Disable(); - Logger.LogVerbose($"Switching active star: {star.gameObject.name}"); + NHLogger.LogVerbose($"Switching active star: {star.gameObject.name}"); _activeStar = star; diff --git a/NewHorizons/Components/Volumes/LoadCreditsVolume.cs b/NewHorizons/Components/Volumes/LoadCreditsVolume.cs index 6eb99143..2746c7b2 100644 --- a/NewHorizons/Components/Volumes/LoadCreditsVolume.cs +++ b/NewHorizons/Components/Volumes/LoadCreditsVolume.cs @@ -1,8 +1,9 @@ using NewHorizons.External.Modules.SerializableEnums; using NewHorizons.Handlers; +using NewHorizons.Utility.OWML; using System.Collections; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Components.Volumes { @@ -65,7 +66,7 @@ namespace NewHorizons.Components.Volumes private void LoadCreditsScene() { - Logger.LogVerbose($"Load credits {creditsType}"); + NHLogger.LogVerbose($"Load credits {creditsType}"); switch (creditsType) { diff --git a/NewHorizons/External/Configs/PlanetConfig.cs b/NewHorizons/External/Configs/PlanetConfig.cs index 2d5a707d..c934a721 100644 --- a/NewHorizons/External/Configs/PlanetConfig.cs +++ b/NewHorizons/External/Configs/PlanetConfig.cs @@ -5,13 +5,13 @@ using NewHorizons.External.Modules.Props.Quantum; using NewHorizons.External.Modules.VariableSize; using NewHorizons.External.Modules.Volumes; using NewHorizons.External.Modules.Volumes.VolumeInfos; +using NewHorizons.Utility.OWML; using Newtonsoft.Json; using System; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; -using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.External.Configs { @@ -220,18 +220,18 @@ namespace NewHorizons.External.Configs Dictionary existingGroups = new Dictionary(); foreach (var quantumGroup in Props.quantumGroups) { - if (existingGroups.ContainsKey(quantumGroup.id)) { Logger.LogWarning($"Duplicate quantumGroup id found: {quantumGroup.id}"); quantumGroup.type = QuantumGroupType.FailedValidation; } + if (existingGroups.ContainsKey(quantumGroup.id)) { NHLogger.LogWarning($"Duplicate quantumGroup id found: {quantumGroup.id}"); quantumGroup.type = QuantumGroupType.FailedValidation; } existingGroups[quantumGroup.id] = quantumGroup; if (quantumGroup.type == QuantumGroupType.Sockets) { - if (quantumGroup.sockets?.Length == 0) { Logger.LogError($"quantumGroup {quantumGroup.id} is of type \"sockets\" but has no defined sockets."); quantumGroup.type = QuantumGroupType.FailedValidation; } + if (quantumGroup.sockets?.Length == 0) { NHLogger.LogError($"quantumGroup {quantumGroup.id} is of type \"sockets\" but has no defined sockets."); quantumGroup.type = QuantumGroupType.FailedValidation; } else { foreach (var socket in quantumGroup.sockets) { if (socket.rotation == null) socket.rotation = UnityEngine.Vector3.zero; - if (socket.position == null) { Logger.LogError($"quantumGroup {quantumGroup.id} has a socket without a position."); quantumGroup.type = QuantumGroupType.FailedValidation; } + if (socket.position == null) { NHLogger.LogError($"quantumGroup {quantumGroup.id} has a socket without a position."); quantumGroup.type = QuantumGroupType.FailedValidation; } } } } @@ -241,7 +241,7 @@ namespace NewHorizons.External.Configs foreach (var prop in Props?.details) { if (prop.quantumGroupID == null) continue; - if (!existingGroups.ContainsKey(prop.quantumGroupID)) Logger.LogWarning($"A prop wants to be a part of quantum group {prop.quantumGroupID}, but this group does not exist."); + if (!existingGroups.ContainsKey(prop.quantumGroupID)) NHLogger.LogWarning($"A prop wants to be a part of quantum group {prop.quantumGroupID}, but this group does not exist."); else existingGroupsPropCounts[prop.quantumGroupID] = existingGroupsPropCounts.GetValueOrDefault(prop.quantumGroupID) + 1; } @@ -249,7 +249,7 @@ namespace NewHorizons.External.Configs { if (quantumGroup.type == QuantumGroupType.Sockets && existingGroupsPropCounts.GetValueOrDefault(quantumGroup.id) >= quantumGroup.sockets?.Length) { - Logger.LogError($"quantumGroup {quantumGroup.id} is of type \"sockets\" and has more props than sockets."); + NHLogger.LogError($"quantumGroup {quantumGroup.id} is of type \"sockets\" and has more props than sockets."); quantumGroup.type = QuantumGroupType.FailedValidation; } } diff --git a/NewHorizons/External/Configs/StarSystemConfig.cs b/NewHorizons/External/Configs/StarSystemConfig.cs index 3e3ccf1c..c05e9d9a 100644 --- a/NewHorizons/External/Configs/StarSystemConfig.cs +++ b/NewHorizons/External/Configs/StarSystemConfig.cs @@ -3,7 +3,7 @@ using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Linq; using NewHorizons.External.Modules; -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; using static NewHorizons.External.Modules.ShipLogModule; diff --git a/NewHorizons/External/Modules/AmbientLightModule.cs b/NewHorizons/External/Modules/AmbientLightModule.cs index 4b618cee..80217c90 100644 --- a/NewHorizons/External/Modules/AmbientLightModule.cs +++ b/NewHorizons/External/Modules/AmbientLightModule.cs @@ -1,6 +1,6 @@ using System.ComponentModel; using System.ComponentModel.DataAnnotations; -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; namespace NewHorizons.External.Modules diff --git a/NewHorizons/External/Modules/AtmosphereModule.cs b/NewHorizons/External/Modules/AtmosphereModule.cs index ec751429..25d8e2f1 100644 --- a/NewHorizons/External/Modules/AtmosphereModule.cs +++ b/NewHorizons/External/Modules/AtmosphereModule.cs @@ -2,8 +2,8 @@ using System; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Runtime.Serialization; +using NewHorizons.External.Modules.SerializableData; using NewHorizons.External.Modules.SerializableEnums; -using NewHorizons.Utility; using Newtonsoft.Json; using Newtonsoft.Json.Converters; diff --git a/NewHorizons/External/Modules/BaseModule.cs b/NewHorizons/External/Modules/BaseModule.cs index 9c47a59d..0d55d804 100644 --- a/NewHorizons/External/Modules/BaseModule.cs +++ b/NewHorizons/External/Modules/BaseModule.cs @@ -1,7 +1,7 @@ using System; using System.ComponentModel; using System.Runtime.Serialization; -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; using Newtonsoft.Json.Converters; diff --git a/NewHorizons/External/Modules/BrambleModule.cs b/NewHorizons/External/Modules/BrambleModule.cs index 78619baf..723a9c4b 100644 --- a/NewHorizons/External/Modules/BrambleModule.cs +++ b/NewHorizons/External/Modules/BrambleModule.cs @@ -1,4 +1,4 @@ -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using System; diff --git a/NewHorizons/External/Modules/GeneralPropInfo.cs b/NewHorizons/External/Modules/GeneralPropInfo.cs index 8ab528a1..0831c48a 100644 --- a/NewHorizons/External/Modules/GeneralPropInfo.cs +++ b/NewHorizons/External/Modules/GeneralPropInfo.cs @@ -1,5 +1,5 @@ -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; namespace NewHorizons.External.Modules diff --git a/NewHorizons/External/Modules/HeightMapModule.cs b/NewHorizons/External/Modules/HeightMapModule.cs index 18c9d250..5f247739 100644 --- a/NewHorizons/External/Modules/HeightMapModule.cs +++ b/NewHorizons/External/Modules/HeightMapModule.cs @@ -1,4 +1,4 @@ -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; using System.ComponentModel; using System.ComponentModel.DataAnnotations; diff --git a/NewHorizons/External/Modules/OrbitModule.cs b/NewHorizons/External/Modules/OrbitModule.cs index d6076378..080d9b39 100644 --- a/NewHorizons/External/Modules/OrbitModule.cs +++ b/NewHorizons/External/Modules/OrbitModule.cs @@ -1,7 +1,7 @@ using System.ComponentModel; using System.ComponentModel.DataAnnotations; using NewHorizons.Components.Orbital; -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; namespace NewHorizons.External.Modules diff --git a/NewHorizons/External/Modules/ProcGenModule.cs b/NewHorizons/External/Modules/ProcGenModule.cs index 4a515774..8099cf97 100644 --- a/NewHorizons/External/Modules/ProcGenModule.cs +++ b/NewHorizons/External/Modules/ProcGenModule.cs @@ -1,5 +1,5 @@ using System.ComponentModel.DataAnnotations; -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; namespace NewHorizons.External.Modules diff --git a/NewHorizons/External/Modules/Props/DetailInfo.cs b/NewHorizons/External/Modules/Props/DetailInfo.cs index 01fef1dc..af5924c4 100644 --- a/NewHorizons/External/Modules/Props/DetailInfo.cs +++ b/NewHorizons/External/Modules/Props/DetailInfo.cs @@ -1,4 +1,4 @@ -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; using System; using System.ComponentModel; diff --git a/NewHorizons/External/Modules/Props/Dialogue/DialogueInfo.cs b/NewHorizons/External/Modules/Props/Dialogue/DialogueInfo.cs index b30065a9..25ef83b4 100644 --- a/NewHorizons/External/Modules/Props/Dialogue/DialogueInfo.cs +++ b/NewHorizons/External/Modules/Props/Dialogue/DialogueInfo.cs @@ -1,4 +1,4 @@ -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; using System; using System.ComponentModel; diff --git a/NewHorizons/External/Modules/Props/EchoesOfTheEye/SlideInfo.cs b/NewHorizons/External/Modules/Props/EchoesOfTheEye/SlideInfo.cs index 39fc2088..35520780 100644 --- a/NewHorizons/External/Modules/Props/EchoesOfTheEye/SlideInfo.cs +++ b/NewHorizons/External/Modules/Props/EchoesOfTheEye/SlideInfo.cs @@ -1,4 +1,4 @@ -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; namespace NewHorizons.External.Modules.Props.EchoesOfTheEye diff --git a/NewHorizons/External/Modules/Props/GeyserInfo.cs b/NewHorizons/External/Modules/Props/GeyserInfo.cs index dbecabaf..4ab5a1eb 100644 --- a/NewHorizons/External/Modules/Props/GeyserInfo.cs +++ b/NewHorizons/External/Modules/Props/GeyserInfo.cs @@ -1,4 +1,4 @@ -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; using System.ComponentModel; diff --git a/NewHorizons/External/Modules/Props/ScatterInfo.cs b/NewHorizons/External/Modules/Props/ScatterInfo.cs index 5a847324..5bb1ca26 100644 --- a/NewHorizons/External/Modules/Props/ScatterInfo.cs +++ b/NewHorizons/External/Modules/Props/ScatterInfo.cs @@ -1,4 +1,4 @@ -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; using System.ComponentModel; diff --git a/NewHorizons/External/Modules/Props/TornadoInfo.cs b/NewHorizons/External/Modules/Props/TornadoInfo.cs index 375c3a66..c389875f 100644 --- a/NewHorizons/External/Modules/Props/TornadoInfo.cs +++ b/NewHorizons/External/Modules/Props/TornadoInfo.cs @@ -1,5 +1,5 @@ +using NewHorizons.External.Modules.SerializableData; using NewHorizons.External.Modules.SerializableEnums; -using NewHorizons.Utility; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using System; diff --git a/NewHorizons/External/Modules/Props/TranslatorText/NomaiTextArcInfo.cs b/NewHorizons/External/Modules/Props/TranslatorText/NomaiTextArcInfo.cs index 3a769805..7772c924 100644 --- a/NewHorizons/External/Modules/Props/TranslatorText/NomaiTextArcInfo.cs +++ b/NewHorizons/External/Modules/Props/TranslatorText/NomaiTextArcInfo.cs @@ -1,4 +1,4 @@ -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using System; diff --git a/NewHorizons/External/Modules/Props/TranslatorText/NomaiTextInfo.cs b/NewHorizons/External/Modules/Props/TranslatorText/NomaiTextInfo.cs index b322a093..97b610fd 100644 --- a/NewHorizons/External/Modules/Props/TranslatorText/NomaiTextInfo.cs +++ b/NewHorizons/External/Modules/Props/TranslatorText/NomaiTextInfo.cs @@ -1,4 +1,4 @@ -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; using System.ComponentModel; diff --git a/NewHorizons/External/Modules/Props/TranslatorText/TranslatorTextInfo.cs b/NewHorizons/External/Modules/Props/TranslatorText/TranslatorTextInfo.cs index d21e9776..17c0e8cf 100644 --- a/NewHorizons/External/Modules/Props/TranslatorText/TranslatorTextInfo.cs +++ b/NewHorizons/External/Modules/Props/TranslatorText/TranslatorTextInfo.cs @@ -1,4 +1,4 @@ -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; using System.ComponentModel; diff --git a/NewHorizons/External/Modules/Props/VolcanoInfo.cs b/NewHorizons/External/Modules/Props/VolcanoInfo.cs index 9afa7e85..f6186871 100644 --- a/NewHorizons/External/Modules/Props/VolcanoInfo.cs +++ b/NewHorizons/External/Modules/Props/VolcanoInfo.cs @@ -1,4 +1,4 @@ -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; using System.ComponentModel; diff --git a/NewHorizons/External/Modules/ReferenceFrameModule.cs b/NewHorizons/External/Modules/ReferenceFrameModule.cs index dbde93db..43d12bd4 100644 --- a/NewHorizons/External/Modules/ReferenceFrameModule.cs +++ b/NewHorizons/External/Modules/ReferenceFrameModule.cs @@ -1,5 +1,5 @@ using System.ComponentModel; -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; namespace NewHorizons.External.Modules diff --git a/NewHorizons/External/Modules/ShipLogModule.cs b/NewHorizons/External/Modules/ShipLogModule.cs index 0d301df2..9badb727 100644 --- a/NewHorizons/External/Modules/ShipLogModule.cs +++ b/NewHorizons/External/Modules/ShipLogModule.cs @@ -1,6 +1,6 @@ using System; using System.ComponentModel; -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; namespace NewHorizons.External.Modules diff --git a/NewHorizons/External/Modules/SpawnModule.cs b/NewHorizons/External/Modules/SpawnModule.cs index 5e2d0377..9dd583ca 100644 --- a/NewHorizons/External/Modules/SpawnModule.cs +++ b/NewHorizons/External/Modules/SpawnModule.cs @@ -1,4 +1,4 @@ -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; using System; diff --git a/NewHorizons/External/Modules/VariableSize/FunnelModule.cs b/NewHorizons/External/Modules/VariableSize/FunnelModule.cs index 5c49da12..6cb7a5b4 100644 --- a/NewHorizons/External/Modules/VariableSize/FunnelModule.cs +++ b/NewHorizons/External/Modules/VariableSize/FunnelModule.cs @@ -1,6 +1,6 @@ using System.ComponentModel; using System.Runtime.Serialization; -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; using Newtonsoft.Json.Converters; diff --git a/NewHorizons/External/Modules/VariableSize/LavaModule.cs b/NewHorizons/External/Modules/VariableSize/LavaModule.cs index f43de819..e3abd0f2 100644 --- a/NewHorizons/External/Modules/VariableSize/LavaModule.cs +++ b/NewHorizons/External/Modules/VariableSize/LavaModule.cs @@ -1,4 +1,4 @@ -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; namespace NewHorizons.External.Modules.VariableSize diff --git a/NewHorizons/External/Modules/VariableSize/SandModule.cs b/NewHorizons/External/Modules/VariableSize/SandModule.cs index cc096166..d5a19dff 100644 --- a/NewHorizons/External/Modules/VariableSize/SandModule.cs +++ b/NewHorizons/External/Modules/VariableSize/SandModule.cs @@ -1,4 +1,4 @@ -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; namespace NewHorizons.External.Modules.VariableSize { diff --git a/NewHorizons/External/Modules/VariableSize/StarModule.cs b/NewHorizons/External/Modules/VariableSize/StarModule.cs index dfb37631..8313fcae 100644 --- a/NewHorizons/External/Modules/VariableSize/StarModule.cs +++ b/NewHorizons/External/Modules/VariableSize/StarModule.cs @@ -2,7 +2,7 @@ using System; using System.ComponentModel; using System.ComponentModel.DataAnnotations; using System.Runtime.Serialization; -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; using Newtonsoft.Json.Converters; diff --git a/NewHorizons/External/Modules/VariableSize/WaterModule.cs b/NewHorizons/External/Modules/VariableSize/WaterModule.cs index 5180c02d..03617034 100644 --- a/NewHorizons/External/Modules/VariableSize/WaterModule.cs +++ b/NewHorizons/External/Modules/VariableSize/WaterModule.cs @@ -1,4 +1,4 @@ -using NewHorizons.Utility; +using NewHorizons.External.Modules.SerializableData; using Newtonsoft.Json; using System.ComponentModel; diff --git a/NewHorizons/External/Modules/Volumes/VolumeInfos/VolumeInfo.cs b/NewHorizons/External/Modules/Volumes/VolumeInfos/VolumeInfo.cs index 8016c7d3..7b106614 100644 --- a/NewHorizons/External/Modules/Volumes/VolumeInfos/VolumeInfo.cs +++ b/NewHorizons/External/Modules/Volumes/VolumeInfos/VolumeInfo.cs @@ -1,9 +1,5 @@ -using NewHorizons.External.Modules.Audio; using Newtonsoft.Json; -using Newtonsoft.Json.Converters; using System.ComponentModel; -using System.ComponentModel.DataAnnotations; -using System.Runtime.Serialization; namespace NewHorizons.External.Modules.Volumes.VolumeInfos { diff --git a/NewHorizons/Utility/NewHorizonBody.cs b/NewHorizons/External/NewHorizonBody.cs similarity index 81% rename from NewHorizons/Utility/NewHorizonBody.cs rename to NewHorizons/External/NewHorizonBody.cs index 2c8328f2..fa80de75 100644 --- a/NewHorizons/Utility/NewHorizonBody.cs +++ b/NewHorizons/External/NewHorizonBody.cs @@ -1,9 +1,12 @@ using NewHorizons.External.Configs; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OWML; using OWML.Common; using System; using System.Linq; using UnityEngine; -namespace NewHorizons.Utility + +namespace NewHorizons.External { public class NewHorizonsBody { @@ -18,7 +21,7 @@ namespace NewHorizons.Utility public PlanetConfig Config; public IModBehaviour Mod; - public Cache Cache; + public NHCache Cache; public string RelativePath; public GameObject Object; @@ -26,26 +29,26 @@ namespace NewHorizons.Utility #region Cache public void LoadCache() { - if (RelativePath == null) + if (RelativePath == null) { return; } - try + try { var pathWithoutExtension = RelativePath.Substring(0, RelativePath.LastIndexOf('.')); - Cache = new Cache(Mod, pathWithoutExtension+".nhcache"); - } - catch (Exception e) - { - Logger.LogError("Cache failed to load: " + e.Message); + Cache = new NHCache(Mod, pathWithoutExtension + ".nhcache"); + } + catch (Exception e) + { + NHLogger.LogError("Cache failed to load: " + e.Message); Cache = null; } } - public void UnloadCache(bool writeBeforeUnload=false) + public void UnloadCache(bool writeBeforeUnload = false) { - if (writeBeforeUnload) + if (writeBeforeUnload) { Cache?.ClearUnaccessed(); Cache?.WriteToFile(); diff --git a/NewHorizons/External/NewHorizonsData.cs b/NewHorizons/External/NewHorizonsData.cs index 18de7b8b..60fdcd01 100644 --- a/NewHorizons/External/NewHorizonsData.cs +++ b/NewHorizons/External/NewHorizonsData.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using NewHorizons.Utility; +using NewHorizons.Utility.OWML; namespace NewHorizons.External { @@ -23,7 +23,7 @@ namespace NewHorizons.External _activeProfileName = GetProfileName(); if (_activeProfileName == null) { - Logger.LogWarning("Couldn't find active profile, are you on Gamepass?"); + NHLogger.LogWarning("Couldn't find active profile, are you on Gamepass?"); _activeProfileName = "XboxGamepassDefaultProfile"; } @@ -33,22 +33,22 @@ namespace NewHorizons.External if (!_saveFile.Profiles.ContainsKey(_activeProfileName)) _saveFile.Profiles.Add(_activeProfileName, new NewHorizonsProfile()); _activeProfile = _saveFile.Profiles[_activeProfileName]; - Logger.LogVerbose($"Loaded save data for {_activeProfileName}"); + NHLogger.LogVerbose($"Loaded save data for {_activeProfileName}"); } catch (Exception) { try { - Logger.LogVerbose($"Couldn't load save data from {FileName}, creating a new file"); + NHLogger.LogVerbose($"Couldn't load save data from {FileName}, creating a new file"); _saveFile = new NewHorizonsSaveFile(); _saveFile.Profiles.Add(_activeProfileName, new NewHorizonsProfile()); _activeProfile = _saveFile.Profiles[_activeProfileName]; Main.Instance.ModHelper.Storage.Save(_saveFile, FileName); - Logger.LogVerbose($"Loaded save data for {_activeProfileName}"); + NHLogger.LogVerbose($"Loaded save data for {_activeProfileName}"); } catch (Exception e) { - Logger.LogError($"Couldn't create save data:\n{e}"); + NHLogger.LogError($"Couldn't create save data:\n{e}"); } } } @@ -67,7 +67,7 @@ namespace NewHorizons.External } catch (Exception ex) { - Logger.LogError($"Couldn't save data:\n{ex}"); + NHLogger.LogError($"Couldn't save data:\n{ex}"); } } } @@ -75,7 +75,7 @@ namespace NewHorizons.External public static void Reset() { if (_saveFile == null || _activeProfile == null) Load(); - Logger.LogVerbose($"Resetting save data for {_activeProfileName}"); + NHLogger.LogVerbose($"Resetting save data for {_activeProfileName}"); _activeProfile = new NewHorizonsProfile(); _saveFile.Profiles[_activeProfileName] = _activeProfile; diff --git a/NewHorizons/Utility/NewHorizonsSystem.cs b/NewHorizons/External/NewHorizonsSystem.cs similarity index 95% rename from NewHorizons/Utility/NewHorizonsSystem.cs rename to NewHorizons/External/NewHorizonsSystem.cs index 75fdcd9e..0724a027 100644 --- a/NewHorizons/Utility/NewHorizonsSystem.cs +++ b/NewHorizons/External/NewHorizonsSystem.cs @@ -2,7 +2,7 @@ using NewHorizons.External.Configs; using NewHorizons.External.Modules; using OWML.Common; -namespace NewHorizons.Utility +namespace NewHorizons.External { public class NewHorizonsSystem { diff --git a/NewHorizons/Utility/MColor.cs b/NewHorizons/External/SerializableData/MColor.cs similarity index 93% rename from NewHorizons/Utility/MColor.cs rename to NewHorizons/External/SerializableData/MColor.cs index 4ead13de..b1d07e98 100644 --- a/NewHorizons/Utility/MColor.cs +++ b/NewHorizons/External/SerializableData/MColor.cs @@ -1,7 +1,7 @@ using System.ComponentModel; using Newtonsoft.Json; using UnityEngine; -namespace NewHorizons.Utility +namespace NewHorizons.External.Modules.SerializableData { [JsonObject] public class MColor @@ -17,25 +17,25 @@ namespace NewHorizons.Utility /// /// The red component of this colour from 0-255, higher values will make the colour glow if applicable. /// - [System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)] + [System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)] public int r; /// /// The green component of this colour from 0-255, higher values will make the colour glow if applicable. /// - [System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)] + [System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)] public int g; /// /// The blue component of this colour from 0-255, higher values will make the colour glow if applicable. /// - [System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)] + [System.ComponentModel.DataAnnotations.Range(0, int.MaxValue)] public int b; - + /// /// The alpha (opacity) component of this colour /// - [System.ComponentModel.DataAnnotations.Range(0, 255)] + [System.ComponentModel.DataAnnotations.Range(0, 255)] [DefaultValue(255)] public int a = 255; diff --git a/NewHorizons/Utility/MGradient.cs b/NewHorizons/External/SerializableData/MGradient.cs similarity index 73% rename from NewHorizons/Utility/MGradient.cs rename to NewHorizons/External/SerializableData/MGradient.cs index f142881e..ac6825ce 100644 --- a/NewHorizons/Utility/MGradient.cs +++ b/NewHorizons/External/SerializableData/MGradient.cs @@ -1,13 +1,13 @@ using Newtonsoft.Json; -namespace NewHorizons.Utility +namespace NewHorizons.External.Modules.SerializableData { [JsonObject] public class MGradient { public MGradient(float time, MColor tint) { - this.time = time; + this.time = time; this.tint = tint; } diff --git a/NewHorizons/Utility/MMesh.cs b/NewHorizons/External/SerializableData/MMesh.cs similarity index 79% rename from NewHorizons/Utility/MMesh.cs rename to NewHorizons/External/SerializableData/MMesh.cs index 2fb28193..95abd1bb 100644 --- a/NewHorizons/Utility/MMesh.cs +++ b/NewHorizons/External/SerializableData/MMesh.cs @@ -1,18 +1,18 @@ using System.Linq; using Newtonsoft.Json; using UnityEngine; -namespace NewHorizons.Utility +namespace NewHorizons.External.Modules.SerializableData { [JsonObject] public class MMesh { public MMesh(MVector3[] vertices, int[] triangles, MVector3[] normals, MVector2[] uv, MVector2[] uv2) { - this.vertices = vertices; - this.triangles = triangles; - this.normals = normals; - this.uv = uv; - this.uv2 = uv2; + this.vertices = vertices; + this.triangles = triangles; + this.normals = normals; + this.uv = uv; + this.uv2 = uv2; } public MVector3[] vertices; @@ -20,15 +20,15 @@ namespace NewHorizons.Utility public MVector3[] normals; public MVector2[] uv; public MVector2[] uv2; - + public static implicit operator MMesh(Mesh mesh) { return new MMesh ( - mesh.vertices.Select(v => (MVector3)v).ToArray(), - mesh.triangles, - mesh.normals.Select(v => (MVector3)v).ToArray(), - mesh.uv.Select(v => (MVector2)v).ToArray(), + mesh.vertices.Select(v => (MVector3)v).ToArray(), + mesh.triangles, + mesh.normals.Select(v => (MVector3)v).ToArray(), + mesh.uv.Select(v => (MVector2)v).ToArray(), mesh.uv2.Select(v => (MVector2)v).ToArray() ); } diff --git a/NewHorizons/Utility/MVector2.cs b/NewHorizons/External/SerializableData/MVector2.cs similarity index 90% rename from NewHorizons/Utility/MVector2.cs rename to NewHorizons/External/SerializableData/MVector2.cs index 1cc25605..abcceb29 100644 --- a/NewHorizons/Utility/MVector2.cs +++ b/NewHorizons/External/SerializableData/MVector2.cs @@ -5,7 +5,7 @@ using UnityEngine; #endregion -namespace NewHorizons.Utility +namespace NewHorizons.External.Modules.SerializableData { [JsonObject] public class MVector2 diff --git a/NewHorizons/Utility/MVector3.cs b/NewHorizons/External/SerializableData/MVector3.cs similarity index 91% rename from NewHorizons/Utility/MVector3.cs rename to NewHorizons/External/SerializableData/MVector3.cs index 6369dd44..62c81d9e 100644 --- a/NewHorizons/Utility/MVector3.cs +++ b/NewHorizons/External/SerializableData/MVector3.cs @@ -1,6 +1,6 @@ using Newtonsoft.Json; using UnityEngine; -namespace NewHorizons.Utility +namespace NewHorizons.External.Modules.SerializableData { [JsonObject] public class MVector3 diff --git a/NewHorizons/External/Modules/SerializableEnums/NHAudioMixerTrackName.cs b/NewHorizons/External/SerializableEnums/NHAudioMixerTrackName.cs similarity index 100% rename from NewHorizons/External/Modules/SerializableEnums/NHAudioMixerTrackName.cs rename to NewHorizons/External/SerializableEnums/NHAudioMixerTrackName.cs diff --git a/NewHorizons/External/Modules/SerializableEnums/NHClipSelectionType.cs b/NewHorizons/External/SerializableEnums/NHClipSelectionType.cs similarity index 100% rename from NewHorizons/External/Modules/SerializableEnums/NHClipSelectionType.cs rename to NewHorizons/External/SerializableEnums/NHClipSelectionType.cs diff --git a/NewHorizons/External/Modules/SerializableEnums/NHCreditsType.cs b/NewHorizons/External/SerializableEnums/NHCreditsType.cs similarity index 100% rename from NewHorizons/External/Modules/SerializableEnums/NHCreditsType.cs rename to NewHorizons/External/SerializableEnums/NHCreditsType.cs diff --git a/NewHorizons/External/Modules/SerializableEnums/NHDeathType.cs b/NewHorizons/External/SerializableEnums/NHDeathType.cs similarity index 100% rename from NewHorizons/External/Modules/SerializableEnums/NHDeathType.cs rename to NewHorizons/External/SerializableEnums/NHDeathType.cs diff --git a/NewHorizons/External/Modules/SerializableEnums/NHFluidType.cs b/NewHorizons/External/SerializableEnums/NHFluidType.cs similarity index 100% rename from NewHorizons/External/Modules/SerializableEnums/NHFluidType.cs rename to NewHorizons/External/SerializableEnums/NHFluidType.cs diff --git a/NewHorizons/Handlers/AudioTypeHandler.cs b/NewHorizons/Handlers/AudioTypeHandler.cs index db7c784b..9d25bb7e 100644 --- a/NewHorizons/Handlers/AudioTypeHandler.cs +++ b/NewHorizons/Handlers/AudioTypeHandler.cs @@ -1,5 +1,5 @@ -using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OWML; using OWML.Common; using OWML.Utils; using System; @@ -7,7 +7,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Handlers { @@ -29,7 +29,7 @@ namespace NewHorizons.Handlers private static void PostInit() { - Logger.LogVerbose($"Adding all custom AudioTypes to the library"); + NHLogger.LogVerbose($"Adding all custom AudioTypes to the library"); var library = Locator.GetAudioManager()._libraryAsset; var audioEntries = library.audioEntries; // store previous array @@ -54,7 +54,7 @@ namespace NewHorizons.Handlers } catch (Exception e) { - Logger.LogError($"Couldn't load AudioType:\n{e}"); + NHLogger.LogError($"Couldn't load AudioType:\n{e}"); return AudioType.None; } } @@ -71,7 +71,7 @@ namespace NewHorizons.Handlers if (audioClip == null) { - Logger.LogError($"Couldn't create audioType for {audioPath}"); + NHLogger.LogError($"Couldn't create audioType for {audioPath}"); return AudioType.None; } @@ -81,7 +81,7 @@ namespace NewHorizons.Handlers // Create a custom audio type from a set of audio clips. Needs a unique ID public static AudioType AddCustomAudioType(string id, AudioClip[] audioClips) { - Logger.LogVerbose($"Registering new audio type [{id}]"); + NHLogger.LogVerbose($"Registering new audio type [{id}]"); var audioType = EnumUtilities.Create(id); diff --git a/NewHorizons/Handlers/CreditsHandler.cs b/NewHorizons/Handlers/CreditsHandler.cs index 4c45b07a..b361555c 100644 --- a/NewHorizons/Handlers/CreditsHandler.cs +++ b/NewHorizons/Handlers/CreditsHandler.cs @@ -1,7 +1,7 @@ +using NewHorizons.Utility.OWML; using System.Collections.Generic; using System.Xml; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Handlers { @@ -13,14 +13,14 @@ namespace NewHorizons.Handlers { if (_creditsInfo == null) _creditsInfo = new(); - Logger.LogVerbose($"Registering credits for {sectionName}"); + NHLogger.LogVerbose($"Registering credits for {sectionName}"); _creditsInfo[sectionName] = entries; } public static void AddCredits(Credits credits) { - Logger.LogVerbose($"Adding to credits"); + NHLogger.LogVerbose($"Adding to credits"); var creditsAsset = credits._creditsAsset; diff --git a/NewHorizons/Handlers/EyeSceneHandler.cs b/NewHorizons/Handlers/EyeSceneHandler.cs index 3b2e2a1a..b19cae29 100644 --- a/NewHorizons/Handlers/EyeSceneHandler.cs +++ b/NewHorizons/Handlers/EyeSceneHandler.cs @@ -1,6 +1,7 @@ using NewHorizons.Builder.General; using NewHorizons.Components; using NewHorizons.Components.Stars; +using NewHorizons.External.Modules.SerializableData; using NewHorizons.Utility; using UnityEngine; diff --git a/NewHorizons/Handlers/PlanetCreationHandler.cs b/NewHorizons/Handlers/PlanetCreationHandler.cs index c6dd25dc..db6f8f22 100644 --- a/NewHorizons/Handlers/PlanetCreationHandler.cs +++ b/NewHorizons/Handlers/PlanetCreationHandler.cs @@ -7,15 +7,16 @@ using NewHorizons.Builder.Volumes; using NewHorizons.Components.Orbital; using NewHorizons.Components.Quantum; using NewHorizons.Components.Stars; +using NewHorizons.External; using NewHorizons.OtherMods.OWRichPresence; using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OWML; +using NewHorizons.Utility.OuterWilds; using System; using System.Collections.Generic; using System.Linq; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Handlers { @@ -115,7 +116,7 @@ namespace NewHorizons.Handlers LoadBody(body); } - Logger.Log("Loading Deferred Bodies"); + NHLogger.Log("Loading Deferred Bodies"); // Make a copy of the next pass of bodies so that the array can be edited while we load them toLoad = _nextPassBodies.ToList(); @@ -129,7 +130,7 @@ namespace NewHorizons.Handlers _nextPassBodies = new List(); } - Logger.Log("Done loading bodies"); + NHLogger.Log("Done loading bodies"); SingularityBuilder.PairAllSingularities(); @@ -150,7 +151,7 @@ namespace NewHorizons.Handlers } catch (Exception) { - if (body?.Config?.name == null) Logger.LogError($"How is there no name for {body}"); + if (body?.Config?.name == null) NHLogger.LogError($"How is there no name for {body}"); else existingPlanet = SearchUtilities.Find(body.Config.name.Replace(" ", "") + "_Body", false); } @@ -207,7 +208,7 @@ namespace NewHorizons.Handlers } catch (Exception ex) { - Logger.LogError($"Couldn't make quantum state for [{body.Config.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't make quantum state for [{body.Config.name}]:\n{ex}"); body.UnloadCache(); return false; } @@ -223,7 +224,7 @@ namespace NewHorizons.Handlers } catch (Exception e) { - Logger.LogError($"Couldn't update body {body.Config?.name}:\n{e}"); + NHLogger.LogError($"Couldn't update body {body.Config?.name}:\n{e}"); body.UnloadCache(); return false; } @@ -243,7 +244,7 @@ namespace NewHorizons.Handlers { try { - Logger.Log($"Creating [{body.Config.name}]"); + NHLogger.Log($"Creating [{body.Config.name}]"); var planetObject = GenerateBody(body, defaultPrimaryToSun); planetObject?.SetActive(true); if (planetObject == null) @@ -261,7 +262,7 @@ namespace NewHorizons.Handlers } catch (Exception e) { - Logger.LogError($"Couldn't generate body {body.Config?.name}:\n{e}"); + NHLogger.LogError($"Couldn't generate body {body.Config?.name}:\n{e}"); body.UnloadCache(); return false; } @@ -274,7 +275,7 @@ namespace NewHorizons.Handlers } catch (Exception e) { - Logger.LogError($"Error in event handler for OnPlanetLoaded on body {body.Config.name}: {e}"); + NHLogger.LogError($"Error in event handler for OnPlanetLoaded on body {body.Config.name}: {e}"); } body.UnloadCache(true); @@ -303,7 +304,7 @@ namespace NewHorizons.Handlers // Called when updating an existing planet public static GameObject UpdateBody(NewHorizonsBody body, GameObject go) { - Logger.Log($"Updating existing Object {go.name}"); + NHLogger.Log($"Updating existing Object {go.name}"); var rb = go.GetAttachedOWRigidbody(); var sector = go.GetComponentInChildren() ?? CreateSectorFromParent(go, rb); @@ -358,7 +359,7 @@ namespace NewHorizons.Handlers // Now that we're done move the planet into place SetPositionFromVector(go, body.Config.Orbit.staticPosition); - Logger.LogVerbose($"Finished creating Bramble Dimension [{body.Config.name}]"); + NHLogger.LogVerbose($"Finished creating Bramble Dimension [{body.Config.name}]"); return go; } @@ -376,7 +377,7 @@ namespace NewHorizons.Handlers { if (defaultPrimaryToSun) { - Logger.LogError($"Couldn't find {body.Config.Orbit.primaryBody}, defaulting to center of solar system"); + NHLogger.LogError($"Couldn't find {body.Config.Orbit.primaryBody}, defaulting to center of solar system"); primaryBody = Locator.GetCenterOfTheUniverse().GetAttachedOWRigidbody().GetComponent(); } else @@ -455,7 +456,7 @@ namespace NewHorizons.Handlers // Spawning on other planets is a bit hacky so we do it last if (body.Config.Spawn != null) { - Logger.LogVerbose("Making spawn point"); + NHLogger.LogVerbose("Making spawn point"); var spawnPoint = SpawnPointBuilder.Make(go, body.Config.Spawn, owRigidBody); if (Main.SystemDict[body.Config.starSystem].SpawnPoint == null || (body.Config.Spawn.playerSpawn?.isDefault ?? false)) { @@ -486,7 +487,7 @@ namespace NewHorizons.Handlers RichPresenceHandler.SetUpPlanet(body.Config.name, go, sector, body.Config.Star != null, body.Config.Atmosphere != null); - Logger.LogVerbose($"Finished creating [{body.Config.name}]"); + NHLogger.LogVerbose($"Finished creating [{body.Config.name}]"); return go; } @@ -679,7 +680,7 @@ namespace NewHorizons.Handlers public static void UpdateBodyOrbit(NewHorizonsBody body, GameObject go) { - Logger.Log($"Updating orbit of [{body.Config.name}]"); + NHLogger.Log($"Updating orbit of [{body.Config.name}]"); try { @@ -785,7 +786,7 @@ namespace NewHorizons.Handlers } catch (Exception ex) { - Logger.LogError($"Couldn't update orbit of [{body.Config.name}]:\n{ex}"); + NHLogger.LogError($"Couldn't update orbit of [{body.Config.name}]:\n{ex}"); // If it doesn't work here there's no point trying again so we'll still return true } @@ -794,7 +795,7 @@ namespace NewHorizons.Handlers public static void UpdatePosition(GameObject go, IOrbitalParameters orbit, AstroObject primaryBody, AstroObject secondaryBody) { - Logger.LogVerbose($"Placing [{secondaryBody?.name}] around [{primaryBody?.name}]"); + NHLogger.LogVerbose($"Placing [{secondaryBody?.name}] around [{primaryBody?.name}]"); if (primaryBody != null) { @@ -863,7 +864,7 @@ namespace NewHorizons.Handlers Delay.FireInNUpdates(() => childObj.gameObject.SetActive(false), 2); } - if (flag) Logger.LogWarning($"Couldn't find \"{childPath}\"."); + if (flag) NHLogger.LogWarning($"Couldn't find \"{childPath}\"."); } } } diff --git a/NewHorizons/Handlers/PlanetDestructionHandler.cs b/NewHorizons/Handlers/PlanetDestructionHandler.cs index fe895b4f..038c7a8b 100644 --- a/NewHorizons/Handlers/PlanetDestructionHandler.cs +++ b/NewHorizons/Handlers/PlanetDestructionHandler.cs @@ -1,12 +1,12 @@ using NewHorizons.Components.Stars; using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OWML; +using NewHorizons.Utility.OuterWilds; using System; using System.Collections.Generic; using System.Linq; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Handlers { public static class PlanetDestructionHandler @@ -62,7 +62,7 @@ namespace NewHorizons.Handlers { var ao = AstroObjectLocator.GetAstroObject(name); if (ao != null) Delay.FireInNUpdates(() => RemoveBody(ao, false), 2); - else Logger.LogError($"Couldn't find [{name}]"); + else NHLogger.LogError($"Couldn't find [{name}]"); } // Bring the sun back because why not @@ -75,17 +75,17 @@ namespace NewHorizons.Handlers { var ao = AstroObjectLocator.GetAstroObject(name); if (ao != null) Delay.FireInNUpdates(() => RemoveBody(ao, false), 2); - else Logger.LogError($"Couldn't find [{name}]"); + else NHLogger.LogError($"Couldn't find [{name}]"); } } public static void RemoveBody(AstroObject ao, bool delete = false, List toDestroy = null) { - Logger.LogVerbose($"Removing [{ao.name}]"); + NHLogger.LogVerbose($"Removing [{ao.name}]"); if (ao.gameObject == null || !ao.gameObject.activeInHierarchy) { - Logger.LogVerbose($"[{ao.name}] was already removed"); + NHLogger.LogVerbose($"[{ao.name}] was already removed"); return; } @@ -93,7 +93,7 @@ namespace NewHorizons.Handlers if (toDestroy.Contains(ao)) { - Logger.LogVerbose($"Possible infinite recursion in RemoveBody: {ao.name} might be it's own primary body?"); + NHLogger.LogVerbose($"Possible infinite recursion in RemoveBody: {ao.name} might be it's own primary body?"); return; } @@ -163,7 +163,7 @@ namespace NewHorizons.Handlers foreach (var sunProxy in GameObject.FindObjectsOfType()) { - Logger.LogVerbose($"Destroying SunProxy {sunProxy.gameObject.name}"); + NHLogger.LogVerbose($"Destroying SunProxy {sunProxy.gameObject.name}"); GameObject.Destroy(sunProxy.gameObject); } @@ -173,12 +173,12 @@ namespace NewHorizons.Handlers } // Always delete the children - Logger.LogVerbose($"Removing Children of [{ao._name}], [{ao._customName}]"); + NHLogger.LogVerbose($"Removing Children of [{ao._name}], [{ao._customName}]"); foreach (var child in AstroObjectLocator.GetChildren(ao)) { if (child == null) continue; - Logger.LogVerbose($"Removing child [{child.name}] of [{ao._name}]"); + NHLogger.LogVerbose($"Removing child [{child.name}] of [{ao._name}]"); // Ship starts as a child of TH but obvious we want to keep that if (child.name == "Ship_Body") continue; @@ -199,7 +199,7 @@ namespace NewHorizons.Handlers } catch (Exception e) { - Logger.LogError($"Exception thrown when trying to delete bodies related to [{ao.name}]:\n{e}"); + NHLogger.LogError($"Exception thrown when trying to delete bodies related to [{ao.name}]:\n{e}"); } // Deal with proxies @@ -245,7 +245,7 @@ namespace NewHorizons.Handlers { if (go == null) return; - Logger.LogVerbose($"Removing [{go.name}]"); + NHLogger.LogVerbose($"Removing [{go.name}]"); OWRigidbody rigidbody = go.GetComponent(); if (rigidbody != null) @@ -298,7 +298,7 @@ namespace NewHorizons.Handlers if (distantProxyClone != null) GameObject.Destroy(distantProxyClone.gameObject); if (distantProxy == null && distantProxyClone == null) - Logger.LogVerbose($"Couldn't find proxy for {name}"); + NHLogger.LogVerbose($"Couldn't find proxy for {name}"); } } } diff --git a/NewHorizons/Handlers/PlanetGraphHandler.cs b/NewHorizons/Handlers/PlanetGraphHandler.cs index 126f5801..e58688a2 100644 --- a/NewHorizons/Handlers/PlanetGraphHandler.cs +++ b/NewHorizons/Handlers/PlanetGraphHandler.cs @@ -1,11 +1,12 @@ +using NewHorizons.External; using NewHorizons.External.Configs; -using NewHorizons.Utility; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; +using NewHorizons.Utility.OWML; using System; using System.Collections; using System.Collections.Generic; using System.Linq; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Handlers { public class PlanetGraphHandler : IEnumerable @@ -49,7 +50,7 @@ namespace NewHorizons.Handlers } else { - Logger.LogError($"There must be one and only one centerOfSolarSystem! Found [{centers.Length}]"); + NHLogger.LogError($"There must be one and only one centerOfSolarSystem! Found [{centers.Length}]"); } } } @@ -116,7 +117,7 @@ namespace NewHorizons.Handlers foreach (var node in nodeDict.Values.ToList()) { var childrenString = String.Join(", ", node.children.Select(x => x?.body?.Config?.name).ToList()); - Logger.LogVerbose($"NODE: [{node?.body?.Config?.name}], [{node?.parent?.body?.Config?.name}], [{childrenString}]"); + NHLogger.LogVerbose($"NODE: [{node?.body?.Config?.name}], [{node?.parent?.body?.Config?.name}], [{childrenString}]"); } // Return all tree roots (no parents) diff --git a/NewHorizons/Handlers/RemoteHandler.cs b/NewHorizons/Handlers/RemoteHandler.cs index b6cd4ebe..28c52e9b 100644 --- a/NewHorizons/Handlers/RemoteHandler.cs +++ b/NewHorizons/Handlers/RemoteHandler.cs @@ -1,8 +1,8 @@ -using NewHorizons.Utility.OWMLUtilities; +using NewHorizons.Utility.OWML; using OWML.Utils; using System; using System.Collections.Generic; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Handlers { @@ -49,14 +49,14 @@ namespace NewHorizons.Handlers } catch (Exception e) { - Logger.LogError($"Couldn't load platform id [{id}]:\n{e}"); + NHLogger.LogError($"Couldn't load platform id [{id}]:\n{e}"); return NomaiRemoteCameraPlatform.ID.None; } } public static NomaiRemoteCameraPlatform.ID AddCustomPlatformID(string id) { - Logger.LogVerbose($"Registering new platform id [{id}]"); + NHLogger.LogVerbose($"Registering new platform id [{id}]"); var platformID = EnumUtilities.Create(id); diff --git a/NewHorizons/Handlers/ShipLogHandler.cs b/NewHorizons/Handlers/ShipLogHandler.cs index 8618e0cf..84cbb203 100644 --- a/NewHorizons/Handlers/ShipLogHandler.cs +++ b/NewHorizons/Handlers/ShipLogHandler.cs @@ -1,9 +1,11 @@ +using NewHorizons.External; using NewHorizons.Utility; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; +using NewHorizons.Utility.OWML; using System.Collections.Generic; using System.Linq; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Handlers { public static class ShipLogHandler @@ -71,7 +73,7 @@ namespace NewHorizons.Handlers if (_entryIDsToNHBody.ContainsKey(entryID)) return _entryIDsToNHBody[entryID]; else { - Logger.LogError($"Couldn't find NewHorizonsBody that corresponds to {entryID}"); + NHLogger.LogError($"Couldn't find NewHorizonsBody that corresponds to {entryID}"); return null; } } @@ -85,17 +87,17 @@ namespace NewHorizons.Handlers { // Nice to be able to just get the AstroID from the body if (!_nhBodyToEntryIDs.ContainsKey(body)) _nhBodyToEntryIDs.Add(body, entryIDs); - else Logger.LogWarning($"Possible duplicate shiplog entry {body.Config.name}"); + else NHLogger.LogWarning($"Possible duplicate shiplog entry {body.Config.name}"); // AstroID if (!_nhBodyToAstroIDs.ContainsKey(body)) _nhBodyToAstroIDs.Add(body, astroID); - else Logger.LogWarning($"Possible duplicate shiplog entry {astroID} for {body.Config.name}"); + else NHLogger.LogWarning($"Possible duplicate shiplog entry {astroID} for {body.Config.name}"); // EntryID to Body foreach (var entryID in entryIDs) { if (!_entryIDsToNHBody.ContainsKey(entryID)) _entryIDsToNHBody.Add(entryID, body); - else Logger.LogWarning($"Possible duplicate shiplog entry {entryID} for {astroID} from NewHorizonsBody {body.Config.name}"); + else NHLogger.LogWarning($"Possible duplicate shiplog entry {entryID} for {astroID} from NewHorizonsBody {body.Config.name}"); } } diff --git a/NewHorizons/Handlers/StarChartHandler.cs b/NewHorizons/Handlers/StarChartHandler.cs index 65ae3515..9acaf8ff 100644 --- a/NewHorizons/Handlers/StarChartHandler.cs +++ b/NewHorizons/Handlers/StarChartHandler.cs @@ -1,9 +1,11 @@ using NewHorizons.Components.ShipLog; -using NewHorizons.Utility; -using System.Collections.Generic; +using NewHorizons.External; using NewHorizons.OtherMods.CustomShipLogModes; +using NewHorizons.Utility; +using NewHorizons.Utility.OWML; +using System.Collections.Generic; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; + namespace NewHorizons.Handlers { public static class StarChartHandler @@ -91,7 +93,7 @@ namespace NewHorizons.Handlers { if (_factIDToStarSystem.TryGetValue(factID, out var systemUnlocked)) { - Logger.Log($"Just learned [{factID}] and unlocked [{systemUnlocked}]"); + NHLogger.Log($"Just learned [{factID}] and unlocked [{systemUnlocked}]"); if (!Main.HasWarpDrive) Main.Instance.EnableWarpDrive(); if (ShipLogStarChartMode != null) @@ -101,7 +103,7 @@ namespace NewHorizons.Handlers public static void RegisterFactForSystem(string factID, string system) { - Logger.LogVerbose($"Need to know [{factID}] to unlock [{system}]"); + NHLogger.LogVerbose($"Need to know [{factID}] to unlock [{system}]"); _starSystemToFactID.Add(system, factID); _factIDToStarSystem.Add(factID, system); } diff --git a/NewHorizons/Handlers/SubtitlesHandler.cs b/NewHorizons/Handlers/SubtitlesHandler.cs index 6939b6f4..fc4bfe94 100644 --- a/NewHorizons/Handlers/SubtitlesHandler.cs +++ b/NewHorizons/Handlers/SubtitlesHandler.cs @@ -1,11 +1,11 @@ +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OWML; +using OWML.Common; using System.Collections.Generic; using System.IO; using System.Linq; using UnityEngine; using UnityEngine.UI; -using OWML.Common; -using Logger = NewHorizons.Utility.Logger; -using NewHorizons.Utility; namespace NewHorizons.Handlers { @@ -69,7 +69,7 @@ namespace NewHorizons.Handlers public void AddSubtitle(IModBehaviour mod, string filepath) { - Logger.Log($"Adding subtitle for {mod.ModHelper.Manifest.Name}"); + NHLogger.Log($"Adding subtitle for {mod.ModHelper.Manifest.Name}"); var tex = ImageUtilities.GetTexture(mod, filepath, false); if (tex == null) return; diff --git a/NewHorizons/Handlers/SystemCreationHandler.cs b/NewHorizons/Handlers/SystemCreationHandler.cs index 22df1250..d0c576f9 100644 --- a/NewHorizons/Handlers/SystemCreationHandler.cs +++ b/NewHorizons/Handlers/SystemCreationHandler.cs @@ -1,8 +1,10 @@ using NewHorizons.Builder.StarSystem; using NewHorizons.Components; +using NewHorizons.External; using NewHorizons.Utility; -using NewHorizons.Utility.OWMLUtilities; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OWML; +using NewHorizons.Utility.OuterWilds; using UnityEngine; using Object = UnityEngine.Object; namespace NewHorizons.Handlers diff --git a/NewHorizons/Handlers/TitleSceneHandler.cs b/NewHorizons/Handlers/TitleSceneHandler.cs index 0a479fec..be0249bb 100644 --- a/NewHorizons/Handlers/TitleSceneHandler.cs +++ b/NewHorizons/Handlers/TitleSceneHandler.cs @@ -1,10 +1,11 @@ using NewHorizons.Builder.Body; +using NewHorizons.External; using NewHorizons.External.Modules; using NewHorizons.Utility; +using NewHorizons.Utility.OWML; using System.Collections.Generic; using System.Linq; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Handlers { @@ -16,7 +17,7 @@ namespace NewHorizons.Handlers if (subtitleContainer == null) { - Logger.LogError("No subtitle container found! Failed to load subtitles."); + NHLogger.LogError("No subtitle container found! Failed to load subtitles."); return; } @@ -35,7 +36,7 @@ namespace NewHorizons.Handlers var selectionCount = Mathf.Min(eligibleCount, 3); var indices = RandomUtility.GetUniqueRandomArray(0, eligible.Count(), selectionCount); - Logger.LogVerbose($"Displaying {selectionCount} bodies on the title screen"); + NHLogger.LogVerbose($"Displaying {selectionCount} bodies on the title screen"); GameObject body1, body2, body3; @@ -75,7 +76,7 @@ namespace NewHorizons.Handlers private static GameObject LoadTitleScreenBody(NewHorizonsBody body) { - Logger.LogVerbose($"Displaying {body.Config.name} on the title screen"); + NHLogger.LogVerbose($"Displaying {body.Config.name} on the title screen"); var titleScreenGO = new GameObject(body.Config.name + "_TitleScreen"); var maxSize = -1f; diff --git a/NewHorizons/Handlers/TranslationHandler.cs b/NewHorizons/Handlers/TranslationHandler.cs index b9cc7735..3447c725 100644 --- a/NewHorizons/Handlers/TranslationHandler.cs +++ b/NewHorizons/Handlers/TranslationHandler.cs @@ -1,8 +1,8 @@ using NewHorizons.External.Configs; +using NewHorizons.Utility.OWML; using System; using System.Collections.Generic; using System.Linq; -using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Handlers { @@ -38,7 +38,7 @@ namespace NewHorizons.Handlers dictionary = _uiTranslationDictionary; break; default: - if (warn) Logger.LogVerbose($"Invalid TextType {type}"); + if (warn) NHLogger.LogVerbose($"Invalid TextType {type}"); return text; } @@ -47,14 +47,14 @@ namespace NewHorizons.Handlers if (table.TryGetValue(text, out var translatedText)) return translatedText; - if (warn) Logger.LogVerbose($"Defaulting to english for {text}"); + if (warn) NHLogger.LogVerbose($"Defaulting to english for {text}"); // Try to default to English if (dictionary.TryGetValue(TextTranslation.Language.ENGLISH, out var englishTable)) if (englishTable.TryGetValue(text, out var englishText)) return englishText; - if (warn) Logger.LogVerbose($"Defaulting to key for {text}"); + if (warn) NHLogger.LogVerbose($"Defaulting to key for {text}"); // Default to the key return text; diff --git a/NewHorizons/Handlers/VesselCoordinatePromptHandler.cs b/NewHorizons/Handlers/VesselCoordinatePromptHandler.cs index e5cdbfe3..496b834a 100644 --- a/NewHorizons/Handlers/VesselCoordinatePromptHandler.cs +++ b/NewHorizons/Handlers/VesselCoordinatePromptHandler.cs @@ -1,5 +1,5 @@ using NewHorizons.Components.ShipLog; -using NewHorizons.Utility; +using NewHorizons.External; using System; using System.Collections.Generic; using System.Linq; diff --git a/NewHorizons/Handlers/VesselWarpHandler.cs b/NewHorizons/Handlers/VesselWarpHandler.cs index cfb09dbf..935c4399 100644 --- a/NewHorizons/Handlers/VesselWarpHandler.cs +++ b/NewHorizons/Handlers/VesselWarpHandler.cs @@ -1,11 +1,11 @@ using UnityEngine; using NewHorizons.Components; using NewHorizons.Utility; -using Logger = NewHorizons.Utility.Logger; + using static NewHorizons.Main; using NewHorizons.Builder.Props; -using NewHorizons.Utility.OWMLUtilities; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OWML; +using NewHorizons.Utility.OuterWilds; namespace NewHorizons.Handlers { @@ -84,10 +84,10 @@ namespace NewHorizons.Handlers { var system = SystemDict[Instance.CurrentStarSystem]; - Logger.LogVerbose("Checking for Vessel Prefab"); + NHLogger.LogVerbose("Checking for Vessel Prefab"); if (VesselPrefab == null) return null; - Logger.LogVerbose("Creating Vessel"); + NHLogger.LogVerbose("Creating Vessel"); var vesselObject = GeneralPropBuilder.MakeFromPrefab(VesselPrefab, VesselPrefab.name, null, null, system.Config.Vessel?.vesselSpawn); VesselObject = vesselObject; @@ -203,7 +203,7 @@ namespace NewHorizons.Handlers { var system = SystemDict[Instance.CurrentStarSystem]; - Logger.LogVerbose("Updating DB Vessel"); + NHLogger.LogVerbose("Updating DB Vessel"); var vectorSector = SearchUtilities.Find("DB_VesselDimension_Body/Sector_VesselDimension"); VesselObject = vectorSector; diff --git a/NewHorizons/Main.cs b/NewHorizons/Main.cs index 3955d27b..4412aae3 100644 --- a/NewHorizons/Main.cs +++ b/NewHorizons/Main.cs @@ -15,10 +15,9 @@ using NewHorizons.OtherMods.MenuFramework; using NewHorizons.OtherMods.OWRichPresence; using NewHorizons.OtherMods.VoiceActing; using NewHorizons.Utility; -using NewHorizons.Utility.DebugMenu; -using NewHorizons.Utility.DebugUtilities; -using NewHorizons.Utility.OWMLUtilities; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OWML; +using NewHorizons.Utility.OuterWilds; using OWML.Common; using OWML.ModHelper; using OWML.Utils; @@ -30,7 +29,9 @@ using System.Reflection; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; -using Logger = NewHorizons.Utility.Logger; + +using NewHorizons.Utility.DebugTools; +using NewHorizons.Utility.DebugTools.Menu; namespace NewHorizons { @@ -90,7 +91,7 @@ namespace NewHorizons public override void Configure(IModConfig config) { - Logger.LogVerbose("Settings changed"); + NHLogger.LogVerbose("Settings changed"); var currentScene = SceneManager.GetActiveScene().name; @@ -103,9 +104,9 @@ namespace NewHorizons DebugMenu.UpdatePauseMenuButton(); } - if (VerboseLogs) Logger.UpdateLogLevel(Logger.LogType.Verbose); - else if (Debug) Logger.UpdateLogLevel(Logger.LogType.Log); - else Logger.UpdateLogLevel(Logger.LogType.Error); + if (VerboseLogs) NHLogger.UpdateLogLevel(NHLogger.LogType.Verbose); + else if (Debug) NHLogger.UpdateLogLevel(NHLogger.LogType.Log); + else NHLogger.UpdateLogLevel(NHLogger.LogType.Error); _defaultSystemOverride = config.GetSettingsValue("Default System Override"); @@ -121,7 +122,7 @@ namespace NewHorizons // Don't reload if we haven't configured yet (called on game start) if (wasUsingCustomTitleScreen != _useCustomTitleScreen && SceneManager.GetActiveScene().name == "TitleScreen" && _wasConfigured) { - Logger.LogVerbose("Reloading"); + NHLogger.LogVerbose("Reloading"); SceneManager.LoadScene("TitleScreen", LoadSceneMode.Single); } @@ -200,7 +201,7 @@ namespace NewHorizons ResetConfigs(resetTranslation: false); - Logger.Log("Begin load of config files..."); + NHLogger.Log("Begin load of config files..."); try { @@ -208,7 +209,7 @@ namespace NewHorizons } catch (Exception) { - Logger.LogWarning("Couldn't find planets folder"); + NHLogger.LogWarning("Couldn't find planets folder"); } Delay.FireOnNextUpdate(() => OnSceneLoaded(SceneManager.GetActiveScene(), LoadSceneMode.Single)); @@ -227,7 +228,7 @@ namespace NewHorizons public void OnDestroy() { - Logger.Log($"Destroying NewHorizons"); + NHLogger.Log($"Destroying NewHorizons"); SceneManager.sceneLoaded -= OnSceneLoaded; GlobalMessenger.RemoveListener("PlayerDeath", OnDeath); GlobalMessenger.RemoveListener("WakeUp", new Callback(OnWakeUp)); @@ -252,7 +253,7 @@ namespace NewHorizons private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { - Logger.Log($"Scene Loaded: {scene.name} {mode} OWScene.{LoadManager.NameToScene(scene.name)}"); + NHLogger.Log($"Scene Loaded: {scene.name} {mode} OWScene.{LoadManager.NameToScene(scene.name)}"); var isTitleScreen = scene.name == LoadManager.SceneToName(OWScene.TitleScreen); var isSolarSystem = scene.name == LoadManager.SceneToName(OWScene.SolarSystem); @@ -302,7 +303,7 @@ namespace NewHorizons } catch (Exception e) { - Logger.LogError($"Couldn't init prefabs:\n{e}"); + NHLogger.LogError($"Couldn't init prefabs:\n{e}"); } } @@ -321,7 +322,7 @@ namespace NewHorizons if (!SystemDict.ContainsKey(_currentStarSystem) || !BodyDict.ContainsKey(_currentStarSystem)) { - Logger.LogError($"System \"{_currentStarSystem}\" does not exist!"); + NHLogger.LogError($"System \"{_currentStarSystem}\" does not exist!"); _currentStarSystem = DefaultStarSystem; } @@ -512,12 +513,12 @@ namespace NewHorizons try { - Logger.Log($"Star system finished loading [{Instance.CurrentStarSystem}]"); + NHLogger.Log($"Star system finished loading [{Instance.CurrentStarSystem}]"); Instance.OnStarSystemLoaded?.Invoke(Instance.CurrentStarSystem); } catch (Exception e) { - Logger.LogError($"Exception thrown when invoking star system loaded event with parameter [{Instance.CurrentStarSystem}]:\n{e}"); + NHLogger.LogError($"Exception thrown when invoking star system loaded event with parameter [{Instance.CurrentStarSystem}]:\n{e}"); } } else @@ -553,7 +554,7 @@ namespace NewHorizons public void EnableWarpDrive() { - Logger.LogVerbose("Setting up warp drive"); + NHLogger.LogVerbose("Setting up warp drive"); PlanetCreationHandler.LoadBody(LoadConfig(this, "Assets/WarpDriveConfig.json")); HasWarpDrive = true; } @@ -582,14 +583,14 @@ namespace NewHorizons if(systemFiles.Length == 0) { - Logger.LogVerbose($"Found no JSON files in systems folder: {systemsFolder}"); + NHLogger.LogVerbose($"Found no JSON files in systems folder: {systemsFolder}"); } foreach (var file in systemFiles) { var name = Path.GetFileNameWithoutExtension(file); - Logger.LogVerbose($"Loading system {name}"); + NHLogger.LogVerbose($"Loading system {name}"); var relativePath = file.Replace(folder, ""); var starSystemConfig = mod.ModHelper.Storage.Load(relativePath, false); @@ -626,7 +627,7 @@ namespace NewHorizons if(planetFiles.Length == 0) { - Logger.LogVerbose($"Found no JSON files in planets folder: {planetsFolder}"); + NHLogger.LogVerbose($"Found no JSON files in planets folder: {planetsFolder}"); } foreach (var file in planetFiles) @@ -658,13 +659,13 @@ namespace NewHorizons } catch (Exception ex) { - Logger.LogError(ex.ToString()); + NHLogger.LogError(ex.ToString()); } } private void LoadAddonManifest(string file, IModBehaviour mod) { - Logger.LogVerbose($"Loading addon manifest for {mod.ModHelper.Manifest.Name}"); + NHLogger.LogVerbose($"Loading addon manifest for {mod.ModHelper.Manifest.Name}"); var addonConfig = mod.ModHelper.Storage.Load(file, false); @@ -694,7 +695,7 @@ namespace NewHorizons if (File.Exists(Path.Combine(folder, relativeFile))) { - Logger.LogVerbose($"Registering {language} translation from {mod.ModHelper.Manifest.Name} from {relativeFile}"); + NHLogger.LogVerbose($"Registering {language} translation from {mod.ModHelper.Manifest.Name} from {relativeFile}"); var config = new TranslationConfig(Path.Combine(folder, relativeFile)); @@ -708,7 +709,7 @@ namespace NewHorizons } } } - if (!foundFile) Logger.LogWarning($"{mod.ModHelper.Manifest.Name} has a folder for translations but none were loaded"); + if (!foundFile) NHLogger.LogWarning($"{mod.ModHelper.Manifest.Name} has a folder for translations but none were loaded"); } public NewHorizonsBody LoadConfig(IModBehaviour mod, string relativePath) @@ -719,19 +720,19 @@ namespace NewHorizons var config = mod.ModHelper.Storage.Load(relativePath, false); if (config == null) { - Logger.LogError($"Couldn't load {relativePath}. Is your Json formatted correctly?"); + NHLogger.LogError($"Couldn't load {relativePath}. Is your Json formatted correctly?"); MenuHandler.RegisterFailedConfig(Path.GetFileName(relativePath)); return null; } - Logger.LogVerbose($"Loaded {config.name}"); + NHLogger.LogVerbose($"Loaded {config.name}"); 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(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?"); + else NHLogger.LogWarning($"Loaded system config for {config.starSystem}. Why wasn't this loaded earlier?"); starSystemConfig.Migrate(); starSystemConfig.FixCoordinates(); @@ -751,7 +752,7 @@ namespace NewHorizons } catch (Exception e) { - Logger.LogError($"Error encounter when loading {relativePath}:\n{e}"); + NHLogger.LogError($"Error encounter when loading {relativePath}:\n{e}"); MenuHandler.RegisterFailedConfig(Path.GetFileName(relativePath)); } @@ -797,7 +798,7 @@ namespace NewHorizons DidWarpFromVessel = false; OnChangeStarSystem?.Invoke(newStarSystem); - Logger.Log($"Warping to {newStarSystem}"); + NHLogger.Log($"Warping to {newStarSystem}"); if (warp && _shipWarpController) _shipWarpController.WarpOut(); IsChangingStarSystem = true; WearingSuit = PlayerState.IsWearingSuit(); diff --git a/NewHorizons/NewHorizonsApi.cs b/NewHorizons/NewHorizonsApi.cs index 09feaf6a..5e627fcb 100644 --- a/NewHorizons/NewHorizonsApi.cs +++ b/NewHorizons/NewHorizonsApi.cs @@ -1,19 +1,20 @@ using NewHorizons.Builder.Props; +using NewHorizons.External; using NewHorizons.External.Modules; +using NewHorizons.External.Modules.Props; +using NewHorizons.External.Modules.Props.Dialogue; using NewHorizons.Utility; +using NewHorizons.Utility.OWML; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using OWML.Common; using OWML.Utils; using System; using System.Collections.Generic; using System.IO; using System.Linq; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using UnityEngine; using UnityEngine.Events; -using Logger = NewHorizons.Utility.Logger; -using NewHorizons.External.Modules.Props.Dialogue; -using NewHorizons.External.Modules.Props; namespace NewHorizons { @@ -33,7 +34,7 @@ namespace NewHorizons { var name = (string)config["Name"]; - Logger.LogWarning($"Recieved API request to create planet [{name}]"); + NHLogger.LogWarning($"Recieved API request to create planet [{name}]"); if (name == null) return; @@ -55,7 +56,7 @@ namespace NewHorizons } catch(Exception ex) { - Logger.LogError($"Error in Create API:\n{ex}"); + NHLogger.LogError($"Error in Create API:\n{ex}"); } } @@ -98,7 +99,7 @@ namespace NewHorizons } catch (Exception ex) { - Logger.LogError($"Couldn't get installed addons:\n{ex}"); + NHLogger.LogError($"Couldn't get installed addons:\n{ex}"); return new string[] { }; } } @@ -118,7 +119,7 @@ namespace NewHorizons } catch (JsonException e) { - Logger.LogError(e.ToString()); + NHLogger.LogError(e.ToString()); return null; } } diff --git a/NewHorizons/OtherMods/AchievementsPlus/AchievementHandler.cs b/NewHorizons/OtherMods/AchievementsPlus/AchievementHandler.cs index 89355b4b..241a68d2 100644 --- a/NewHorizons/OtherMods/AchievementsPlus/AchievementHandler.cs +++ b/NewHorizons/OtherMods/AchievementsPlus/AchievementHandler.cs @@ -1,5 +1,5 @@ using NewHorizons.External.Configs; -using NewHorizons.Utility; +using NewHorizons.Utility.OWML; using OWML.ModHelper; using System; using System.Collections.Generic; @@ -23,7 +23,7 @@ namespace NewHorizons.OtherMods.AchievementsPlus if (API == null) { - Logger.LogVerbose("Achievements+ isn't installed"); + NHLogger.LogVerbose("Achievements+ isn't installed"); Enabled = false; return; } @@ -49,7 +49,7 @@ namespace NewHorizons.OtherMods.AchievementsPlus } catch(Exception ex) { - Logger.LogError($"Achievements+ handler failed to initialize: {ex}"); + NHLogger.LogError($"Achievements+ handler failed to initialize: {ex}"); } } diff --git a/NewHorizons/OtherMods/CommonCameraUtility/CommonCameraHandler.cs b/NewHorizons/OtherMods/CommonCameraUtility/CommonCameraHandler.cs index a0fee2fe..b6c27177 100644 --- a/NewHorizons/OtherMods/CommonCameraUtility/CommonCameraHandler.cs +++ b/NewHorizons/OtherMods/CommonCameraUtility/CommonCameraHandler.cs @@ -1,4 +1,4 @@ -using Logger = NewHorizons.Utility.Logger; +using NewHorizons.Utility.OWML; namespace NewHorizons.OtherMods.CommonCameraUtility { @@ -19,7 +19,7 @@ namespace NewHorizons.OtherMods.CommonCameraUtility } else { - Logger.LogError("Tried to register custom camera but Common Camera Utility was missing."); + NHLogger.LogError("Tried to register custom camera but Common Camera Utility was missing."); } } } diff --git a/NewHorizons/OtherMods/MenuFramework/MenuHandler.cs b/NewHorizons/OtherMods/MenuFramework/MenuHandler.cs index bb88e7b4..4181c2d5 100644 --- a/NewHorizons/OtherMods/MenuFramework/MenuHandler.cs +++ b/NewHorizons/OtherMods/MenuFramework/MenuHandler.cs @@ -1,11 +1,11 @@ using NewHorizons.External; using NewHorizons.Handlers; using NewHorizons.Utility; +using NewHorizons.Utility.OWML; using OWML.Common; using System.Collections.Generic; using System.Linq; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.OtherMods.MenuFramework { @@ -34,7 +34,7 @@ namespace NewHorizons.OtherMods.MenuFramework VersionUtility.RequiredVersionString, Application.version); - Logger.LogError(warning); + NHLogger.LogError(warning); _menuApi.RegisterStartupPopup(warning); } diff --git a/NewHorizons/OtherMods/OWRichPresence/RichPresenceHandler.cs b/NewHorizons/OtherMods/OWRichPresence/RichPresenceHandler.cs index 313435f5..bdc4a308 100644 --- a/NewHorizons/OtherMods/OWRichPresence/RichPresenceHandler.cs +++ b/NewHorizons/OtherMods/OWRichPresence/RichPresenceHandler.cs @@ -1,8 +1,8 @@ using NewHorizons.Components.ShipLog; using NewHorizons.Handlers; +using NewHorizons.Utility.OWML; using System; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.OtherMods.OWRichPresence { @@ -20,7 +20,7 @@ namespace NewHorizons.OtherMods.OWRichPresence if (API == null) { - Logger.LogVerbose("OWRichPresence isn't installed"); + NHLogger.LogVerbose("OWRichPresence isn't installed"); Enabled = false; return; } @@ -29,7 +29,7 @@ namespace NewHorizons.OtherMods.OWRichPresence } catch(Exception ex) { - Logger.LogError($"OWRichPresence handler failed to initialize: {ex}"); + NHLogger.LogError($"OWRichPresence handler failed to initialize: {ex}"); Enabled = false; } } @@ -38,7 +38,7 @@ namespace NewHorizons.OtherMods.OWRichPresence { if (!Enabled) return; - Logger.LogVerbose($"Registering {go.name} to OWRichPresence"); + NHLogger.LogVerbose($"Registering {go.name} to OWRichPresence"); var localizedName = TranslationHandler.GetTranslation(name, TranslationHandler.TextType.UI); var message = TranslationHandler.GetTranslation("RICH_PRESENCE_EXPLORING", TranslationHandler.TextType.UI).Replace("{0}", localizedName); diff --git a/NewHorizons/OtherMods/VoiceActing/VoiceHandler.cs b/NewHorizons/OtherMods/VoiceActing/VoiceHandler.cs index ed7142de..d0d9af81 100644 --- a/NewHorizons/OtherMods/VoiceActing/VoiceHandler.cs +++ b/NewHorizons/OtherMods/VoiceActing/VoiceHandler.cs @@ -1,4 +1,4 @@ -using NewHorizons.Utility; +using NewHorizons.Utility.OWML; using System; using System.IO; using System.Linq; @@ -19,7 +19,7 @@ namespace NewHorizons.OtherMods.VoiceActing if (API == null) { - Logger.LogVerbose("VoiceMod isn't installed"); + NHLogger.LogVerbose("VoiceMod isn't installed"); return; } @@ -29,7 +29,7 @@ namespace NewHorizons.OtherMods.VoiceActing } catch (Exception ex) { - Logger.LogError($"VoiceMod handler failed to initialize: {ex}"); + NHLogger.LogError($"VoiceMod handler failed to initialize: {ex}"); Enabled = false; } } @@ -45,12 +45,12 @@ namespace NewHorizons.OtherMods.VoiceActing } if (Directory.Exists(folder)) { - Logger.Log($"Registering VoiceMod audio for {mod.ModHelper.Manifest.Name} from {folder}"); + NHLogger.Log($"Registering VoiceMod audio for {mod.ModHelper.Manifest.Name} from {folder}"); API.RegisterAssets(folder); } else { - Logger.LogVerbose($"Didn't find VoiceMod audio for {mod.ModHelper.Manifest.Name} at {folder}"); + NHLogger.LogVerbose($"Didn't find VoiceMod audio for {mod.ModHelper.Manifest.Name} at {folder}"); } } } diff --git a/NewHorizons/Patches/EyeScenePatches/SubmitActionLoadScenePatches.cs b/NewHorizons/Patches/EyeScenePatches/SubmitActionLoadScenePatches.cs index 33bdb236..9feba169 100644 --- a/NewHorizons/Patches/EyeScenePatches/SubmitActionLoadScenePatches.cs +++ b/NewHorizons/Patches/EyeScenePatches/SubmitActionLoadScenePatches.cs @@ -1,4 +1,5 @@ using HarmonyLib; +using NewHorizons.Utility.OWML; namespace NewHorizons.Patches.EyeScenePatches { @@ -12,7 +13,7 @@ namespace NewHorizons.Patches.EyeScenePatches // Title screen can warp you to eye and cause problems. if (__instance._sceneToLoad == SubmitActionLoadScene.LoadableScenes.EYE) { - Utility.Logger.LogWarning("Warping to solar system and then back to eye"); + NHLogger.LogWarning("Warping to solar system and then back to eye"); Main.Instance.IsWarpingBackToEye = true; __instance._sceneToLoad = SubmitActionLoadScene.LoadableScenes.GAME; } diff --git a/NewHorizons/Patches/PlayerPatches/PlayerDataPatches.cs b/NewHorizons/Patches/PlayerPatches/PlayerDataPatches.cs index fc170a1a..3811cfee 100644 --- a/NewHorizons/Patches/PlayerPatches/PlayerDataPatches.cs +++ b/NewHorizons/Patches/PlayerPatches/PlayerDataPatches.cs @@ -4,7 +4,7 @@ using NewHorizons.External; using NewHorizons.Handlers; using NewHorizons.OtherMods.AchievementsPlus; using NewHorizons.OtherMods.AchievementsPlus.NH; -using NewHorizons.Utility; +using NewHorizons.Utility.OWML; using System.Collections.Generic; using System.Linq; @@ -106,7 +106,7 @@ namespace NewHorizons.Patches.PlayerPatches __result = PlayerData._currentGameSave.newlyRevealedFactIDs.Concat(newHorizonsNewlyRevealedFactIDs).ToList(); return false; } - Logger.LogError("Newly Revealed Fact IDs is null!"); + NHLogger.LogError("Newly Revealed Fact IDs is null!"); return true; } diff --git a/NewHorizons/Patches/PlayerPatches/PlayerSpawnerPatches.cs b/NewHorizons/Patches/PlayerPatches/PlayerSpawnerPatches.cs index 11bcc7c1..f3017482 100644 --- a/NewHorizons/Patches/PlayerPatches/PlayerSpawnerPatches.cs +++ b/NewHorizons/Patches/PlayerPatches/PlayerSpawnerPatches.cs @@ -1,6 +1,6 @@ using HarmonyLib; using NewHorizons.Utility; -using Logger = NewHorizons.Utility.Logger; +using NewHorizons.Utility.OWML; namespace NewHorizons.Patches.PlayerPatches { @@ -13,16 +13,16 @@ namespace NewHorizons.Patches.PlayerPatches { if (Main.Instance.IsWarpingFromVessel || Main.Instance.DidWarpFromVessel) { - Logger.LogWarning("Abort player spawn. Vessel will handle it."); + NHLogger.LogWarning("Abort player spawn. Vessel will handle it."); return false; } else if (Main.SystemDict[Main.Instance.CurrentStarSystem].SpawnPoint != null) { - Logger.LogVerbose($"Player spawning at {Main.SystemDict[Main.Instance.CurrentStarSystem].SpawnPoint.transform.GetPath()}"); + NHLogger.LogVerbose($"Player spawning at {Main.SystemDict[Main.Instance.CurrentStarSystem].SpawnPoint.transform.GetPath()}"); __instance.SetInitialSpawnPoint(Main.SystemDict[Main.Instance.CurrentStarSystem].SpawnPoint); } else if (Main.Instance.CurrentStarSystem != "SolarSystem" && Main.Instance.CurrentStarSystem != "EyeOfTheUniverse") { - Logger.LogWarning("No player spawn point set."); + NHLogger.LogWarning("No player spawn point set."); } return true; } diff --git a/NewHorizons/Patches/ShipLogPatches/ShipLogManagerPatches.cs b/NewHorizons/Patches/ShipLogPatches/ShipLogManagerPatches.cs index 8276ccc7..831bb888 100644 --- a/NewHorizons/Patches/ShipLogPatches/ShipLogManagerPatches.cs +++ b/NewHorizons/Patches/ShipLogPatches/ShipLogManagerPatches.cs @@ -1,11 +1,11 @@ using HarmonyLib; using NewHorizons.Builder.ShipLog; +using NewHorizons.External; using NewHorizons.Handlers; using NewHorizons.OtherMods.AchievementsPlus; -using NewHorizons.Utility; +using NewHorizons.Utility.OWML; using System.Collections.Generic; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Patches.ShipLogPatches { @@ -28,7 +28,7 @@ namespace NewHorizons.Patches.ShipLogPatches currentStarSystem = Main.Instance.DefaultStarSystem; } - Logger.Log($"Beginning Ship Log Generation For: {currentStarSystem}"); + NHLogger.Log($"Beginning Ship Log Generation For: {currentStarSystem}"); if (currentStarSystem != "SolarSystem") { @@ -68,7 +68,7 @@ namespace NewHorizons.Patches.ShipLogPatches RumorModeBuilder.UpdateEntryCuriosity(ref logEntry); } - Logger.Log($"Ship Log Generation Complete For: {Main.Instance.CurrentStarSystem}"); + NHLogger.Log($"Ship Log Generation Complete For: {Main.Instance.CurrentStarSystem}"); } [HarmonyPrefix] diff --git a/NewHorizons/Patches/ShipLogPatches/ShipLogMapModePatches.cs b/NewHorizons/Patches/ShipLogPatches/ShipLogMapModePatches.cs index b946c3c6..8f70fbfe 100644 --- a/NewHorizons/Patches/ShipLogPatches/ShipLogMapModePatches.cs +++ b/NewHorizons/Patches/ShipLogPatches/ShipLogMapModePatches.cs @@ -2,10 +2,10 @@ using HarmonyLib; using NewHorizons.Builder.ShipLog; using NewHorizons.Handlers; using NewHorizons.Utility; +using NewHorizons.Utility.OWML; using System.Collections.Generic; using System.Linq; using UnityEngine; -using Logger = NewHorizons.Utility.Logger; namespace NewHorizons.Patches.ShipLogPatches { @@ -21,7 +21,7 @@ namespace NewHorizons.Patches.ShipLogPatches ShipLogAstroObject[][] navMatrix = MapModeBuilder.ConstructMapMode(Main.Instance.CurrentStarSystem, panRoot, __instance._astroObjects, sunObject.layer); if (navMatrix == null || navMatrix.Length <= 1) { - Logger.LogWarning("Skipping Map Mode Generation."); + NHLogger.LogWarning("Skipping Map Mode Generation."); } else { @@ -41,7 +41,7 @@ namespace NewHorizons.Patches.ShipLogPatches } } - Logger.Log("Map Mode Construction Complete"); + NHLogger.Log("Map Mode Construction Complete"); } } } diff --git a/NewHorizons/Patches/WarpPatches/VesselWarpControllerPatches.cs b/NewHorizons/Patches/WarpPatches/VesselWarpControllerPatches.cs index 39eb3d72..4676edd4 100644 --- a/NewHorizons/Patches/WarpPatches/VesselWarpControllerPatches.cs +++ b/NewHorizons/Patches/WarpPatches/VesselWarpControllerPatches.cs @@ -1,6 +1,6 @@ using HarmonyLib; using NewHorizons.Utility; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OuterWilds; namespace NewHorizons.Patches.WarpPatches { diff --git a/NewHorizons/Utility/DebugUtilities/DebugPropPlacer.cs b/NewHorizons/Utility/DebugTools/DebugPropPlacer.cs similarity index 93% rename from NewHorizons/Utility/DebugUtilities/DebugPropPlacer.cs rename to NewHorizons/Utility/DebugTools/DebugPropPlacer.cs index 454db82f..1db7bd36 100644 --- a/NewHorizons/Utility/DebugUtilities/DebugPropPlacer.cs +++ b/NewHorizons/Utility/DebugTools/DebugPropPlacer.cs @@ -2,13 +2,15 @@ using NewHorizons.Builder.Props; using NewHorizons.External.Configs; using NewHorizons.External.Modules.Props; using NewHorizons.Handlers; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OWML; +using NewHorizons.Utility.OuterWilds; using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.InputSystem; -namespace NewHorizons.Utility.DebugUtilities +namespace NewHorizons.Utility.DebugTools { // @@ -130,7 +132,7 @@ namespace NewHorizons.Utility.DebugUtilities if (data.hitBodyGameObject == null) { - Logger.LogError($"Failed to place object {currentObject} on nothing."); + NHLogger.LogError($"Failed to place object {currentObject} on nothing."); return; } @@ -145,7 +147,7 @@ namespace NewHorizons.Utility.DebugUtilities if (!planetGO.name.EndsWith("_Body")) { - Logger.LogWarning("Cannot place object on non-body object: " + data.hitBodyGameObject.name); + NHLogger.LogWarning("Cannot place object on non-body object: " + data.hitBodyGameObject.name); } var sector = planetGO.GetComponentInChildren(); @@ -162,7 +164,7 @@ namespace NewHorizons.Utility.DebugUtilities } catch { - Logger.LogError($"Failed to place object {currentObject} on body ${data.hitBodyGameObject} at location ${data.pos}."); + NHLogger.LogError($"Failed to place object {currentObject} on body ${data.hitBodyGameObject} at location ${data.pos}."); } } @@ -195,7 +197,7 @@ namespace NewHorizons.Utility.DebugUtilities if (spawnedProp == null) { - Logger.LogError("No spawned prop found for " + detail.path); + NHLogger.LogError("No spawned prop found for " + detail.path); continue; } @@ -224,7 +226,7 @@ namespace NewHorizons.Utility.DebugUtilities //var body = AstroObjectLocator.GetAstroObject(bodyGameObjectName); - Logger.LogVerbose($"Adding prop to {Main.Instance.CurrentStarSystem}::{body.name}"); + NHLogger.LogVerbose($"Adding prop to {Main.Instance.CurrentStarSystem}::{body.name}"); detailInfo = detailInfo == null ? new DetailInfo() : detailInfo; @@ -256,7 +258,7 @@ namespace NewHorizons.Utility.DebugUtilities if (bodyProps == null || bodyProps.Count == 0) continue; if (bodyProps[0].body == null) continue; var body = bodyProps[0].body; - Logger.LogVerbose("getting prop group for body " + body.name); + NHLogger.LogVerbose("getting prop group for body " + body.name); //string bodyName = GetAstroObjectName(bodyProps[0].body); DetailInfo[] infoArray = new DetailInfo[bodyProps.Count]; diff --git a/NewHorizons/Utility/DebugUtilities/DebugRaycastData.cs b/NewHorizons/Utility/DebugTools/DebugRaycastData.cs similarity index 92% rename from NewHorizons/Utility/DebugUtilities/DebugRaycastData.cs rename to NewHorizons/Utility/DebugTools/DebugRaycastData.cs index 493ecc9a..f1ab36e9 100644 --- a/NewHorizons/Utility/DebugUtilities/DebugRaycastData.cs +++ b/NewHorizons/Utility/DebugTools/DebugRaycastData.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace NewHorizons.Utility.DebugUtilities +namespace NewHorizons.Utility.DebugTools { struct DebugRaycastData { diff --git a/NewHorizons/Utility/DebugUtilities/DebugRaycaster.cs b/NewHorizons/Utility/DebugTools/DebugRaycaster.cs similarity index 94% rename from NewHorizons/Utility/DebugUtilities/DebugRaycaster.cs rename to NewHorizons/Utility/DebugTools/DebugRaycaster.cs index 03542ecc..ea2f1fca 100644 --- a/NewHorizons/Utility/DebugUtilities/DebugRaycaster.cs +++ b/NewHorizons/Utility/DebugTools/DebugRaycaster.cs @@ -1,9 +1,11 @@ using NewHorizons.Handlers; +using NewHorizons.Utility.Files; using NewHorizons.Utility.Geometry; +using NewHorizons.Utility.OWML; using UnityEngine; using UnityEngine.InputSystem; -namespace NewHorizons.Utility.DebugUtilities +namespace NewHorizons.Utility.DebugTools { [RequireComponent(typeof(OWRigidbody))] public class DebugRaycaster : MonoBehaviour @@ -70,7 +72,7 @@ namespace NewHorizons.Utility.DebugUtilities if (!data.hit) { - Logger.LogWarning("Debug Raycast Didn't Hit Anything! (Try moving closer)"); + NHLogger.LogWarning("Debug Raycast Didn't Hit Anything! (Try moving closer)"); return; } @@ -107,7 +109,7 @@ 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\n\n\"position\": {posText},\n\"rotation\": {rotText},\n\"normal\": {normText}\n\non collider [{data.colliderPath}] " + + NHLogger.Log($"Raycast hit\n\n\"position\": {posText},\n\"rotation\": {rotText},\n\"normal\": {normText}\n\non collider [{data.colliderPath}] " + (data.bodyPath != null ? $"at rigidbody [{data.bodyPath}]" : "not attached to a rigidbody")); } internal DebugRaycastData Raycast() @@ -157,7 +159,7 @@ namespace NewHorizons.Utility.DebugUtilities if (Vector3.Cross(U, N) == Vector3.zero) U = new Vector3(0, 0, 1); if (Vector3.Cross(U, N) == Vector3.zero) U = new Vector3(0, 1, 0); // if 0,0,1 was actually the same vector U already was (lol), try (0,1,0) instead - Logger.LogVerbose("Up vector is " + U.ToString()); + NHLogger.LogVerbose("Up vector is " + U.ToString()); // stackoverflow.com/a/9605695 // I don't know exactly how this works, but I'm projecting a point that is located above the plane's origin, relative to the planet, onto the plane. this gets us our v vector diff --git a/NewHorizons/Utility/DebugUtilities/DebugReload.cs b/NewHorizons/Utility/DebugTools/DebugReload.cs similarity index 87% rename from NewHorizons/Utility/DebugUtilities/DebugReload.cs rename to NewHorizons/Utility/DebugTools/DebugReload.cs index 85a7b0b0..af3bd938 100644 --- a/NewHorizons/Utility/DebugUtilities/DebugReload.cs +++ b/NewHorizons/Utility/DebugTools/DebugReload.cs @@ -1,9 +1,10 @@ using NewHorizons.Handlers; +using NewHorizons.Utility.OWML; using OWML.Common; using OWML.Common.Menus; using System; -namespace NewHorizons.Utility.DebugUtilities +namespace NewHorizons.Utility.DebugTools { public static class DebugReload { @@ -28,7 +29,7 @@ namespace NewHorizons.Utility.DebugUtilities private static void ReloadConfigs() { - Logger.Log("Begin reload of config files..."); + NHLogger.Log("Begin reload of config files..."); Main.Instance.ResetConfigs(); @@ -41,7 +42,7 @@ namespace NewHorizons.Utility.DebugUtilities } catch (Exception) { - Logger.LogWarning("Error While Reloading"); + NHLogger.LogWarning("Error While Reloading"); } SearchUtilities.Find("/PauseMenu/PauseMenuManagers").GetComponent().OnSkipToNextTimeLoop(); diff --git a/NewHorizons/Utility/DebugMenu/DebugMenu.cs b/NewHorizons/Utility/DebugTools/Menu/DebugMenu.cs similarity index 93% rename from NewHorizons/Utility/DebugMenu/DebugMenu.cs rename to NewHorizons/Utility/DebugTools/Menu/DebugMenu.cs index cc71e475..07bd39f6 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenu.cs +++ b/NewHorizons/Utility/DebugTools/Menu/DebugMenu.cs @@ -1,5 +1,7 @@ using NewHorizons.External.Configs; using NewHorizons.Handlers; +using NewHorizons.Utility.Files; +using NewHorizons.Utility.OWML; using Newtonsoft.Json; using OWML.Common; using OWML.Common.Menus; @@ -9,7 +11,7 @@ using System.IO; using System.Linq; using UnityEngine; -namespace NewHorizons.Utility.DebugMenu +namespace NewHorizons.Utility.DebugTools.Menu { class DebugMenu : MonoBehaviour { @@ -206,7 +208,7 @@ namespace NewHorizons.Utility.DebugMenu { if (body.RelativePath == null) { - Logger.LogWarning($"Error loading config for {body.Config.name} in {body.Config.starSystem}"); + NHLogger.LogWarning($"Error loading config for {body.Config.name} in {body.Config.starSystem}"); continue; } @@ -221,11 +223,11 @@ namespace NewHorizons.Utility.DebugMenu var backupFolderName = $"configBackups\\{DateTime.Now.ToString("yyyyMMddTHHmmss")}\\"; - Logger.Log($"Potentially saving {loadedConfigFiles.Keys.Count} files"); + NHLogger.Log($"Potentially saving {loadedConfigFiles.Keys.Count} files"); foreach (var filePath in loadedConfigFiles.Keys) { - Logger.LogVerbose($"Possibly Saving... {loadedConfigFiles[filePath].name} @ {filePath}"); + NHLogger.LogVerbose($"Possibly Saving... {loadedConfigFiles[filePath].name} @ {filePath}"); if (loadedConfigFiles[filePath].starSystem != Main.Instance.CurrentStarSystem) continue; @@ -236,7 +238,7 @@ namespace NewHorizons.Utility.DebugMenu try { var path = Path.Combine(loadedMod.ModHelper.Manifest.ModFolderPath, backupFolderName, relativePath); - Logger.LogVerbose($"Backing up... {relativePath} to {path}"); + NHLogger.LogVerbose($"Backing up... {relativePath} to {path}"); var oldPath = Path.Combine(loadedMod.ModHelper.Manifest.ModFolderPath, relativePath); var directoryName = Path.GetDirectoryName(path); Directory.CreateDirectory(directoryName); @@ -248,12 +250,12 @@ namespace NewHorizons.Utility.DebugMenu } catch (Exception e) { - Logger.LogError($"Failed to save backup file {backupFolderName}{relativePath}:\n{e}"); + NHLogger.LogError($"Failed to save backup file {backupFolderName}{relativePath}:\n{e}"); } try { - Logger.Log($"Saving... {relativePath} to {filePath}"); + NHLogger.Log($"Saving... {relativePath} to {filePath}"); var path = Path.Combine(loadedMod.ModHelper.Manifest.ModFolderPath, relativePath); var directoryName = Path.GetDirectoryName(path); Directory.CreateDirectory(directoryName); @@ -262,7 +264,7 @@ namespace NewHorizons.Utility.DebugMenu } catch (Exception e) { - Logger.LogError($"Failed to save file {relativePath}:\n{e}"); + NHLogger.LogError($"Failed to save file {relativePath}:\n{e}"); } } } diff --git a/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs b/NewHorizons/Utility/DebugTools/Menu/DebugMenuPropPlacer.cs similarity index 95% rename from NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs rename to NewHorizons/Utility/DebugTools/Menu/DebugMenuPropPlacer.cs index d9f91d88..74d67169 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenuPropPlacer.cs +++ b/NewHorizons/Utility/DebugTools/Menu/DebugMenuPropPlacer.cs @@ -1,15 +1,15 @@ using HarmonyLib; using NewHorizons.External.Configs; using NewHorizons.External.Modules; -using NewHorizons.Utility.DebugUtilities; using NewHorizons.Utility.Geometry; -using NewHorizons.Utility.OWUtilities; +using NewHorizons.Utility.OWML; +using NewHorizons.Utility.OuterWilds; using Newtonsoft.Json; using System.Collections.Generic; using System.Linq; using UnityEngine; -namespace NewHorizons.Utility.DebugMenu +namespace NewHorizons.Utility.DebugTools.Menu { class DebugMenuPropPlacer : DebugSubmenu { @@ -226,7 +226,7 @@ namespace NewHorizons.Utility.DebugMenu Vector3 finalLocalPosition = CoordinateUtilities.SphericalToCartesian(newSpherical); Vector3 finalAbsolutePosition = astroObject.TransformPoint(finalLocalPosition); prop.transform.localPosition = prop.transform.parent.InverseTransformPoint(finalAbsolutePosition); - Logger.Log("new position: " + prop.transform.localPosition); + NHLogger.Log("new position: " + prop.transform.localPosition); var onlyChangingRAndRIsNegative = false; @@ -339,21 +339,21 @@ namespace NewHorizons.Utility.DebugMenu var newDetails = _dpp.GetPropsConfigByBody(); var newDetailsCountsByPlanet = string.Join(", ", newDetails.Keys.Select(x => $"{x.name} ({newDetails[x].Length})")); - Logger.Log($"Updating config files. New Details Counts by planet: {newDetailsCountsByPlanet}"); + NHLogger.Log($"Updating config files. New Details Counts by planet: {newDetailsCountsByPlanet}"); var planetToConfigPath = new Dictionary(); // Get all configs foreach (var filePath in menu.loadedConfigFiles.Keys) { - Logger.LogVerbose($"Potentially updating copy of config at {filePath}"); - Logger.LogVerbose($"{menu.loadedConfigFiles[filePath].name} {AstroObjectLocator.GetAstroObject(menu.loadedConfigFiles[filePath].name)?.name}"); - Logger.LogVerbose($"{menu.loadedConfigFiles[filePath].name}"); + NHLogger.LogVerbose($"Potentially updating copy of config at {filePath}"); + NHLogger.LogVerbose($"{menu.loadedConfigFiles[filePath].name} {AstroObjectLocator.GetAstroObject(menu.loadedConfigFiles[filePath].name)?.name}"); + NHLogger.LogVerbose($"{menu.loadedConfigFiles[filePath].name}"); if (menu.loadedConfigFiles[filePath].starSystem != Main.Instance.CurrentStarSystem) return; if (menu.loadedConfigFiles[filePath].name == null || AstroObjectLocator.GetAstroObject(menu.loadedConfigFiles[filePath].name) == null) { - Logger.LogWarning("Failed to update copy of config at " + filePath); + NHLogger.LogWarning("Failed to update copy of config at " + filePath); continue; } @@ -365,14 +365,14 @@ namespace NewHorizons.Utility.DebugMenu if (menu.loadedConfigFiles[filePath].Props == null) menu.loadedConfigFiles[filePath].Props = new PropModule(); menu.loadedConfigFiles[filePath].Props.details = newDetails[astroObject]; - Logger.Log($"Successfully updated copy of config file for {astroObject.name}"); + NHLogger.Log($"Successfully updated copy of config file for {astroObject.name}"); } // find all new planets that do not yet have config paths var planetsThatDoNotHaveConfigFiles = newDetails.Keys.Where(x => !planetToConfigPath.ContainsKey(x)).ToList(); foreach (var astroObject in planetsThatDoNotHaveConfigFiles) { - Logger.Log("Fabricating new config file for " + astroObject.name); + NHLogger.Log("Fabricating new config file for " + astroObject.name); var filepath = $"planets/{Main.Instance.CurrentStarSystem}/{astroObject.name}.json"; @@ -394,7 +394,7 @@ namespace NewHorizons.Utility.DebugMenu detail => "\t" + JsonConvert.SerializeObject(detail, DebugMenu.jsonSettings), ",\n" ); - Logger.Log($"{body.Key.name} ({body.Value.Length})\n[\n{json}\n]"); + NHLogger.Log($"{body.Key.name} ({body.Value.Length})\n[\n{json}\n]"); } } } diff --git a/NewHorizons/Utility/DebugMenu/DebugMenuShipLogs.cs b/NewHorizons/Utility/DebugTools/Menu/DebugMenuShipLogs.cs similarity index 90% rename from NewHorizons/Utility/DebugMenu/DebugMenuShipLogs.cs rename to NewHorizons/Utility/DebugTools/Menu/DebugMenuShipLogs.cs index 53adf2af..081fa5ab 100644 --- a/NewHorizons/Utility/DebugMenu/DebugMenuShipLogs.cs +++ b/NewHorizons/Utility/DebugTools/Menu/DebugMenuShipLogs.cs @@ -1,11 +1,13 @@ using HarmonyLib; using NewHorizons.External.Configs; using NewHorizons.External.Modules; +using NewHorizons.External.Modules.SerializableData; +using NewHorizons.Utility.OWML; using Newtonsoft.Json; using System.Linq; using UnityEngine; -namespace NewHorizons.Utility.DebugMenu +namespace NewHorizons.Utility.DebugTools.Menu { class DebugMenuShipLogs : DebugSubmenu { @@ -73,7 +75,7 @@ namespace NewHorizons.Utility.DebugMenu internal override void PrintNewConfigSection(DebugMenu menu) { - Logger.Log(GetEntryPositionsJSON()); + NHLogger.Log(GetEntryPositionsJSON()); } } } diff --git a/NewHorizons/Utility/DebugMenu/DebugSubmenu.cs b/NewHorizons/Utility/DebugTools/Menu/DebugSubmenu.cs similarity index 93% rename from NewHorizons/Utility/DebugMenu/DebugSubmenu.cs rename to NewHorizons/Utility/DebugTools/Menu/DebugSubmenu.cs index 054e06fd..0bcc9099 100644 --- a/NewHorizons/Utility/DebugMenu/DebugSubmenu.cs +++ b/NewHorizons/Utility/DebugTools/Menu/DebugSubmenu.cs @@ -1,6 +1,6 @@ using NewHorizons.External.Configs; -namespace NewHorizons.Utility.DebugMenu +namespace NewHorizons.Utility.DebugTools.Menu { abstract class DebugSubmenu { diff --git a/NewHorizons/Utility/AssetBundleUtilities.cs b/NewHorizons/Utility/Files/AssetBundleUtilities.cs similarity index 87% rename from NewHorizons/Utility/AssetBundleUtilities.cs rename to NewHorizons/Utility/Files/AssetBundleUtilities.cs index dff9efef..60fdce56 100644 --- a/NewHorizons/Utility/AssetBundleUtilities.cs +++ b/NewHorizons/Utility/Files/AssetBundleUtilities.cs @@ -1,10 +1,11 @@ +using NewHorizons.Utility.OWML; using OWML.Common; using System; using System.Collections.Generic; using System.IO; using UnityEngine; -namespace NewHorizons.Utility +namespace NewHorizons.Utility.Files { public static class AssetBundleUtilities { @@ -14,7 +15,7 @@ namespace NewHorizons.Utility { foreach (var pair in AssetBundles) { - if (pair.Value == null) Logger.LogError($"The asset bundle for {pair.Key} was null when trying to unload"); + if (pair.Value == null) NHLogger.LogError($"The asset bundle for {pair.Key} was null when trying to unload"); else pair.Value.Unload(true); } AssetBundles.Clear(); @@ -39,7 +40,7 @@ namespace NewHorizons.Utility bundle = AssetBundle.LoadFromFile(completePath); if (bundle == null) { - Logger.LogError($"Couldn't load AssetBundle at [{completePath}] for [{mod.ModHelper.Manifest.Name}]"); + NHLogger.LogError($"Couldn't load AssetBundle at [{completePath}] for [{mod.ModHelper.Manifest.Name}]"); return null; } @@ -50,7 +51,7 @@ namespace NewHorizons.Utility } catch (Exception e) { - Logger.LogError($"Couldn't load asset {pathInBundle} from AssetBundle {assetBundleRelativeDir}:\n{e}"); + NHLogger.LogError($"Couldn't load asset {pathInBundle} from AssetBundle {assetBundleRelativeDir}:\n{e}"); return null; } diff --git a/NewHorizons/Utility/AudioUtilities.cs b/NewHorizons/Utility/Files/AudioUtilities.cs similarity index 83% rename from NewHorizons/Utility/AudioUtilities.cs rename to NewHorizons/Utility/Files/AudioUtilities.cs index f7d07126..ca01b44a 100644 --- a/NewHorizons/Utility/AudioUtilities.cs +++ b/NewHorizons/Utility/Files/AudioUtilities.cs @@ -1,3 +1,4 @@ +using NewHorizons.Utility.OWML; using OWML.Common; using OWML.Utils; using System; @@ -6,7 +7,7 @@ using System.IO; using System.Threading.Tasks; using UnityEngine; using UnityEngine.Networking; -namespace NewHorizons.Utility +namespace NewHorizons.Utility.Files { public static class AudioUtilities { @@ -30,7 +31,7 @@ namespace NewHorizons.Utility } catch { - Logger.LogError($"Could not load file {audio}"); + NHLogger.LogError($"Could not load file {audio}"); } } @@ -41,7 +42,7 @@ namespace NewHorizons.Utility else { var audioClip = SearchUtilities.FindResourceOfTypeAndName(audio); - if (audioClip == null) Logger.Log($"Couldn't find audio clip {audio}"); + if (audioClip == null) NHLogger.Log($"Couldn't find audio clip {audio}"); else source.clip = audioClip; } } @@ -52,10 +53,10 @@ namespace NewHorizons.Utility { if (_loadedAudioClips.ContainsKey(path)) { - Logger.LogVerbose($"Already loaded audio at path: {path}"); + NHLogger.LogVerbose($"Already loaded audio at path: {path}"); return _loadedAudioClips[path]; } - Logger.LogVerbose($"Loading audio at path: {path}"); + NHLogger.LogVerbose($"Loading audio at path: {path}"); var task = Task.Run(async () => await GetAudioClip(path)); task.Wait(); _loadedAudioClips.Add(path, task.Result); @@ -63,14 +64,14 @@ namespace NewHorizons.Utility } catch (Exception ex) { - Logger.LogError($"Couldn't load Audio at {path} : {ex}"); + NHLogger.LogError($"Couldn't load Audio at {path} : {ex}"); return null; } } public static void ClearCache() { - Logger.LogVerbose("Clearing audio cache"); + NHLogger.LogVerbose("Clearing audio cache"); foreach (var audioClip in _loadedAudioClips.Values) { @@ -98,7 +99,7 @@ namespace NewHorizons.Utility audioType = UnityEngine.AudioType.MPEG; break; default: - Logger.LogError($"Couldn't load Audio at {path} : Invalid audio file extension ({extension}) must be .wav or .ogg or .mp3"); + NHLogger.LogError($"Couldn't load Audio at {path} : Invalid audio file extension ({extension}) must be .wav or .ogg or .mp3"); return null; } @@ -115,7 +116,7 @@ namespace NewHorizons.Utility if (www.isNetworkError || www.isHttpError) { - Logger.LogError($"Couldn't load Audio at {path} : {www.error}"); + NHLogger.LogError($"Couldn't load Audio at {path} : {www.error}"); return null; } else @@ -134,7 +135,7 @@ namespace NewHorizons.Utility if (www.isNetworkError || www.isHttpError) { - Logger.LogError($"Couldn't load Audio at {path} : {www.error}"); + NHLogger.LogError($"Couldn't load Audio at {path} : {www.error}"); return null; } else diff --git a/NewHorizons/Utility/ImageUtilities.cs b/NewHorizons/Utility/Files/ImageUtilities.cs similarity index 95% rename from NewHorizons/Utility/ImageUtilities.cs rename to NewHorizons/Utility/Files/ImageUtilities.cs index c4c2e565..bd883f85 100644 --- a/NewHorizons/Utility/ImageUtilities.cs +++ b/NewHorizons/Utility/Files/ImageUtilities.cs @@ -1,3 +1,4 @@ +using NewHorizons.Utility.OWML; using OWML.Common; using System; using System.Collections; @@ -8,7 +9,7 @@ using UnityEngine; using UnityEngine.Events; using UnityEngine.Networking; -namespace NewHorizons.Utility +namespace NewHorizons.Utility.Files { public static class ImageUtilities { @@ -33,11 +34,11 @@ namespace NewHorizons.Utility var path = Path.Combine(mod.ModHelper.Manifest.ModFolderPath, filename); if (_loadedTextures.ContainsKey(path)) { - Logger.LogVerbose($"Already loaded image at path: {path}"); + NHLogger.LogVerbose($"Already loaded image at path: {path}"); return _loadedTextures[path]; } - Logger.LogVerbose($"Loading image at path: {path}"); + NHLogger.LogVerbose($"Loading image at path: {path}"); try { var data = File.ReadAllBytes(path); @@ -52,7 +53,7 @@ namespace NewHorizons.Utility catch (Exception ex) { // Half the time when a texture doesn't load it doesn't need to exist so just log verbose - Logger.LogVerbose($"Exception thrown while loading texture [{filename}]:\n{ex}"); + NHLogger.LogVerbose($"Exception thrown while loading texture [{filename}]:\n{ex}"); return null; } } @@ -74,7 +75,7 @@ namespace NewHorizons.Utility public static void ClearCache() { - Logger.LogVerbose("Clearing image cache"); + NHLogger.LogVerbose("Clearing image cache"); foreach (var texture in _loadedTextures.Values) { @@ -232,7 +233,7 @@ namespace NewHorizons.Utility { if (image == null) { - Logger.LogError($"Tried to tint null image"); + NHLogger.LogError($"Tried to tint null image"); return null; } @@ -401,7 +402,7 @@ namespace NewHorizons.Utility if (_loadedCount >= PathsToLoad.Count) { - Logger.LogVerbose($"Finished loading all textures for {gameObject.name} (one was {PathsToLoad.FirstOrDefault()}"); + NHLogger.LogVerbose($"Finished loading all textures for {gameObject.name} (one was {PathsToLoad.FirstOrDefault()}"); FinishedLoading = true; } } @@ -413,7 +414,7 @@ namespace NewHorizons.Utility { if (_loadedTextures.ContainsKey(url)) { - Logger.LogVerbose($"Already loaded image {index}:{url}"); + NHLogger.LogVerbose($"Already loaded image {index}:{url}"); var texture = _loadedTextures[url]; imageLoadedEvent?.Invoke(texture, index); yield break; @@ -428,7 +429,7 @@ namespace NewHorizons.Utility if (hasError) { - Logger.LogError($"Failed to load {index}:{url} - {uwr.error}"); + NHLogger.LogError($"Failed to load {index}:{url} - {uwr.error}"); } else { @@ -444,7 +445,7 @@ namespace NewHorizons.Utility { if (_loadedTextures.ContainsKey(url)) { - Logger.LogVerbose($"Already loaded image {index}:{url}"); + NHLogger.LogVerbose($"Already loaded image {index}:{url}"); Destroy(texture); texture = _loadedTextures[url]; } diff --git a/NewHorizons/Utility/Cache.cs b/NewHorizons/Utility/Files/NHCache.cs similarity index 79% rename from NewHorizons/Utility/Cache.cs rename to NewHorizons/Utility/Files/NHCache.cs index f19aaced..431cbc49 100644 --- a/NewHorizons/Utility/Cache.cs +++ b/NewHorizons/Utility/Files/NHCache.cs @@ -4,9 +4,9 @@ using System.Collections.Generic; using System.IO; using System.Linq; -namespace NewHorizons.Utility +namespace NewHorizons.Utility.Files { - public class Cache + public class NHCache { string filepath; IModBehaviour mod; @@ -14,12 +14,12 @@ namespace NewHorizons.Utility HashSet accessedKeys = new HashSet(); bool dirty; - public Cache(IModBehaviour mod, string cacheFilePath) + public NHCache(IModBehaviour mod, string cacheFilePath) { this.mod = mod; - this.filepath = cacheFilePath; + filepath = cacheFilePath; var fullPath = mod.ModHelper.Manifest.ModFolderPath + cacheFilePath; - + if (!File.Exists(fullPath)) { data = new Dictionary(); @@ -27,7 +27,7 @@ namespace NewHorizons.Utility return; } - var json = File.ReadAllText(fullPath); + var json = File.ReadAllText(fullPath); data = JsonConvert.DeserializeObject>(json); // the code above does exactly the same thing that the code below does, but the below for some reason always returns null. no clue why // data = mod.ModHelper.Storage.Load>(filepath); @@ -35,14 +35,14 @@ namespace NewHorizons.Utility dirty = false; } - public void WriteToFile() + public void WriteToFile() { if (data.Count <= 0) return; // don't write empty caches if (!dirty) return; // don't write unmodified caches - mod.ModHelper.Storage.Save>(data, filepath); + mod.ModHelper.Storage.Save(data, filepath); } - public bool ContainsKey(string key) + public bool ContainsKey(string key) { return data.ContainsKey(key); } @@ -61,10 +61,10 @@ namespace NewHorizons.Utility data[key] = JsonConvert.SerializeObject(value); } - public void ClearUnaccessed() + public void ClearUnaccessed() { var keys = data.Keys.ToList(); - foreach(var key in keys) + foreach (var key in keys) { if (accessedKeys.Contains(key)) continue; data.Remove(key); diff --git a/NewHorizons/Utility/Geometry/MeshUtilities.cs b/NewHorizons/Utility/Geometry/MeshUtilities.cs index 1631bffd..d4f10583 100644 --- a/NewHorizons/Utility/Geometry/MeshUtilities.cs +++ b/NewHorizons/Utility/Geometry/MeshUtilities.cs @@ -1,4 +1,5 @@ using System.Linq; +using NewHorizons.External.Modules.SerializableData; using UnityEngine; namespace NewHorizons.Utility.Geometry diff --git a/NewHorizons/Utility/NewHorizonExtensions.cs b/NewHorizons/Utility/NewHorizonExtensions.cs index d7f0838e..b235f779 100644 --- a/NewHorizons/Utility/NewHorizonExtensions.cs +++ b/NewHorizons/Utility/NewHorizonExtensions.cs @@ -1,5 +1,7 @@ using NewHorizons.External.Configs; +using NewHorizons.External.Modules.SerializableData; using NewHorizons.External.Modules.SerializableEnums; +using NewHorizons.Utility.OWML; using Newtonsoft.Json; using OWML.Utils; using System; @@ -124,7 +126,7 @@ namespace NewHorizons.Utility } catch (Exception) { - Logger.LogWarning($"Couldn't copy property {targetProperty.Name} from {source} to {destination}"); + NHLogger.LogWarning($"Couldn't copy property {targetProperty.Name} from {source} to {destination}"); } } } @@ -151,7 +153,7 @@ namespace NewHorizons.Utility } catch (Exception) { - Logger.LogWarning($"Couldn't copy field {targetField.Name} from {source} to {destination}"); + NHLogger.LogWarning($"Couldn't copy field {targetField.Name} from {source} to {destination}"); } } } @@ -248,7 +250,7 @@ namespace NewHorizons.Utility bool xCorrect = nomaiCoordinateInterface._nodeControllers[0].CheckCoordinate(coordinates.x); bool yCorrect = nomaiCoordinateInterface._nodeControllers[1].CheckCoordinate(coordinates.y); bool zCorrect = nomaiCoordinateInterface._nodeControllers[2].CheckCoordinate(coordinates.z); - Utility.Logger.LogVerbose($"Coordinate Check for {system}: {xCorrect}, {yCorrect}, {zCorrect} [{string.Join("-", coordinates.x)}, {string.Join("-", coordinates.y)}, {string.Join("-", coordinates.z)}]"); + OWML.NHLogger.LogVerbose($"Coordinate Check for {system}: {xCorrect}, {yCorrect}, {zCorrect} [{string.Join("-", coordinates.x)}, {string.Join("-", coordinates.y)}, {string.Join("-", coordinates.z)}]"); return xCorrect && yCorrect && zCorrect; } diff --git a/NewHorizons/Utility/OWMLUtilities/Delay.cs b/NewHorizons/Utility/OWML/Delay.cs similarity index 91% rename from NewHorizons/Utility/OWMLUtilities/Delay.cs rename to NewHorizons/Utility/OWML/Delay.cs index 3d8288f0..9e83e9bc 100644 --- a/NewHorizons/Utility/OWMLUtilities/Delay.cs +++ b/NewHorizons/Utility/OWML/Delay.cs @@ -1,6 +1,6 @@ using System; -namespace NewHorizons.Utility.OWMLUtilities +namespace NewHorizons.Utility.OWML { public static class Delay { diff --git a/NewHorizons/Utility/OWMLUtilities/EnumUtilities.cs b/NewHorizons/Utility/OWML/EnumUtilities.cs similarity index 96% rename from NewHorizons/Utility/OWMLUtilities/EnumUtilities.cs rename to NewHorizons/Utility/OWML/EnumUtilities.cs index aec5f721..075f1878 100644 --- a/NewHorizons/Utility/OWMLUtilities/EnumUtilities.cs +++ b/NewHorizons/Utility/OWML/EnumUtilities.cs @@ -2,7 +2,7 @@ using OWML.Utils; using System; using System.Collections.Generic; -namespace NewHorizons.Utility.OWMLUtilities +namespace NewHorizons.Utility.OWML { public static class EnumUtilities { diff --git a/NewHorizons/Utility/Logger.cs b/NewHorizons/Utility/OWML/NHLogger.cs similarity index 94% rename from NewHorizons/Utility/Logger.cs rename to NewHorizons/Utility/OWML/NHLogger.cs index f083f241..ea53aec6 100644 --- a/NewHorizons/Utility/Logger.cs +++ b/NewHorizons/Utility/OWML/NHLogger.cs @@ -1,9 +1,9 @@ using OWML.Common; using System; -namespace NewHorizons.Utility +namespace NewHorizons.Utility.OWML { - public static class Logger + public static class NHLogger { private static LogType _logLevel = LogType.Error; diff --git a/NewHorizons/Utility/OWUtilities/AstroObjectLocator.cs b/NewHorizons/Utility/OuterWilds/AstroObjectLocator.cs similarity index 97% rename from NewHorizons/Utility/OWUtilities/AstroObjectLocator.cs rename to NewHorizons/Utility/OuterWilds/AstroObjectLocator.cs index cd169053..88d46e51 100644 --- a/NewHorizons/Utility/OWUtilities/AstroObjectLocator.cs +++ b/NewHorizons/Utility/OuterWilds/AstroObjectLocator.cs @@ -1,7 +1,9 @@ using System.Collections.Generic; using System.Linq; +using NewHorizons.Utility.OWML; using UnityEngine; -namespace NewHorizons.Utility.OWUtilities + +namespace NewHorizons.Utility.OuterWilds { public static class AstroObjectLocator { @@ -64,12 +66,12 @@ namespace NewHorizons.Utility.OWUtilities if (_customAstroObjectDictionary.ContainsKey(key)) { - Logger.LogWarning($"Registering duplicate [{ao.name}] as [{key}]"); + NHLogger.LogWarning($"Registering duplicate [{ao.name}] as [{key}]"); _customAstroObjectDictionary[key] = ao; } else { - Logger.LogVerbose($"Registering [{ao.name}] as [{key}]"); + NHLogger.LogVerbose($"Registering [{ao.name}] as [{key}]"); _customAstroObjectDictionary.Add(key, ao); } } diff --git a/NewHorizons/Utility/OWUtilities/Layer.cs b/NewHorizons/Utility/OuterWilds/Layer.cs similarity index 98% rename from NewHorizons/Utility/OWUtilities/Layer.cs rename to NewHorizons/Utility/OuterWilds/Layer.cs index a9eae8bb..4f95d451 100644 --- a/NewHorizons/Utility/OWUtilities/Layer.cs +++ b/NewHorizons/Utility/OuterWilds/Layer.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace NewHorizons.Utility.OWUtilities +namespace NewHorizons.Utility.OuterWilds { public static class Layer { diff --git a/NewHorizons/Utility/OWUtilities/TimeLoopUtilities.cs b/NewHorizons/Utility/OuterWilds/TimeLoopUtilities.cs similarity index 96% rename from NewHorizons/Utility/OWUtilities/TimeLoopUtilities.cs rename to NewHorizons/Utility/OuterWilds/TimeLoopUtilities.cs index 32a9b5aa..4566487c 100644 --- a/NewHorizons/Utility/OWUtilities/TimeLoopUtilities.cs +++ b/NewHorizons/Utility/OuterWilds/TimeLoopUtilities.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace NewHorizons.Utility.OWUtilities +namespace NewHorizons.Utility.OuterWilds { public static class TimeLoopUtilities { diff --git a/NewHorizons/Utility/SearchUtilities.cs b/NewHorizons/Utility/SearchUtilities.cs index 99cd2cdb..3d043925 100644 --- a/NewHorizons/Utility/SearchUtilities.cs +++ b/NewHorizons/Utility/SearchUtilities.cs @@ -1,3 +1,4 @@ +using NewHorizons.Utility.OWML; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -12,7 +13,7 @@ namespace NewHorizons.Utility public static void ClearCache() { - Logger.LogVerbose("Clearing search cache"); + NHLogger.LogVerbose("Clearing search cache"); CachedGameObjects.Clear(); } @@ -118,7 +119,7 @@ namespace NewHorizons.Utility } var name = names.Last(); - if (warn) Logger.LogWarning($"Couldn't find object in path {path}, will look for potential matches for name {name}"); + if (warn) NHLogger.LogWarning($"Couldn't find object in path {path}, will look for potential matches for name {name}"); // 3: find resource to include inactive objects (but skip prefabs) go = Resources.FindObjectsOfTypeAll() .FirstOrDefault(x => x.name == name && x.scene.name != null); @@ -128,7 +129,7 @@ namespace NewHorizons.Utility return go; } - if (warn) Logger.LogWarning($"Couldn't find object with name {name}"); + if (warn) NHLogger.LogWarning($"Couldn't find object with name {name}"); return null; }