diff --git a/Nautilus/Handlers/KnownTechHandler.cs b/Nautilus/Handlers/KnownTechHandler.cs
index 8b3e1ca38..afc0acb98 100644
--- a/Nautilus/Handlers/KnownTechHandler.cs
+++ b/Nautilus/Handlers/KnownTechHandler.cs
@@ -336,6 +336,21 @@ public static void RemoveAllCurrentAnalysisTechEntry(TechType targetTechType)
RemoveAnalysisTechEntry(targetTechType);
}
+ ///
+ /// Allows you to remove a from being unlocked by default.
+ ///
+ ///
+ public static void RemoveDefaultUnlock(TechType techType)
+ {
+ var modName = ReflectionHelper.CallingAssemblyByStackTrace().GetName().Name;
+ if (!KnownTechPatcher.DefaultRemovalTechs.TryGetValue(modName, out var techTypes))
+ techTypes = new List();
+ techTypes.Add(techType);
+
+ KnownTechPatcher.DefaultRemovalTechs[modName] = techTypes;
+ Reinitialize();
+ }
+
///
/// References to generic unlock sounds and unlock messages for the Known Tech system, matching those used in the base game.
///
diff --git a/Nautilus/Patchers/KnownTechPatcher.cs b/Nautilus/Patchers/KnownTechPatcher.cs
index 0fc44187c..f9fec628f 100644
--- a/Nautilus/Patchers/KnownTechPatcher.cs
+++ b/Nautilus/Patchers/KnownTechPatcher.cs
@@ -14,6 +14,7 @@ internal class KnownTechPatcher
internal static HashSet LockedWithNoUnlocks = new();
internal static HashSet HardLocked = new();
internal static HashSet RemovalTechs = new();
+ internal static Dictionary> DefaultRemovalTechs = new();
internal static IDictionary AnalysisTech = new SelfCheckingDictionary("AnalysisTech", AsStringFunction);
internal static IDictionary> BlueprintRequirements = new SelfCheckingDictionary>("BlueprintRequirements", AsStringFunction);
internal static IDictionary CompoundTech = new SelfCheckingDictionary("CompoundTech", AsStringFunction);
@@ -49,7 +50,25 @@ internal static void Reinitialize()
private static void InitializePrefix(PDAData data)
{
- data.defaultTech.AddRange(UnlockedAtStart);
+ foreach (var unlockedTech in UnlockedAtStart)
+ {
+ if (!data.defaultTech.Contains(unlockedTech))
+ {
+ data.defaultTech.Add(unlockedTech);
+ InternalLogger.Debug($"Setting {unlockedTech.AsString()} to be unlocked at start.");
+ }
+ }
+
+ foreach (var removalTechsByMod in DefaultRemovalTechs)
+ {
+ foreach (var removalTech in removalTechsByMod.Value)
+ {
+ if (data.defaultTech.Remove(removalTech))
+ {
+ InternalLogger.Debug($"{removalTechsByMod.Key} removed {removalTech.AsString()} from unlocking at start.");
+ }
+ }
+ }
foreach (var tech in AnalysisTech.Values)
{
@@ -80,6 +99,7 @@ private static void InitializePrefix(PDAData data)
continue;
}
+ InternalLogger.Debug($"Adding TechTypes to be unlocked by {blueprintRequirements.Key}: {blueprintRequirements.Value.Join((techType) => techType.AsString())}");
data.analysisTech[index].unlockTechTypes.AddRange(blueprintRequirements.Value);
}