Fix insertion returns, fix error on invalid stack index
This commit is contained in:
parent
9db0dc184c
commit
a1cbc91029
@ -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)
|
||||
|
||||
|
@ -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") .. " " ..
|
||||
|
Loading…
Reference in New Issue
Block a user