From b1faab1398c5f229b664636b19eae08daa00bdd6 Mon Sep 17 00:00:00 2001 From: JavidPack Date: Wed, 10 Jan 2024 16:41:08 -0700 Subject: [PATCH] Fix #3977, language workshop tags will persist with some leniency. --- .../UI/States/WorkshopPublishInfoStateForMods.TML.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/patches/tModLoader/Terraria/GameContent/UI/States/WorkshopPublishInfoStateForMods.TML.cs b/patches/tModLoader/Terraria/GameContent/UI/States/WorkshopPublishInfoStateForMods.TML.cs index a505c314dce..f4b9c956b6a 100644 --- a/patches/tModLoader/Terraria/GameContent/UI/States/WorkshopPublishInfoStateForMods.TML.cs +++ b/patches/tModLoader/Terraria/GameContent/UI/States/WorkshopPublishInfoStateForMods.TML.cs @@ -151,12 +151,13 @@ public override void OnInitialize() float localizationProgress = (float)countOtherEntries / countMaxEntries; ModLoader.Logging.tML.Info($"{culture.Name}, {countOtherEntries}/{countMaxEntries}, {localizationProgress:P0}, missing {countMaxEntries - countOtherEntries}"); - bool languageMostlyLocalized = localizationProgress > 0.75f; // Suitable threshold? + bool languageMostlyLocalized = localizationProgress > 0.75f; // 75% Threshold to be localized. + bool languagePreviouslyLocalizedAndStillEnough = tagOption.IsSelected && localizationProgress > 0.5f; // If mod previously tagged as localized, persist selection as long as above 50% - // Override existing selection or only set to true if true? Current behavior is override. - tagOption.SetCurrentOption(languageMostlyLocalized ? tagOption.OptionValue : null); - // Automatically set option is slightly redder, indicating it was automaticly selected - tagOption.SetColor(tagOption.IsSelected ? new Color(192, 175, 235) : Colors.InventoryDefaultColor, 1f); + // Override existing selection. Existing selection will persist if still above 50% to accommodate temporarily falling below threshold. + tagOption.SetCurrentOption(languageMostlyLocalized || languagePreviouslyLocalizedAndStillEnough ? tagOption.OptionValue : null); + // Automatically set option slightly redder, indicating it was automatically selected. Even redder if below 75% + tagOption.SetColor(tagOption.IsSelected ? (languageMostlyLocalized ? new Color(192, 175, 235) : new Color(255, 175, 235)) : Colors.InventoryDefaultColor, 1f); } } }