Skip to content

Commit

Permalink
unify unloaded check and make sure it compiles smh
Browse files Browse the repository at this point in the history
  • Loading branch information
InvalidArgument3 committed Oct 27, 2024
1 parent c85c569 commit 997e798
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void UnloadData() {
}

public void Update() {
if (MasterSession.I == null || Log.IsUnloaded)
if (MasterSession.I == null || Log._unloaded)
return;

_networkLoadUpdate--;
Expand All @@ -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 {
Expand All @@ -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);
}
}
Expand All @@ -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);
}
}
Expand Down
5 changes: 2 additions & 3 deletions ConfigurableGridPoints/Data/Scripts/ShipPoints/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -277,7 +276,7 @@ public override void LoadData() {
}

protected override void UnloadData() {
IsUnloaded = true;
_unloaded = true;
_instance = null;
if (_handler != null && _handler.AutoClose)
Unload();
Expand Down

0 comments on commit 997e798

Please sign in to comment.