Exemplo n.º 1
0
        private static void CreateAndPatchPacks()
        {
            var enzymeBattery = new CbBattery // Calling the CustomBatteries API to patch this item as a Battery
            {
                EnergyCapacity    = 1000,
                ID                = "EnzymeBattery",
                Name              = "Enzyme-Charged Ion Battery",
                FlavorText        = "A new battery based on the discovery of a chemical interaction between hatching enzymes, radiation, and ion crystals.",
                CraftingMaterials = { TechType.PrecursorIonCrystal, TechType.HatchingEnzymes, TechType.HatchingEnzymes, TechType.Lead, TechType.UraniniteCrystal, TechType.UraniniteCrystal },
                CustomIcon        = new Atlas.Sprite(assetBundle.LoadAsset <Sprite>("EnzymeBattery.png")),
                UnlocksWith       = TechType.HatchingEnzymes,
                CBModelData       = new CBModelData
                {
                    CustomTexture       = assetBundle.LoadAsset <Texture2D>("EnzymeBatteryskin"),
                    CustomIllumMap      = assetBundle.LoadAsset <Texture2D>("EnzymeBatteryillum"),
                    CustomSpecMap       = assetBundle.LoadAsset <Texture2D>("EnzymeBatteryspec"),
                    CustomIllumStrength = 1.1f,
                    UseIonModelsAsBase  = true
                }
            };

            enzymeBattery.Patch();


            var enzymeCell = new CbPowerCell // Calling the CustomBatteries API to patch this item as a Power Cell
            {
                EnergyCapacity    = enzymeBattery.EnergyCapacity * 2,
                ID                = "EnzymePowerCell",
                Name              = "Enzyme-Charged Ion Power Cell",
                FlavorText        = "A new power cell based on the discovery of a chemical interaction between hatching enzymes, radiation, and ion crystals.",
                CraftingMaterials = { enzymeBattery.TechType, enzymeBattery.TechType, TechType.Silicone },
                CustomIcon        = new Atlas.Sprite(assetBundle.LoadAsset <Sprite>("EnzymeCell")),
                UnlocksWith       = TechType.HatchingEnzymes,
                CBModelData       = new CBModelData
                {
                    CustomTexture       = assetBundle.LoadAsset <Texture2D>("EnzymeCellskin"),
                    CustomIllumMap      = assetBundle.LoadAsset <Texture2D>("EnzymeCellillum"),
                    CustomSpecMap       = assetBundle.LoadAsset <Texture2D>("EnzymeCellspec"),
                    CustomIllumStrength = 1.1f,
                    UseIonModelsAsBase  = true
                }
            };

            enzymeCell.Patch();
        }
Exemplo n.º 2
0
        private static void CreateAndPatchPacks()
        {
            var nBattery = new CbBattery // Calling the CustomBatteries API to patch this item as a Battery
            {
                EnergyCapacity    = 2500,
                ID                = "NuclearBattery",
                Name              = "Ion-fused Nuclear Battery",
                FlavorText        = "A Battery made by the Precursor Technology and its interaction with Nuclear Power.",
                CraftingMaterials = { TechType.UraniniteCrystal, TechType.UraniniteCrystal, TechType.PrecursorIonCrystal, TechType.Lead, TechType.Lead, TechType.Nickel },
                UnlocksWith       = TechType.UraniniteCrystal,
                CustomIcon        = ImageUtils.LoadSpriteFromFile(Path.Combine(AssetsFolder, "NuclearBattery.png")),
                CBModelData       = new CBModelData
                {
                    CustomTexture       = ImageUtils.LoadTextureFromFile(Path.Combine(AssetsFolder, "NuclearBatteryskin.png")),
                    CustomIllumMap      = ImageUtils.LoadTextureFromFile(Path.Combine(AssetsFolder, "NuclearBatteryillum.png")),
                    CustomSpecMap       = ImageUtils.LoadTextureFromFile(Path.Combine(AssetsFolder, "NuclearBatteryspec.png")),
                    CustomIllumStrength = 0.95f,
                    UseIonModelsAsBase  = true
                },
            };

            nBattery.Patch();

            var nPowercell = new CbPowerCell // Calling the CustomBatteries API to patch this item as a Power Cell
            {
                EnergyCapacity    = nBattery.EnergyCapacity * 2,
                ID                = "NuclearPowercell",
                Name              = "Ion-fused Nuclear Power Cell",
                FlavorText        = "A Power Cell made by the Precursor Technology and its interaction with Nuclear Power.",
                CraftingMaterials = { nBattery.TechType, nBattery.TechType, TechType.Silicone },
                UnlocksWith       = nBattery.TechType,
                CustomIcon        = ImageUtils.LoadSpriteFromFile(Path.Combine(AssetsFolder, "NuclearPowerCell.png")),
                CBModelData       = new CBModelData
                {
                    CustomTexture       = ImageUtils.LoadTextureFromFile(Path.Combine(AssetsFolder, "Nuclearcellskin.png")),
                    CustomIllumMap      = ImageUtils.LoadTextureFromFile(Path.Combine(AssetsFolder, "Nuclearcellillum.png")),
                    UseIonModelsAsBase  = true,
                    CustomIllumStrength = 1.2f
                },
            };

            nPowercell.Patch();

            var unBattery = new CbBattery // Calling the CustomBatteries API to patch this item as a Battery
            {
                EnergyCapacity    = 5250,
                ID                = "VolatileBattery",
                Name              = "Volatile Radioactive Battery",
                FlavorText        = "This Battery pulsates with Radioactive energy. Extreme caution when handling; Contains too much Uranium!",
                CraftingMaterials = { nBattery.TechType, TechType.UraniniteCrystal, TechType.UraniniteCrystal, TechType.UraniniteCrystal, TechType.Lead, TechType.Lead, TechType.Sulphur, TechType.Sulphur, TechType.Sulphur },
                UnlocksWith       = nBattery.TechType,
                CustomIcon        = ImageUtils.LoadSpriteFromFile(Path.Combine(AssetsFolder, "VolatileBattery.png")),
                CBModelData       = new CBModelData
                {
                    CustomTexture       = ImageUtils.LoadTextureFromFile(Path.Combine(AssetsFolder, "VolatileBatteryskin.png")),
                    CustomIllumMap      = ImageUtils.LoadTextureFromFile(Path.Combine(AssetsFolder, "VolatileBatteryillum.png")),
                    CustomSpecMap       = ImageUtils.LoadTextureFromFile(Path.Combine(AssetsFolder, "VolatileBatteryspec.png")),
                    UseIonModelsAsBase  = true,
                    CustomIllumStrength = 1.2f
                },
            };

            unBattery.Patch();

            var unPowercell = new CbPowerCell // Calling the CustomBatteries API to patch this item as a Power Cell
            {
                EnergyCapacity    = unBattery.EnergyCapacity * 2,
                ID                = "VolatilePowercell",
                Name              = "Volatile Radioactive Power Cell",
                FlavorText        = "This Power Cell pulsates with Radioactive energy. Extreme caution when handling; Contains too much Uranium!",
                CraftingMaterials = { unBattery.TechType, unBattery.TechType, TechType.Silicone },
                UnlocksWith       = unBattery.TechType,
                CustomIcon        = ImageUtils.LoadSpriteFromFile(Path.Combine(AssetsFolder, "VolatileCell.png")),
                CBModelData       = new CBModelData
                {
                    CustomTexture       = ImageUtils.LoadTextureFromFile(Path.Combine(AssetsFolder, "VolatileCellskin.png")),
                    CustomIllumMap      = ImageUtils.LoadTextureFromFile(Path.Combine(AssetsFolder, "VolatileCellillum.png")),
                    UseIonModelsAsBase  = true,
                    CustomIllumStrength = 1.2f
                },
            };

            unPowercell.Patch();
        }
Exemplo n.º 3
0
        public static void Load()
        {
            var assembly = Assembly.GetExecutingAssembly();

            new Harmony($"DaWrecka_{assembly.GetName().Name}").PatchAll(assembly);
#if BELOWZERO
            (new CoralSample()).Patch();
#endif
            config.OnLoad();
#if BATTERYPATCHING
            Batteries.PostPatch();
#endif

            var nBattery = new CbBattery // Calling the CustomBatteries API to patch this item as a Battery
            {
                EnergyCapacity    = (int)config.smallFuelCellCap,
                ID                = "SmallFuelCell",
                Name              = "Small Fuel Cell",
                FlavorText        = "Small hydrogen fuel cell, higher-capacity drop-in substitute for standard Alterra batteries.",
                CraftingMaterials = { TechType.Battery, TechType.Polyaniline, TechType.DisinfectedWater, TechType.Magnetite },
                UnlocksWith       = TechType.Polyaniline,
                CustomIcon        = ImageUtils.LoadSpriteFromFile(Path.Combine(AssetsFolder, "fuelcell.png")),
                CBModelData       = new CBModelData
                {
                    CustomTexture       = ImageUtils.LoadTextureFromFile(Path.Combine(AssetsFolder, "fuelcell_01.png")),
                    CustomIllumMap      = ImageUtils.LoadTextureFromFile(Path.Combine(AssetsFolder, "fuelcell_01_illum.png")),
                    CustomSpecMap       = ImageUtils.LoadTextureFromFile(Path.Combine(AssetsFolder, "fuelcell_01_spec.png")),
                    CustomIllumStrength = 0.95f,
                    UseIonModelsAsBase  = false
                },
            };
            nBattery.Patch();

            var nPowercell = new CbPowerCell // Calling the CustomBatteries API to patch this item as a Power Cell
            {
                EnergyCapacity    = (int)config.cellCap,
                ID                = "FuelCell",
                Name              = "Fuel Cell",
                FlavorText        = "Full-sized hydrogen fuel cell, higher-capacity drop-in substitute for standard Alterra power cells.",
                CraftingMaterials = { TechType.PowerCell, TechType.Polyaniline, TechType.DisinfectedWater, TechType.Magnetite },
                UnlocksWith       = nBattery.TechType,
                CustomIcon        = ImageUtils.LoadSpriteFromFile(Path.Combine(AssetsFolder, "largefuelcell.png")),
                CBModelData       = new CBModelData
                {
                    CustomTexture       = ImageUtils.LoadTextureFromFile(Path.Combine(AssetsFolder, "large_fuel_cell_01.png")),
                    CustomIllumMap      = ImageUtils.LoadTextureFromFile(Path.Combine(AssetsFolder, "large_fuel_cell_01_illum.png")),
                    CustomSpecMap       = ImageUtils.LoadTextureFromFile(Path.Combine(AssetsFolder, "large_fuel_cell_01_spec.png")),
                    UseIonModelsAsBase  = true,
                    CustomIllumStrength = 1.2f
                },
            };
            nPowercell.Patch();

            /*CraftDataHandler.SetTechData(TechType.LithiumIonBattery, new SMLHelper.V2.Crafting.RecipeData()
             * {
             *  craftAmount = 1,
             *  Ingredients = new List<Ingredient>()
             *  {
             *      new Ingredient(TechType.Lithium, 1),
             *      new Ingredient(TechType.Copper, 1),
             *      new Ingredient(TechType.GenericRibbon, 2)
             *  }
             * });
             * CraftTreeHandler.AddCraftingNode(CraftTree.Type.Fabricator, TechType.LithiumIonBattery, BatteryCraftPath);
             * KnownTechHandler.SetAnalysisTechEntry(TechType.Lithium, new TechType[] { TechType.LithiumIonBattery });*/

            float LithiumCapacity = config.BatteryValues.GetOrDefault("LithiumIonBattery", 200f);
            //if (!config.BatteryValues.TryGetValue("LithiumIonBattery", out LithiumCapacity))
            //{
            //  LithiumCapacity = 200f;
            //}

            var cbLithiumBattery = new CbBattery
            {
                EnergyCapacity    = (int)LithiumCapacity,
                ID                = "CbLithiumBattery",
                Name              = "Lithium-Ion Battery",
                FlavorText        = "High-capacity mobile power source",
                CraftingMaterials =
                {
                    TechType.Lithium,       TechType.Copper,
#if SUBNAUTICA_STABLE
                    TechType.AcidMushroom,  TechType.AcidMushroom
#elif BELOWZERO
                    TechType.GenericRibbon, TechType.GenericRibbon
#endif
                },