Helfima / helmod

Factorio Mod
154 stars 66 forks source link

Mod totally ignores fluid temperatures from fluid ingredients or products #259

Closed clampi closed 2 years ago

clampi commented 4 years ago

Happens in version: 0.10.15

Long description: Recipes in Factorio allow to specify ingredient temperature min/max or product temperature. This allows recipes to impose limits on input temperature and specify output temperature. If an input fluid temperature is not in the limits specified by recipe, the crafting machine does not accept the fluid into fluid box. This whole mechanic is simply ignored by Helmod, allowing to chain recipes that are in fact incompatible due to fluid temperatures. A simple example is angelssmelting coolant mechanic: casting produces 'used coolant' at 300C and one has to cool it down to below 100, using cooling towers, before is able to filter and feed the coolant inside the casting machine again. Despite this, one can directly specify casting->coolant filtering and Hellmod will happily accept the loop of the fluid, without pointing the need of cooling recipes. The tooltips over the fluid input/output do not specify the temperature either, further hiding this mechanic.

Expected result: Mod should treat fluids with different temperatures separately, and allow only recipes that match fluid input temperatures, either by temperature being ignored or in the correct interval. So, steam at 165C is a different fluid from steam at 500C, if recipe impose limits on input.

Helfima commented 4 years ago

hello interesting, currently I am correcting the calculation on the usage of fluids image green square is input values and red square is computed values it's a real headache to calculate the comsumption and power :)

could you export a sample or do a screenshot?

clampi commented 4 years ago

Not sure how your comment applies to the problem described above Helfima. I understand that implementing the needed functionality can be a major task and it would apply to a very narrow audience. But, OTOH is something that the game recipes support. See FluidIngredientPrototype and FluidProductPrototype and the respective temperature* fields.

Helfima commented 4 years ago

I don't use raw data but the factorio API https://lua-api.factorio.com/latest/ I know there are temperature for the fluid but if you are a sample with same fluid and different temperature, it's more easy to ckeck the feasibility

I need your wrong sample, I don't know all Mod

clampi commented 4 years ago

Ok, here are some simple replication steps:

1) Factorio, install and enable angelssmelting + all dependencies of angelssmelting + bobplates 2) research all technologies 3) Design a block that will cast molten iron using the coolant recipe (name = "roll-iron-casting-fast") 4) With the "liquid-coolant-used" product try to apply the filtering recipe (name = "coolant-used-filtration-1" or "coolant-used-filtration-2") 5) Observe that Helmod DOES lets you do that, whilst in game you will not be able, due to temperature restriction.

Expected result: Helmod should recognize that there is only 1 recipe that accepts "liquid-coolant-used" @ 300C as ingredient and that is "coolant-cool-300", which accepts "liquid-coolant-used" between [285, 315] and produces "liquid-coolant-used" @ 200C. After that there is just 1 recipe that accepts "liquid-coolant-used" @ 200C, "coolant-cool-200". Likewise for "coolant-cool-100" which finally produces something that is accepted by either "coolant-used-filtration-1" or "coolant-used-filtration-2" recipes.

The lua API exposes all the values from data stage, otherwise the game would not know about those values. A simple search at the location pointed by you revealed: LuaRecipe RecipeIngredient fields minimum_temperature and maximum_temperature RecipeProduct field temperature

Helfima commented 4 years ago

I saw the temperature on fluid it's not easy to implement

Helfima commented 4 years ago

implemented in v0.11.7

eternaleye commented 3 years ago

I'm on 0.12.5, and when I attempt to put together a production line that produces steam at 165 degrees (purified water in electric boiler), and accepts steam at any temperature (synthesis of propene from methanol), it treats the two as entirely distinct, when the former (more precise) steam should satisfy the latter (broad range) requirement.

Specific links to the recipes in question, from Angel's Petrochem version 0.9.18 (I tracked down the commit where the version was changed)

I think what might work best is that if a recipe input does not specify a temperature, then it can accept any single temperature - and if multiple are available, then maybe offer a way to choose which one it uses.

KiwiHawk commented 2 years ago

@clampi @eternaleye Can you please confirm that this issue is fixed for you in the latest version of Helmod? 0.12.8

eternaleye commented 2 years ago

Will look, might be a day or so

eternaleye commented 2 years ago

So, the answer is that it works almost perfectly:

The simple case, "consumes steam at any temperature" and "produces steam at specific temperature", seems to work perfectly.

The complex case, "consumes fluid X at <= Y degrees" and "produces fluid X at Z degrees" (where Z <= Y) (example: deuterium gas refining chain from Angel's Petrochem) works great except that, when clicking an ingredient to pop up the dialog to select a recipe that produces it (or, I suppose, clicking a product to find a recipe that consumes it) the search does not restrict by temperature in any way. Since the deuterium gas refining chain involves several enrichment/cooling steps with nigh-identical icons, this can make for a frustrating misclick that leaves you wondering why half your recipe calculates its quantities as zero (and it's because you skipped one step, and never reduced the heavy water below 26 degrees).

EDIT: Actually, one weird thing - the step that wants enriched hydrogen sulfide gas >= 90 degrees doesn't seem to properly force the product quantity of the step that produces it at 100 degrees if they're different top-level production lines in a production block, but does if they're inside the same production line.

EDIT 2: Ah, actually, the same happens for wanting steam >=125 & <=165, and producing at 165 - the latter doesn't get its output quantity set to the quantity the former wants.