View difference between Paste ID: bsnnwdkt and Vi7xwA6H
SHOW: | | - or go back to the newest paste.
1
args = {...}
2
local start = tonumber(args[1])
3
local steps = tonumber(args[2])
4
local depth = tonumber(args[3])
5
local width = tonumber(args[4])
6
7-
local consume = steps * depth * width
7+
local consume = steps * (depth + width) * 2
8-
if turtle.getFuelLevel() <= consume then
8+
if turtle.getFuelLevel() < consume then
9
  turtle.select(1)
10
  turtle.refuel(math.floor(consume/80)+1)
11
end
12
local fuel = turtle.getFuelLevel()
13
print("fuel:"..tostring(fuel))
14
15
local function GetBlocks(z)
16
  for i=1,z do
17
    turtle.down()
18
  end
19
  turtle.turnLeft()
20
  for i=1,3 do
21
    turtle.forward()
22
  end
23
  turtle.turnRight()
24
  turtle.suck()
25
  turtle.turnLeft()
26
  for i=1,3 do
27
    turtle.back()
28
  end
29
  turtle.turnRight()
30
  for i=1,z do
31
    turtle.up()
32
  end
33
end
34
35
local function PutLine(wl)
36
  for i=1, tonumber(wl) do
37
    if not turtle.detectDown() then
38
      print("place")
39
      turtle.placeDown()
40
    else
41
      print("skip")
42
    end
43
    turtle.forward()
44
  end
45
end
46
47
local function MakeWall(d, w)
48
  PutLine(d)
49
  turtle.turnRight()
50
  PutLine(w)
51
  turtle.turnRight()
52
  PutLine(d)
53
  turtle.turnRight()
54
  PutLine(w)
55
  turtle.turnRight()
56
end
57
58
local cz = 0
59
turtle.select(2)
60-
for i=1,start do
60+
for i=1,start-1 do
61
  turtle.up()
62
  cz = cz + 1
63
end
64
for i=1,steps do
65
  if turtle.getItemCount() < (depth + width) * 2 then
66
    GetBlocks(cz)
67
  end
68
  turtle.up()
69-
  GetBlocks(cz)
69+
70
  turtle.forward()
71-
for i=1,start do
71+
72
  turtle.back()
73-
  cz = cz - 1
73+
74
for i=1,cz do
75-
75+
76
end