Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local l,w,h = ...
- local function slot_plus() turtle.select(turtle.getSelectedSlot()%16+1) end
- local function build_line(n)
- for i=1,n do
- if not turtle.placeDown() then
- slot_plus()
- turtle.placeDown()
- end
- while not turtle.getItemCount() do slot_plus() end
- turtle.forward()
- end
- end
- local function build_layer(l,w)
- build_line(l-1)
- turtle.turnLeft()
- build_line(w-1)
- turtle.turnLeft()
- build_line(l-1)
- turtle.turnLeft()
- build_line(w-1)
- turtle.turnLeft()
- end
- local function build_wall(l,w,h)
- for i=1,h do
- turtle.up()
- build_layer(l,w)
- end
- end
- if not l then
- error("Must have three arguments: length, width and height.")
- end
- if tonumber(l) and tonumber(w) and tonumber(h) then
- build_wall(l,w,h)
- end
- return {build=build_wall}
Advertisement
Add Comment
Please, Sign In to add comment