-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoreMiningRobot.lua
More file actions
53 lines (47 loc) · 1.01 KB
/
Copy pathoreMiningRobot.lua
File metadata and controls
53 lines (47 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
local os = require("os")
local thread = require("thread")
local event = require("event")
local robot = require("robot")
local sides = require("sides")
function checkInventory()
for i=1, 16 do
robot.select(i)
if robot.count(i) > 0 then
robot.select(1)
return true
end
end
robot.select(1)
return false
end
function dropItems()
for i=1, 16 do
robot.select(i)
robot.dropDown(64)
end
robot.select(1)
end
function main()
robot.select(1)
mainThread = thread.create(function()
while true do
os.sleep(0.1)
for i=1, 64 do
robot.swing(sides.front)
os.sleep(0.1)
end
if checkInventory() then
dropItems()
end
end
end)
end
main()
while true do
local id, _, x, y = event.pullMultiple("interrupted")
if id == "interrupted" then
print("soft interrupt, closing")
os.exit()
break
end
end