Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print(">>platform v1.1<<")
- local length = 32
- local width = 32
- if arg[1] then
- length = arg[1]
- end
- if arg[2] then
- width = arg[2]
- end
- local function select_block()
- while true do
- for slot=1,16 do
- if turtle.getItemCount(slot) ~= 0 then
- turtle.select(slot)
- return true
- end
- end
- write ("place blocks and push Enter...")
- _ = read()
- end
- return false
- end
- local function build_step()
- if select_block() then
- turtle.placeUp()
- return true
- end
- return false
- end
- local function build_line()
- for i=1, length-1 do
- build_step()
- turtle.forward()
- end
- build_step()
- end
- local function build_flat()
- for i=1, width -1 do
- build_line()
- if math.fmod(i, 2) == 1 then
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- else
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- end
- end
- build_line()
- end
- need_fuel = width*length+length+width+10
- print("Fuel: "..turtle.getFuelLevel())
- print("Need: "..need_fuel)
- if turtle.getFuelLevel() > need_fuel then
- turtle.forward()
- turtle.down()
- turtle.down()
- build_flat()
- if math.fmod(width, 2) == 1 then
- turtle.turnLeft()
- for i=1, width - 1 do
- turtle.forward()
- end
- turtle.turnRight()
- turtle.forward()
- else
- turtle.turnRight()
- for i=1,width -1 do
- turtle.forward()
- end
- turtle.turnRight()
- for i=1,length do
- turtle.forward()
- end
- end
- turtle.up()
- turtle.up()
- turtle.back()
- else
- print("not enough fuel!!!")
- end
- print("Fuel: "..turtle.getFuelLevel())
Add Comment
Please, Sign In to add comment