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