Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local compuer = require("computer")
- local robot = require("robot")
- local shell = require("shell")
- local sides = require("sides")
- turn=1
- local args, options = shell.parse(...)
- if #args < 1 then
- io.write("Useage: living <stacks>\n")
- return
- end
- local size = tonumber(args[1])
- if not size then
- io.stderr:write("invalid stack amount")
- return
- end
- local function swingFree()
- local tmp = robot.detect()
- while tmp == true do
- robot.swing()
- tmp = robot.detect()
- end
- end
- local function swingFreeDown()
- local tmp = robot.detectDown()
- while tmp == true do
- robot.swingDown()
- tmp = robot.detectDown()
- end
- robot.placeDown() --place new stone
- end
- --BLOCK OF WALK
- for i=1, size*2 do --movement
- robot.select(1)
- robot.dropDown() --remove half stack
- robot.suckDown() --get full stone stack
- swingFree()
- robot.forward()
- for j=1, 6 do --lines
- for k=1, 5 do --blocks
- if j==1 or j==3 or j==4 or j==6 then --dig full lines
- swingFreeDown()
- swingFree() --prevent mob corruption
- robot.forward()
- else --do not dig flowers
- if k==1 or k==3 or k==4 or k==6 then
- swingFreeDown()
- swingFree()
- robot.forward()
- else
- swingFree()
- robot.forward()
- end
- end
- end --blocks
- if j<6 then --do not turn on last line
- if (turn==1) then --goto next line right
- swingFreeDown()
- robot.turnRight()
- swingFree() --prevent mob corruption
- robot.forward()
- robot.turnRight()
- else --goto next line left
- swingFreeDown()
- robot.turnLeft()
- swingFree() --prevent mob corruption
- robot.forward()
- robot.turnLeft()
- end
- end
- if turn==1 then turn=2 else turn=1 end
- end --lines
- swingFreeDown()
- robot.forward()
- robot.select(2)
- robot.dropDown() --remove living BLOCK
- robot.select(1)
- robot.turnRight()
- for a=1, 5 do swingFree() robot.forward() end
- robot.turnRight()
- os.sleep(15)
- end --movement
- print("finished")
- os.execute("shutdown")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement