Example #1
0
        void ModifySpeed()
        {
            ItemProto           assemblerMk2 = LDB.items.Select(2304);
            CustomAssemblerDesc assDesc2     = new CustomAssemblerDesc()
            {
                tier          = 2,
                assembleSpeed = 1f
            };

            assDesc2.ApplyProperties(new PrefabDesc());

            assemblerMk2.prefabDesc.assemblerSpeed = (int)(assDesc2.assembleSpeed * 10000);

            ItemProto           assemblerMk3 = LDB.items.Select(2305);
            CustomAssemblerDesc assDesc3     = new CustomAssemblerDesc()
            {
                tier          = 3,
                assembleSpeed = 1.5f
            };

            assDesc3.ApplyProperties(new PrefabDesc());

            assemblerMk3.prefabDesc.assemblerSpeed = (int)(assDesc3.assembleSpeed * 10000);

            // Spray coater grid index
            LDB.recipes.Select(109).GridIndex = ProtoRegistry.GetGridIndex(2, 7, 4);
            LDB.items.Select(2313).GridIndex  = ProtoRegistry.GetGridIndex(2, 8, 4);


            // Arc smelter grid index
            LDB.recipes.Select(56).GridIndex = ProtoRegistry.GetGridIndex(2, 4, 4);
            ItemProto smelterMk1Item       = LDB.items.Select(2302);
            ItemProto smelterMk3Item       = LDB.items.Select(2315);
            ItemProto chemicalPlantMk1Item = LDB.items.Select(2309);
            ItemProto beltMk3 = LDB.items.Select(2003);

            beltMk3.recipes = null;
            beltMk3.FindRecipes();
            smelterMk1Item.FindRecipes();

            // Plane smelter grid index
            smelterMk3Item.GridIndex = ProtoRegistry.GetGridIndex(2, 6, 4);
            smelterMk1Item.recipes   = null; //Reload smelter recipes
            smelterMk2item.recipes   = null;
            smelterMk3Item.recipes   = null;
            smelterMk1Item.FindRecipes();
            smelterMk2item.FindRecipes();
            smelterMk3Item.FindRecipes();


            // Chemical plant mk1 grid index
            chemicalPlantMk1Item.GridIndex = ProtoRegistry.GetGridIndex(2, 4, 5);
            chemicalPlantMk1Item.recipes   = null;
            chemicalPlantMk1Item.FindRecipes();
            LDB.recipes.Select(22).GridIndex = ProtoRegistry.GetGridIndex(2, 4, 5);


            ColorUtility.TryParseHtmlString("#F9D352FF", out Color yellow);

            smelterMk3 = LDB.models.Select(194);
            smelterMk3.prefabDesc.lodMaterials[0][0].color = yellow;
            smelterMk3.prefabDesc.lodMaterials[1][0].color = yellow;
            smelterMk3.prefabDesc.lodMaterials[2][0].color = yellow;

            SmelterDesc desc = new SmelterDesc()
            {
                tier       = 3,
                smeltSpeed = 2f
            };

            desc.ApplyProperties(new PrefabDesc());

            smelterMk3.prefabDesc.assemblerSpeed = (int)(desc.smeltSpeed * 10000);

            smelterMk3.prefabDesc.workEnergyPerTick = 24000;
            smelterMk3.prefabDesc.idleEnergyPerTick = 800;

            beltMk4Item.BuildMode            = 2; //Belt Build mode
            beltMk4.prefabDesc.beltPrototype = beltMk4Item.ID;
            BeltFixes.AddMatAndMesh();
        }