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)
|
function fluid_lib.insert_into_buffer(pos, buffer, fluid, count)
|
||||||
local bfdata = fluid_lib.get_buffer_data(pos, buffer)
|
local bfdata = fluid_lib.get_buffer_data(pos, buffer)
|
||||||
if not bfdata then return 0 end
|
if not bfdata then return count end
|
||||||
if bfdata.fluid ~= fluid and bfdata.fluid ~= "" then return 0 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)
|
local can_put = fluid_lib.can_insert_into_buffer(pos, buffer, fluid, count)
|
||||||
|
|
||||||
|
@ -75,6 +75,7 @@ local nodeiodef = {
|
|||||||
for buf in pairs(bfs) do
|
for buf in pairs(bfs) do
|
||||||
cnt[#cnt + 1] = buf
|
cnt[#cnt + 1] = buf
|
||||||
end
|
end
|
||||||
|
if not cnt[index] then return ItemStack(nil) end
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
return meta:get_string(cnt[index] .. "_fluid")
|
return meta:get_string(cnt[index] .. "_fluid")
|
||||||
@ -86,6 +87,7 @@ local nodeiodef = {
|
|||||||
for buf in pairs(bfs) do
|
for buf in pairs(bfs) do
|
||||||
cnt[#cnt + 1] = buf
|
cnt[#cnt + 1] = buf
|
||||||
end
|
end
|
||||||
|
if not cnt[index] then return ItemStack(nil) end
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
|
||||||
return ItemStack(meta:get_string(cnt[index] .. "_fluid") .. " " ..
|
return ItemStack(meta:get_string(cnt[index] .. "_fluid") .. " " ..
|
||||||
|
Loading…
Reference in New Issue
Block a user