Jump to content

New Temperature settings for Recipes


Recommended Posts

I was quite happy to found out that no longer recipes take the temperature from the fabricator; now they have their own temperature setting:

ComplexRecipe.RecipeElement.TemperatureOperation.Melted

However, I found something weird in this. While test this in my furnace, the recipe would produce 100kg of molten metal and 90g of carbon dioxide. The temperature settings were Melted for the Molten Copper and Heated for the Carbon Dioxide. Immediately I got a crash with this setting, with the error log saying that the Carbon Dioxide temperature was 0. So I did test it with Average, with the same error, but it was only with Melted that I finally got the output of 90g of Carbon Dioxide..... at 4500°C. Note that both products were suppose to be piped, one for liquid and the other for gas pipe. Only in the test with both set to Melted that it worked. But I didn't wanted the Carbon Dioxide to be at this unreasonable temperature, I wanted it to be like 110°C, and so I thought when I used the Heated setting. Is this issue caused because of the temperature value for the Heated setting, or because the complex recipe could not output two products with different temperature settings? Its not possible to set an specific temperature for each individual product, and not use a fixed setting beside the Average, Heated and Melted?

Spoiler

 


    [HarmonyPatch(typeof(BlastFurnaceConfig), "ConfigureBuildingTemplate")]
    public static class CopperOre_Smelting_Recipe
    {

        public static void Postfix()
        {
            Tag material = SimHashes.Cuprite.CreateTag();
            Tag material2 = SimHashes.Carbon.CreateTag();
            Tag material3 = SimHashes.MoltenCopper.CreateTag();
            Tag material4 = SimHashes.CarbonDioxide.CreateTag();
            string name = ElementLoader.FindElementByHash(SimHashes.MoltenCopper).name;
            string name2 = ElementLoader.FindElementByHash(SimHashes.Cuprite).name;
            ComplexRecipe.RecipeElement[] array = new ComplexRecipe.RecipeElement[]
            {
                new ComplexRecipe.RecipeElement(material, 1000f),
                new ComplexRecipe.RecipeElement(material2, 200f)
            };
            ComplexRecipe.RecipeElement[] array2 = new ComplexRecipe.RecipeElement[]
            {
                new ComplexRecipe.RecipeElement(material3, 1000f, ComplexRecipe.RecipeElement.TemperatureOperation.Melted, false),
                new ComplexRecipe.RecipeElement(material4, 0.09f, ComplexRecipe.RecipeElement.TemperatureOperation.Heated, false)
            };
            string id = ComplexRecipeManager.MakeRecipeID("BlastFurnace", array, array2);
            ComplexRecipe complexRecipe = new ComplexRecipe(id, array, array2);
            complexRecipe.time = 1f;
            complexRecipe.nameDisplay = ComplexRecipe.RecipeNameDisplay.Result;
            complexRecipe.description = string.Format(string.Concat(new string[]
            {
                "Smelt ",name2," to produce ",name,"."}), name);
            complexRecipe.fabricators = new List<Tag>
            {
                TagManager.Create("BlastFurnace")
            };
        }
    }

Edit: Indeed it seems that it won't give two different temperatures for the same fabrication, even if both products are released through the same mean.

Link to comment
Share on other sites

On 1/16/2021 at 11:19 PM, Ronivan said:

                new ComplexRecipe.RecipeElement(material4, 0.09f, ComplexRecipe.RecipeElement.TemperatureOperation.Heated, false)

Something about the 4500 degrees C and the 90g seems...suspicious to me.

Is "0.09" the correct specification for the temperature for this element? (I'm presuming that this is the Carbon Dioxide by `material4`)

Link to comment
Share on other sites

On 1/20/2021 at 5:31 PM, Clinch said:

Something about the 4500 degrees C and the 90g seems...suspicious to me.

Is "0.09" the correct specification for the temperature for this element? (I'm presuming that this is the Carbon Dioxide by `material4`)

No, that means the amount generated by the recipe. The temperature is not even described as a float; its an definition added in the ComplexRecipe.TemperatureOperation, where you have three choices:

  • Heat
  • Melted
  • AverageTemperature

For carbon dioxide, Heated gives something around 74°C, Melted gives 4500°C and AverageTemperature don't change anything; the same temperature of the elements that goes in, goes out.

Anyway, the api will crash if there is two different temperature for the recipe product. If there is two products, both must be set at the same temperature, else it goes caput.

 

Link to comment
Share on other sites

On 1/21/2021 at 10:10 PM, Ronivan said:

Anyway, the api will crash if there is two different temperature for the recipe product. If there is two products, both must be set at the same temperature, else it goes caput.

 

Thank you for clarifying - this is an important find!!!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
×
  • Create New...