Exemplo n.º 1
0
        private static bool FindAllowedModules()
        {
            var aIDeepDrillerBattery = TechTypeHandler.TryGetModdedTechType("AIDeepDrillerBattery", out TechType aiDeepDrillerBattery);

            if (aIDeepDrillerBattery)
            {
                DeepDrillerAllowedModules.Add(aiDeepDrillerBattery);
            }
            else
            {
                Log.Error($"Deep Driller Battery not found!");
                return(false);
            }

            var aIDeepDrillerSolar = TechTypeHandler.TryGetModdedTechType("AIDeepDrillerSolar", out TechType aiDeepDrillerSolar);

            if (aIDeepDrillerSolar)
            {
                DeepDrillerAllowedModules.Add(aiDeepDrillerSolar);
            }
            else
            {
                Log.Error($"Deep Driller Solar not found!");
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
 private static void HandleCrossModUpdates()
 {
     if (TechTypeHandler.TryGetModdedTechType("SeamothHullModule4", out TechType vehicleHullModule4) &&
         TechTypeHandler.TryGetModdedTechType("SeamothHullModule5", out TechType vehicleHullModule5))
     {
         VehicleUpgrader.SetModdedDepthModules(vehicleHullModule4, vehicleHullModule5);
     }
 }
Exemplo n.º 3
0
        public static void CrossModUpdates()
        {
            QuickLogger.Info("Checking if MoreSeamothDepth mod is present");

            IQMod moreSeamothDepth = QModServices.Main.FindModById("MoreSeamothDepth");

            if (moreSeamothDepth != null &&
                TechTypeHandler.TryGetModdedTechType("SeamothHullModule4", out TechType vehicleHullModule4) &&
                TechTypeHandler.TryGetModdedTechType("SeamothHullModule5", out TechType vehicleHullModule5))
            {
                QuickLogger.Info("Detected Seamoth Depth Modules Mk4 & Mk5");
                // the AddDepthModule will add the module to the common upgrades set, the common depth modules set, and the vehicle-specific set
                VehicleUpgrader.AddDepthModule(vehicleHullModule4, 4, VehicleUpgrader.EVehicleType.Seamoth);
                VehicleUpgrader.AddDepthModule(vehicleHullModule5, 5, VehicleUpgrader.EVehicleType.Seamoth);
            }

#if BELOWZERO
            QuickLogger.Info("Checking if SeaTruckDepthUpgrades mod is present");

            IQMod moreSeatruckDepth = QModServices.Main.FindModById("SeaTruckDepthUpgrades");
            if (moreSeatruckDepth != null &&
                TechTypeHandler.TryGetModdedTechType("SeaTruckDepthMK4", out TechType seaTruckHull4) &&
                TechTypeHandler.TryGetModdedTechType("SeaTruckDepthMK5", out TechType seaTruckHull5) &&
                TechTypeHandler.TryGetModdedTechType("SeaTruckDepthMK6", out TechType seaTruckHull6))
            {
                QuickLogger.Info("Detected SeaTruck Depth Modules Mk4, Mk5 and Mk6");
                VehicleUpgrader.AddDepthModule(seaTruckHull4, 4, VehicleUpgrader.EVehicleType.Seatruck);
                VehicleUpgrader.AddDepthModule(seaTruckHull5, 5, VehicleUpgrader.EVehicleType.Seatruck);
                VehicleUpgrader.AddDepthModule(seaTruckHull6, 6, VehicleUpgrader.EVehicleType.Seatruck);
            }

            IQMod seatruckSpeed = QModServices.Main.FindModById("SeaTruckSpeedUpgrades");
            if (seatruckSpeed != null &&
                TechTypeHandler.TryGetModdedTechType("SeaTruckSpeedMK1", out TechType speedMk1) &&
                TechTypeHandler.TryGetModdedTechType("SeaTruckSpeedMK2", out TechType speedMk2) &&
                TechTypeHandler.TryGetModdedTechType("SeaTruckSpeedMK3", out TechType speedMk3))
            {
                QuickLogger.Info("Detected Seatruck Speed Modules Mk1, Mk2 and Mk3");
                VehicleUpgrader.AddSpeedModifier(speedMk1, 1f, 0f);
                VehicleUpgrader.AddSpeedModifier(speedMk2, 2f, 0f);
                VehicleUpgrader.AddSpeedModifier(speedMk3, 3f, 0f);
            }

            IQMod seatruckArmour = QModServices.Main.FindModById("SeaTruckArmorUpgrades");
            if (seatruckSpeed != null &&
                TechTypeHandler.TryGetModdedTechType("SeaTruckArmorMK1", out TechType armour1) &&
                TechTypeHandler.TryGetModdedTechType("SeaTruckArmorMK2", out TechType armour2) &&
                TechTypeHandler.TryGetModdedTechType("SeaTruckArmorMK3", out TechType armour3))
            {
                QuickLogger.Info("Detected Seatruck Armour Modules Mk1, Mk2 and Mk3");
                VehicleUpgrader.AddArmourModule(armour1, 1);
                VehicleUpgrader.AddArmourModule(armour2, 2);
                VehicleUpgrader.AddArmourModule(armour3, 3);
            }
#endif
        }
Exemplo n.º 4
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            var tt = (string)serializer.Deserialize(reader, typeof(string));

            return(TechTypeExtensions.FromString(tt, out var techType, true) ?
                   techType
                : TechTypeHandler.TryGetModdedTechType(tt, out techType) ?
                   techType
                    : throw new Exception($"Failed to parse {tt} into a TechType."));
        }
Exemplo n.º 5
0
        private static void CreateDataboxesAndLoadFiles()
        {
            foreach (FileInfo file in DataboxFolder.GetFiles().Where((x) => x.Extension.ToLower() == ".json"))
            {
                try
                {
                    DataboxInfo databox;
                    using (var reader = new StreamReader(file.FullName))
                    {
                        var serializer = new JsonSerializer();
                        databox = JsonConvert.DeserializeObject <DataboxInfo>(reader.ReadToEnd(), new JsonConverter[]
                        {
                            new StringEnumConverter()
                            {
#if SN1
                                CamelCaseText = true,
#elif BZ
                                NamingStrategy = new CamelCaseNamingStrategy(),
#endif
                                AllowIntegerValues = true
                            },
                            new TechTypeConverter(),
                            new Vector3Converter()
                        });
                    }
                    if (databox != null)
                    {
                        var tt = TechTypeExtensions.FromString(databox.ItemToUnlock, out var techType, true) ? techType
                            : TechTypeHandler.TryGetModdedTechType(databox.ItemToUnlock, out techType) ? techType
                                : TechType.None;

                        if (tt != TechType.None)
                        {
                            var customDatabox = new DataboxPrefab(databox.DataboxID, databox.AlreadyUnlockedDescription, databox.PrimaryDescription, databox.SecondaryDescription, tt, databox.BiomesToSpawnIn, databox.CoordinatedSpawns);
                            customDatabox.Patch();
                        }
                        else
                        {
                            throw new Exception($"Couldn't parse {databox.ItemToUnlock} to TechType.");
                        }
                    }
                    else
                    {
                        QModManager.Utility.Logger.Log(QModManager.Utility.Logger.Level.Error, $"Unable to load Custom Databox from {Path.GetDirectoryName(file.FullName)}!");
                    }
                }
                catch (Exception e)
                {
                    QModManager.Utility.Logger.Log(QModManager.Utility.Logger.Level.Error, $"Unable to load Custom Databox from {Path.GetDirectoryName(file.FullName)}!", e);
                }
            }
        }
Exemplo n.º 6
0
        public static void refresh()
        {
            $"ArmsEnergyUsage: {Main.config.armsEnergyUsage.enabled}".logDbg();
            float grapplingArmEnergyCost = Main.config.armsEnergyUsage.enabled? Main.config.armsEnergyUsage.grapplingArmShoot: 0f;

            setEnergyCost(TechType.ExosuitGrapplingArmModule, grapplingArmEnergyCost);

            if (TechTypeHandler.TryGetModdedTechType("GrapplingArmUpgradeModule", out TechType upgradedGrapplingArm))
            {
                setEnergyCost(upgradedGrapplingArm, grapplingArmEnergyCost);
            }

            setEnergyCost(TechType.ExosuitTorpedoArmModule, Main.config.armsEnergyUsage.enabled? Main.config.armsEnergyUsage.torpedoArm: 0f);
            setEnergyCost(TechType.ExosuitClawArmModule, Main.config.armsEnergyUsage.enabled? Main.config.armsEnergyUsage.clawArm: 0.1f);
        }
        public static void refresh()
        {
            $"ArmsEnergyUsage: {Main.config.armsEnergyUsage.enabled}".logDbg();
            float grapplingArmEnergyCost = Main.config.armsEnergyUsage.enabled? Main.config.armsEnergyUsage.grapplingArmShoot: 0f;

            CraftData.energyCost[TechType.ExosuitGrapplingArmModule] = grapplingArmEnergyCost;

            if (TechTypeHandler.TryGetModdedTechType("GrapplingArmUpgradeModule", out TechType upgradedGrapplingArm))
            {
                CraftData.energyCost[upgradedGrapplingArm] = grapplingArmEnergyCost;
            }

            CraftData.energyCost[TechType.ExosuitTorpedoArmModule] = Main.config.armsEnergyUsage.enabled? Main.config.armsEnergyUsage.torpedoArm: 0f;
            CraftData.energyCost[TechType.ExosuitClawArmModule]    = Main.config.armsEnergyUsage.enabled? Main.config.armsEnergyUsage.clawArm: 0.1f;
        }
Exemplo n.º 8
0
        protected override void PrePatch()
        {
            if (TechTypeHandler.TryGetModdedTechType("SeamothHullModule4", out TechType seamothDepthMk4) &&
                TechTypeHandler.TryGetModdedTechType("SeamothHullModule5", out TechType seamothDepthMk5))
            {
                MTechType.SeamothHullModule4 = seamothDepthMk4;
                MTechType.SeamothHullModule5 = seamothDepthMk5;

                // MoreSeamothUpgrades found. Patch normally.
            }
            else
            {
                // MoreSeamothUpgrades not found. Register just the TechType to preserve the ID.
                PatchTechTypeOnly = true;
            }
        }
Exemplo n.º 9
0
        public static void Postfix()
        {
            if (modCheck)
            {
                TechTypeHandler.TryGetModdedTechType("ScubaManifold", out scubaManifold);
                TechTypeHandler.TryGetModdedTechType("photosynthesissmalltank", out photosynthesisSmall);
                TechTypeHandler.TryGetModdedTechType("photosynthesistank", out photosynthesisTank);
                TechTypeHandler.TryGetModdedTechType("chemosynthesistank", out chemosynthesisTank);
                modCheck = false;
            }

            if (scubaManifold != TechType.None && photosynthesisSmall != TechType.None && photosynthesisTank != TechType.None && chemosynthesisTank != TechType.None)
            {
                var tankSlot = Inventory.main.equipment.GetTechTypeInSlot("Tank");
                if (GameModeUtils.RequiresOxygen() && Player.main.IsSwimming() && tankSlot == scubaManifold)
                {
                    var photosynthesisTanks = Inventory.main.container.GetCount(photosynthesisSmall) + Inventory.main.container.GetCount(photosynthesisTank);
                    var chemosynthesisTanks = Inventory.main.container.GetCount(chemosynthesisTank);

                    if (photosynthesisTanks > 0)
                    {
                        var playerDepth =
#if SN1
                            Ocean.main.GetDepthOf(Player.main.gameObject);
#else
                            Ocean.GetDepthOf(Player.main.gameObject);
#endif
                        var currentLight            = DayNightCycle.main.GetLocalLightScalar();
                        var photosynthesisDepthCalc = (currentLight > 0.9f ? 0.9f : currentLight) * Time.deltaTime * (Main.Config.multipleTanks ? photosynthesisTanks : 1) * (200f - playerDepth > 0f ? ((200 - playerDepth) / 200f) : 0);
                        Player.main.oxygenMgr.AddOxygen(photosynthesisDepthCalc);
                    }

                    if (chemosynthesisTanks > 0)
                    {
                        var waterTemp = WaterTemperatureSimulation.main.GetTemperature(Player.main.transform.position);
                        var chemosynthesisTempCalc = (waterTemp > 30f ? waterTemp : 0) * Time.deltaTime * 0.01f * (Main.Config.multipleTanks ? chemosynthesisTanks : 1);
                        Player.main.oxygenMgr.AddOxygen(chemosynthesisTempCalc);
                    }
                }
            }
        }
Exemplo n.º 10
0
        internal static void CheckForCrossModAdditions()
        {
            if (TechTypeHandler.TryGetModdedTechType("CyclopsSolarCharger", out TechType solarChargerID))
            {
                UpgradeModuleTabs[0].CraftNodes.Add(solarChargerID);
            }

            if (TechTypeHandler.TryGetModdedTechType("CyclopsSpeedModule", out TechType cyclopsSpeedModuleID))
            {
                UpgradeModuleTabs[0].CraftNodes.Add(cyclopsSpeedModuleID);
            }

            if (TechTypeHandler.TryGetModdedTechType("SpeedModule", out TechType speedModuleID))
            {
                UpgradeModuleTabs[1].CraftNodes.Add(speedModuleID);
            }

            if (TechTypeHandler.TryGetModdedTechType("VehiclePowerCore", out TechType powerCoreID))
            {
                UpgradeModuleTabs[1].CraftNodes.Add(powerCoreID);
            }
        }
Exemplo n.º 11
0
        internal static void Initialize()
        {
            var batteryModuleFound = TechTypeHandler.TryGetModdedTechType("BatteryAttachment_DD", out TechType batteryModuleTechType);

            if (!batteryModuleFound)
            {
                QuickLogger.Error("Deep Driller Battery Attachment TechType not found");
            }
            else
            {
                _batteryModuleTechType = batteryModuleTechType;
            }

            var solarPanelFound = TechTypeHandler.TryGetModdedTechType("SolarAttachment_DD", out TechType solarPanelTechType);

            if (!solarPanelFound)
            {
                QuickLogger.Error("Deep Driller Solar Panel TechType not found");
            }
            else
            {
                _solarPanelTechType = solarPanelTechType;
            }

            var focusFound = TechTypeHandler.TryGetModdedTechType("FocusAttachment_DD", out TechType focusTechType);

            if (!focusFound)
            {
                QuickLogger.Error("Deep Driller Focus Attachment TechType not found");
            }
            else
            {
                _focusTechType = focusTechType;
            }

            for (int i = 1; i < 4; i++)
            {
                var mkFound = TechTypeHandler.TryGetModdedTechType($"DrillerMK{i}_DD", out TechType techType);

                if (!mkFound)
                {
                    QuickLogger.Error($"Deep Driller MK{i} TechType not found");
                }
                else
                {
                    switch (i)
                    {
                    case 1:
                        _drillerMK1TechType = techType;
                        break;

                    case 2:
                        _drillerMK2TechType = techType;
                        break;

                    case 3:
                        _drillerMK3TechType = techType;
                        break;
                    }
                }
            }
        }
Exemplo n.º 12
0
        public static void Patch()
        {
            bundle = AssetBundle.LoadFromFile(Path.Combine(Environment.CurrentDirectory, "QMods/5H-4RK Submersible/shark"));

            sharkTech = TechTypeHandler.AddTechType("Shark", "5H-4RK Submersible", "An ancient alien vessel designed to mimic local fauna");
            SpriteHandler.RegisterSprite(sharkTech, Environment.CurrentDirectory + "/QMods/5H-4RK Submersible/Assets/Shark_Icon.png");

            SharkPrefab prefab = new SharkPrefab("Shark", "WorldEntities/Vehicles/Shark", sharkTech);

            PrefabHandler.RegisterPrefab(prefab);

            TechType ingotTech;

            if (!TechTypeHandler.TryGetModdedTechType("PrecursorIngot", out ingotTech))
            {
                throw new Exception("SHARK TRIED LOADING BUT PRECURSOR FABRICATOR NOT FOUND");
            }

            TechData data = new TechData();

            data.craftAmount = 1;
            data.Ingredients = new List <Ingredient>()
            {
                new Ingredient(TechType.AdvancedWiringKit, 1),
                new Ingredient(TechType.Magnetite, 3),
                new Ingredient(TechType.PrecursorKey_Purple, 1),
                new Ingredient(TechType.PrecursorIonCrystal, 1),
                new Ingredient(ingotTech, 3)
            };

            CraftTreeHandler.AddCraftingNode(CraftTree.Type.Constructor, sharkTech, "Vehicles");
            CraftDataHandler.SetTechData(sharkTech, data);
            CraftData.GetCraftTime(TechType.Seamoth, out float time);
            CraftDataHandler.SetCraftingTime(sharkTech, time);

            SpriteHandler.RegisterSprite(SpriteManager.Group.Pings, "SharkPing",
                                         Environment.CurrentDirectory + "/QMods/5H-4RK Submersible/Assets/SharkPing_Icon.png");

            HarmonyInstance harm = HarmonyInstance.Create("Kylinator25.SharkSub");

            harm.PatchAll(Assembly.GetExecutingAssembly());

            Shark.laserTechType = TechTypeHandler.AddTechType("SharkLaserCannon", "5H-4RK Ranged Combat Module", "Equips the vessel with mid to long range combat capabilities.");
            CraftDataHandler.SetEquipmentType(Shark.laserTechType, (EquipmentType)sharkTech);
            CraftDataHandler.SetQuickSlotType(Shark.laserTechType, QuickSlotType.Passive);
            PrefabHandler.RegisterPrefab(new SharkUpgradePrefab("SharkLaserCannon", "WorldEntities/Upgrades/SharkLaserCannon", Shark.laserTechType));

            Shark.ramTechType = TechTypeHandler.AddTechType("SharkBatteringRam", "5H-4RK Momentum-Based Combat Module", "Equips the vessel with hardlight blades to lacerate prey at high velocity");
            CraftDataHandler.SetEquipmentType(Shark.ramTechType, (EquipmentType)sharkTech);
            CraftDataHandler.SetQuickSlotType(Shark.ramTechType, QuickSlotType.Passive);
            PrefabHandler.RegisterPrefab(new SharkUpgradePrefab("SharkBatteringRam", "WorldEntities/Upgrades/SharkBatteringRam", Shark.ramTechType));

            Shark.visionTechType = TechTypeHandler.AddTechType("SharkVision", "5H-4RK Precursor Vision Module", "Allows the vessel's pilot to visualise potential targets through obstructive media");
            CraftDataHandler.SetEquipmentType(Shark.visionTechType, (EquipmentType)sharkTech);
            CraftDataHandler.SetQuickSlotType(Shark.visionTechType, QuickSlotType.Selectable);
            SpriteHandler.RegisterSprite(Shark.visionTechType, Environment.CurrentDirectory + "/QMods/5H-4RK Submersible/Assets/SharkVision_Icon.png");
            PrefabHandler.RegisterPrefab(new SharkUpgradePrefab("SharkVision", "WorldEntities/Upgrades/SharkVision", Shark.visionTechType));

            Shark.shieldTechType = TechTypeHandler.AddTechType("SharkShield", "5H-4RK External Defense Module", "Projects a light energy shield around the submersible, which must recharge once depleted");
            CraftDataHandler.SetEquipmentType(Shark.shieldTechType, (EquipmentType)sharkTech);
            CraftDataHandler.SetQuickSlotType(Shark.shieldTechType, QuickSlotType.Selectable);
            PrefabHandler.RegisterPrefab(new SharkUpgradePrefab("SharkShield", "WorldEntities/Upgrades/SharkShield", Shark.shieldTechType));

            Shark.blinkTechType = TechTypeHandler.AddTechType("SharkBlink", "5H-4RK Warp Evasion Module", "Uses warper technology to rapidly move the submersible in any direction");
            CraftDataHandler.SetEquipmentType(Shark.blinkTechType, (EquipmentType)sharkTech);
            CraftDataHandler.SetQuickSlotType(Shark.blinkTechType, QuickSlotType.Selectable);
            SpriteHandler.RegisterSprite(Shark.blinkTechType, Environment.CurrentDirectory + "/QMods/5H-4RK Submersible/Assets/SharkBlink_Icon.png");
            PrefabHandler.RegisterPrefab(new SharkUpgradePrefab("SharkBlink", "WorldEntities/Upgrades/SharkBlink", Shark.blinkTechType));

            Shark.drillTechType = TechTypeHandler.AddTechType("SharkDrill", "5H-4RK Resource Acquisition Module", "Uses a steady beam of focused light to collect resources");
            CraftDataHandler.SetEquipmentType(Shark.drillTechType, (EquipmentType)sharkTech);
            CraftDataHandler.SetQuickSlotType(Shark.drillTechType, QuickSlotType.Selectable);
            SpriteHandler.RegisterSprite(Shark.drillTechType, Environment.CurrentDirectory + "/QMods/5H-4RK Submersible/Assets/SharkDrill_Icon.png");
            PrefabHandler.RegisterPrefab(new SharkUpgradePrefab("SharkDrill", "WorldEntities/Upgrades/SharkDrill", Shark.drillTechType));

            Shark.internalBattery = TechTypeHandler.AddTechType("SharkBattery_Internal", "battery baybee", "you shouldn't be holding this item");
            PrefabHandler.RegisterPrefab(new SharkBatteryPrefab("SharkBattery_Internal", "WorldEntities/Batteris/SharkBattery", Shark.internalBattery));

            Shark.depletedIonCube = TechTypeHandler.AddTechType("IonCubeEmpty", "Depleted Ion Cube", "This Ion Cube has gone dark, depleted of energy");
            SpriteHandler.RegisterSprite(Shark.depletedIonCube, Environment.CurrentDirectory + "/QMods/5H-4RK Submersible/Assets/DepletedCrystal_Icon.png");
            PrefabHandler.RegisterPrefab(new DepletedCrystalPrefab("IonCubeEmpty", "WorldEntites/Doodads/EmptyIonCube", Shark.depletedIonCube));

            Shark.ionFragment = TechTypeHandler.AddTechType("IonFragment", "Ion Cube Fragment", "A chunk of a depleted ion cube, suitable for advanced electronics fabrication");

            TechData fragmentData = new TechData();

            fragmentData.craftAmount = 3;
            fragmentData.Ingredients = new List <Ingredient>()
            {
                new Ingredient(Shark.depletedIonCube, 1),
            };

            CraftDataHandler.SetTechData(Shark.ionFragment, fragmentData);

            Shark.sharkEngine   = TechTypeHandler.AddTechType("SharkEngine", "5H-4RK Engine", "This converter is specially designed to convert energy from Ion Cubes directly into underwater thrust");
            Shark.sharkComputer = TechTypeHandler.AddTechType("SharkComputer", "5H-4RK Internal Computer Systems", "This alien processor seems to be built to " +
                                                              "manage several submersible-related subroutines");
            Shark.sharkHull = TechTypeHandler.AddTechType("SharkHull", "5H-4RK Hull Plating", "Alien metal that is designed to be very slightly flexible and " +
                                                          "lightweight, to allow for maneuverability while maintaining integrity under extreme pressure");

            seeThroughMat = bundle.LoadAsset <Material>("Assets/Materials/Shark/wallvision.mat");
        }
Exemplo n.º 13
0
        private static void AddInventory(TechType techType, int count = 1, bool bNoMessage = false, bool bSpawnIfCantAdd = true)
        {
            // Ripped<cough>based upon MrPurple6411's method Deconstruct_Patch from the BuilderModule
            if (Player.main.isPiloting)
            {
#if SUBNAUTICA_STABLE
                //GameObject gameObject = CraftData.InstantiateFromPrefab(techType, false);
                GameObject prefabForTechType = CraftData.GetPrefabForTechType(techType, true);
                GameObject gameObject        = (prefabForTechType != null) ? global::Utils.SpawnFromPrefab(prefabForTechType, null) : global::Utils.CreateGenericLoot(techType);
#elif BELOWZERO
                GameObject gameObject = CraftData.InstantiateFromPrefab(null, techType, false); // Coming back to this months later, I didn't think this worked in BZ, because it's not async. But apparently it does...
#endif
                Pickupable pickup = gameObject.GetComponent <Pickupable>();
                if (pickup != null)
                {
                    pickup.Initialize();

                    // This is kind of messy but it's an easy way to get the cross-game code running. In SN1 modules will always == null so the block won't run; but it'll still compile.
#if SUBNAUTICA_STABLE
                    Equipment modules = null;
#elif BELOWZERO
                    SeaTruckUpgrades upgrades = Player.main.GetComponentInParent <SeaTruckUpgrades>();
                    Equipment        modules  = upgrades?.modules;
#endif
                    if (modules != null && TechTypeHandler.TryGetModdedTechType("SeaTruckStorage", out TechType storageType))
                    {
                        //HashSet<string> TruckSlotIDs = modules.equipment.Keys.ToSet<string>();
                        List <string> TruckSlotIDs = null;
                        modules.GetSlots(EquipmentType.SeaTruckModule, TruckSlotIDs);
                        foreach (string slot in TruckSlotIDs)
                        {
                            InventoryItem item = modules.GetItemInSlot(slot);
                            if (item.item.GetTechType() == storageType)
                            {
                                //InventoryItem item = modules.GetItemInSlot(slot);

                                if (item.item.TryGetComponent(out SeamothStorageContainer seamothStorageContainer))
                                {
                                    InventoryItem newItem = new InventoryItem(pickup);
                                    if (seamothStorageContainer.container.AddItem(newItem) != null)
                                    {
                                        string name = Language.main.Get(pickup.GetTechName());
                                        ErrorMessage.AddMessage(Language.main.GetFormat("VehicleAddedToStorage", name));

                                        //uGUI_IconNotifier.main.Play(pickup.GetTechType(), uGUI_IconNotifier.AnimationType.From, null);
                                        uGUI_IconNotifier.main.Play(techType, uGUI_IconNotifier.AnimationType.From, null);
                                        pickup.PlayPickupSound();
#if !RELEASE
                                        Logger.Log(Logger.Level.Debug, $"Adding tech {techType} to Seatruck storage");
#endif
                                        return;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        Vehicle thisVehicle = Player.main.GetVehicle();
                        if (thisVehicle != null)
                        {
                            if (thisVehicle is Exosuit exo)
                            {
                                StorageContainer storageContainer = exo.storageContainer;

                                if (storageContainer != null)
                                {
                                    int lastCount = storageContainer.container.GetCount(techType);
                                    storageContainer.container.AddItem(pickup);
                                    int techCount = storageContainer.container.GetCount(techType);
#if !RELEASE
                                    Logger.Log(Logger.Level.Debug, $"Adding tech {techType.AsString().PadLeft(15)} to Exosuit storage; previous count {lastCount}, new count {techCount}");
#endif
                                    if (techCount - lastCount == 1)
                                    {
                                        string name = Language.main.Get(pickup.GetTechName());
                                        ErrorMessage.AddMessage(Language.main.GetFormat("VehicleAddedToStorage", name));

                                        uGUI_IconNotifier.main.Play(pickup.GetTechType(), uGUI_IconNotifier.AnimationType.From, null);
                                        pickup.PlayPickupSound();
                                        return;
                                    }
                                }
                            }

                            else if (thisVehicle is SeaMoth seamoth)
                            {
                                //bool storageCheck = false;
                                List <IItemsContainer> containers = new List <IItemsContainer>();
                                seamoth.GetAllStorages(containers);
                                //for (int i = 0; i < 12; i++)
                                InventoryItem newItem = new InventoryItem(pickup);
                                foreach (IItemsContainer storage in containers)
                                {
                                    try
                                    {
                                        //ItemsContainer storage = seamoth.GetStorageInSlot(i, TechType.VehicleStorageModule);
                                        if (storage is ItemsContainer iContainer)
                                        {
                                            int lastCount = iContainer.GetCount(techType);
                                            iContainer.AddItem(pickup);
                                            int techCount = iContainer.GetCount(techType);
#if !RELEASE
                                            Logger.Log(Logger.Level.Debug, $"Adding tech {techType.AsString().PadLeft(15)} to Seamoth storage; previous count {lastCount}, new count {techCount}");
#endif
                                            if (techCount - lastCount == 1)
                                            {
                                                string name = Language.main.Get(pickup.GetTechName());
                                                ErrorMessage.AddMessage(Language.main.GetFormat("VehicleAddedToStorage", name));
                                                uGUI_IconNotifier.main.Play(pickup.GetTechType(), uGUI_IconNotifier.AnimationType.From, null);

                                                pickup.PlayPickupSound();
                                                //storageCheck = true;
                                                return;
                                            }
                                        }
                                    }
                                    catch (Exception e)
                                    {
#if !RELEASE
                                        Logger.Log(Logger.Level.Debug, $"Exception adding tech {techType} to Seamoth storage: {e.ToString()}");
#endif
                                        continue;
                                    }
                                }

                                /*if (storageCheck)
                                 * {
                                 *  return;
                                 * }*/
                            }
                        }
                    }
                }
            }
#if !RELEASE
            Logger.Log(Logger.Level.Debug, $"Adding tech {techType} to player inventory");
#endif
            CraftData.AddToInventory(techType, count, bNoMessage, bSpawnIfCantAdd);
        }