From 51ff7989d3f0d7ffbf840d2f9fcf0dedea6c1f69 Mon Sep 17 00:00:00 2001 From: Safairette <71556532+Safairette@users.noreply.github.com> Date: Sat, 21 Dec 2024 20:25:01 +0200 Subject: [PATCH] Hide disabled ammo from research --- .../Harmony_ResearchPrerequisitesUtility.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Source/CombatExtended/Harmony/Harmony_ResearchPrerequisitesUtility.cs diff --git a/Source/CombatExtended/Harmony/Harmony_ResearchPrerequisitesUtility.cs b/Source/CombatExtended/Harmony/Harmony_ResearchPrerequisitesUtility.cs new file mode 100644 index 0000000000..a1a7c0f111 --- /dev/null +++ b/Source/CombatExtended/Harmony/Harmony_ResearchPrerequisitesUtility.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using HarmonyLib; +using RimWorld; +using Verse; + +namespace CombatExtended +{ + [HarmonyPatch(typeof(ResearchPrerequisitesUtility), nameof(ResearchPrerequisitesUtility.UnlockedDefsGroupedByPrerequisites))] + public class Harmony_ResearchPrerequisitesUtility + { + public static List>> Postfix(List>> input) + { + foreach (var pair in input) + { + pair.second.RemoveWhere(x => x is AmmoDef ammoDef && ammoDef.menuHidden); + } + return input; + } + } +}