From e3001bedfc558ee3338f1b57741a2b5e75a93cf8 Mon Sep 17 00:00:00 2001 From: Terry Hearst Date: Mon, 4 Sep 2023 16:38:48 -0400 Subject: [PATCH] Custom logging function --- Config.cs | 11 +++++++---- PatchEntryPoint.cs | 4 ++-- Patches/MarbleHolderPatches.cs | 2 -- Shared.cs | 8 +++++++- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Config.cs b/Config.cs index 4de1b49..b1fec31 100644 --- a/Config.cs +++ b/Config.cs @@ -58,7 +58,7 @@ namespace CustomCosmeticLoader } catch (Exception e) { - Debug.LogError("Couldn't load CustomCosmeticLoader config!"); + Shared.Log("Couldn't load CustomCosmeticLoader config!"); Debug.LogException(e); return; } @@ -87,12 +87,15 @@ namespace CustomCosmeticLoader { string nickname = node.Key; string skinName = node.Value.Value; - Debug.Log("Other player: " + nickname + " | " + skinName); if (skins.ContainsKey(skinName)) { - Debug.Log("Skin found, adding other player!"); + Shared.Log("Adding other player: " + nickname + " -> " + skinName); otherPlayers.Add(nickname, skinName); } + else + { + Shared.Log("NOT adding other player " + nickname + ", skin " + skinName + " not found"); + } } } } @@ -124,7 +127,7 @@ namespace CustomCosmeticLoader { if (skins.Count == 0) { - Debug.LogWarning("No custom skins found, disabling"); + Shared.Log("No custom skins found, disabling mod"); enabled = false; return; } diff --git a/PatchEntryPoint.cs b/PatchEntryPoint.cs index b6d0a00..8f8ff7e 100644 --- a/PatchEntryPoint.cs +++ b/PatchEntryPoint.cs @@ -34,7 +34,7 @@ namespace CustomCosmeticLoader skinsPath = Path.Combine(skinsPath, "skins"); if (!Directory.Exists(skinsPath)) { - Debug.Log(skinsPath + " directory does not exist, no skins to load"); + Shared.Log(skinsPath + " directory does not exist, no skins to load"); return; } string printStr = "Loaded custom skins: "; @@ -46,7 +46,7 @@ namespace CustomCosmeticLoader skinTexture.LoadImage(File.ReadAllBytes(skinFile)); Config.skins.Add(skinName, skinTexture); } - Debug.Log(printStr); + Shared.Log(printStr); } } } diff --git a/Patches/MarbleHolderPatches.cs b/Patches/MarbleHolderPatches.cs index e93e52f..81e47f0 100644 --- a/Patches/MarbleHolderPatches.cs +++ b/Patches/MarbleHolderPatches.cs @@ -67,8 +67,6 @@ namespace CustomCosmeticLoader.Patches if (controller == null) return; - Debug.Log("========= MarbleHolder.CheckSet with nickname " + controller.nickname); - if (!controller.isMyClientMarble()) { if (!Config.otherPlayers.ContainsKey(controller.nickname)) diff --git a/Shared.cs b/Shared.cs index 9220fbe..ed4baf0 100644 --- a/Shared.cs +++ b/Shared.cs @@ -16,7 +16,7 @@ namespace CustomCosmeticLoader DetermineSkinToHijack(); if (skinToHijack == null) { - Debug.LogWarning("Couldn't find skin " + Config.skinNameToHijack + " to hijack"); + Shared.Log("Couldn't find skin " + Config.skinNameToHijack + " to hijack"); Config.skinNameToHijack = "Swirl_M"; DetermineSkinToHijack(); } @@ -50,5 +50,11 @@ namespace CustomCosmeticLoader material.mainTexture = skin; } } + + public static void Log(string message) + { + message = "[CUSTOM COSMETIC LOADER] " + message; + Debug.Log(message); + } } }