fluid things
This commit is contained in:
parent
7694798ad0
commit
ad6af0fa35
21 changed files with 608 additions and 183 deletions
|
@ -21,6 +21,29 @@ function count(name)
|
|||
end
|
||||
return value
|
||||
end
|
||||
function countinventory()
|
||||
counts = {}
|
||||
for i = 1,16 do
|
||||
item = turtle.getItemDetail(i)
|
||||
if item then
|
||||
if item.name == "packages:package" then
|
||||
turtle.select(i)
|
||||
turtle.placeUp()
|
||||
sleep(0.1)
|
||||
for i,item2 in pairs(peripheral.call("top","list")) do
|
||||
write(item2.name,item2.count)
|
||||
counts[item2.name] =
|
||||
(counts[item2.name] or 0)
|
||||
+ item2.count
|
||||
print(counts[item2.name])
|
||||
end
|
||||
turtle.digUp()
|
||||
else
|
||||
counts[item.name] = counts[item.name] or 0 + item.count
|
||||
end end
|
||||
end
|
||||
return counts
|
||||
end
|
||||
function select(name)
|
||||
local flag = false
|
||||
for i = 1,16 do
|
||||
|
@ -86,4 +109,4 @@ function pull(name, slot)
|
|||
return error("there is no '"..name.."' in my inventory")
|
||||
end
|
||||
|
||||
return {pull=pull,count=count,select=select}
|
||||
return {pull=pull,count=count,select=select,countinventory = countinventory}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue