SHOW:
|
|
- or go back to the newest paste.
1 | function quitProgram() | |
2 | - | manual=redstone.getInput("front") |
2 | + | local e, msg=os.pullEvent("char") |
3 | - | if manual then |
3 | + | if msg=="q" |
4 | - | cell.setEnergySend(100) |
4 | + | then quit=true |
5 | - | else |
5 | + | end |
6 | - | cell.setEnergySend(0) |
6 | + | |
7 | - | end |
7 | + | |
8 | function man_ovr() | |
9 | local e=os.pullEvent() | |
10 | if e=="redstone" then | |
11 | - | for i=0,sz-1, 1 do |
11 | + | ovr=true |
12 | end | |
13 | end | |
14 | ||
15 | function readSlots() | |
16 | for i=0, sz-1, 1 do | |
17 | tbl[i+1]=p.getStackInSlot(i) | |
18 | term.setCursorPos(1,1) | |
19 | pct= math.floor((i+1) / 27 * 100) | |
20 | print(pct.. "% complete") | |
21 | end | |
22 | end | |
23 | ||
24 | - | for i=1,60, 1 do |
24 | + | function wait() |
25 | - | man_ovr() |
25 | + | sleep(0.05) |
26 | - | term.clear() |
26 | + | |
27 | - | term.setCursorPos(1,1) |
27 | + | |
28 | - | p=peripheral.wrap("bottom") |
28 | + | |
29 | - | n=p.getInvName() |
29 | + | |
30 | - | sz=p.getSizeInventory() |
30 | + | |
31 | - | tbl={} |
31 | + | |
32 | ||
33 | -- infinite loop | |
34 | while true do | |
35 | parallel.waitForAny(quitProgram,wait,man_ovr) | |
36 | ||
37 | - | -- mon.addText(3,30,tostring(pct), 0xFFFFFF) |
37 | + | if quit ==true then |
38 | print ("quitting program") | |
39 | - | end |
39 | + | break |
40 | - | if tbl then |
40 | + | |
41 | - | slots=#tbl |
41 | + | |
42 | - | mon.clear() |
42 | + | if ovr==true then |
43 | - | mon.addText(3,25,tostring(slots).." slots full",0xFFFFFF) |
43 | + | |
44 | - | --note.triggerNote() |
44 | + | else |
45 | - | --note.triggerNote() |
45 | + | |
46 | - | --mon.addText(3,20,tostring(60- |
46 | + | |
47 | - | if slots>10 then |
47 | + | --60 cycles till it exits and provides power to clear any machines |
48 | - | cell = peripheral.wrap("left") |
48 | + | |
49 | - | cell.setEnergySend(100) |
49 | + | end |