예제 #1
0
 private static void RegisterKeyBinds()
 {
     CustomKeyBindSystem.RegisterKeyBind <PressKeyBind>(new BuiltinKey
     {
         id            = 212,
         key           = new CombineKey((int)KeyCode.BackQuote, CombineKey.ALT_COMB, ECombineKeyAction.OnceClick, false),
         conflictGroup = 2052,
         name          = "NebulaChatWindow",
         canOverride   = true
     });
     ProtoRegistry.RegisterString("KEYNebulaChatWindow", "Show or Hide Chat Window");
 }
예제 #2
0
        private void Awake()
        {
            logger = Logger;

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

            resources = new ResourceData(MODNAME, "RebindBuildBar", pluginfolder);
            resources.LoadAssetBundle("rebindbarbundle");

            ProtoRegistry.RegisterString("ResetBuildMenuTipTitle", "Reset Build Bar item binding");
            ProtoRegistry.RegisterString("ResetBuildMenuTip",
                                         "Pressing this button will reset Build Bar items in current category to their defaults. Holding ctrl (Rebindable) resets all items in all categories.");

            ProtoRegistry.RegisterString("ResetBuildMenuQuestionTitle", "Are you sure?");
            ProtoRegistry.RegisterString("ResetBuildMenuQuestion1", "This action will reset all Build Bar items in build bar to their defaults");
            ProtoRegistry.RegisterString("ResetBuildMenuQuestion2", "This action will reset Build Bar items in current category to their defaults");

            ProtoRegistry.RegisterString("KEYReassignBuildBar", "Reassign Build Bar item");
            ProtoRegistry.RegisterString("KEYClearBuildBar", "Clear Build Bar item");

            ProtoRegistry.RegisterString("LockedTipText", "Locked");

            CustomKeyBindSystem.RegisterKeyBind <HoldKeyBind>(new BuiltinKey
            {
                id            = 150,
                key           = new CombineKey(0, CombineKey.CTRL_COMB, ECombineKeyAction.OnceClick, false),
                conflictGroup = KeyBindConflict.KEYBOARD_KEYBIND | KeyBindConflict.UI,
                name          = "ReassignBuildBar",
                canOverride   = true
            });

            CustomKeyBindSystem.RegisterKeyBind <PressKeyBind>(new BuiltinKey
            {
                id            = 151,
                key           = new CombineKey((int)KeyCode.Mouse2, 0, ECombineKeyAction.OnceClick, false),
                conflictGroup = KeyBindConflict.MOUSE_KEYBIND | KeyBindConflict.UI,
                name          = "ClearBuildBar",
                canOverride   = true
            });

            Harmony harmony = new Harmony(MODGUID);

            harmony.PatchAll(typeof(Patches));

            logger.LogInfo("Rebind Build Bar mod is loaded successfully!");
        }
예제 #3
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;
        }
예제 #4
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!");
        }
예제 #5
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;
        }
예제 #6
0
        private void Awake()
        {
            logger = Logger;

            #region Config

            cameraToggleEnabled   = Config.Bind("Interface", "cameraToggle", true, "Allows toggling camera between 3rd person and god view\nAll values are applied on restart");
            addPasteButtonEnabled = Config.Bind("Interface", "addBluprintPasteButton", true, "If enabled new button will be added to Blueprint Browser. Pressing it will paste curretly selected blueprint\nAll values are applied on restart");

            recipeChangeEnabled        = Config.Bind("Interface", "recipeChange", true, "Add recipe change panel to blueprint inspectors\nAll values are applied on restart");
            logisticCargoChangeEnabled = Config.Bind("Interface", "changeLogisticCargo", true, "Allows changing cargo requested/provided by logistic stations");
            changeTierEnabled          = Config.Bind("Interface", "changeTier", true, "Allows using change tier functionality\nAll values are applied on restart");
            beltHintsChangeEnable      = Config.Bind("Interface", "beltHintChange", true, "Add belt hint change panel to blueprint inspectors\nAll values are applied on restart");
            keepBlueprintDesc          = Config.Bind("Interface", "keepBlueprintDescription", true, "When pasting blueprint string into existing blueprint you can hold shift to keep description and icons");
            keepBrowserPath            = Config.Bind("Interface", "keepBroserPath", true, "Preserve last open Blueprint Browser directory. Also when creating new blueprints, they will be saved in the last open directory");



            forcePasteEnabled  = Config.Bind("Features", "forcePaste", true, "Allows using key to force blueprint placement\nAll values are applied on restart");
            axisLockEnabled    = Config.Bind("Features", "axisLock", true, "Allows using Latitude/Longtitude axis locks\nAll values are applied on restart");
            gridControlFeature = Config.Bind("Features", "gridControl", true, "Allows changing grid size and its offset\nAll values are applied on restart");
            blueprintMirroring = Config.Bind("Features", "blueprintMirroring", true, "Allows mirroring Blueprints\nAll values are applied on restart");
            dragRemove         = Config.Bind("Features", "dragRemove", true, "Allows using drag remove function\nAll values are applied on restart");
            pasteLocked        = Config.Bind("Features", "PasteLockedRecipes", true, "Allow pasting assemblers with recipes which have not been unlocked yet. Assemblers with recipes that are not unlocked will not work.");
            moveWithDragNDrop  = Config.Bind("Features", "moveBPWithDragNDrop", true, "Allow moving blueprints using drag and drop");
            factoryUndo        = Config.Bind("Features", "factoryUndo", true, "Enable Factory Undo feature. Allows to undo/redo most building actions. Will force dragRemove to true");


            blueprintFoundations = Config.Bind("Features", "blueprintFoundations", true, "Allow blueprinting foundations along with buildings.\nAll values are applied on restart");

            resetFunctionsOnMenuExit = Config.Bind("Misc", "resetOnExit", true, "If enabled when you exit build mode, some functions (Axis/Grid lock, Mirror) will reset their state");
            canBlueprintOnGasGiants  = Config.Bind("Misc", "bpOnGasGiants", true, "Allow using Blueprints on Gas Giants\nAll values are applied on restart");

            useFastDismantle = Config.Bind("Misc", "useFastDismantle", true, "When using drag remove tool or factory undo, an improved algorithm of removing entities will be used. It is about 20x faster, but might have some imperfections. If you encounter issues you can switch back to vanilla code.");
            excludeStations  = Config.Bind("Misc", "excludeStations", true, "When using drag remove tool, logistic stations (and miners Mk.II) will not get removed. This is a safeguard against errors which occur most of the time when you try to mass dismantle logistic stations.");

            undoMaxHistory = Config.Bind("Misc", "undoMaxHistory", 50, "Defines undo history size. When history reaches it's capacity, old entries will get removed. When using Nebula host controls the used value");


            Config.MigrateConfig <bool>("General", "Interface", new [] { "cameraToggle", "recipeChange", "changeLogisticCargo", "changeTier" });
            Config.MigrateConfig <bool>("General", "Features", new [] { "forcePaste", "axisLock", "gridControl", "gridControl", "blueprintFoundations" });
            Config.MigrateConfig <bool>("General", "Misc", new [] { "bpOnGasGiants" });

            if (factoryUndo.Value)
            {
                dragRemove.Value = true;
            }

            #endregion

            Config.Save();

            if (BepInEx.Bootstrap.Chainloader.PluginInfos.ContainsKey(FREE_FOUNDATIONS_GUID))
            {
                freeFoundationsIsInstalled = true;
            }
            if (BepInEx.Bootstrap.Chainloader.PluginInfos.ContainsKey(FREE_FOUNDATIONS_GUID_2))
            {
                freeFoundationsIsInstalled = true;
            }

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

            resource = new ResourceData(MODNAME, "blueprinttweaks", pluginfolder);
            resource.LoadAssetBundle("blueprinttweaks");
            ProtoRegistry.AddResource(resource);

            Harmony harmony = new Harmony(MODGUID);

            #region Strings

            ProtoRegistry.RegisterString("KEYToggleBPGodModeDesc", "Toggle Blueprint God Mode", "切换上帝模式浏览蓝图");
            ProtoRegistry.RegisterString("RecipesLabel", "Recipes", "配方");
            ProtoRegistry.RegisterString("ChangeTipText", "Left-click to change recipe", "左键点击更改配方");

            ProtoRegistry.RegisterString("ChangeTipTitle", "Change Recipe", "更改配方");
            ProtoRegistry.RegisterString("ChangeTipDesc",
                                         "Left-click to change recipe. When you click, picker menu will open, where a new recipe can be selected. All machines that used the old recipe will now use selected recipe. This change will take effect after saving.",
                                         "左键点击更改配方。点击将打开选择菜单,可在其中选择新配方。所有使用旧配方的机器将更新到选定的新配方。此更改将在保存后生效。");
            ProtoRegistry.RegisterString("KEYForceBPPlace", "Force Blueprint placement", "强制蓝图放置");

            ProtoRegistry.RegisterString("KEYLockLongAxis", "Lock Longitude axis", "经度锁定");
            ProtoRegistry.RegisterString("KEYLockLatAxis", "Lock Latitude axis", "纬度锁定");
            ProtoRegistry.RegisterString("KEYSetLocalOffset", "Set grid snapping offset", "设定网格捕捉偏移");

            ProtoRegistry.RegisterString("GridSizeLabel", "Blueprint Size", "蓝图尺寸");
            ProtoRegistry.RegisterString("GridLongSize", "Width", "宽度");
            ProtoRegistry.RegisterString("GridLatSize", "Height", "高度");

            ProtoRegistry.RegisterString("CantPasteThisInGasGiantWarn",
                                         "This Blueprint can't be pasted on a Gas Giant.",
                                         "此蓝图无法放置在气态/冰巨星上。");

            ProtoRegistry.RegisterString("FoundationsLabel", "Foundations", "地基");
            ProtoRegistry.RegisterString("foundationsBPCountLabel", "recorded", "块地基");
            ProtoRegistry.RegisterString("foundationBPEnabledLabel", "Blueprint foundations", "蓝图包含地基");

            ProtoRegistry.RegisterString("TransportLabel", "Logistics", "物流");
            ProtoRegistry.RegisterString("ChangeTipText2", "Left-click to change requested item", "左键点击更改物流清单物品");
            ProtoRegistry.RegisterString("ChangeTip2Title", "Change requested items", "更改物流清单物品");
            ProtoRegistry.RegisterString("ChangeTip2Desc",
                                         "Left-click to change requested item. When you click, picker menu will open, where a new item can be selected. Logistic station that used the old item will now use selected item. This change will take effect after saving.",
                                         "左键点击更改物流清单物品。点击将打开选择菜单,可在其中选择新的物流清单物品。使用旧物流清单物品的物流塔将更新到选定的新物流清单物品。此更改将在保存后生效。");


            ProtoRegistry.RegisterString("copyColorsLabel", "Copy Custom foundation colors", "附带自定义调色板");
            ProtoRegistry.RegisterString("copyColorsTip", "Copy Custom foundation colors", "附带自定义调色板");
            ProtoRegistry.RegisterString("copyColorsTipDesc",
                                         "When enabled, Custom foundation colors will be saved with Blueprint Data. When such Blueprint will be pasted, current planet's Custom colors will be replaced with colors stored in the Blueprint",
                                         "启用后,地基的自定义调色板将与蓝图数据一同保存。粘贴此类蓝图时,当前行星的地基自定义调色板将被蓝图中的调色板替代。");

            ProtoRegistry.RegisterString("hasColorsLabel", "Contains Color data", "含有颜色数据");

            ProtoRegistry.RegisterString("foundationsBlueprintTip", "Blueprint Foundations", "蓝图包含地基");
            ProtoRegistry.RegisterString("foundationsBlueprintTipDesc",
                                         "When enabled, all Foundations (Including their colors and types) in your selection will be saved to the Blueprint. If there are buildings that lack support, but blueprint has foundations under them they will successfully be pasted",
                                         "启用后,您选中的所有地基(包括它们的颜色和类型)都将保存到蓝图中。另外只要蓝图中的建筑下方包含地基,即便施工场地缺乏地基支撑,蓝图也能成功粘贴");

            ProtoRegistry.RegisterString("KEYMirrorLongAxis", "Mirror Blueprint in Longitude axis", "经向镜像");
            ProtoRegistry.RegisterString("KEYMirrorLatAxis", "Mirror Blueprint in Latitude axis", "纬向镜像");


            ProtoRegistry.RegisterString("BeltHintsLabel", "Belt Hints", "腰带提示");
            ProtoRegistry.RegisterString("HintsChangeTipText", "Left-click to change belt hints", "左键单击更改腰带提示");

            ProtoRegistry.RegisterString("ChangeHintsTipTitle", "You can change belt hints", "您可以更改腰带提示");
            ProtoRegistry.RegisterString("ChangeHintsTipDesc",
                                         "Left-click to change hints on belts. When you click, picker menu will open, where a new icon can be selected. All belts that used the old icon will now use selected icon. This change will take effect after saving.",
                                         "左键点击更改腰带提示。点击将打开选择菜单,可在其中选择新腰带提示。所有使用旧腰带提示的输送带将更新到选定的新腰带提示。此更改将在保存后生效。");

            ProtoRegistry.RegisterString("recipeLockedWarn", "Recipe is locked", "食谱已锁定");

            ProtoRegistry.RegisterString("BPBrowserPasteButtonTipTitle", "Paste Blueprint [Double click]", "粘贴蓝图[双击]");
            ProtoRegistry.RegisterString("BPBrowserPasteButtonTipDesc", "Start pasting current selected blueprint", "开始张贴当前选定的蓝图");

            ProtoRegistry.RegisterString("MoveBlueprintTip", "Move to", "移动到");

            ProtoRegistry.RegisterString("FileAlreadyExistsTitle", "Can't move blueprint!", "动不了蓝图!");
            ProtoRegistry.RegisterString("FileAlreadyExistsDesc",
                                         "Blueprint with same name already exists in target location! Please rename your blueprint and try again.",
                                         "同名蓝图已存在于目标位置! 请重命名蓝图并重试。");

            ProtoRegistry.RegisterString("KEYFactoryUndo", "Undo", "撤消");
            ProtoRegistry.RegisterString("KEYFactoryRedo", "Redo", "重做");

            ProtoRegistry.RegisterString("KEYDSPTrashButton", "Select Trash", "选择垃圾");

            ProtoRegistry.RegisterString("NotEnoughFoundationsMessage",
                                         "You need {0} more foundations to place this Blueprint!",
                                         "你需要 {0} 更多的基础来放置这个蓝图!");

            ProtoRegistry.RegisterString("FoundCountMessage",
                                         "Will consume {0} foundations",
                                         "会消耗 {0} 基础");


            ProtoRegistry.RegisterString("UndoSuccessText", "Undone successfully!", "撤消成功!");
            ProtoRegistry.RegisterString("UndoFailureText", "Failed to undo!", "未能撤消!");
            ProtoRegistry.RegisterString("RedoSuccessText", "Redone successfully!", "重做成功!");
            ProtoRegistry.RegisterString("RedoFailureText", "Failed to redo!", "重做失败!");

            ProtoRegistry.RegisterString("UndoClearedMessage", "Undo history cleared!", "撤消历史清除!");

            ProtoRegistry.RegisterString("UndoHistoryEmptyMessage", "Undo history is empty!", "撤消历史是空的!");
            ProtoRegistry.RegisterString("RedoHistoryEmptyMessage", "Redo history is empty!", "重做历史是空的!");

            #endregion

            if (factoryUndo.Value)
            {
                UndoManager.Init();
            }
            UIBlueprintInspectorPatch.Init();
            BlueprintUtilsPatch2.Init();
            RegisterKeyBinds();

            NebulaModAPI.RegisterPackets(Assembly.GetExecutingAssembly());

            #region Patches

            if (factoryUndo.Value)
            {
                harmony.PatchAll(FACTORY_UNDO);
            }

            if (keepBrowserPath.Value)
            {
                harmony.PatchAll(typeof(UIBlueprintBrowser_Patch));
            }

            if (moveWithDragNDrop.Value)
            {
                harmony.PatchAll(typeof(BuildTool_Copy_Patch));
                harmony.PatchAll(typeof(DragToMoveBlueprints.UIBlueprintBrowser_Patch));
            }

            if (keepBlueprintDesc.Value)
            {
                harmony.PatchAll(typeof(KeepBPName.UIBlueprintInspectorPatch));
            }

            if (pasteLocked.Value)
            {
                harmony.PatchAll(PASTE_LOCKED);
            }

            if (addPasteButtonEnabled.Value)
            {
                harmony.PatchAll(typeof(UIBlueprintBrowserPatch));
            }

            if (blueprintMirroring.Value)
            {
                harmony.PatchAll(typeof(BlueprintUtilsPatch2));
            }

            if (dragRemove.Value)
            {
                harmony.PatchAll(DRAG_REMOVE);
            }

            if (blueprintFoundations.Value)
            {
                harmony.PatchAll(BLUEPRINT_FOUNDATIONS);
            }

            if (changeTierEnabled.Value)
            {
                harmony.PatchAll(typeof(UIBlueprintComponentItemPatch));
            }

            if (canBlueprintOnGasGiants.Value)
            {
                harmony.PatchAll(typeof(PlayerControllerPatch));
                harmony.PatchAll(typeof(BuildTool_BlueprintPastePatch));
            }

            if (axisLockEnabled.Value || gridControlFeature.Value)
            {
                harmony.PatchAll(typeof(GridSnappingPatches));
            }
            if (cameraToggleEnabled.Value)
            {
                harmony.PatchAll(typeof(CameraFixPatch));
            }
            if (recipeChangeEnabled.Value || gridControlFeature.Value)
            {
                harmony.PatchAll(typeof(UIBlueprintInspectorPatch));
            }
            if (forcePasteEnabled.Value)
            {
                harmony.PatchAll(typeof(BlueprintPastePatch));
            }

            #endregion

            logger.LogInfo("Blueprint tweaks mod is initialized!");
        }
예제 #7
0
        void Awake()
        {
            logger = Logger;

            mode = Config.Bind("General", "Mode", ModeType.SIMPLE,
                               "Which mode to use:\n" +
                               "Simple means only one model for substation, and fully safe to use(Removing this mod will not harm saves).\n" +
                               "Advanced means that all substation types will be available at once.\n" +
                               "Downside is that it is not save safe(Removing this mod will cause you to lose all built substations)\n" +
                               "Remove mode is intended to prepare your save to removal of this mod. In it all placed substations will revert back to original when save is LOADED");

            type = Config.Bind("General", "SubstationType", SubstaionType.GROUND, "Which model to use(Has no effect in advanced mode!)");

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

            resource = new ResourceData(ID, "custommachines", pluginfolder);
            resource.LoadAssetBundle("substationbundle");
            resource.ResolveVertaFolder();

            ProtoRegistry.AddResource(resource);


            Material mainMat = ProtoRegistry.CreateMaterial("VF Shaders/Forward/PBR Standard Substation", "ground-substation",
                                                            "#FF7070FF",
                                                            new[]
            {
                "assets/custommachines/texture2d/orbital-substation-a",
                "assets/custommachines/texture2d/orbital-substation-n",
                "assets/custommachines/texture2d/orbital-substation-s",
                "assets/custommachines/texture2d/orbital-substation-e"
            });

            //VF Shaders/Forward/Unlit Additive Substation
            Material effectMat = ProtoRegistry.CreateMaterial("VF Shaders/Forward/Unlit Additive Substation", "substation-effects",
                                                              "#00000000",
                                                              new[]
            {
                "assets/custommachines/texture2d/orbital-substation-effect",
                "assets/custommachines/texture2d/orbital-substation-effect-mask"
            }, null,
                                                              new[]
            {
                Shader.PropertyToID("_MainTex"),
                Shader.PropertyToID("_MaskTex")
            });

            effectMat.SetFloat(Multiplier, 20);
            effectMat.SetVector(UVSpeed, new Vector4(0, 1, 0, 0));
            effectMat.SetFloat(InvFade, 0.4f);

            ProtoRegistry.RegisterString("SubstationModificationWarn", "  - [GroundSubstation] Replaced {0} buildings");
            ProtoRegistry.RegisterString("SubstationRestoreWarn", "  - [GroundSubstation] Restored {0} buildings (Save the game! You can now remove this mod safely)");

            if (mode.Value == ModeType.SIMPLE)
            {
                Logger.LogInfo("Initialising in SIMPLE mode");
                switch (type.Value)
                {
                case SubstaionType.GROUND:
                    ProtoRegistry.AddLodMaterials("assets/custommachines/prefabs/ground-substation", 0, new [] { mainMat, effectMat });
                    break;

                case SubstaionType.SATELITE:
                    ProtoRegistry.AddLodMaterials("assets/custommachines/prefabs/orbital-substation", 0, new [] { mainMat, effectMat });
                    break;
                }
                Harmony.CreateAndPatchAll(typeof(VFPreloadPatch), "groundsubstation");
                Harmony.CreateAndPatchAll(typeof(BuildTool_ClickPatch), "groundsubstation");
            }
            else if (mode.Value == ModeType.ADVANCED)
            {
                Logger.LogInfo("Initialising in ADVANCED mode");
                ProtoRegistry.RegisterModel(firstSubstationId, "Entities/Prefabs/orbital-substation", new[] { mainMat, effectMat });
                ProtoRegistry.RegisterModel(firstSubstationId + 1, "assets/custommachines/prefabs/ground-substation", new[] { mainMat, effectMat });
                ProtoRegistry.RegisterModel(firstSubstationId + 2, "assets/custommachines/prefabs/orbital-substation", new[] { mainMat, effectMat });
                Harmony.CreateAndPatchAll(typeof(BuildTool_ClickPatch), "groundsubstation");

                Harmony.CreateAndPatchAll(typeof(GameDataPatch), "groundsubstation");
                Harmony.CreateAndPatchAll(typeof(EntityDataPatch), "groundsubstation");
                Harmony.CreateAndPatchAll(typeof(PlayerControlGizmoPatch), "groundsubstation");
            }
            else
            {
                Logger.LogInfo("Initialising in REMOVE mode");

                Harmony.CreateAndPatchAll(typeof(GameDataPatch), "groundsubstation");
                Harmony.CreateAndPatchAll(typeof(EntityDataPatch), "groundsubstation");
            }

            UtilSystem.AddLoadMessageHandler(GetReplaceMessage);


            Logger.LogInfo("Ground Substation mod is initialized!");

            ProtoRegistry.onLoadingFinished += AfterLoad;
        }