Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local l,w = ...
- local b=true
- local function rotate()
- if b then
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- else
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- end
- b = not b
- end
- local function slot_plus() turtle.select(turtle.getSelectedSlot()%16+1) end
- local function floor_block()
- if not turtle.compareDown() then
- turtle.digDown()
- if not turtle.placeDown() then
- slot_plus()
- turtle.placeDown()
- end
- while turtle.getItemCount()==0 do slot_plus() end
- end
- end
- local function floor_line(n)
- for j=1,n do
- floor_block()
- turtle.forward()
- end
- end
- local function build_floor(l,w)
- b=true
- for i=1,w-1 do
- floor_line(l-1)
- floor_block()
- rotate()
- end
- floor_line(l-1)
- floor_block()
- end
- if not l then
- error("Must have two arguments: length and width.")
- end
- if tonumber(l) and tonumber(w) then
- build_floor(l,w)
- end
- return {build=build_floor}
Advertisement
Add Comment
Please, Sign In to add comment