From c85c569e134ff7a44fff4063ff93d6f8ca7a6d28 Mon Sep 17 00:00:00 2001 From: InvalidArgument3 Date: Sun, 27 Oct 2024 00:00:05 -0500 Subject: [PATCH 1/2] Update Logger.cs --- ConfigurableGridPoints/Data/Scripts/ShipPoints/Logger.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ConfigurableGridPoints/Data/Scripts/ShipPoints/Logger.cs b/ConfigurableGridPoints/Data/Scripts/ShipPoints/Logger.cs index 4636c9a..d3b4f16 100644 --- a/ConfigurableGridPoints/Data/Scripts/ShipPoints/Logger.cs +++ b/ConfigurableGridPoints/Data/Scripts/ShipPoints/Logger.cs @@ -38,7 +38,7 @@ public class Log : MySessionComponentBase { private static Log _instance; private static Handler _handler; private static bool _unloaded; - public bool IsUnloaded { get; set; } + public static bool IsUnloaded { get; set; } public static readonly string File = GenerateTimestampedFileName(); From 997e7989c8e51ed79ace0077f59f31a0d3dfc595 Mon Sep 17 00:00:00 2001 From: InvalidArgument3 Date: Sun, 27 Oct 2024 00:01:58 -0500 Subject: [PATCH 2/2] unify unloaded check and make sure it compiles smh --- .../Scripts/ShipPoints/HeartNetworking/HeartNetwork.cs | 8 ++++---- ConfigurableGridPoints/Data/Scripts/ShipPoints/Logger.cs | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ConfigurableGridPoints/Data/Scripts/ShipPoints/HeartNetworking/HeartNetwork.cs b/ConfigurableGridPoints/Data/Scripts/ShipPoints/HeartNetworking/HeartNetwork.cs index 0851f65..eb42fd0 100644 --- a/ConfigurableGridPoints/Data/Scripts/ShipPoints/HeartNetworking/HeartNetwork.cs +++ b/ConfigurableGridPoints/Data/Scripts/ShipPoints/HeartNetworking/HeartNetwork.cs @@ -45,7 +45,7 @@ public void UnloadData() { } public void Update() { - if (MasterSession.I == null || Log.IsUnloaded) + if (MasterSession.I == null || Log._unloaded) return; _networkLoadUpdate--; @@ -64,7 +64,7 @@ public void Update() { private void ReceivedPacket(ushort channelId, byte[] serialized, ulong senderSteamId, bool isSenderServer) { // Add check if mod is unloaded - if (MasterSession.I == null || Log.IsUnloaded) + if (MasterSession.I == null || Log._unloaded) return; try { @@ -78,7 +78,7 @@ private void ReceivedPacket(ushort channelId, byte[] serialized, ulong senderSte HandlePacket(packet, senderSteamId); } catch (Exception ex) { - if (!Log.IsUnloaded) + if (!Log._unloaded) Log.Error(ex); } } @@ -91,7 +91,7 @@ private void HandlePacket(PacketBase packet, ulong senderSteamId) { packet.Received(senderSteamId); } catch (Exception ex) { - if (!Log.IsUnloaded) + if (!Log._unloaded) Log.Error(ex); } } diff --git a/ConfigurableGridPoints/Data/Scripts/ShipPoints/Logger.cs b/ConfigurableGridPoints/Data/Scripts/ShipPoints/Logger.cs index d3b4f16..347787d 100644 --- a/ConfigurableGridPoints/Data/Scripts/ShipPoints/Logger.cs +++ b/ConfigurableGridPoints/Data/Scripts/ShipPoints/Logger.cs @@ -37,8 +37,7 @@ public class Log : MySessionComponentBase { private static Log _instance; private static Handler _handler; - private static bool _unloaded; - public static bool IsUnloaded { get; set; } + public static bool _unloaded; public static readonly string File = GenerateTimestampedFileName(); @@ -277,7 +276,7 @@ public override void LoadData() { } protected override void UnloadData() { - IsUnloaded = true; + _unloaded = true; _instance = null; if (_handler != null && _handler.AutoClose) Unload();