From 809df8f58f119e6a77176ba912d740bef23b449a Mon Sep 17 00:00:00 2001 From: homothetyhk Date: Thu, 23 Jun 2022 12:33:30 -0700 Subject: [PATCH] Destroy toll machine when destroying base toll benches. LanguageData compatibility fix. --- BenchRando/IC/BenchDestroyerModule.cs | 11 +++++++++++ BenchRando/IC/LanguageData.cs | 12 +++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/BenchRando/IC/BenchDestroyerModule.cs b/BenchRando/IC/BenchDestroyerModule.cs index 5fa37d8..287e826 100644 --- a/BenchRando/IC/BenchDestroyerModule.cs +++ b/BenchRando/IC/BenchDestroyerModule.cs @@ -127,6 +127,17 @@ private static List BuildDestroyerList(BenchKey key) SceneName = SceneNames.Mines_18, }); } + else if (key == new BenchKey(SceneNames.Ruins1_31, "RestBench") + || key == new BenchKey(SceneNames.Fungus3_50, "RestBench") + || key == new BenchKey(SceneNames.Abyss_18, "RestBench")) + { + deployers.Add(new ObjectDestroyer + { + MatchType = ObjectDestroyer.NameMatchType.Path, + ObjectName = "Toll Machine Bench", + SceneName = key.SceneName, + }); + } return deployers; } diff --git a/BenchRando/IC/LanguageData.cs b/BenchRando/IC/LanguageData.cs index 9545d0c..57d14ac 100644 --- a/BenchRando/IC/LanguageData.cs +++ b/BenchRando/IC/LanguageData.cs @@ -36,11 +36,13 @@ internal static void Load() private static string OverrideLanguageString(string key, string sheetTitle, string orig) { - // If orig has already been overridden, then it was probably an ItemChanger language override - if (orig != Language.Language.GetInternal(key, sheetTitle)) return orig; - - LanguageKey obj = new(sheetTitle, key); - return _languageStrings.TryGetValue(obj, out string overrideValue) ? overrideValue : orig; + if (key == null || sheetTitle == null) return orig; + if (string.IsNullOrEmpty(orig) || orig.StartsWith("#!")) + { + LanguageKey obj = new(sheetTitle, key); + return _languageStrings.TryGetValue(obj, out string value) ? value : orig; + } + return orig; // If orig has already been overridden, then it was probably an ItemChanger language override } } }