From 560c8c01fc5c7e0d01bd8086d4e96458c6b8e97d Mon Sep 17 00:00:00 2001 From: Rug Date: Tue, 9 Apr 2024 14:30:44 -0700 Subject: [PATCH] Registering keys is now optional --- MyceliumNetworkingForCW/MyceliumNetwork.cs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/MyceliumNetworkingForCW/MyceliumNetwork.cs b/MyceliumNetworkingForCW/MyceliumNetwork.cs index 69f15eb..e1a8207 100644 --- a/MyceliumNetworkingForCW/MyceliumNetwork.cs +++ b/MyceliumNetworkingForCW/MyceliumNetwork.cs @@ -368,8 +368,7 @@ public static void SetLobbyData(string key, object value) if(!lobbyDataKeys.Contains(key)) { - RugLogger.LogError($"Cannot access lobby data for unregistered key '{key}'."); - return; + RugLogger.LogWarning($"Accessing lobby data for unregistered key '{key}'. This might not exist."); } if(!SteamMatchmaking.SetLobbyData(Lobby, key, value.ToString())) @@ -393,8 +392,7 @@ public static bool HasLobbyData(string key) if(!lobbyDataKeys.Contains(key)) { - RugLogger.LogError($"Cannot access lobby data for unregistered key '{key}'."); - return false; + RugLogger.LogWarning($"Accessing lobby data for unregistered key '{key}'. This might not exist."); } string value = SteamMatchmaking.GetLobbyData(Lobby, key.ToString()); @@ -418,8 +416,7 @@ public static T GetLobbyData(string key) if(!lobbyDataKeys.Contains(key)) { - RugLogger.LogError($"Cannot access lobby data for unregistered key '{key}'."); - return default(T); + RugLogger.LogWarning($"Accessing lobby data for unregistered key '{key}'. This might not exist."); } string value = SteamMatchmaking.GetLobbyData(Lobby, key.ToString()); @@ -451,8 +448,7 @@ public static void SetPlayerData(string key, object value) if(!playerDataKeys.Contains(key)) { - RugLogger.LogError($"Cannot access player data for unregistered key '{key}'."); - return; + RugLogger.LogWarning($"Accessing player data for unregistered key '{key}'. This might not exist."); } SteamMatchmaking.SetLobbyMemberData(Lobby, key.ToString(), value.ToString()); @@ -473,8 +469,7 @@ public static bool HasPlayerData(CSteamID player, string key) if(!playerDataKeys.Contains(key)) { - RugLogger.LogError($"Cannot access player data for unregistered key '{key}'."); - return false; + RugLogger.LogWarning($"Accessing player data for unregistered key '{key}'. This might not exist."); } string value = SteamMatchmaking.GetLobbyMemberData(MyceliumNetwork.Lobby, player, key.ToString()); @@ -497,8 +492,7 @@ public static T GetPlayerData(CSteamID player, string key) if(!playerDataKeys.Contains(key)) { - RugLogger.LogError($"Cannot access player data for unregistered key '{key}'."); - return default(T); + RugLogger.LogWarning($"Accessing player data for unregistered key '{key}'. This might not exist."); } string value = SteamMatchmaking.GetLobbyMemberData(Lobby, player, key.ToString());