Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local lampslot = 1
- local modemslot = 5
- local cableslot = 9
- local move = function(f)
- if turtle.getFuelLevel() < 1 then
- print("Low on fuel. Please add fuel to my inventory.")
- while turtle.getFuelLevel() < 1 do
- os.sleep(5)
- print("Checking for fuel...")
- shell.run("refuel all")
- end
- end
- while not f() do
- sleep(0.3)
- end
- sleep(0.1)
- end
- local assemble = function()
- move(closer)
- while turtle.getItemCount(lampslot) < 1 do
- lampslot = lampslot + 1
- if lampslot > 4 then
- print("Out of Illuminators, please put more on the first row and press return.")
- lampslot = 1
- local e,c = os.pullEvent("key")
- while c ~= 28 do
- e,c = os.pullEvent("key")
- end
- end
- end
- turtle.select(lampslot)
- place()
- click()
- move(away)
- while turtle.getItemCount(modemslot) < 1 do
- modemslot = modemslot + 1
- if modemslot > 8 then
- print("Out of modems, please put more on the second row and press return.")
- modemslot = 5
- local e,c = os.pullEvent("key")
- while c ~= 28 do
- e,c = os.pullEvent("key")
- end
- end
- end
- turtle.select(modemslot)
- place()
- while turtle.getItemCount(cableslot) < 1 do
- cableslot = cableslot + 1
- if cableslot > 12 then
- print("Out of cable, please put more on the third row and press return.")
- cableslot = 9
- local e,c = os.pullEvent("key")
- while c ~= 28 do
- e,c = os.pullEvent("key")
- end
- end
- end
- turtle.select(cableslot)
- place()
- click()
- end
- width,height = 16,16
- column,row = 1,height
- ascend = turtle.up
- descend = turtle.down
- closer = turtle.forward
- away = turtle.back
- click = turtle.attack
- place = turtle.place
- --[[
- ascend = turtle.forward
- descend = turtle.back
- closer = turtle.down
- away = turtle.back
- click = turtle.attackDown
- place = turtle.placeDown
- --]]
- print("Good to go!")
- print(string.format("The process will take around %f minutes to finish.",(2.5*height*width)/60))
- print("Press return to begin.")
- e,c = os.pullEvent("key")
- while c ~= 28 do
- e,c = os.pullEvent("key")
- end
- print("Starting...")
- turtle.select(1)
- while true do
- if column > width then break end
- assemble()
- while row > 1 do
- move(ascend)
- row = row - 1
- assemble()
- end
- turtle.turnLeft()
- move(turtle.forward)
- turtle.turnRight()
- column = column + 1
- if column > width then break end
- assemble()
- while row < height do
- move(descend)
- row = row + 1
- assemble()
- end
- turtle.turnLeft()
- move(turtle.forward)
- turtle.turnRight()
- column = column + 1
- end
- if width % 2 == 1 then
- for i=1,height-1 do
- move(descend)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement