mirror of
https://github.com/joe7575/techpack.git
synced 2024-12-26 15:37:30 +01:00
Merge pull request #8 from realmicu/master
fermenter: improve input items processing.
This commit is contained in:
commit
70845bc126
@ -91,18 +91,32 @@ local function convert_leaves_to_biogas(meta)
|
|||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local biogas = ItemStack("tubelib_addons1:biogas")
|
local biogas = ItemStack("tubelib_addons1:biogas")
|
||||||
if inv:room_for_item("dst", biogas) then -- enough output space?
|
if inv:room_for_item("dst", biogas) then -- enough output space?
|
||||||
local items = tubelib.get_num_items(meta, "src", 2)
|
local items = {}
|
||||||
if items then -- input available?
|
local fault = false
|
||||||
if is_leaves(items:get_name()) then
|
for i = 1, 2 do
|
||||||
|
items[i] = tubelib.get_num_items(meta, "src", 1)
|
||||||
|
if items[i] then -- input available?
|
||||||
|
if not is_leaves(items[i]:get_name()) then
|
||||||
|
fault = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
else
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if #items == 2 then
|
||||||
inv:add_item("dst", biogas)
|
inv:add_item("dst", biogas)
|
||||||
return true
|
return true
|
||||||
else
|
else
|
||||||
inv:add_item("src", items)
|
for i = 1, #items do
|
||||||
return nil -- error
|
inv:add_item("src", items[i])
|
||||||
end
|
end
|
||||||
|
if fault then
|
||||||
|
return nil -- error
|
||||||
else
|
else
|
||||||
return false -- standby
|
return false -- standby
|
||||||
end
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
return false -- standby
|
return false -- standby
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user