View difference between Paste ID: dxwK6SXp and N75UCWs1
SHOW: | | - or go back to the newest paste.
1
-- Drop
2
-- by SukaiPoppuGo
3
--
4
-- Require mod plethora
5
--
6
7
------------------------------
8
-- pause at startup
9
print("init")
10
sleep(os.clock()<2 and 2 or 0)
11
print("run")
12
13
------------------------------
14
-- Params
15
local dir = ...
16
assert(dir, "Usage: Drop <string:dir>\nex:\nDrop up")
17
18
-- Base delay, min delay each loop
19
local delay = .1
20
21
------------------------------
22
-- Peripheral
23
local p = peripheral.find("minecraft:chest")
24
assert(p,"Hopper not found")
25
26
------------------------------
27
-- Main
28
repeat
29
    local count = 0
30
    for slot,item in pairs(p.list()) do
31
        print("Drop slot",slot,"to",dir)
32
        p.drop(slot,64,dir)
33
        count = count+1
34
    end
35
    local _d = math.max(delay, delay*count)
36
    print("Pause", _d, "sec")
37
    sleep(_d)
38
until false