public static void Patch()
        {
            var assembly = Assembly.GetExecutingAssembly();

            QuickLogger.Info("Started patching. Version: " + QuickLogger.GetAssemblyVersion(assembly));

#if DEBUG
            QuickLogger.DebugLogsEnabled = true;
            QuickLogger.Debug("Debug logs enabled");
#endif

            try
            {
                AddTechFabricatorItems();

                CraftDataHandler.SetHarvestType(TechType.Peeper, HarvestType.DamageAlive);
                CraftDataHandler.SetHarvestOutput(TechType.Peeper, TechType.AcidMushroom);

                AlterraShippingBuildable.PatchSMLHelper();

                var harmony = HarmonyInstance.Create("com.alterrashipping.fcstudios");
                harmony.PatchAll(Assembly.GetExecutingAssembly());

                QuickLogger.Info("Finished patching");
            }
            catch (Exception ex)
            {
                QuickLogger.Error(ex);
            }
        }
示例#2
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);
            }
        }
示例#3
0
        protected FCSVehicleUpgradeModule(string classId, string friendlyName, string description, FcCraftingTab parentTab)
            : base(classId, friendlyName, description)
        {
            this.ParentTab = parentTab;

            OnStartedPatching += () =>
            {
                this.ParentTab.LoadAssets(this.AssetBundlesService);
                this.AssetBundle = this.AssetBundlesService.GetAssetBundleByName(this.AssetBundleName);
            };

            OnFinishedPatching += () =>
            {
                if (!this.FabricatorService.HasCraftingTab(this.ParentTab.Id))
                {
                    string       tabId       = this.ParentTab.Id;
                    string       displayText = this.ParentTab.DisplayName;
                    Atlas.Sprite icon        = this.ParentTab.Icon;

                    this.FabricatorService.AddTabNode(tabId, displayText, icon);
                }
                CraftDataHandler.SetQuickSlotType(this.TechType, QuickSlotType.Passive);
                this.FabricatorService.AddCraftNode(this, this.ParentTab.Id);
            };
        }
        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);
        }
示例#5
0
            public static bool TryGet(TechType originTech, out TechType recyclingTech, bool initialRun = false)
            {
                recyclingTech = TechType.None;
                if (originTech == TechType.None)
                {
                    return(false);
                }
                if (cache.TryGetValue(originTech, out recyclingTech))
                {
                    return(true);
                }
#if SUBNAUTICA
                RecipeData originData = CraftDataHandler.GetTechData(originTech);
#elif BELOWZERO
                RecipeData originData = CraftDataHandler.GetRecipeData(originTech);
#endif
                if (originData == null)
                {
                    if (!initialRun)
                    {
                        Logger.Log(Logger.Level.Error, $"Failed to load RecipeData for TechType '{originTech}'.");
                    }
                    return(false);
                }

                if (Config.IsBlacklisted(originTech))
                {
                    blacklist.Add(originTech);
                }
                recyclingTech     = CreateRecyclingData(originTech, originData);
                cache[originTech] = recyclingTech;

                return(true);
            }
 public ServerCraftable(string classId, string friendlyName, string description, FcCraftingTab parentTab) : base(classId, friendlyName, description, parentTab)
 {
     OnFinishedPatching += () =>
     {
         CraftDataHandler.SetEquipmentType(TechType, EquipmentType.Hand);
     };
 }
        public static void ModifyRecipe(TechType craftedItem, TechData recipe)
        {
            Assert.AreNotEqual(craftedItem.ToString(), ((int)craftedItem).ToString(), "This API in intended only for use with standard, non-modded TechTypes.");
            // Only modded enums use the int string as their ToString value

            CraftDataHandler.SetTechData(craftedItem, recipe);
        }
示例#8
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;
        }
示例#9
0
        public static void Patch()
        {
            Console.WriteLine("[healthchip]harmony started initaializing");
            CraftDataHandler.SetEquipmentType(FlatHealthModule, EquipmentType.Chip);

            var techData = new TechData()
            {
                craftAmount = 1,
                Ingredients = new List <Ingredient>()
                {
                    new Ingredient(TechType.FiberMesh, 4),
                    new Ingredient(TechType.Titanium, 4)
                },
                LinkedItems = new List <TechType>()
                {
                    TechType.Titanium,
                    TechType.Titanium
                }
            };

            CraftDataHandler.SetTechData(FlatHealthModule, techData);
            CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, FlatHealthModule, "Resources", "AdvancedMaterials");



            Console.WriteLine("[healthchip] Initialized");
            var harmony = HarmonyInstance.Create("abariba.HealthModuleMod");

            harmony.PatchAll(Assembly.GetExecutingAssembly());
            Console.WriteLine("[healthchip]harmony Initialized");
            Console.WriteLine("[MissingietemsFabricator]chaos ensues");
            HealthModuleMod.HealthFabricatorModule.Patch();
            Console.WriteLine("[MissingietemsFabricator]chaos complete.");
        }
        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);
        }
示例#11
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());
 }
示例#12
0
        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);
        }
示例#13
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);
        }
示例#14
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);
        }
示例#15
0
        public CoralSample()
            : base("CoralSample", "Coral Shelf Sample", "A sample of coral from the Twisty Bridges.")
        {
            OnFinishedPatching += () =>
            {
                KnifePatches.AddHarvestable(TechType.TwistyBridgesCoralShelf, 200f);
                Main.AddModTechType(this.TechType);
                CraftDataHandler.SetHarvestOutput(TechType.TwistyBridgesCoralShelf, this.TechType);
                CraftDataHandler.SetHarvestType(TechType.TwistyBridgesCoralShelf, HarvestType.DamageAlive);
                CraftDataHandler.SetTechData(TechType.Bleach, new SMLHelper.V2.Crafting.RecipeData()
                {
                    craftAmount = 1,
                    Ingredients = new List <Ingredient>()
                    {
                        new Ingredient(this.TechType, 1),
                        new Ingredient(TechType.Salt, 1)
                    }
                });
                CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.Bleach, new string[] { "Resources", "BasicMaterials" });

                CraftDataHandler.SetTechData(TechType.DisinfectedWater, new SMLHelper.V2.Crafting.RecipeData()
                {
                    craftAmount = 2,
                    Ingredients = new List <Ingredient>()
                    {
                        new Ingredient(TechType.Bleach, 1)
                    }
                });
                CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.DisinfectedWater, new string[] { "Survival", "Water" });
                KnownTechHandler.SetAnalysisTechEntry(this.TechType, new TechType[] { TechType.Bleach });
                KnownTechHandler.SetAnalysisTechEntry(TechType.Bleach, new TechType[] { TechType.DisinfectedWater });
                LanguageHandler.Main.SetTechTypeTooltip(TechType.Bleach, "NaClO. Sodium hypochlorite bleach. Sanitizing applications.");
            };
        }
 public override void Patch()
 {
     base.Patch();
     CraftDataHandler.SetEquipmentType(TechType, EquipmentType.VehicleModule);
     CraftDataHandler.SetQuickSlotType(TechType, QuickSlotType.Toggleable);
     TechTypeID = TechType;
 }
示例#17
0
        public void RegisterFloraFabricator(List <IDecorationItem> decorationItems)
        {
            if (this.IsRegistered == false)
            {
                // Create new Craft Tree Type
                CreateCustomTree(out CraftTree.Type craftType, decorationItems);
                this.TreeTypeID = craftType;

                // 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, TechType.Fabricator);

                // Register handover text
                LanguageHandler.SetLanguageLine(HandOverText, LanguageHelper.GetFriendlyWord(HandOverText));

                // Unlock at start
                KnownTechHandler.UnlockOnStart(this.TechType);

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

                // Register sprite
                SpriteHandler.RegisterSprite(this.TechType, AssetsHelper.Assets.LoadAsset <Sprite>("fabricator_icon_green"));

                // Load texture
                this.ColoredTexture = AssetsHelper.Assets.LoadAsset <Texture2D>("submarine_fabricator_green");

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

                this.IsRegistered = true;
            }
        }
        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!");
        }
示例#19
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);
        }
示例#20
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);
        }
示例#21
0
        /// <summary>
        /// Initializes a new <see cref="Spawnable"/>, the basic class needed for any item that can be spawned into the Subnautica game world.
        /// </summary>
        /// <param name="classId">The main internal identifier for this item. Your item's <see cref="TechType"/> will be created using this name.</param>
        /// <param name="friendlyName">The name displayed in-game for this item whether in the open world or in the inventory.</param>
        /// <param name="description">The description for this item; Typically seen in the PDA, inventory, or crafting screens.</param>
        protected Spawnable(string classId, string friendlyName, string description)
            : base(classId, $"{classId}Prefab")
        {
            if (string.IsNullOrEmpty(classId))
            {
                Logger.Log($"ClassID for Spawnables must be a non-empty value.", LogLevel.Error);
                throw new ArgumentException($"Error patching Spawnable");
            }

            FriendlyName = friendlyName;
            Description  = description;

            CorePatchEvents += () =>
            {
                PrefabHandler.RegisterPrefab(this);
                SpriteHandler.RegisterSprite(TechType, GetItemSprite());

                if (!SizeInInventory.Equals(defaultSize))
                {
                    CraftDataHandler.SetItemSize(TechType, SizeInInventory);
                }

                if (EntityInfo != null && BiomesToSpawnIn != null)
                {
                    LootDistributionHandler.AddLootDistributionData(this, BiomesToSpawnIn, EntityInfo);
                }
                else if (EntityInfo != null)
                {
                    WorldEntityDatabaseHandler.AddCustomInfo(ClassID, EntityInfo);
                }
            };
        }
示例#22
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);
        }
示例#23
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);
        }
示例#24
0
        public void PostPatch()
        {
            //patch crafting recipes
            //is there a more efficient way of doing this?
            var techDataBlade = new RecipeData()
            {
                craftAmount = 3,
                Ingredients = new List <Ingredient>()
                {
                    new Ingredient(TechType.Titanium, 3)
                }
            };

            CraftDataHandler.SetTechData(turbineBlade, techDataBlade);
            CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, turbineBlade, new string[] { "Resources", "Electronics" });
            KnownTechHandler.SetAnalysisTechEntry(TechType.WiringKit, new TechType[] { turbineBlade });
            CraftDataHandler.SetItemSize(turbineBlade, new Vector2int(2, 1));
            //SetItemSize(turbineBlade, 2, 1);

            var techDataGen = new RecipeData()
            {
                craftAmount = 1,
                Ingredients = new List <Ingredient>()
                {
                    new Ingredient(TechType.WiringKit, 1),
                    new Ingredient(TechType.PowerCell, 1),
                    new Ingredient(TechType.Lubricant, 1)
                }
            };

            CraftDataHandler.SetTechData(turbineGenerator, techDataGen);
            KnownTechHandler.SetAnalysisTechEntry(TechType.WiringKit, new TechType[] { turbineGenerator });
            CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, turbineGenerator, new string[] { "Resources", "Electronics" });
            CraftDataHandler.SetItemSize(turbineGenerator, new Vector2int(2, 2));
            //SetItemSize(turbineBlade, 2, 2);

            var techDataPole = new RecipeData()
            {
                craftAmount = 1,
                Ingredients = new List <Ingredient>()
                {
                    new Ingredient(TechType.Titanium, 4)
                }
            };

            CraftDataHandler.SetTechData(turbinePole, techDataPole);
            KnownTechHandler.SetAnalysisTechEntry(TechType.WiringKit, new TechType[] { turbinePole });
            CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, turbinePole, new string[] { "Resources", "Electronics" });
            CraftDataHandler.SetItemSize(turbinePole, new Vector2int(1, 2));
            //SetItemSize(turbineBlade, 1, 2);

            //Add the databank entry.
            LanguageHandler.SetLanguageLine("Ency_WindTurbine", "Wind Turbine");
            LanguageHandler.SetLanguageLine("EncyDesc_WindTurbine", string.Format("A large generator suspended by 17.5 meter tall pole. The lightweight blades are rotated by the planet's strong air currents and efficiently converts the force into electrical energy. The generator contains a large internal battery that can hold up to {0} units of power. Unlike solar panels, these operate at roughly the same efficiency throughout the day. Orientation does not appear to affect power output. However certain places seem to simply have more wind than others. Power output also increases with altitude.", config.MaxPower));

            //This just isn't working for now. Maybe another update?
            //var windTool = new WindTool.WindToolPatch();
            //windTool.Patch();
        }
示例#25
0
 private static void setItemSizes()
 {
     CraftDataHandler.SetItemSize(TechType.LEDLight, new Vector2int(1, 3));
     CraftDataHandler.SetItemSize(TechType.PowerCell, new Vector2int(1, 2));
     CraftDataHandler.SetItemSize(TechType.PrecursorIonPowerCell, new Vector2int(1, 2));
     CraftDataHandler.SetItemSize(TechType.FireExtinguisher, new Vector2int(1, 2));
     CraftDataHandler.SetItemSize(TechType.Beacon, new Vector2int(1, 2));
 }
示例#26
0
 public HorizontalWallLocker() : base("horizontalwalllocker", "Horizontal Wall Locker", "Small, wall-mounted storage solution.")
 {
     OnFinishedPatching += () =>
     {
         CraftDataHandler.RemoveFromGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, this.TechType);
         CraftDataHandler.AddToGroup(TechGroup.InteriorModules, TechCategory.InteriorModule, this.TechType, TechType.SmallLocker);
     };
 }
 public override void Patch()
 {
     base.Patch();
     CraftDataHandler.SetEquipmentType(TechType, EquipmentType.VehicleModule);
     CraftDataHandler.SetQuickSlotType(TechType, QuickSlotType.Selectable);
     TechTypeID = TechType;
     OptionsPanelHandler.RegisterModOptions(Config);
 }
 public SeaTruckSonarModule() : base("SeaTruckSonarModule", "SeaTruck Sonar Module", "A dedicated system for detecting and displaying topographical data on the HUD.")
 {
     OnFinishedPatching += () =>
     {
         Main.AddModTechType(this.TechType);
         CraftDataHandler.SetEnergyCost(this.TechType, EnergyCost);
     };
 }
 public FCSModule(string classId, string friendlyName, string description, FcCraftingTab parentTab, RecipeData ingredients) : base(classId, friendlyName, description, parentTab)
 {
     _ingredients        = ingredients;
     OnFinishedPatching += () =>
     {
         CraftDataHandler.SetEquipmentType(TechType, EquipmentType.CyclopsModule);
     };
 }
        protected override RecipeData GetBlueprintRecipe()
        {
#if SN1
            return(CraftDataHandler.GetTechData(TechType.Fabricator));
#elif BZ
            return(CraftDataHandler.GetRecipeData(TechType.Fabricator));
#endif
        }