diff --git a/ProducerFrameworkMod/Controllers/ProducerController.cs b/ProducerFrameworkMod/Controllers/ProducerController.cs index fff1e1b..d85d182 100644 --- a/ProducerFrameworkMod/Controllers/ProducerController.cs +++ b/ProducerFrameworkMod/Controllers/ProducerController.cs @@ -282,9 +282,8 @@ private static bool ValidateRuleProducerName(string producerName) private static void AddRuleToRepository(ProducerRule producerRule) { Tuple ruleKey = new Tuple(producerRule.ProducerName, producerRule.InputKey); - if (RulesRepository.ContainsKey(ruleKey)) + if (RulesRepository.TryGetValue(ruleKey, out var oldRule)) { - ProducerRule oldRule = RulesRepository[ruleKey]; if (oldRule.ModUniqueID != producerRule.ModUniqueID) { if (oldRule.OverrideMod.Contains(producerRule.ModUniqueID) && @@ -475,28 +474,34 @@ private static void AddConfigToRepository(ProducerConfig producerConfig) public static ProducerRule GetProducerItem(string producerName, Object input) { ProducerRule value; - if (input == null) - { - RulesRepository.TryGetValue(new Tuple(producerName, null), out value); + if (input == null) { + RulesRepository.TryGetValue(new Tuple(producerName, null), out value); + return value; + } + + if (RulesRepository.TryGetValue(new Tuple(producerName, input.Name), out value)) + { + return value; } - else + + if (RulesRepository.TryGetValue(new Tuple(producerName, input.ParentSheetIndex), out value)) + { + return value; + } + + foreach (string tag in input.GetContextTagList()) { - RulesRepository.TryGetValue(new Tuple(producerName, input.ParentSheetIndex), out value); - if (value == null) - { - foreach (string tag in input.GetContextTagList()) - { - if (RulesRepository.TryGetValue(new Tuple(producerName, tag), out value)) - { - break; - } - } - } - if (value == null) + if (RulesRepository.TryGetValue(new Tuple(producerName, tag), out value)) { - RulesRepository.TryGetValue(new Tuple(producerName, input.Category), out value); + return value; } } + + if (RulesRepository.TryGetValue(new Tuple(producerName, input.Category), out value)) + { + return value; + } + return value; } diff --git a/ProducerFrameworkMod/ObjectOverrides.cs b/ProducerFrameworkMod/ObjectOverrides.cs index 8798a52..de580e4 100644 --- a/ProducerFrameworkMod/ObjectOverrides.cs +++ b/ProducerFrameworkMod/ObjectOverrides.cs @@ -28,7 +28,7 @@ internal static bool PerformObjectDropInAction(Object __instance, Item dropInIte bool failLocationCondition = false; bool failSeasonCondition = false; - if (__instance.heldObject.Value != null && !__instance.name.Equals("Crystalarium") || input.bigCraftable.Value) + if (__instance.heldObject.Value != null && !__instance.name.Equals("Crystalarium")) { return true; }