View difference between Paste ID: 5Psfihcx and ZsM3Qauq
SHOW: | | - or go back to the newest paste.
1
-- Program:
2
--   mine
3
-- Original program by Direwolf20
4-
-- Modified by Kzorith
4+
-- Modified by Kzorith and even more by Liktorn
5
-- Description:
6-
--   Operates the mining wells and MFFS caterpillar drive
6+
--   Operates the mining wells and Force Manipulator
7
-- Hardware requirements:
8
--   1 Advanced Mining Turtle
9
--   1 Rednet cable
10
11-
--  print what we are doing
11+
function turnOff()
12-
print("Mining for 8 seconds")
12+
	rs.setBundledOutput("bottom",0)
13
end
14-
--  make sure the rednet cable is ready
14+
function startTesseract()
15-
turtle.select(1)
15+
	--  print what we are doing
16-
--  place it under the turtle
16+
	print("Mining for 8 seconds")
17-
turtle.placeDown()
17+
	--  set a redstone signal to activate the tesseract
18-
--  set a redstone signal to activate the tesseract
18+
	--    (mine is white)
19-
--    (mine is white)
19+
	rs.setBundledOutput("bottom",colors.white)
20-
rs.setBundledOutput("bottom",colors.white)
20+
	--  wait 8 seconds for the mining operation to complete
21-
--  wait 8 seconds for the mining operation to complete
21+
	sleep(8)
22-
--    (I'm not pumping as much power into this as DW20 does)
22+
	--  turn off all redstone signals
23-
sleep(8)
23+
	turnOff()
24-
--  turn off all restone signals
24+
end
25-
rs.setBundledOutput("bottom",0)
25+
26-
--  print what we are doing
26+
function move()
27-
print("Moving platform")
27+
	--moving the platform
28-
--  wait 5 seconds
28+
	--  print what we are doing
29-
sleep(5)
29+
	print("Moving platform")
30-
--  set a redstone signal to activate the MFFS caterpillar drive
30+
	--  wait 5 seconds
31-
--    (Move is orange)
31+
	sleep(5)
32-
rs.setBundledOutput("bottom",colors.orange)
32+
	--  set a redstone signal to activate the Force Manipulator
33-
-- make sure that the MFFS
33+
	--    (Move is orange)
34-
sleep(1)
34+
	rs.setBundledOutput("bottom",colors.orange)
35-
--  turn off all restone signals
35+
	-- make sure that the Force Manipulator have time to get the signal
36-
rs.setBundledOutput("bottom",0)
36+
	sleep(1)
37-
--  break the rednet cable
37+
	--  turn off all redstone signals
38-
turtle.digDown()
38+
	turnOff()
39-
--  move the turtle forward
39+
	sleep(4)
40-
turtle.forward()
40+
	-- and move the turtle 1 forward
41-
--  wait 4 seconds for the platform to catch up
41+
	turtle.forward()
42-
sleep(4)
42+
end
43
44
function placeChest()
45
	print("Placing chest")
46
	turtle.select(1)
47
	turtle.place()
48
	sleep(0.5)
49
50
end
51
52
function breakChest()
53
	print("Breasking chest")
54
	--brakes the chest in front of it
55
	turtle.dig()
56
end
57
58
function checkCable()
59
	print("Checking for cable below")
60
	-- checks if the cable is under the turtle
61
	-- if not, the miner is stuck
62
	-- break the program
63
	if turtle.detectDown() then
64
		print("Cable below, continuing")
65
		placeChest()
66
	else
67
		while true do
68
			print("Error: No cable below. Miner stuck. Infinite loop")
69
			return
70
		end
71
	end
72
end
73
74
breakChest()
75
startTesseract()
76
77
78
79
-- move the platform
80
move()
81
checkCable()