Recipe ingredients support more than a single value .temperature. See Ingredient properties. Some time back I remember FNEI supported the temperatures for ingredients, now it doesn't.
Here is some code that will bring back that functionality
FNEI/scripts/recipe/gui.lua, ~line 479
-- add temperature for fluid
local function is_number(value) return "number" == type(value) end
local function is_finite(value) return is_number(value) and value-(value-1) == 1 and value-(value+1) == -1 and -math.huge ~= value and math.huge ~= value end
if element.type == "fluid" and Settings.get_val("show-temperature-of-fluids") then
if element.temperature then -- product
loc_str = {"", loc_str, " (" .. element.temperature .. "°)"}
elseif element.minimum_temperature and not is_finite(element.maximum_temperature) then -- ingredient
loc_str = {"", loc_str, " ( ≥" .. element.minimum_temperature .. "°)"}
elseif element.maximum_temperature and not is_finite(element.minimum_temperature) then -- ingredient
loc_str = {"", loc_str, " ( ≤" .. element.maximum_temperature .. "°)"}
elseif element.minimum_temperature and element.maximum_temperature then -- ingredient; must be after each of the single temperature value test
if element.minimum_temperature == element.maximum_temperature then
loc_str = {"", loc_str, " (" .. element.minimum_temperature .. "°)"}
else
loc_str = {"", loc_str, " ([" .. element.minimum_temperature .. ", " .. element.maximum_temperature .. "]°)"}
end
end
end
Some points about the code.
Factorio seems to always return both element.minimum_temperature and element.maximum_temperature, but when the temperature is not defined in prototype, it returns the lowest/greatest number that can still be represented on a double. It is not NaN (math.huge), but a number very large. The test value-(value-1) == 1 and value-(value+1) == -1 excludes numbers that are not huge enough such that n-1 or n+1 overflow.
The test for both temperatures present must be placed after the single temperatures test, such that the above tests will correctly identify the cases where min_temp/max_temp are not really defined in the prototype.
The test for equal temperatures is needed for a nice output, instead of an interval.
Attached some snapshots of recipes with temperature restricted fluid ingredients, with the above code changes.
Recipe ingredients support more than a single value .temperature. See Ingredient properties. Some time back I remember FNEI supported the temperatures for ingredients, now it doesn't.
Here is some code that will bring back that functionality FNEI/scripts/recipe/gui.lua, ~line 479
Some points about the code.
element.minimum_temperature
andelement.maximum_temperature
, but when the temperature is not defined in prototype, it returns the lowest/greatest number that can still be represented on a double. It is notNaN
(math.huge), but a number very large. The testvalue-(value-1) == 1 and value-(value+1) == -1
excludes numbers that are not huge enough such that n-1 or n+1 overflow.Attached some snapshots of recipes with temperature restricted fluid ingredients, with the above code changes.