Fix insertion returns, fix error on invalid stack index

This commit is contained in:
Evert Prants 2018-08-24 22:37:05 +03:00
parent 9db0dc184c
commit a1cbc91029
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
2 changed files with 5 additions and 3 deletions

View File

@ -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)

View File

@ -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") .. " " ..