Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dofile("Gassy")
- function PlaceBlockDownAndRefuel()
- while (true) do
- if (turtle.getItemCount() > 0) then
- turtle.placeDown()
- break
- end
- local curSlot = turtle.getSelectedSlot()
- if (curSlot == 16) then
- curSlot = 1 -- skip 1: fuel
- end
- turtle.select(curSlot + 1)
- end
- if (turtle.getFuelLevel() < 5) then
- local slot = turtle.getSelectedSlot()
- turtle.select(1)
- while (turtle.getItemCount() <= 0) do end
- turtle.refuel(1)
- end
- end
- local r1 = 20.5
- local r2 = 37.5
- local pn = math.floor(r2 * 2 + 4)
- local pc = math.floor(pn / 2 + 0.5) -- (pc, pc) = center
- local pat = {}
- local cstart = {}
- local cend = {}
- local lc = 0
- local rc = 0
- for i = 1, pn do
- pat[i] = {}
- cstart[i] = 0
- cend[i] = 0
- local dx = i - pc
- for j = 1, pn do
- local dy = j - pc
- local d = math.sqrt(dx * dx + dy * dy)
- pat[i][j] = d > r1 and d < r2
- if (pat[i][j]) then
- rc = i -- trick: i increasing
- if (lc == 0) then
- lc = i
- end
- if (cstart[i] == 0) then
- cstart[i] = j
- cend[i] = j
- end
- if (cend[i] == j - 1) then
- cend[i] = j
- end
- end
- end
- end
- Gassy.x = pc
- Gassy.y = pc
- Gassy.z = 0
- -- initially face South
- Gassy.dump()
- turtle.select(2)
- local ns = 1
- for i = rc, lc, -1 do
- if (ns == 1) then
- Gassy.go(i, cend[i], 0);
- Gassy.turn(0)
- PlaceBlockDownAndRefuel()
- else
- Gassy.go(i, cstart[i], 0);
- Gassy.turn(2)
- PlaceBlockDownAndRefuel()
- end
- for jj = 0, (cend[i] - cstart[i]) do
- Gassy.forward()
- PlaceBlockDownAndRefuel()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement