View difference between Paste ID: zGm0diSV and EQ10uws2
SHOW: | | - or go back to the newest paste.
1
local component = require("component")
2
local sides = require("sides")
3
local os = require("os")
4
local robot = require("robot")
5
local inv = component.inventory_controller
6
local red = component.redstone
7-
local pulsetime = 0.25
7+
local pulsetime = 0.1
8
9
local function pulse(PT)
10-
	red.setOutput(sides.back,15)
10+
	red.setOutput(sides.down,15)
11
	os.sleep(PT)
12-
	red.setOutput(sides.back,0)	
12+
	red.setOutput(sides.down,0)	
13
end
14-
local function dropcomparenot(slot,Target1,Target2)
14+
15-
	robot.select(slot)
15+
16-
	if not robot.compareTo(Target1) and not robot.compareTo(Target2) and robot.count(slot)>0 then
16+
	os.sleep(5)
17-
			robot.dropDown()
17+
while red.getInput(sides.back) > 1 do
18
	red.setOutput(sides.down,0)	
19
	pulse(pulsetime)
20-
local function dropcompare(slot, Target)
20+
	os.sleep(1)
21-
	robot.select(slot)
21+
	for i = 1, 10 do  --attack dragon
22-
	if robot.compareTo(Target) then
22+
		robot.use(sides.front,false,1)
23-
		robot.dropDown(1)
23+
24
	robot.select(1)
25
	inv.equip()
26-
local function activate()
26+
	robot.turnRight()
27-
	for i = 1, 14 do  --dropping seed
27+
	robot.select(1)
28-
		dropcompare(i,15)
28+
	robot.drop()
29
30
	while robot.count(1)==0 do
31
		os.sleep(1)
32-
	
32+
33-
	if robot.count(1) and robot.count(2) and robot.count(3) > 0 then
33+
34-
		os.sleep(0.1)
34+
35-
		for i = 1, 14 do  --dropping bucket
35+
	robot.turnLeft()
36-
			dropcompare(i,16)
36+
	robot.select(1)
37-
		end	
37+
	inv.equip()
38-
		for i = 1, 14 do  --use all items except seed and water bucket
38+
39-
			dropcomparenot(i,14,15)
39+
	os.sleep(1)
40-
		end
40+
41
42
end
43-
		activate()
43+
44-
		os.sleep(0.1)
44+