Fixed a bug tool workshop being able to fill up the cans

This commit is contained in:
RealBadAngel 2013-01-02 02:39:42 +01:00
parent 2bb3b42ca0
commit 67c0d2834d

View File

@ -63,18 +63,22 @@ minetest.register_abm({
local load_cost=200 local load_cost=200
local inv = meta:get_inventory() local inv = meta:get_inventory()
if inv:is_empty("src")==false then if inv:is_empty("src")==false then
srcstack = inv:get_stack("src", 1) srcstack = inv:get_stack("src", 1)
src_item=srcstack:to_table() src_item=srcstack:to_table()
local load1=tonumber((src_item["wear"])) if (src_item["name"]=="technic:water_can" or src_item["name"]=="technic:lava_can") then
if charge>load_cost then load_step=0
if load1>1 then load_cost=0
if load1-load_step<0 then load_step=load1 load1=1 end
else load1=load1-load_step end local load1=tonumber((src_item["wear"]))
charge=charge-load_cost if charge>load_cost then
src_item["wear"]=tostring(load1) if load1>1 then
inv:set_stack("src", 1, src_item) if load1-load_step<0 then load_step=load1 load1=1
end else load1=load1-load_step end
end charge=charge-load_cost
src_item["wear"]=tostring(load1)
inv:set_stack("src", 1, src_item)
end
end
end end
meta:set_float("internal_EU_buffer",charge) meta:set_float("internal_EU_buffer",charge)