From 2fee0aade6f24d77bd72584633a15fd65e57bbfd Mon Sep 17 00:00:00 2001 From: JavidPack Date: Wed, 17 Jan 2024 15:14:27 -0700 Subject: [PATCH] Add log message to indicate which mod's config is triggering reload in MP join --- patches/tModLoader/Terraria/ModLoader/ModNet.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/patches/tModLoader/Terraria/ModLoader/ModNet.cs b/patches/tModLoader/Terraria/ModLoader/ModNet.cs index c731580d9ea..8c2bb2071eb 100644 --- a/patches/tModLoader/Terraria/ModLoader/ModNet.cs +++ b/patches/tModLoader/Terraria/ModLoader/ModNet.cs @@ -234,7 +234,7 @@ internal static bool SyncClientMods(BinaryReader reader, out bool needsReload) // overwrite an existing version of the mod if there is one if (localVersions.Length > 0) - header.path = localVersions[0].modFile.path; + header.path = localVersions[0].modFile.path; // TODO: This can potentially overwrite the workshop folder's .tmod file, is that intended? if (downloadModsFromServers && (header.signed || !onlyDownloadSignedMods)) downloadQueue.Enqueue(header); @@ -273,10 +273,14 @@ internal static bool SyncClientMods(BinaryReader reader, out bool needsReload) foreach (NetConfig pendingConfig in pendingConfigs) JsonConvert.PopulateObject(pendingConfig.json, ConfigManager.GetConfig(pendingConfig), ConfigManager.serializerSettingsCompact); - if (ConfigManager.AnyModNeedsReload()) { - needsReload = true; + foreach (var mod in ModLoader.Mods) { + if (ConfigManager.ModNeedsReload(mod)) { + needsReload = true; + Logging.tML.Debug($"Config Requires Reload: {mod.Name} has a config change that requires a mod reload"); + break; + } } - else { + if (!needsReload) { foreach (NetConfig pendingConfig in pendingConfigs) ConfigManager.GetConfig(pendingConfig).OnChanged(); } @@ -340,7 +344,7 @@ internal static void ReceiveMod(BinaryReader reader) mod.Close(); downloadingLength = reader.ReadInt64(); - Logging.tML.Debug($"Downloading: {downloadingMod.name} {downloadingLength}bytes"); + Logging.tML.Debug($"Downloading: {downloadingMod.name} {downloadingLength} bytes"); downloadingFile = new FileStream(downloadingMod.path, FileMode.Create); return; }