View difference between Paste ID: iE7GyzAV and duY6wvQq
SHOW: | | - or go back to the newest paste.
1
local torchDistance = 0 -- Distanz für Fackel
2
local fuelLevel = turtle.getFuelLevel() --FuelLevel
3
local chests = turtle.getItemCount(4) --Anzahl Chests
4
5
function ivFull()
6
	local full = true
7
		for i = 5,16 do
8
			if turtle.getItemCount(i) == 0 then
9
				full = false
10
			end
11
		end
12
	return full
13
end
14
15
function mine()
16
	if turtle.getFuelLevel() < 100 then
17
		turtle.refuel(1)
18
    end
19
end
20
21
while ivFull() == false do
22
23
	if torchDistance == 8 then
24
		turtle.select(2)
25
		turtle.turnRight()
26
		turtle.turnRight()
27
		turtle.place()
28
		turtle.turnLeft()
29
		turtle.turnLeft()
30
		torchDistance = torchDistance - 8
31
        
32
	end
33
34
	if turtle.detectDown() == false then
35
		turtle.select(3)
36
		turtle.placeDown()
37
	end
38
39
	if turtle.detect() then
40
		turtle.dig()
41
		turtle.forward()
42
		turtle.digUp()
43
		turtle.turnLeft()
44
		turtle.dig()
45
		turtle.up()
46
		turtle.dig()
47
		turtle.turnRight()
48
		turtle.turnRight()
49
		turtle.dig()
50
		turtle.down()
51
		turtle.dig()
52
		turtle.turnLeft()
53
		torchDistance = torchDistance + 1
54
	else
55
		turtle.forward()
56
		torchDistance = torchDistance + 1
57
	end
58
	
59-
	if ivFull() == true then
59+
60-
		if chests > 0 then
60+
61-
			turtle.select(4)
61+
62-
			turtle.digDown()
62+
63-
			turtle.placeDown()
63+
64-
			chest = chest - 1
64+
65-
			for slot = 5,16 do
65+
66-
				turtle.select(slot)
66+
67-
				turtle.dropDown()
67+
68-
				sleep(1.5)
68+
69
70-
			turtle.select(5)
70+
71-
		else
71+
72-
			print("Keine Kisten vorhanden")
72+
73-
			os.shutdown()
73+
74
else
75
	print("Fackeln sind vorhanden")
76
end
77
78
if fuel == 0 then
79
	print("Es fehlt brennbares Material")
80
	error = error + 1
81
else
82
	print("Brennbares Material vorhanden")
83
end
84
85
if chest == 0 then
86
        print("Es fehlen Kisten")
87
        error = error + 1
88
    else
89
        print("Kisten vorhanden")
90
end
91
    
92
if error == 0 then
93
	return true
94
else
95
	return false
96
end
97
98
end
99
100
function Start() 
101
	if check() == true then
102
		mine()
103
	else
104
		print("Slots ueberpruefen")
105
	end
106
end
107
108
Start()