Exemplo n.º 1
0
        void Awake()
        {
            logger = Logger;

            string pluginfolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            resource = new ResourceData(MODNAME, "gigastations", pluginfolder);
            resource.LoadAssetBundle("gigastations");

            ProtoRegistry.AddResource(resource);


            //General
            gridXCount   = Config.Bind("-|0|- General", "-| 1 Grid X Max. Count", 1, new ConfigDescription("Amount of slots visible horizontally.\nIf this value is bigger than 1, layout will form a grid", new AcceptableValueRange <int>(1, 3))).Value;
            gridYCount   = Config.Bind("-|0|- General", "-| 2 Grid Y Max. Count", 5, new ConfigDescription("Amount of slots visible vertically", new AcceptableValueRange <int>(3, 12))).Value;
            stationColor = Config.Bind("-|0|- General", "-| 3 Station Color", new Color(0.3726f, 0.8f, 1f, 1f), "Color tint of giga stations").Value;

            //ILS
            ilsMaxSlots   = Config.Bind("-|1|- ILS", "-| 1 Max. Item Slots", 12, new ConfigDescription("The maximum Item Slots the Station can have.\nVanilla: 5", new AcceptableValueRange <int>(5, 12))).Value;
            ilsMaxStorage = Config.Bind("-|1|- ILS", "-| 2 Max. Storage", 30000, "The maximum Storage capacity per Item-Slot.\nVanilla: 10000").Value;
            ilsMaxVessels = Config.Bind("-|1|- ILS", "-| 3 Max. Vessels", 30, new ConfigDescription("The maximum Logistic Vessels amount.\nVanilla: 10", new AcceptableValueRange <int>(10, 30))).Value;
            ilsMaxDrones  = Config.Bind("-|1|- ILS", "-| 4 Max. Drones", 150, new ConfigDescription("The maximum Logistic Drones amount.\nVanilla: 50", new AcceptableValueRange <int>(50, 150))).Value;
            ilsMaxAcuGJ   = Config.Bind("-|1|- ILS", "-| 5 Max. Accu Capacity (GJ)", 50, "The Stations maximum Accumulator Capacity in GJ.\nVanilla: 12 GJ").Value;
            ilsMaxWarps   = Config.Bind("-|1|- ILS", "-| 6 Max. Warps", 150, "The maximum Warp Cells amount.\nVanilla: 50").Value;

            //PLS
            plsMaxSlots   = Config.Bind("-|2|- PLS", "-| 1 Max. Item Slots", 12, new ConfigDescription("The maximum Item Slots the Station can have.\nVanilla: 3", new AcceptableValueRange <int>(3, 12))).Value;
            plsMaxStorage = Config.Bind("-|2|- PLS", "-| 2 Max. Storage", 15000, "The maximum Storage capacity per Item-Slot.\nVanilla: 5000").Value;
            plsMaxDrones  = Config.Bind("-|2|- PLS", "-| 3 Max. Drones", 150, new ConfigDescription("The maximum Logistic Drones amount.\nVanilla: 50", new AcceptableValueRange <int>(50, 150))).Value;
            plsMaxAcuMJ   = Config.Bind("-|2|- PLS", "-| 4 Max. Accu Capacity (GJ)", 500, "The Stations maximum Accumulator Capacity in MJ.\nVanilla: 180 MJ").Value;

            //Collector
            colSpeedMultiplier = Config.Bind("-|3|- Collector", "-| 1 Collect Speed Multiplier", 3, "Multiplier for the Orbital Collectors Collection-Speed.\nVanilla: 1").Value;
            colMaxStorage      = Config.Bind("-|3|- Collector", "-| 2 Max. Storage", 15000, "The maximum Storage capacity per Item-Slot.\nVanilla: 5000").Value;


            //VesselCapacity
            vesselCapacityMultiplier = Config.Bind("-|4|- Vessel", "-| 1 Max. Capacity", 3, "Vessel Capacity Multiplier\n1 == 1000 Vessel Capacity at max Level").Value;

            //DroneCapacity
            droneCapacityMultiplier = Config.Bind("-|5|- Drone", "-| 1 Max. Capacity", 3, "Drone Capacity Multiplier\n1 == 100 Drone Capacity at max Level").Value;

            ProtoRegistry.RegisterString("PLS_Name", "Planetary Giga Station");
            ProtoRegistry.RegisterString("PLS_Desc", "Has more Slots, Capacity, etc. than a usual PLS.");
            ProtoRegistry.RegisterString("ILS_Name", "Interstellar Giga Station");
            ProtoRegistry.RegisterString("ILS_Desc", "Has more Slots, Capacity, etc. than a usual ILS.");
            ProtoRegistry.RegisterString("Collector_Name", "Orbital Giga Collector");
            ProtoRegistry.RegisterString("Collector_Desc", $"Has more Capacity and collects {colSpeedMultiplier}x faster than a usual Collector.");

            ProtoRegistry.RegisterString("ModificationWarn", "  - [GigaStationsUpdated] Replaced {0} buildings");

            ProtoRegistry.RegisterString("CantDowngradeWarn", "Downgrading logistic station is not possible!");


            pls                  = ProtoRegistry.RegisterItem(2110, "PLS_Name", "PLS_Desc", "assets/gigastations/texture2d/icon_pls", 2701);
            ils                  = ProtoRegistry.RegisterItem(2111, "ILS_Name", "ILS_Desc", "assets/gigastations/texture2d/icon_ils", 2702);
            collector            = ProtoRegistry.RegisterItem(2112, "Collector_Name", "Collector_Desc", "assets/gigastations/texture2d/icon_collector", 2703);
            collector.BuildInGas = true;

            ProtoRegistry.RegisterRecipe(410, ERecipeType.Assemble, 2400, new[] { 2103, 1103, 1106, 1303, 1206 }, new[] { 1, 40, 40, 40, 20 }, new[] { pls.ID },
                                         new[] { 1 }, "PGS_Desc", 1604);
            ProtoRegistry.RegisterRecipe(411, ERecipeType.Assemble, 3600, new[] { 2110, 1107, 1206 }, new[] { 1, 40, 20 }, new[] { ils.ID },
                                         new[] { 1 }, "ILS_Desc", 1605);
            ProtoRegistry.RegisterRecipe(412, ERecipeType.Assemble, 3600, new[] { 2111, 1205, 1406, 2207 }, new[] { 1, 50, 20, 20 }, new[] { collector.ID },
                                         new[] { 1 }, "Collector_Desc", 1606);


            plsModel       = ProtoRegistry.RegisterModel(300, pls, "Entities/Prefabs/logistic-station", null, new[] { 24, 38, 12, 10, 1 }, 605, 2, new [] { 2103, 0 });
            ilsModel       = ProtoRegistry.RegisterModel(301, ils, "Entities/Prefabs/interstellar-logistic-station", null, new[] { 24, 38, 12, 10, 1 }, 606, 2, new [] { 2104, 0 });
            collectorModel = ProtoRegistry.RegisterModel(302, collector, "Entities/Prefabs/orbital-collector", null, new[] { 18, 11, 32, 1 }, 607, 2, new [] { 2105, 0 });

            ProtoRegistry.onLoadingFinished += AddGigaPLS;
            ProtoRegistry.onLoadingFinished += AddGigaILS;
            ProtoRegistry.onLoadingFinished += AddGigaCollector;

            var harmony = new Harmony(MODGUID);

            harmony.PatchAll(typeof(StationEditPatch));
            harmony.PatchAll(typeof(SaveFixPatch));
            harmony.PatchAll(typeof(StationUpgradePatch));
            harmony.PatchAll(typeof(UIStationWindowPatch));
            harmony.PatchAll(typeof(BlueprintBuilding_Patch));
            harmony.PatchAll(typeof(UIEntityBriefInfo_Patch));

            foreach (var pluginInfo in BepInEx.Bootstrap.Chainloader.PluginInfos)
            {
                if (pluginInfo.Value.Metadata.GUID != WARPERS_MOD_GUID)
                {
                    continue;
                }

                ((ConfigEntry <bool>)pluginInfo.Value.Instance.Config["General", "ShowWarperSlot"]).Value = true;
                logger.LogInfo("Overriding Distribute Space Warpers config: ShowWarperSlot = true");
                break;
            }

            UtilSystem.AddLoadMessageHandler(SaveFixPatch.GetFixMessage);

            logger.LogInfo("GigaStations is initialized!");
        }
Exemplo n.º 2
0
        private void Awake()
        {
            logger = Logger;
            config = Config;

            string pluginfolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            resources = new ResourceData(MODGUID, "BetterMachines", pluginfolder);
            resources.LoadAssetBundle("bettermachines");
            resources.ResolveVertaFolder();
            ProtoRegistry.AddResource(resources);

            #region Strings

            ProtoRegistry.EditString("电弧熔炉", "Arc Smelter (MK.I)", "电弧熔炉 (MK.I)");
            ProtoRegistry.RegisterString("smelterMk2", "Arc Smelter (MK.II)", "电弧熔炉 (MK.II)");
            ProtoRegistry.EditString("位面熔炉", "Plane Smelter (MK.III)", "位面熔炉 (MK.III)");

            ProtoRegistry.EditString("化工厂", "Chemical Plant MK.I", "化工厂 MK.I");
            ProtoRegistry.RegisterString("chemicalPlantMk2", "Chemical Plant MK.II", "化工厂 MK.II");
            ProtoRegistry.RegisterString("chemicalPlantMk3", "Chemical Plant MK.III", "化工厂 MK.III");

            ProtoRegistry.RegisterString("storageMk3", "Storage MK.III", "型储物仓 MK.III");
            ProtoRegistry.RegisterString("storageMk4", "Storage MK.IV", "型储物仓 MK.IV");

            ProtoRegistry.EditString("储液罐", "Liquid Tank MK.I", "储液罐 MK.I", "Réservoir de stockage de liquide MK.I");
            ProtoRegistry.RegisterString("liquidTankMk2", "Liquid Tank MK.II", "储液罐 MK.II", "Réservoir de stockage de liquide MK.II");
            ProtoRegistry.RegisterString("liquidTankMk3", "Liquid Tank MK.III", "储液罐 MK.III", "Réservoir de stockage de liquide MK.III");

            ProtoRegistry.RegisterString("smelterMk2Desc", "High temperature arc smelting can smelt ores and metals, and also be used for purification and crystal smelting. By increasing maximum furnace temperature arc smelter can now smelt faster!");
            ProtoRegistry.EditString("位面冶金结果",
                                     "You have unlocked the more advanced smelter ━━ <color=\"#FD965ECC\">Plane Smelter</color>, which is faster as an Arc Smelter (MK.II)!",
                                     "你解锁了更高级的熔炉━━<color=\"#FD965ECC\">位面熔炉</color>, 它的速度比电弧炉(MK.II)还要高!",
                                     "You have unlocked the more advanced smelter ━━ <color=\"#FD965ECC\">Plane Smelter</color>, which is faster as an Arc Smelter (MK.II)!");

            ProtoRegistry.RegisterString("chemicalPlantMk2Desc", "Chemical facility. Can process the primary products of Crude oil into more advanced chemical products. Production speed has been increased.");
            ProtoRegistry.RegisterString("chemicalPlantMk3Desc", "Chemical facility. Can process the primary products of Crude oil into more advanced chemical products. Production speed has been greatly increased.");

            ProtoRegistry.EditString("I小型储物仓", "Storage MK.I is designed to store Solids.");
            ProtoRegistry.EditString("I大型储物仓", "Storage MK.II is designed to store Solids. Thanks to new materials it has more capacity than Storage Mk.I");
            ProtoRegistry.RegisterString("storageMk3Desc", "Storage MK.III is designed to store Solids. Thanks to new materials it has more capacity than Storage Mk.II");
            ProtoRegistry.RegisterString("storageMk4Desc", "Storage MK.IV is designed to store Solids. Thanks to new materials it has more capacity than Storage Mk.III");

            ProtoRegistry.EditString("I储液罐", "Liquid Tank MK.I is designed to store Liquids. When dismantling a non-empty Storage Tank any remaining fluid will be lost.");
            ProtoRegistry.RegisterString("liquidTankMk2Desc", "Liquid Tank MK.II is designed to store Liquids. Thanks to new materials it has more capacity than Liquid Tank Mk.I. When dismantling a non-empty Storage Tank any remaining fluid will be lost.");
            ProtoRegistry.RegisterString("liquidTankMk3Desc", "Liquid Tank MK.III is designed to store Liquids. Thanks to new materials it has more capacity than Liquid Tank Mk.II. When dismantling a non-empty Storage Tank any remaining fluid will be lost.");

            ProtoRegistry.RegisterString("highDensityStorageTech", "High density storage");
            ProtoRegistry.RegisterString("highDensityStorageTechDesc", "By using new stronger materials maximum capacity of Storages and Liquid Tanks can be increased.");
            ProtoRegistry.RegisterString("highDensityStorageTechConc", "You have obtained new Storage MK.IV and Liquid Tank Mk.III, which have increased storage capacity");

            ProtoRegistry.RegisterString("beltMk4", "Belt MK.IV");
            ProtoRegistry.RegisterString("beltMk4Desc", "Allows to transport items around. I have heard that it's so fast, that the game doesn't understand what to do with it.");



            #endregion

            #region Materials

            Material smelterMk2Part1 = ProtoRegistry.CreateMaterial("VF Shaders/Forward/PBR Standard", "smelter-mk2-part1", "#DB5860FF",
                                                                    new[]
            {
                "Assets/BetterMachines/Textures/smelter-mk1-lod0-a",
                "Assets/BetterMachines/Textures/smelter-mk1-lod0-n",
                "Assets/BetterMachines/Textures/smelter-mk1-lod0-s",
                "Assets/BetterMachines/Textures/smelter-mk1-lod0-e",
                "Assets/BetterMachines/Textures/smelter-mk1-lod0-j"
            });

            smelterMk2Part1.SetFloat(emissionSwitch, 1);
            smelterMk2Part1.SetFloat(emissionUsePower, 1);

            smelterMk2Part1.SetFloat(albedoMultiplier, 1.3f);
            smelterMk2Part1.SetFloat(emissionMultiplier, 10);
            smelterMk2Part1.SetFloat(emissionJitter, 0.5f);

            Material smelterMk2Part2 = ProtoRegistry.CreateMaterial("VF Shaders/Forward/PBR Standard", "smelter-mk2-part2", "#DB5860FF",
                                                                    new[]
            {
                "Assets/BetterMachines/Textures/smelter-mk3-lod0-a",
                "Assets/BetterMachines/Textures/smelter-mk3-lod0-n",
                "Assets/BetterMachines/Textures/smelter-mk3-lod0-s",
                "Assets/BetterMachines/Textures/smelter-mk3-lod0-e"
            });

            smelterMk2Part2.SetFloat(emissionSwitch, 1);
            smelterMk2Part2.SetFloat(emissionUsePower, 1);

            smelterMk2Part2.SetFloat(albedoMultiplier, 1.3f);
            smelterMk2Part2.SetFloat(emissionMultiplier, 10);
            smelterMk2Part2.SetFloat(emissionJitter, 0.5f);

            Material smelterMk2Lods = ProtoRegistry.CreateMaterial("VF Shaders/Forward/PBR Standard", "smelter-mk2-lods", "#DB5860FF",
                                                                   new[]
            {
                "Assets/BetterMachines/Textures/smelter-mk2-lod1-a",
                "Assets/BetterMachines/Textures/smelter-mk2-lod1-n",
                "Assets/BetterMachines/Textures/smelter-mk2-lod1-s",
                "Assets/BetterMachines/Textures/smelter-mk2-lod1-e"
            });

            smelterMk2Lods.SetFloat(emissionSwitch, 1);
            smelterMk2Lods.SetFloat(emissionUsePower, 1);
            smelterMk2Lods.SetFloat(alphaClip, 0.5f);

            Material storageMat = ProtoRegistry.CreateMaterial("VF Shaders/Forward/PBR Standard", "storage-mat", "#DB5860FF",
                                                               new[]
            {
                "Assets/BetterMachines/Textures/storage-a",
                "Assets/BetterMachines/Textures/storage-n",
                "Assets/BetterMachines/Textures/storage-s"
            });

            Material storageMatLod1 = ProtoRegistry.CreateMaterial("VF Shaders/Forward/PBR Standard", "storage-mat", "#DB5860FF",
                                                                   new[]
            {
                "Assets/BetterMachines/Textures/storage-lod-a",
                "Assets/BetterMachines/Textures/storage-lod-n",
                "Assets/BetterMachines/Textures/storage-lod-s"
            });

            storageMatLod1.SetFloat(alphaClip, 0.5f);

            Material blackMat =
                ProtoRegistry.CreateMaterial("VF Shaders/Forward/Black Mask", "black", "#00000000");

            blackMat.renderQueue = 2980;
            blackMat.SetColor(tintColor, Color.black);
            blackMat.SetFloat(invFade, 1.5f);

            Material blackMatToggle =
                ProtoRegistry.CreateMaterial("VF Shaders/Forward/Black Mask Vertex Toggle", "liquid-tank-black", "#00000000");

            blackMatToggle.renderQueue = 2980;
            blackMatToggle.SetColor(tintColor, Color.black);
            blackMatToggle.SetFloat(invFade, 1.5f);

            Material liquidTankMat = ProtoRegistry.CreateMaterial("VF Shaders/Forward/PBR Standard Vertex Toggle", "liquid-tank-mat", "#FFFFFFFF",
                                                                  new[]
            {
                "Assets/BetterMachines/Textures/storage-tank-a",
                "Assets/BetterMachines/Textures/storage-tank-n",
                "Assets/BetterMachines/Textures/storage-tank-s"
            });

            Material liquidTankGlassMat =
                ProtoRegistry.CreateMaterial("VF Shaders/Forward/PBR Standard Tank Vertex Toggle", "liquid-tank-glass-mat", "#F2FFFA42", new []
            {
                "", "",
                "Assets/BetterMachines/Textures/storage-tank-glass-s"
            });
            liquidTankGlassMat.renderQueue = 2989;
            liquidTankGlassMat.SetFloat(albedoMultiplier, 3);
            liquidTankGlassMat.SetFloat(bumpScale, 1);
            liquidTankGlassMat.SetFloat(emissionMultiplier, 10);
            liquidTankGlassMat.SetFloat(smoothMultiplier, 0.8f);
            liquidTankGlassMat.SetFloat(emissionSwitch, 1);
            liquidTankGlassMat.SetColor(specularColor, new Color(0.1981132f, 0.1981132f, 0.1981132f, 1));
            liquidTankGlassMat.SetColor(rimColor, new Color(0.6039216f, 0.8462228f, 0.8588235f, 1));

            string[] chemicalTextures =
            {
                "Assets/BetterMachines/Textures/chemical-plant-a",
                "Assets/BetterMachines/Textures/chemical-plant-n",
                "Assets/BetterMachines/Textures/chemical-plant-s",
                "Assets/BetterMachines/Textures/chemical-plant-e"
            };

            Material chemicalPlantMatMk2 = ProtoRegistry.CreateMaterial("VF Shaders/Forward/PBR Standard", "chemical-plant-mk2", "#00FFE8FF", chemicalTextures);

            Material chemicalPlantMatMk3 = ProtoRegistry.CreateMaterial("VF Shaders/Forward/PBR Standard", "chemical-plant-mk2", "#5FB9FFFF", chemicalTextures);

            Material chemicalPlantMatGlass = ProtoRegistry.CreateMaterial("VF Shaders/Forward/PBR Standard Glass", "chemical-plant-glass", "#D7F7FF29",
                                                                          new [] {
                "", "",
                "Assets/BetterMachines/Textures/chemical-plant-glass-s"
            });

            chemicalPlantMatGlass.renderQueue = 3001;
            chemicalPlantMatGlass.SetColor(emissionColor, Color.black);
            chemicalPlantMatGlass.SetColor(rimColor, new Color(0.6448024f, 0.8279268f, 0.8490566f, 1f));

            Material chemicalPlantMatWater = ProtoRegistry.CreateMaterial("VF Shaders/Forward/PBR Standard Glass", "chemical-plant-glass",
                                                                          new Color(1f, 0.6380855f, 0.1650943f, 0.5176471f));

            chemicalPlantMatWater.renderQueue = 3000;
            chemicalPlantMatWater.SetColor(emissionColor, Color.black);

            string[] chemicallodTextures =
            {
                "Assets/BetterMachines/Textures/chemical-plant-lod-a",
                "Assets/BetterMachines/Textures/chemical-plant-lod-n",
                "Assets/BetterMachines/Textures/chemical-plant-lod-s",
                "Assets/BetterMachines/Textures/chemical-plant-lod-e"
            };

            Material chemicalPlantMatMk2Lod = ProtoRegistry.CreateMaterial("VF Shaders/Forward/PBR Standard", "chemical-plant-mk2", "#00FFE8FF", chemicallodTextures);
            Material chemicalPlantMatMk3Lod = ProtoRegistry.CreateMaterial("VF Shaders/Forward/PBR Standard", "chemical-plant-mk2", "#5FB9FFFF", chemicallodTextures);


            gizmoMat = resources.bundle.LoadAsset <Material>("Assets/BetterMachines/Materials/SolidGizmo.mat");
            gizmoMat.shaderKeywords = new[] { "_ALPHABLEND_ON", "_EMISSION" };

            gizmoLineMat = resources.bundle.LoadAsset <Material>("Assets/BetterMachines/Materials/SolidLine.mat");
            gizmoLineMat.shaderKeywords = new[] { "_ALPHABLEND_ON", "_EMISSION" };

            #endregion

            #region Items

            ItemProto smelterMk3Item = LDB.items.Select(2315);
            smelterMk3Item.SetIcon("Assets/BetterMachines/Icons/smelter-3", false);

            smelterMk2item = ProtoRegistry.RegisterItem(3700, "smelterMk2", "smelterMk2Desc",
                                                        "Assets/BetterMachines/Icons/smelter-2", ProtoRegistry.GetGridIndex(2, 5, 4), 50, EItemType.Production);

            ItemProto chemicalPlantMk2item = ProtoRegistry.RegisterItem(3701, "chemicalPlantMk2", "chemicalPlantMk2Desc",
                                                                        "Assets/BetterMachines/Icons/chemical-plant-mk2", ProtoRegistry.GetGridIndex(2, 5, 5), 50, EItemType.Production);

            ItemProto chemicalPlantMk3item = ProtoRegistry.RegisterItem(3702, "chemicalPlantMk3", "chemicalPlantMk3Desc",
                                                                        "Assets/BetterMachines/Icons/chemical-plant-mk3", ProtoRegistry.GetGridIndex(2, 6, 5), 50, EItemType.Production);

            ItemProto storageMk3Item = ProtoRegistry.RegisterItem(3703, "storageMk3", "storageMk3Desc",
                                                                  "Assets/BetterMachines/Icons/storage-3", ProtoRegistry.GetGridIndex(2, 1, 6), 50, EItemType.Logistics);

            ItemProto storageMk4Item = ProtoRegistry.RegisterItem(3704, "storageMk4", "storageMk4Desc",
                                                                  "Assets/BetterMachines/Icons/storage-4", ProtoRegistry.GetGridIndex(2, 2, 6), 50, EItemType.Logistics);

            ItemProto tankMk2Item = ProtoRegistry.RegisterItem(3705, "liquidTankMk2", "liquidTankMk2Desc",
                                                               "Assets/BetterMachines/Icons/storage-tank-2", ProtoRegistry.GetGridIndex(2, 1, 5), 50, EItemType.Logistics);

            ItemProto tankMk3Item = ProtoRegistry.RegisterItem(3706, "liquidTankMk3", "liquidTankMk3Desc",
                                                               "Assets/BetterMachines/Icons/storage-tank-3", ProtoRegistry.GetGridIndex(2, 2, 5), 50, EItemType.Logistics);

            beltMk4Item = ProtoRegistry.RegisterItem(3707, "beltMk4", "beltMk4Desc",
                                                     "Assets/BetterMachines/Icons/belt-4", ProtoRegistry.GetGridIndex(2, 3, 5), 300, EItemType.Logistics);


            #endregion

            #region Models

            ProtoRegistry.RegisterModel(260, smelterMk2item, "Assets/BetterMachines/Machines/smelter-mk2",
                                        new [] { smelterMk2Part1, smelterMk2Part2 }, new[] { 22, 11, 12, 1 }, 502, 2, new [] { 2302, 0, 2315 });
            ProtoRegistry.AddLodMaterials("Assets/BetterMachines/Machines/smelter-mk2", 1, new [] { smelterMk2Lods });
            ProtoRegistry.AddLodMaterials("Assets/BetterMachines/Machines/smelter-mk2", 2, new [] { smelterMk2Lods });

            ProtoRegistry.RegisterModel(261, chemicalPlantMk2item, "Assets/BetterMachines/Machines/chemical-plant-mk2",
                                        new [] { chemicalPlantMatMk2, chemicalPlantMatGlass, blackMat, chemicalPlantMatWater }, new[] { 22, 11, 12, 1 }, 704, 2, new [] { 2309, 0, chemicalPlantMk3item.ID });
            ProtoRegistry.AddLodMaterials("Assets/BetterMachines/Machines/chemical-plant-mk2", 1, new [] { chemicalPlantMatMk2Lod, chemicalPlantMatGlass });
            ProtoRegistry.AddLodMaterials("Assets/BetterMachines/Machines/chemical-plant-mk2", 2, new [] { chemicalPlantMatMk2Lod, chemicalPlantMatGlass });

            ProtoRegistry.RegisterModel(262, chemicalPlantMk3item, "Assets/BetterMachines/Machines/chemical-plant-mk3",
                                        new [] { chemicalPlantMatMk3, chemicalPlantMatGlass, blackMat, chemicalPlantMatWater }, new[] { 22, 11, 12, 1 }, 705, 3, new [] { 2309, chemicalPlantMk2item.ID, 0 });
            ProtoRegistry.AddLodMaterials("Assets/BetterMachines/Machines/chemical-plant-mk3", 1, new [] { chemicalPlantMatMk3Lod, chemicalPlantMatGlass });
            ProtoRegistry.AddLodMaterials("Assets/BetterMachines/Machines/chemical-plant-mk3", 2, new [] { chemicalPlantMatMk3Lod, chemicalPlantMatGlass });

            ProtoRegistry.RegisterModel(263, storageMk3Item, "Assets/BetterMachines/Machines/storage-3",
                                        new [] { storageMat }, new[] { 17, 1 }, 403);
            ProtoRegistry.AddLodMaterials("Assets/BetterMachines/Machines/storage-3", 1, new [] { storageMatLod1 });


            ProtoRegistry.RegisterModel(264, storageMk4Item, "Assets/BetterMachines/Machines/storage-4",
                                        new [] { storageMat }, new[] { 17, 1 }, 404);
            ProtoRegistry.AddLodMaterials("Assets/BetterMachines/Machines/storage-4", 1, new [] { storageMatLod1 });

            liquidTankMk2 = ProtoRegistry.RegisterModel(265, tankMk2Item, "Assets/BetterMachines/Machines/liquid-tank-mk2",
                                                        new [] { liquidTankMat, blackMatToggle, liquidTankGlassMat }, new[] { 30, 1 }, 406, 0, new int [0], 3);

            liquidTankMk3 = ProtoRegistry.RegisterModel(266, tankMk3Item, "Assets/BetterMachines/Machines/liquid-tank-mk3",
                                                        new [] { liquidTankMat, blackMatToggle, liquidTankGlassMat }, new[] { 30, 1 }, 407, 0, new int[0], 3);

            beltMk4 = ProtoRegistry.RegisterModel(267, beltMk4Item, "Assets/BetterMachines/Machines/belt-4",
                                                  null, new[] { 15, 1 }, 304, 4, new [] { 2001, 2002, 2003, 0 });

            #endregion

            #region Recipes

            // Smelter mk2 <= Smelter mk1,  Titanium alloy * 4, Processor * 4, Magnetic coil * 8
            ProtoRegistry.RegisterRecipe(250, ERecipeType.Assemble, 240, new[] { 2302, 1107, 1303, 1202 }, new[] { 1, 4, 4, 8 },
                                         new[] { smelterMk2item.ID }, new[] { 1 }, "smelterMk2Desc", 1202);

            // Smelter mk3 <= Smelter mk2,  Particle container * 8, Plane filter * 4, Particle broadband * 8
            ProtoRegistry.EditRecipe(116, ERecipeType.Assemble, 300, new[] { smelterMk2item.ID, 1206, 1304, 1402 }, new[] { 1, 8, 4, 8 },
                                     new[] { 2315 }, new[] { 1 }, "smelterMk3Desc", 1417, ProtoRegistry.GetGridIndex(2, 6, 4));

            // Chem plant mk2 <= Chem plant mk1, Titanium alloy * 4, Titanium glass * 4, Processor * 4
            ProtoRegistry.RegisterRecipe(251, ERecipeType.Assemble, 360, new[] { 2309, 1107, 1119, 1303 }, new[] { 1, 4, 4, 4 },
                                         new[] { chemicalPlantMk2item.ID }, new[] { 1 }, "chemicalPlantMk2Desc", 1202);

            // Chem plant mk3 <= Chem plant mk2, Particle broadband * 4,  Plane filter * 2, Quantum chip * 2
            ProtoRegistry.RegisterRecipe(252, ERecipeType.Assemble, 420, new[] { chemicalPlantMk2item.ID, 1402, 1304, 1305 }, new[] { 1, 4, 2, 2 },
                                         new[] { chemicalPlantMk3item.ID }, new[] { 1 }, "chemicalPlantMk2Desc", 1203);

            ProtoRegistry.RegisterRecipe(253, ERecipeType.Assemble, 300, new[] { 1106, 1108 }, new[] { 12, 12 },
                                         new[] { storageMk3Item.ID }, new[] { 1 }, "storageMk3Desc", 1604);

            RecipeProto storageMk4Recipe = ProtoRegistry.RegisterRecipe(254, ERecipeType.Assemble, 360, new[] { 1107, 1108 }, new[] { 16, 16 },
                                                                        new[] { storageMk4Item.ID }, new[] { 1 }, "storageMk4Desc", 1851);

            ProtoRegistry.RegisterRecipe(255, ERecipeType.Assemble, 300, new[] { 1103, 1108, 1110 }, new[] { 12, 12, 8 },
                                         new[] { tankMk2Item.ID }, new[] { 1 }, "liquidTankMk2Desc", 1603);

            RecipeProto liquidTankMk3Recipe = ProtoRegistry.RegisterRecipe(256, ERecipeType.Assemble, 360, new[] { 1107, 1108, 1119 }, new[] { 16, 16, 12 },
                                                                           new[] { tankMk3Item.ID }, new[] { 1 }, "liquidTankMk3Desc", 1851);

            ProtoRegistry.RegisterTech(1851, "highDensityStorageTech", "highDensityStorageTechDesc", "highDensityStorageTechConc", "Assets/BetterMachines/Icons/high-density-storage",
                                       new[] { 1414 }, new[] { 6001, 6002, 6003 }, new[] { 20, 20, 2 }, 216000, new[] { storageMk4Recipe.ID, liquidTankMk3Recipe.ID }, new Vector2(37, 13));

            ProtoRegistry.RegisterRecipe(257, ERecipeType.Assemble, 360, new[] { 2003, 1304, 1124 }, new[] { 3, 1, 1 },
                                         new[] { beltMk4Item.ID }, new[] { 3 }, "beltMk4Desc", 1605);

            #endregion

            LDBTool.SetBuildBar(3, 4, beltMk4Item.ID); // Insert belt mk4
            LDBTool.SetBuildBar(3, 5, 2011);
            LDBTool.SetBuildBar(3, 6, 2012);
            LDBTool.SetBuildBar(3, 7, 2013);
            LDBTool.SetBuildBar(3, 8, 2040);
            LDBTool.SetBuildBar(3, 9, 2030);
            LDBTool.SetBuildBar(3, 10, 2020);

            LDBTool.SetBuildBar(4, 5, 2106);  //Move default position for Liquid Tank mk1

            LDBTool.SetBuildBar(5, 2, smelterMk2item.ID);
            LDBTool.SetBuildBar(5, 3, 2315);  //Move default position for Plane Smelter (MK.III)
            LDBTool.SetBuildBar(5, 4, 2303);
            LDBTool.SetBuildBar(5, 5, 2304);
            LDBTool.SetBuildBar(5, 6, 2305);
            LDBTool.SetBuildBar(5, 7, 2308);
            LDBTool.SetBuildBar(5, 8, 2309);
            LDBTool.SetBuildBar(5, 9, 2314);
            LDBTool.SetBuildBar(5, 10, 2310);

            Harmony harmony = new Harmony(MODGUID);
            harmony.PatchAll(Assembly.GetExecutingAssembly());

            ProtoRegistry.onLoadingFinished += ModifySpeed;
        }
Exemplo n.º 3
0
        void Awake()
        {
            logger = Logger;
            config = Config;

            string pluginfolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            resources = new ResourceData(GUID, "BetterMachines", pluginfolder);
            resources.LoadAssetBundle("minerbundle");
            resources.ResolveVertaFolder();
            ProtoRegistry.AddResource(resources);

            EnableMinerMk3 = Config.Bind("General",
                                         "EnableMinerMk3",
                                         true,
                                         "Should Miner Mk3 item be added? Do note that loading a save that has Miners mk3 without this enabled will result in loss of these miners");

            Config.Bind("AdvancedMiners",
                        "Tier-2_miningRange",
                        10f,
                        "How much range this tier has(Range of miner mk.1 is 7.75m). Note that this applies only to new miners built, already existing will not have their range changed!");

            Config.MigrateConfig <float>("General", "MinerMk2Range", "AdvancedMiners", "Tier-2_miningRange");

            Harmony harmony = new Harmony(GUID);

            harmony.PatchAll(Assembly.GetExecutingAssembly());

            string[] textures =
            {
                "Assets/BetterMachines/Textures/mining-drill-a",
                "Assets/BetterMachines/Textures/mining-drill-n",
                "Assets/BetterMachines/Textures/mining-drill-s",
                "Assets/BetterMachines/Textures/mining-drill-e"
            };

            Material mk2Mat = ProtoRegistry.CreateMaterial("VF Shaders/Forward/PBR Standard", "mining-drill-mk2",
                                                           "#00FFE8FF", textures);

            mk2Mat.SetFloat(albedoMultiplier, 1.5f);
            mk2Mat.SetFloat(emissionMultiplier, 15f);
            mk2Mat.SetFloat(emissionSwitch, 1f);
            mk2Mat.SetFloat(emissionUsePower, 1f);
            mk2Mat.SetFloat(albedoMultiplier, 1.5f);


            Material mk3Mat = ProtoRegistry.CreateMaterial("VF Shaders/Forward/PBR Standard", "mining-drill-mk3",
                                                           "#5FB9FFFF", textures);

            mk3Mat.SetFloat(albedoMultiplier, 1.5f);
            mk3Mat.SetFloat(emissionMultiplier, 15f);
            mk3Mat.SetFloat(emissionSwitch, 1f);
            mk3Mat.SetFloat(emissionUsePower, 1f);
            mk3Mat.SetFloat(albedoMultiplier, 1.5f);

            Material blackMat =
                ProtoRegistry.CreateMaterial("VF Shaders/Forward/Black Mask", "mining-drill-black", "#00000000");

            blackMat.renderQueue = 2980;
            blackMat.SetColor(tintColor, Color.black);
            blackMat.SetFloat(invFade, 1.5f);

            //Register and create buildings, items, models, etc
            ProtoRegistry.RegisterString("advancedMiningDrill", "Mining drill Mk.II");
            ProtoRegistry.RegisterString("advancedMiningDrillDesc",
                                         "Thanks to some hard to pronounce tech this drill has better range!");

            ProtoRegistry.RegisterString("miningDrillMk3", "Mining drill Mk.III");
            ProtoRegistry.RegisterString("miningDrillMk3Desc",
                                         "They did it again. Technology that makes this machine possible is so hard to pronounce that its name contains unknown symbols and math equations! Has better range and mining speed.");

            ItemProto miner = ProtoRegistry.RegisterItem(2000, "advancedMiningDrill", "advancedMiningDrillDesc",
                                                         "Assets/BetterMachines/Icons/mining-drill-mk2", 2504);

            ItemProto minerMk3 = default;

            if (EnableMinerMk3.Value)
            {
                minerMk3 = ProtoRegistry.RegisterItem(2550, "miningDrillMk3", "miningDrillMk3Desc",
                                                      "Assets/BetterMachines/Icons/mining-drill-mk3", 2505);
            }

            ModelProto model = ProtoRegistry.RegisterModel(178, "Assets/BetterMachines/Machines/mining-drill-mk2",
                                                           new[] { mk2Mat, blackMat });

            int[] upgrades = EnableMinerMk3.Value ? new[] { 2301, 0, minerMk3.ID } : new[] { 2301, 0 };

            ProtoRegistry.AddModelToItemProto(model, miner, new[] { 18, 19, 11, 12, 1 }, 204, 2,
                                              upgrades);

            ProtoRegistry.RegisterRecipe(105, ERecipeType.Assemble, 60, new[] { 2301, 1106, 1303, 1206 }, new[] { 1, 4, 2, 2 },
                                         new[] { miner.ID }, new[] { 1 }, "advancedMiningDrillDesc", 1202);

            if (EnableMinerMk3.Value)
            {
                ModelProto modelMk3 = ProtoRegistry.RegisterModel(270, "Assets/BetterMachines/Machines/mining-drill-mk3",
                                                                  new[] { mk3Mat, blackMat });

                ProtoRegistry.AddModelToItemProto(modelMk3, minerMk3, new[] { 18, 19, 11, 12, 1 }, 205, 3,
                                                  new[] { 2301, miner.ID, 0 });

                ProtoRegistry.RegisterRecipe(260, ERecipeType.Assemble, 60, new[] { miner.ID, 1107, 1305, 1402 }, new[] { 1, 4, 2, 8 },
                                             new[] { minerMk3.ID }, new[] { 1 }, "miningDrillMk3Desc", 1203);
            }



            logger.LogInfo("Advanced Miner mod is initialized!");

            //ProtoRegistry.onLoadingFinished += onPostAdd;
        }