fixed a bug that would crash the game if player tried to take liquid out of an empty silo or barrel.

master
NathanSalapat 2019-09-01 19:51:28 -05:00
parent 631d641249
commit 66c1ce1be5
1 changed files with 22 additions and 10 deletions

View File

@ -478,11 +478,17 @@ minetest.register_node('drinks:liquid_barrel', {
return 0
end
elseif listname == 'dst' then --removing liquid
local inputstack = stack:get_name()
local inputcount = stack:get_count()
local valid = string.sub(inputstack, 1, 7)
if valid == 'vessels' or valid == 'bucket:' then
return inputcount
--make sure there is a liquid to remove
local juice = meta:get_string('fruit')
if juice ~= 'empty' then
local inputstack = stack:get_name()
local inputcount = stack:get_count()
local valid = string.sub(inputstack, 1, 7)
if valid == 'vessels' or valid == 'bucket:' then
return inputcount
else
return 0
end
else
return 0
end
@ -589,11 +595,17 @@ minetest.register_node('drinks:liquid_silo', {
return 0
end
elseif listname == 'dst' then --removing liquid
local inputstack = stack:get_name()
local inputcount = stack:get_count()
local valid = string.sub(inputstack, 1, 7)
if valid == 'vessels' or valid == 'bucket:' then
return inputcount
--make sure there is liquid to take_item
local juice = meta:get_string('fruit')
if juice ~= 'empty' then
local inputstack = stack:get_name()
local inputcount = stack:get_count()
local valid = string.sub(inputstack, 1, 7)
if valid == 'vessels' or valid == 'bucket:' then
return inputcount
else
return 0
end
else
return 0
end