示例#1
0
        public static void Patch()
        {
            try
            {
                QuickLogger.Message("Started patching - " + QuickLogger.GetAssemblyVersion());

                if (TechTypeHandler.TryGetModdedTechType("SeamothHullModule4", out TechType vehicleHullModule4) &&
                    TechTypeHandler.TryGetModdedTechType("SeamothHullModule5", out TechType vehicleHullModule5))
                {
                    VehicleUpgrader.SetModdedDepthModules(vehicleHullModule4, vehicleHullModule5);
                }

                SpeedBooster speedModule = SpeedBooster.Main;
                speedModule.Patch();

                VehicleUpgrader.SetSpeedBooster(speedModule);

                var harmony = HarmonyInstance.Create("com.upgradedvehicles.psmod");
                harmony.PatchAll(Assembly.GetExecutingAssembly());

                QuickLogger.Message("Finished patching");
            }
            catch (Exception ex)
            {
                QuickLogger.Error("EXCEPTION on Patch: " + ex.ToString());
            }
        }
示例#2
0
        public void Patch()
        {
            if (this.IsPatched)
            {
                return;
            }

            this.TechType = TechTypeHandler.AddTechType(this.ClassID, this.FriendlyName, this.Description, this.UnlocksAtStart);

            if (!this.UnlocksAtStart)
            {
                KnownTechHandler.SetAnalysisTechEntry(this.RequiredForUnlock, new TechType[] { this.TechType });
            }

            if (this.Sprite == null)
            {
                this.Sprite = ImageUtils.LoadSpriteFromFile(IOUtilities.Combine(ExecutingFolder, this.PluginFolder, this.IconFileName));
            }

            SpriteHandler.RegisterSprite(this.TechType, this.Sprite);

            CraftDataHandler.SetTechData(this.TechType, GetBlueprintRecipe());

            CraftDataHandler.AddToGroup(TechGroup.Resources, TechCategory.Electronics, this.TechType);

            CraftDataHandler.SetEquipmentType(this.TechType, this.ChargerType);

            CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, this.TechType, this.StepsToFabricatorTab);

            PrefabHandler.RegisterPrefab(this);

            AddToList();

            this.IsPatched = true;
        }
        public ExteriorPlantPotPrefab(string plantPotId, string displayName, string tooltip, string basePotPath, TechType basePotTechType) : base(plantPotId, $"Submarine/Build/{plantPotId}")
        {
            this.basePlantPotPath = basePotPath;

            // Register the TechType
            TechType = TechTypeHandler.AddTechType(plantPotId, displayName, tooltip, false);

            // Register the Sprite(icon) of the new TechType with the icon of the base plant pot.
            SpriteHandler.RegisterSprite(TechType, SpriteManager.Get(basePotTechType));

            // Set the recipe of the TechType.
            CraftDataHandler.SetTechData(TechType, new TechData()
            {
                craftAmount = 1,
                Ingredients = new List <Ingredient>()
                {
                    new Ingredient(TechType.Titanium, 2)
                }
            });

            // Add it as a buildable.
            CraftDataHandler.AddBuildable(TechType);

            // Add it to the group in the PDA.
            CraftDataHandler.AddToGroup(TechGroup.ExteriorModules, TechCategory.ExteriorOther, TechType);

            // Set it to unlock after the base TechType is unlocked.
            KnownTechHandler.SetAnalysisTechEntry(basePotTechType, new List <TechType>()
            {
                TechType
            });

            // Register this prefab.
            PrefabHandler.RegisterPrefab(this);
        }
示例#4
0
        public virtual void Patch()
        {
            Atlas.Sprite sprite;

            if (NameUsingForFiles != null)
            {
                sprite = ImageUtils.LoadSpriteFromFile($"./QMods/{NameUsingForFiles}/Assets/{NameUsingForFiles}.png");
            }
            else
            {
                sprite = GetResourceIcon(PrefabTemplate);
            }


            TechType = TechTypeHandler.AddTechType(NameID, FriendlyName, Description, sprite, false);
            SpriteHandler.RegisterSprite(TechType, sprite);
            CraftTreeHandler.AddCraftingNode(FabricatorType, TechType, FabricatorTab);
            CraftDataHandler.SetTechData(TechType, GetRecipe());
            CraftDataHandler.AddToGroup(GroupForPDA, CategoryForPDA, TechType);
            CraftDataHandler.SetEquipmentType(TechType, TypeForEquipment);
            CraftDataHandler.SetQuickSlotType(TechType, TypeForQuickslot);
            CraftDataHandler.SetItemSize(TechType, ItemSize);

            KnownTechHandler.SetAnalysisTechEntry(RequiredForUnlock, new TechType[1] {
                TechType
            }, $"{FriendlyName} blueprint discovered!");

            PrefabHandler.RegisterPrefab(this);
        }
示例#5
0
        public static void Patch()
        {
            darktest = AssetBundle.LoadFromFile(Environment.CurrentDirectory + "/QMods/techpistol/Assets");
            Atlas.Sprite Icon = new Atlas.Sprite(darktest.LoadAsset <Sprite>("Icon"));
            var          gun  = TechTypeHandler.AddTechType("techpistol", "tech pistol", "tech pistol", true);

            SpriteHandler.RegisterSprite(gun, Icon);
            GunPrefab gunper = new GunPrefab("techpistol", "WorldEntities/Tools/techpistol", gun);

            PrefabHandler.RegisterPrefab(gunper);
            CraftDataHandler.SetEquipmentType(gun, EquipmentType.Hand);
            var techData = new TechData()
            {
                craftAmount = 1,
                Ingredients = new List <Ingredient>()
                {
                    new Ingredient(TechType.SeaTreaderPoop, 1),
                    new Ingredient(TechType.TitaniumIngot, 2),
                    new Ingredient(TechType.Lubricant, 1),
                    new Ingredient(TechType.EnameledGlass, 3),
                }
            };

            CraftDataHandler.SetTechData(gun, techData);
            CraftDataHandler.SetCraftingTime(gun, 5f);
            CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, gun, "Personal", "Tools", "techpistol");
            CraftDataHandler.SetItemSize(gun, 2, 2);
        }
示例#6
0
        public void Patch()
        {
            TechType = TechTypeHandler.AddTechType(ID, DisplayName, Tooltip, RequiredForUnlock == TechType.None);

            if (RequiredForUnlock != TechType.None)
            {
                KnownTechHandler.SetAnalysisTechEntry(RequiredForUnlock, new TechType[] { TechType });
            }

            if (Sprite == null)
            {
                SpriteHandler.RegisterSprite(TechType, $"./QMods/SeamothClawArm/Assets/{ID}.png");
            }
            else
            {
                SpriteHandler.RegisterSprite(TechType, Sprite);
            }

            switch (Fabricator)
            {
            case CraftTree.Type.Workbench:
                CraftDataHandler.AddToGroup(TechGroup.Workbench, TechCategory.Workbench, TechType, AddAfter);
                break;

            case CraftTree.Type.SeamothUpgrades:
                CraftDataHandler.AddToGroup(TechGroup.VehicleUpgrades, TechCategory.VehicleUpgrades, TechType, AddAfter);
                break;
            }

            CraftDataHandler.SetEquipmentType(TechType, EquipmentType.SeamothModule);
            CraftDataHandler.SetTechData(TechType, GetTechData());

            CraftTreeHandler.AddCraftingNode(Fabricator, TechType, StepsToTab);
        }
        protected override void Patch()
        {
            DepletedNuclearModuleID = TechTypeHandler.AddTechType(DepletedNameID, FriendlyName, Description, false);

            RefillNuclearModuleID = TechTypeHandler.AddTechType(RefillNameID,
                                                                "Reload Cyclops Nuclear Module",
                                                                "Reload a Depleted Cyclops Nuclear Module with a Reactor Rod",
                                                                false);

            if (CyclopsModule.ModulesEnabled) // Even if the options have this be disabled,
            {                                 // we still want to run through the AddTechType methods to prevent mismatched TechTypeIDs as these settings are switched
                SpriteHandler.RegisterSprite(DepletedNuclearModuleID, $"./QMods/MoreCyclopsUpgrades/Assets/DepletedCyclopsNuclearModule.png");
                SpriteHandler.RegisterSprite(RefillNuclearModuleID, $"./QMods/MoreCyclopsUpgrades/Assets/CyclopsNuclearModule.png");

                CraftDataHandler.SetTechData(RefillNuclearModuleID, GetRecipe());
                KnownTechHandler.SetAnalysisTechEntry(TechType.BaseNuclearReactor, new TechType[1] {
                    RefillNuclearModuleID
                }, "Reload of cyclops nuclear module available.");

                PrefabHandler.RegisterPrefab(this);
                PrefabHandler.RegisterPrefab(new RefillNuclearModule(RefillNuclearModuleID));

                LanguageHandler.SetLanguageLine(DepletedEventKey, "Nuclear Reactor Module depleted");
            }

            this.NukFabricator.Patch(CyclopsModule.ModulesEnabled);
        }
        public void Patch()
        {
            TechType = TechTypeHandler.AddTechType(ID, DisplayName, Tooltip, RequiredForUnlock == TechType.Seaglide);

            if (RequiredForUnlock != TechType.None)
            {
                KnownTechHandler.SetAnalysisTechEntry(RequiredForUnlock, new TechType[] { TechType.PowerGlide });
            }

            if (Sprite == null)
            {
                SpriteHandler.RegisterSprite(TechType, $"./QMods/BetterSeaglide/Assets/powerglide.png");
            }
            else
            {
                SpriteHandler.RegisterSprite(TechType, Sprite);
            }

            /*switch (Fabricator)
             * {
             *  case CraftTree.Type.Fabricator:
             *      CraftDataHandler.AddToGroup(TechGroup.Machines, TechCategory.Machines, TechType, AddAfter);
             *      break;
             *
             * }*/

            //CraftDataHandler.AddToGroup(TechGroup.Machines, TechCategory.Machines, TechType, AddAfter);
            CraftDataHandler.SetEquipmentType(TechType, EquipmentType.Hand);
            CraftDataHandler.SetTechData(TechType, GetTechData());
            CraftDataHandler.SetQuickSlotType(TechType, QuickSlotType.Selectable);
            //CraftTreeHandler.AddTabNode(Fabricator, "Deployables", "Better Seaglide", SpriteManager.Get(BetterSeaglide));
            CraftTreeHandler.AddCraftingNode(Fabricator, TechType, StepsToTab);
        }
        public void Patch(bool auxConsolesEnabled)
        {
            this.TechType = TechTypeHandler.AddTechType(NameID, FriendlyName, Description, false);

            if (!auxConsolesEnabled) // Even if the options have this be disabled,
            {
                return;              // we still want to run through the AddTechType methods to prevent mismatched TechTypeIDs as these settings are switched
            }
            LanguageHandler.SetLanguageLine(HandOverText, "Access Auxiliary Cyclops Upgrade Console");
            CraftDataHandler.AddBuildable(this.TechType);
            CraftDataHandler.AddToGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, this.TechType);

            PrefabHandler.RegisterPrefab(this);

            var recipe = new TechData()
            {
                craftAmount = 1,
                Ingredients = new List <Ingredient>(new Ingredient[3]
                {
                    new Ingredient(TechType.AdvancedWiringKit, 1),
                    new Ingredient(TechType.Titanium, 2),
                    new Ingredient(TechType.Lead, 1),
                })
            };

            CraftDataHandler.SetTechData(this.TechType, recipe);
            SpriteHandler.RegisterSprite(this.TechType, @"./QMods/MoreCyclopsUpgrades/Assets/AuxCyUpgradeConsole.png");
            KnownTechHandler.SetAnalysisTechEntry(TechType.CyclopsHullModule1, new TechType[1] {
                this.TechType
            }, $"{FriendlyName} blueprint discovered!");
        }
示例#10
0
        public static void Patch()
        {
            bundle = AssetBundle.LoadFromFile("QMods/AlienRifle2/alienrifle");

            rifleTech = TechTypeHandler.AddTechType("AlienRifleWeapon", "Alien Rifle", "An ancient weapon found in an alien facility", ImageUtils.LoadSpriteFromFile("QMods/AlienRifle2/Assets/alienrifle.png"), false);

            PrefabHandler.RegisterPrefab(new RiflePrefab("AlienRifleWeapon", "WorldEntities/Tools/AlienRifle", rifleTech));

            CraftDataHandler.SetEquipmentType(rifleTech, EquipmentType.Hand);
            TechData data = new TechData();

            data.Ingredients = new List <Ingredient>()
            {
                new Ingredient(TechType.StasisRifle, 1),
                new Ingredient(TechType.Magnetite, 3),
                new Ingredient(TechType.PlasteelIngot, 2),
                new Ingredient(TechType.PrecursorIonCrystal, 1)
            };
            data.craftAmount = 1;

            CraftDataHandler.SetTechData(rifleTech, data);
            CraftDataHandler.SetItemSize(rifleTech, 2, 2);
            CraftTreeHandler.AddTabNode(CraftTree.Type.Workbench, "StasisRifleMods", "Stasis Rifle Upgrades", ImageUtils.LoadSpriteFromFile("QMods/AlienRifle2/Assets/stasisrifleupgrades.png"));
            CraftTreeHandler.AddCraftingNode(CraftTree.Type.Workbench, rifleTech, "StasisRifleMods", "Alien Rifle");

            HarmonyInstance inst = HarmonyInstance.Create("Kylinator25.AlienRifle.V2");

            inst.PatchAll(typeof(MainPatch).Assembly);
        }
示例#11
0
        // Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
        public void PrePatch()
        {
            AssetBundle.LoadFromFile(Path.Combine("Qmods" + "EggMod" + "eggs.assets"));
            TechTypeHandler.AddTechType("GhostRayBlueEgg", "Ghost Ray Egg", "this is the egg from the ghostRay");
            TechTypeHandler.AddTechType("GhostRayBlueEggUndiscovered", "GhostRayBlueEggUndiscovered", "ghostrayegg");
            TechTypeHandler.AddTechType("GhostRayRedEgg", "GhostRayRedEgg", "ghost Ray Red Egg");
            TechTypeHandler.AddTechType("GhostRayRedEggUndiscovered", "GhostRayRedEggUndiscovered", "GhostRayRedEggUndiscovered");
            Dictionary <TechType, float> dictionary = typeof(BaseBioReactor).GetField("charge", BindingFlags.Static | BindingFlags.NonPublic).GetValue(null) as Dictionary <TechType, float>;

            WaterParkCreature.waterParkCreatureParameters[TechType.GhostRayBlue]           = new WaterParkCreatureParameters(0.05f, 0.2f, 0.5f, 1f, false);
            WaterParkCreature.waterParkCreatureParameters[TechType.GhostRayRed]            = new WaterParkCreatureParameters(0.05f, 0.2f, 0.5f, 1f, false);
            WaterParkCreature.waterParkCreatureParameters[TechType.ReaperLeviathan]        = new WaterParkCreatureParameters(0.03f, 0.05f, 0.5f, 1f, false);
            WaterParkCreature.waterParkCreatureParameters[TechType.GhostLeviathan]         = new WaterParkCreatureParameters(0.03f, 0.05f, 0.5f, 1f, false);
            WaterParkCreature.waterParkCreatureParameters[TechType.GhostLeviathanJuvenile] = new WaterParkCreatureParameters(0.03f, 0.05f, 0.5f, 1f, false);
            WaterParkCreature.waterParkCreatureParameters[TechType.SeaDragon] = new WaterParkCreatureParameters(0.03f, 0.05f, 0.5f, 1f, false);
            WaterParkCreature.creatureEggs[TechType.GhostRayBlue]             = (TechType)9999;
            WaterParkCreature.creatureEggs[TechType.GhostRayRed] = (TechType)6969;
            CraftDataHandler.SetItemSize(TechType.GhostRayBlue, 3, 3);
            CraftDataHandler.SetItemSize(TechType.GhostRayRed, 3, 3);
            GhostRayBlueEggPrefab ghostRayBlueEggPrefab = new GhostRayBlueEggPrefab("WorldEntities/Eggs/GhostRayBlueEgg", "GhostRayBlueEggID");

            ghostRayBlueEggPrefab.LoadResource();
            PrefabHandler.RegisterPrefab(this);
            GhostRayRedEggPrefab ghostRayRedEggPrefab = new GhostRayRedEggPrefab("WorldEntities/Eggs/GhostRayRedEgg", "GhostRayRedEggID");

            ghostRayRedEggPrefab.LoadResource();
            CustomResourceManager.customResources.Add(ghostRayRedEggPrefab);
        }
示例#12
0
 public static void Patch()
 {
     // Add the techtype
     tank = TechTypeHandler.AddTechType("SolarOxygenTank", "Solar-powered Oxygen Tank", "An solar-powered oxygen tank which replenishes in the daylight!");
     // Apply prefab
     PrefabHandler.RegisterPrefab(new TankPrefab());
     // Add recipe
     CraftDataHandler.SetTechData(tank, new TechData()
     {
         craftAmount = 1,
         Ingredients = new List <Ingredient>()
         {
             new Ingredient(TechType.AdvancedWiringKit, 1),
             new Ingredient(TechType.EnameledGlass, 1),
             new Ingredient(TechType.Copper, 2),
             new Ingredient(TechType.Quartz, 2),
             new Ingredient(TechType.Pipe, 3),
             new Ingredient(TechType.PlasteelTank, 1),
         }
     });
     // Add it to the crafting tree
     CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, tank, "Personal", "Equipment");
     // Make the background purple
     CraftDataHandler.SetBackgroundType(tank, CraftData.BackgroundType.ExosuitArm);
     // Double it's crafting time
     CraftDataHandler.SetCraftingTime(tank, 6f);
     // Make it equipable in the tank slot
     CraftDataHandler.SetEquipmentType(tank, EquipmentType.Tank);
     // Make it take a lot of inventory space
     CraftDataHandler.SetItemSize(tank, 3, 3);
     // Start patching
     HarmonyInstance.Create("alexejheroytb.subnauticamods.solaroxygentank").PatchAll(Assembly.GetExecutingAssembly());
 }
示例#13
0
        protected virtual void Patch()
        {
            this.TechType = TechTypeHandler.AddTechType(NameID, FriendlyName, Description, RequiredForUnlock == TechType.None);

            if (!ModulesEnabled) // Even if the options have this be disabled,
            {
                return;          // we still want to run through the AddTechType methods to prevent mismatched TechTypeIDs as these settings are switched
            }
            if (RequiredForUnlock == TechType.None)
            {
                KnownTechHandler.UnlockOnStart(this.TechType);
            }
            else
            {
                KnownTechHandler.SetAnalysisTechEntry(RequiredForUnlock, new TechType[1] {
                    this.TechType
                }, $"{FriendlyName} blueprint discovered!");
            }

            PrefabHandler.RegisterPrefab(this);

            SpriteHandler.RegisterSprite(this.TechType, $"./QMods/MoreCyclopsUpgrades/Assets/{NameID}.png");

            CraftDataHandler.SetTechData(this.TechType, GetRecipe());

            if (AddToCraftTree)
            {
                CraftTreeHandler.AddCraftingNode(Fabricator, this.TechType, FabricatorTabs);
            }

            CraftDataHandler.SetEquipmentType(this.TechType, EquipmentType.CyclopsModule);
            CraftDataHandler.AddToGroup(TechGroup.Cyclops, TechCategory.CyclopsUpgrades, this.TechType);

            SetStaticTechTypeID(this.TechType);
        }
示例#14
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);
        }
示例#15
0
        public BuildableHelper(string id, string displayname, string tooltip, TechGroup group, TechCategory category, TechType after = TechType.None, bool unlockonstart = true, Atlas.Sprite atlasSprite = null, Sprite unitySprite = null)
        {
            if (atlasSprite != null && unitySprite != null)
            {
                throw new ArgumentException("Neither atlasSprite nor unitySprite are null!");
            }

            if (atlasSprite != null)
            {
                techType = TechTypeHandler.AddTechType(id, displayname, tooltip, atlasSprite, unlockonstart);
            }
            else if (unitySprite != null)
            {
                techType = TechTypeHandler.AddTechType(id, displayname, tooltip, unitySprite, unlockonstart);
            }
            else
            {
                techType = TechTypeHandler.AddTechType(id, displayname, tooltip, unlockonstart);
            }

            CraftDataHandler.AddBuildable(techType);
            if (after == TechType.None)
            {
                CraftDataHandler.AddToGroup(group, category, techType);
            }
            else
            {
                CraftDataHandler.AddToGroup(group, category, techType, after);
            }
        }
示例#16
0
        private void OpenPDA()
        {
            bool isStorageTypeExists = TechTypeHandler.TryGetModdedTechType(storageModuleString, out TechType techType);

            if (!isStorageTypeExists)
            {
                return;
            }

            ItemsContainer storageInSlot = helper.GetSeamothStorageInSlot(slotID, techType);

            if (storageInSlot != null)
            {
                PDA pda = Player.main.GetPDA();

                Inventory.main.SetUsedStorage(storageInSlot, false);

                if (!pda.Open(PDATab.Inventory, tr, new PDA.OnClose(OnClosePDA)))
                {
                    OnClosePDA(pda);
                }
            }
            else
            {
                OnClosePDA(null);
            }
        }
        internal static void PatchBatteries()
        {
            if (!TechTypeHandler.ModdedTechTypeExists("DeepPowerCell"))
            {
                var tabIcon = ImageUtils.LoadSpriteFromFile(@"./Qmods/" + Assets + @"/TabIcon.png");
                CraftTreeHandler.AddTabNode(CraftTree.Type.Fabricator, BatCraftTab, "Batteries and Power Cells", tabIcon, ResCraftTab, ElecCraftTab);
                SeraLogger.Message(Main.modName, "MidGameBatteries not installed, creating new crafting tab");

                CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResCraftTab, ElecCraftTab, TechType.Battery.ToString());
                CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResCraftTab, ElecCraftTab, TechType.PrecursorIonBattery.ToString());
                CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResCraftTab, ElecCraftTab, TechType.PowerCell.ToString());
                CraftTreeHandler.RemoveNode(CraftTree.Type.Fabricator, ResCraftTab, ElecCraftTab, TechType.PrecursorIonPowerCell.ToString());

                CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.Battery, CraftPath);
                CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.PowerCell, CraftPath);
                CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.PrecursorIonBattery, CraftPath);
                CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.PrecursorIonPowerCell, CraftPath);
            }
            else
            {
                SeraLogger.Message(Main.modName, "MidGameBatteries installed, adding to crafting tab");
            }
            var enzBatt = new EnzymeBattery(1000f);

            enzBatt.Patch();
            var enzPowerCell = new EnzymePowerCell(enzBatt);

            enzPowerCell.Patch();
        }
示例#18
0
 private static void HandleCrossModUpdates()
 {
     if (TechTypeHandler.TryGetModdedTechType("SeamothHullModule4", out TechType vehicleHullModule4) &&
         TechTypeHandler.TryGetModdedTechType("SeamothHullModule5", out TechType vehicleHullModule5))
     {
         VehicleUpgrader.SetModdedDepthModules(vehicleHullModule4, vehicleHullModule5);
     }
 }
示例#19
0
        protected TechType register(string name, string description, Atlas.Sprite sprite)
        {
            TechType = TechTypeHandler.AddTechType(ClassID, name, description, sprite, false);

            registerPrefabAndTechData();

            return(TechType);
        }
示例#20
0
 internal Fabricator_Decorations() : base("", "")
 {
     this.ClassID        = DecorationsFabID;
     this.PrefabFileName = $"Submarine/Build/{DecorationsFabID}";
     this.TechType       = TechTypeHandler.AddTechType(DecorationsFabID,
                                                       LanguageHelper.GetFriendlyWord("DecorationsFabricatorName"),
                                                       LanguageHelper.GetFriendlyWord("DecorationsFabricatorDescription"),
                                                       true);
 }
示例#21
0
        public virtual void Patch()
        {
            Atlas.Sprite sprite = null;

            if (IconFilename != null)
            {
                string iconfilePath = $"./QMods/{IconFilename}/Assets/{IconFilename}.png";

                try
                {
                    sprite = ImageUtils.LoadSpriteFromFile(iconfilePath);
                }
                catch
                {
                    SNLogger.Log($"[{NameID}] ***ERROR! File [{iconfilePath}] not Found! ");
                }
            }
            else if (IconTechType != TechType.None)
            {
                try
                {
                    sprite = GetResourceIcon(IconTechType);
                }
                catch
                {
                    SNLogger.Log($"[{NameID}] ***ERROR! Resource TechType icon [{IconTechType.ToString()}] not Found! ");
                }
            }
            else
            {
                try
                {
                    sprite = GetResourceIcon(PrefabTemplate);
                }
                catch
                {
                    SNLogger.Log($"[{NameID}] ***ERROR! Resource template icon [{PrefabTemplate.ToString()}] not Found! ");
                }
            }


            TechType = TechTypeHandler.AddTechType(NameID, FriendlyName, Description, sprite, false);
            SpriteHandler.RegisterSprite(TechType, sprite);
            CraftTreeHandler.AddCraftingNode(FabricatorType, TechType, FabricatorTab);
            CraftDataHandler.SetTechData(TechType, GetRecipe());
            CraftDataHandler.AddToGroup(GroupForPDA, CategoryForPDA, TechType);
            CraftDataHandler.SetEquipmentType(TechType, TypeForEquipment);
            CraftDataHandler.SetQuickSlotType(TechType, TypeForQuickslot);
            CraftDataHandler.SetItemSize(TechType, ItemSize);
            CraftDataHandler.SetBackgroundType(TechType, BackgroundType);
            KnownTechHandler.SetAnalysisTechEntry(RequiredForUnlock, new TechType[1] {
                TechType
            }, $"{FriendlyName} blueprint discovered!");

            PrefabHandler.RegisterPrefab(this);
        }
示例#22
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
        }
        private void Patch(bool auxConsolesEnabled)
        {
            if (!auxConsolesEnabled) // Even if the options have this be disabled,
            {
                this.TechType = TechTypeHandler.AddTechType(this.ClassID, this.FriendlyName, this.Description, false);
                return; // we still want to run through the AddTechType methods to prevent mismatched TechTypeIDs as these settings are switched
            }

            Patch();
        }
示例#24
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."));
        }
示例#25
0
        // for using already existing fragments (will be used for this tech if fragment own tech is unlocked)
        protected void setFragmentToUnlock(TechType fragTechType, int fragCount, float scanTime = 1f)
        {
            string fragTechID = ClassID + "_Fragment";

            TechType substFragTechType = TechTypeHandler.AddTechType(fragTechID, "", "");

            LanguageHelper.substituteString(fragTechID, fragTechType.AsString());             // use name from original fragment

            UnlockTechHelper.setFragmentTypeToUnlock(TechType, fragTechType, substFragTechType, fragCount, scanTime);
        }
 internal void Patch(bool auxConsolesEnabled)
 {
     if (!auxConsolesEnabled) // Even if the options have this be disabled,
     {
         QuickLogger.Info("Auxiliary Upgrade Console disabled by config settings");
         this.TechType = TechTypeHandler.AddTechType(this.ClassID, this.FriendlyName, this.Description, false);
         return; // we still want to run through the AddTechType methods to prevent mismatched TechTypeIDs as these settings are switched
     }
     QuickLogger.Debug("Patching Auxiliary Upgrade Console");
     base.Patch();
 }
示例#27
0
 public static void AddTechTypes()
 {
     _1_Previous         = TechTypeHandler.AddTechType("MP3Player_Controls_Previous", "Previous", "Previous song");
     _2_1_Play           = TechTypeHandler.AddTechType("MP3Player_Controls_Play", "Play/Pause", "Current status: <color=#C21807FF>paused</color>");
     _2_2_Pause          = TechTypeHandler.AddTechType("MP3Player_Controls_Pause", "Pause/Pause", "Current status: <color=#4CBB17FF>playing</color>");
     _3_Next             = TechTypeHandler.AddTechType("MP3Player_Controls_Next", "Next", "Next song");
     _4_1_EnableRepeat   = TechTypeHandler.AddTechType("MP3Player_Controls_EnableRepeat", "Repeat", "Current status: <color=#C21807FF>disabled</color>");
     _4_2_DisableRepeat  = TechTypeHandler.AddTechType("MP3Player_Controls_DisableRepeat", "Repeat", "Current status: <color=#4CBB17FF>enabled</color>");
     _5_1_EnableShuffle  = TechTypeHandler.AddTechType("MP3Player_Controls_EnableShuffle", "Shuffle", "Current status: <color=#C21807FF>disabled</color>");
     _5_2_DisableShuffle = TechTypeHandler.AddTechType("MP3Player_Controls_DisableShuffle", "Shuffle", "Current status: <color=#4CBB17FF>enabled</color>");
     _6_ExitInterface    = TechTypeHandler.AddTechType("MP3Player_Controls_ExitInterface", "Exit", "Close the interface");
 }
        protected override void Patch()
        {
            if (!ModulesEnabled || !ModConfig.Settings.EnableBioReactors) // Even if the options have this be disabled,
            {
                this.TechType = TechTypeHandler.AddTechType(NameID, FriendlyName, Description, RequiredForUnlock == TechType.None);
                return; // we still want to run through the AddTechType methods to prevent mismatched TechTypeIDs as these settings are switched
            }

            base.Patch();
            LanguageHandler.SetLanguageLine(MaxBoostKey, "Maximum boost to cyclops bioreactors achieved");
            LanguageHandler.SetLanguageLine(CannotRemoveKey, "Cannot remove BioReactor Booster while bioreactor is too full");
        }
        public void Patch()
        {
            ModdedItems.Initialize();

            // Create new Craft Tree Type
            CreateCustomTree(out CraftTree.Type craftType);
            this.TreeTypeID = craftType;

            // Create a new TechType for new fabricator
            this.TechType = TechTypeHandler.AddTechType(
                internalName: NameID,
                displayName: FriendlyName,
                tooltip: "Construct vehicle upgrade modules from the comfort of your favorite habitat or cyclops.",
                sprite: ImageUtils.LoadSpriteFromFile(@"./QMods/VModFabricator/Assets/VModFabIcon.png"),
                unlockAtStart: false);

            // Create a Recipie for the new TechType
            var customFabRecipe = new TechData()
            {
                craftAmount = 1,
                Ingredients = new List <Ingredient>(new Ingredient[4]
                {
                    new Ingredient(TechType.Titanium, 2),
                    new Ingredient(TechType.ComputerChip, 1),
                    new Ingredient(TechType.Diamond, 1),
                    new Ingredient(TechType.Lead, 1),
                })
            };

            // Add the new TechType to the buildables
            CraftDataHandler.AddBuildable(this.TechType);

            // Add the new TechType to the group of Interior Module buildables
            CraftDataHandler.AddToGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, this.TechType);

            LanguageHandler.SetLanguageLine(HandOverText, "Use Vehicle Module Fabricator");

            // Set the buildable prefab
            PrefabHandler.RegisterPrefab(this);

            // Associate the recipie to the new TechType
            CraftDataHandler.SetTechData(this.TechType, customFabRecipe);

            // Set which blueprints unlock the VMod Fabricator
            string unlockMessage = $"{FriendlyName} blueprint discovered!";
            var    unlockThis    = new TechType[1] {
                this.TechType
            };

            KnownTechHandler.SetAnalysisTechEntry(TechType.Workbench, unlockThis, unlockMessage);
            KnownTechHandler.SetAnalysisTechEntry(TechType.BaseUpgradeConsole, unlockThis, unlockMessage);
            KnownTechHandler.SetAnalysisTechEntry(TechType.Cyclops, unlockThis, unlockMessage);
        }
示例#30
0
        public static void Patch()
        {
            TechType techType = TechTypeHandler.AddTechType("CyclopsInceptionModule", "Cyclops Inception Module", "Uses precursor technology to shrink any other cyclops near the docking hatch, allowing them to dock.");

            CraftDataHandler.SetEquipmentType(techType, EquipmentType.CyclopsModule);
            CraftDataHandler.AddToGroup(TechGroup.Cyclops, TechCategory.CyclopsUpgrades, techType);
            UpgradeManager.RegisterReusableHandlerCreator(() => new InceptionUpgrade(techType));

            Hooks.Update += InceptionManager.UpdateUndockTime;

            HarmonyHelper.Patch();
        }