From 117bfe1636e66eb65a9bd4fd2d3608fbc8a69314 Mon Sep 17 00:00:00 2001 From: jkorvin Date: Mon, 22 Jul 2024 23:52:11 +0300 Subject: [PATCH] Fix problem when each liquid chunk is stored separately due to float error --- auto-resource-redux/src/Storage.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/auto-resource-redux/src/Storage.lua b/auto-resource-redux/src/Storage.lua index c27456b..d9b8895 100644 --- a/auto-resource-redux/src/Storage.lua +++ b/auto-resource-redux/src/Storage.lua @@ -245,6 +245,8 @@ local function add_item_or_fluid(storage, item_or_fluid_name, amount, ignore_lim local new_amount = Util.clamp((amount_stored or 0) + amount, 0, math.max((amount_stored or 0), item_limit)) if temperature then local fluid = storage.items[item_or_fluid_name] or {} + --- temperature is a float, so we need to round to an integer due to float error + temperature = math.floor(temperature) fluid[temperature] = new_amount storage.items[item_or_fluid_name] = fluid else