Ejemplo n.º 1
0
 public static Tag GetUnbaggedCreatureTag(Tag bagged_tag)
 {
     return(TagManager.Create(bagged_tag.Name.Substring(6)));
 }
Ejemplo n.º 2
0
 public static bool Prefix(Pickupable pu)
 {
     return(pu.KPrefabID.HasTag(TagManager.Create("Seed")));
 }
Ejemplo n.º 3
0
 public static Tag GetBaggedCreatureTag(Tag tag)
 {
     return(TagManager.Create("Bagged" + tag.Name));
 }
Ejemplo n.º 4
0
        internal static void ConfigureRecipes()
        {
            const float INPUT_KG = 100f;

            // добавляем переплавку абиссалития в электроплавильню
            if (SmelterOptions.Instance.RecipeKatairiteToTungsten)
            {
                const float PHOSPHORUS             = 10f;
                const float SALT                   = 20f;
                const float TUNGSTEN               = INPUT_KG - PHOSPHORUS - SALT;
                const float SALT_TO_CHLORINE_RATIO = 1f / 3f;
                const float CHLORINEGAS            = SALT * SALT_TO_CHLORINE_RATIO;
                const float MAGMA                  = INPUT_KG - TUNGSTEN - CHLORINEGAS;

                var ingredients = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(SimHashes.Katairite.CreateTag(), TUNGSTEN),
                    new ComplexRecipe.RecipeElement(SimHashes.Salt.CreateTag(), SALT),
                    new ComplexRecipe.RecipeElement(SimHashes.Phosphorus.CreateTag(), PHOSPHORUS)
                };
                var results = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(SimHashes.Tungsten.CreateTag(), TUNGSTEN),
                    new ComplexRecipe.RecipeElement(SimHashes.IgneousRock.CreateTag(), MAGMA),
                    new ComplexRecipe.RecipeElement(SimHashes.ChlorineGas.CreateTag(), CHLORINEGAS)
                };
                string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(MetalRefineryConfig.ID, SimHashes.Katairite.CreateTag());
                string id          = ComplexRecipeManager.MakeRecipeID(MetalRefineryConfig.ID, ingredients, results);
                new ComplexRecipe(id, ingredients, results)
                {
                    time        = BUILDINGS.FABRICATION_TIME_SECONDS.MODERATE,
                    description = string.Format(
                        global::STRINGS.BUILDINGS.PREFABS.METALREFINERY.RECIPE_DESCRIPTION,
                        ElementLoader.FindElementByHash(SimHashes.Tungsten).name,
                        ElementLoader.FindElementByHash(SimHashes.Katairite).name),
                    nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult,
                    fabricators = new List <Tag> {
                        TagManager.Create(MetalRefineryConfig.ID)
                    }
                };
                ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id);
            }

            // добавляем переплавку фосфора в стеклоплавильню
            if (SmelterOptions.Instance.RecipePhosphoriteToPhosphorus)
            {
                var ingredients = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(SimHashes.Phosphorite.CreateTag(), INPUT_KG)
                };
                var results = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(SimHashes.LiquidPhosphorus.CreateTag(), INPUT_KG)
                };
                string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(GlassForgeConfig.ID, SimHashes.Phosphorite.CreateTag());
                string id          = ComplexRecipeManager.MakeRecipeID(GlassForgeConfig.ID, ingredients, results);
                new ComplexRecipe(id, ingredients, results)
                {
                    time        = BUILDINGS.FABRICATION_TIME_SECONDS.SHORT / 2,
                    description = string.Format(
                        global::STRINGS.BUILDINGS.PREFABS.GLASSFORGE.RECIPE_DESCRIPTION,
                        ElementLoader.FindElementByHash(SimHashes.LiquidPhosphorus).name,
                        ElementLoader.FindElementByHash(SimHashes.Phosphorite).name),
                    nameDisplay = ComplexRecipe.RecipeNameDisplay.Result,
                    fabricators = new List <Tag> {
                        TagManager.Create(GlassForgeConfig.ID)
                    }
                };
                ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id);
            }

            // добавляем копию рецептов из электроплавильни. кроме стали и наёбия
            var metalrefinery_recipes = ComplexRecipeManager.Get().recipes
                                        .Where((ComplexRecipe recipe) => recipe.fabricators.Contains(TagManager.Create(MetalRefineryConfig.ID)))
                                        .ToList();

            metalrefinery_recipes
            .DoIf(
                condition: (ComplexRecipe recipe) => !recipe.id.Contains(SimHashes.Steel.ToString()) &&
                !recipe.id.Contains(SimHashes.Niobium.ToString()),
                action: (ComplexRecipe recipe) => recipe.fabricators.Add(TagManager.Create(ID))
                );

            // добавляем сталь с увеличенным временем фабрикации
            const float fabricationTimeMultiplier = 1.3f;

            metalrefinery_recipes
            .Where((ComplexRecipe recipe) => recipe.id.Contains(SimHashes.Steel.ToString()))
            .ToList()
            .Do((ComplexRecipe recipe) =>
            {
                string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(ID, recipe.ingredients[0].material);
                string id          = ComplexRecipeManager.MakeRecipeID(ID, recipe.ingredients, recipe.results);
                new ComplexRecipe(id, recipe.ingredients, recipe.results)
                {
                    time        = recipe.time * fabricationTimeMultiplier,
                    description = recipe.description,
                    nameDisplay = recipe.nameDisplay,
                    fabricators = new List <Tag> {
                        TagManager.Create(ID)
                    }
                };
                ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id);
            });

            // добавляем копию рецептов из стеклоплавильни с увеличенным временем фабрикации
            var glassforge_recipes = ComplexRecipeManager.Get().recipes
                                     .Where((ComplexRecipe recipe) => recipe.fabricators.Contains(TagManager.Create(GlassForgeConfig.ID)))
                                     .ToList();

            glassforge_recipes
            .Do((ComplexRecipe recipe) =>
            {
                var results = new ComplexRecipe.RecipeElement[] {
                    new ComplexRecipe.RecipeElement(ElementLoader.GetElement(recipe.results[0].material).lowTempTransition.tag, recipe.results[0].amount)
                };
                string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(ID, recipe.ingredients[0].material);
                string id          = ComplexRecipeManager.MakeRecipeID(ID, recipe.ingredients, results);
                new ComplexRecipe(id, recipe.ingredients, results)
                {
                    time        = recipe.time * fabricationTimeMultiplier,
                    description = string.Format(global::STRINGS.BUILDINGS.PREFABS.GLASSFORGE.RECIPE_DESCRIPTION, ElementLoader.GetElement(results[0].material).name, ElementLoader.GetElement(recipe.ingredients[0].material).name),
                    nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult,
                    fabricators = new List <Tag> {
                        TagManager.Create(ID)
                    }
                };
                ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id);
            });

            // добавляем переплавку пластика
            if (SmelterOptions.Instance.RecipePlasticToNaphtha)
            {
                var ingredients = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(SimHashes.Polypropylene.CreateTag(), INPUT_KG)
                };
                var results = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(SimHashes.Naphtha.CreateTag(), INPUT_KG)
                };
                string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(ID, SimHashes.Polypropylene.CreateTag());
                string id          = ComplexRecipeManager.MakeRecipeID(ID, ingredients, results);
                new ComplexRecipe(id, ingredients, results)
                {
                    time        = BUILDINGS.FABRICATION_TIME_SECONDS.SHORT,
                    description = string.Format(
                        global::STRINGS.BUILDINGS.PREFABS.GLASSFORGE.RECIPE_DESCRIPTION,
                        ElementLoader.FindElementByHash(SimHashes.Naphtha).name,
                        ElementLoader.FindElementByHash(SimHashes.Polypropylene).name),
                    nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult,
                    fabricators = new List <Tag> {
                        TagManager.Create(ID)
                    }
                };
                ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id);
            }

            // добавляем варку резины
            if (DlcManager.IsExpansion1Active() && SmelterOptions.Instance.RecipeResinToIsoresin)
            {
                var resin    = ElementLoader.FindElementByHash(SimHashes.Resin);
                var water    = resin.highTempTransition.lowTempTransition;
                var isoresin = resin.highTempTransitionOreID;

                float input   = INPUT_KG * 2;
                float output1 = input * resin.highTempTransitionOreMassConversion;
                float output2 = input - output1;

                // жидкая резина
                // побочный продукт вода сохраняется внутри
                var ingredients = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(resin.tag, input)
                };
                var results = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(isoresin.CreateTag(), output1),
                    new ComplexRecipe.RecipeElement(water.tag, output2, ComplexRecipe.RecipeElement.TemperatureOperation.Heated, true),
                };
                string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(ID, resin.tag);
                string id          = ComplexRecipeManager.MakeRecipeID(ID, ingredients, results);
                new ComplexRecipe(id, ingredients, results)
                {
                    time        = BUILDINGS.FABRICATION_TIME_SECONDS.SHORT,
                    description = string.Format(
                        global::STRINGS.BUILDINGS.PREFABS.GLASSFORGE.RECIPE_DESCRIPTION,
                        ElementLoader.FindElementByHash(isoresin).name,
                        resin.name),
                    nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult,
                    fabricators = new List <Tag> {
                        TagManager.Create(ID)
                    }
                };
                ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id);

                // и замерзшая резина
                var resin_solid  = resin.lowTempTransition;
                var ingredients2 = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(resin_solid.tag, input)
                };
                string obsolete_id2 = ComplexRecipeManager.MakeObsoleteRecipeID(ID, resin_solid.tag);
                string id2          = ComplexRecipeManager.MakeRecipeID(ID, ingredients2, results);
                new ComplexRecipe(id2, ingredients2, results)
                {
                    time        = BUILDINGS.FABRICATION_TIME_SECONDS.SHORT,
                    description = string.Format(
                        global::STRINGS.BUILDINGS.PREFABS.GLASSFORGE.RECIPE_DESCRIPTION,
                        ElementLoader.FindElementByHash(isoresin).name,
                        resin_solid.name),
                    nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult,
                    fabricators = new List <Tag> {
                        TagManager.Create(ID)
                    }
                };
                ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id2, id2);
            }

            // добавляем древесный уголь в печку
            if (SmelterOptions.Instance.RecipeWoodToCarbon)
            {
                const float WOOD   = 200f;
                const float CARBON = 100f;
                const float CO2    = 60f;

                var ingredients = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(WoodLogConfig.TAG, WOOD)
                };
                var results = new ComplexRecipe.RecipeElement[]
                {
                    new ComplexRecipe.RecipeElement(SimHashes.RefinedCarbon.CreateTag(), CARBON),
                    new ComplexRecipe.RecipeElement(SimHashes.CarbonDioxide.CreateTag(), CO2)
                };
                string obsolete_id = ComplexRecipeManager.MakeObsoleteRecipeID(KilnConfig.ID, WoodLogConfig.TAG);
                string id          = ComplexRecipeManager.MakeRecipeID(KilnConfig.ID, ingredients, results);
                new ComplexRecipe(id, ingredients, results)
                {
                    time        = BUILDINGS.FABRICATION_TIME_SECONDS.SHORT,
                    description = string.Format(
                        global::STRINGS.BUILDINGS.PREFABS.EGGCRACKER.RECIPE_DESCRIPTION,
                        global::STRINGS.UI.FormatAsLink(global::STRINGS.ITEMS.INDUSTRIAL_PRODUCTS.WOOD.NAME, ForestTreeConfig.ID.ToUpperInvariant()),
                        ElementLoader.FindElementByHash(SimHashes.RefinedCarbon).name),
                    nameDisplay = ComplexRecipe.RecipeNameDisplay.IngredientToResult,
                    fabricators = new List <Tag> {
                        TagManager.Create(KilnConfig.ID)
                    }
                };
                ComplexRecipeManager.Get().AddObsoleteIDMapping(obsolete_id, id);
            }
        }