Skip to content

Commit

Permalink
Add log message to indicate which mod's config is triggering reload i…
Browse files Browse the repository at this point in the history
…n MP join
  • Loading branch information
JavidPack committed Jan 17, 2024
1 parent 1b105d7 commit 2fee0aa
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions patches/tModLoader/Terraria/ModLoader/ModNet.cs
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 2fee0aa

Please sign in to comment.