diff --git a/fluid_lib/buffer.lua b/fluid_lib/buffer.lua index e541e7d..2c24d65 100644 --- a/fluid_lib/buffer.lua +++ b/fluid_lib/buffer.lua @@ -87,8 +87,8 @@ end function fluid_lib.insert_into_buffer(pos, buffer, fluid, count) local bfdata = fluid_lib.get_buffer_data(pos, buffer) - if not bfdata then return 0 end - if bfdata.fluid ~= fluid and bfdata.fluid ~= "" then return 0 end + if not bfdata then return count end + if bfdata.fluid ~= fluid and bfdata.fluid ~= "" then return count end local can_put = fluid_lib.can_insert_into_buffer(pos, buffer, fluid, count) diff --git a/fluid_lib/nodeio.lua b/fluid_lib/nodeio.lua index 712f10d..c37d7e6 100644 --- a/fluid_lib/nodeio.lua +++ b/fluid_lib/nodeio.lua @@ -52,7 +52,7 @@ local nodeiodef = { local storage = bfdata.amount local fluid = bfdata.fluid if (fluid == want_liquid or want_liquid == "") and storage >= want_millibuckets then - name,took = fluid_lib.take_from_buffer(pos, buffer, want_millibuckets) + name, took = fluid_lib.take_from_buffer(pos, buffer, want_millibuckets) if took > 0 then break end end end @@ -75,6 +75,7 @@ local nodeiodef = { for buf in pairs(bfs) do cnt[#cnt + 1] = buf end + if not cnt[index] then return ItemStack(nil) end local meta = minetest.get_meta(pos) return meta:get_string(cnt[index] .. "_fluid") @@ -86,6 +87,7 @@ local nodeiodef = { for buf in pairs(bfs) do cnt[#cnt + 1] = buf end + if not cnt[index] then return ItemStack(nil) end local meta = minetest.get_meta(pos) return ItemStack(meta:get_string(cnt[index] .. "_fluid") .. " " ..