[go: up one dir, main page]

Menu

[r3]: / trunk / treeFarmer.lua  Maximize  Restore  History

Download this file

88 lines (61 with data), 1.5 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
term.clear()
term.setCursorPos(1,1)
print("X90 Tree Farmer")
term.write("How many trees per row?")
doLenght = term.read()
term.write("How many rows?")
doWidth = term.read()
term.write("In what slot is your sapling?")
sapling = term.read()
term.write("In what slot is the dirt?")
dirt = term.read()
term.write("In what slot is the fuel?")
fuel = term.read()
term.write("Do you want to clear the area first before creating the farm?")
clearLand = term.read()
function xFarmTree ()
turtle.up()
if turtle.detect() then
turtle.dig()
end
turtle.forward()
if turtle.detectUp() then
while turtle.detectUp() do
turtle.digUp()
turtle.up()
end
while not turtle.compareDown(dirt) do
turtle.down()
if(turtle.detectDown() then
turtle.digDown()
end
end
turtle.up()
turtle.place(sapling)
end
end
function newRow (heading)
if heading == 1 then
turtle.turnLeft()
for i=1, 5 do
turtle.forward()
end
turtle.turnLeft()
else
turtle.turnRight()
for i=1, 5 do
turtle.forward()
end
turtle.turnRight()
end
end
function checkFuel ()
if turtle.getFuelLevel() < 20 then
print("Turtle is refueling")
print("New fuel level is: " + turtle.getFuelLevel())
turtle.refuel(fuel)
else
print("Turtle has a sufficient fuel level");
end
for i=1, doLenght do
end