Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- -----------------------------
- -- Floor maker
- -- pastebin get gt9FVdK8 floor
- -- -----------------------------
- even = true
- current_slot = 2
- x_coord = 0
- y_coord = 0
- write("Please enter floor lenth ")
- lenth = read()
- write("Please enter floor width ")
- width = read()
- write('Clear up block?')
- clear_up = read()
- if clear_up == 'y' or clear_up == '1' or clear_up == 'true' or clear_up == 'yes' then
- clear_up = true
- else
- clear_up = false
- end
- function checkFuel()
- while turtle.getFuelLevel() < 5 do
- turtle.select(1)
- turtle.refuel(1)
- if turtle.getFuelLevel() < 5 then
- sleep(5)
- end
- end
- turtle.select(16)
- end
- function placeBlock()
- turtle.select(currentSlot())
- if not turtle.compareDown() then
- turtle.select(16)
- turtle.digDown()
- cleanSlot()
- turtle.select(currentSlot())
- turtle.placeDown()
- end
- turtle.select(16)
- end
- function cleanSlot()
- if(turtle.getItemCount(16) > 0) then turtle.dropUp() end
- end
- function currentSlot()
- if turtle.getItemCount(current_slot) < 2 then
- found_slot = false
- while not found_slot do
- for i=2,15 do
- if turtle.getItemCount(i) > 1 then
- found_slot = i
- break
- end
- end
- if not found_slot then
- print("Out of building materials. Please refill and press enter to continue.")
- io.read()
- else
- current_slot = found_slot
- end
- end
- end
- return current_slot
- end
- turtle.select(16)
- placeBlock()
- while y_coord < tonumber(width) do
- while x_coord < (tonumber(lenth) - 1) do
- x_coord = x_coord + 1
- checkFuel()
- while not turtle.forward() do
- turtle.dig()
- cleanSlot()
- end
- if clear_up and turtle.detectUp() then
- turtle.digUp()
- cleanSlot()
- end
- placeBlock()
- end
- x_coord = 0
- y_coord = y_coord + 1
- if even then
- turtle.turnRight()
- while not turtle.forward() do
- turtle.dig()
- cleanSlot()
- end
- turtle.turnRight()
- else
- turtle.turnLeft()
- while not turtle.forward() do
- turtle.dig()
- cleanSlot()
- end
- turtle.turnLeft()
- end
- if (y_coord < tonumber(width)) then placeBlock() end
- even = not even
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement