-- to be used with plant_trees -- this turtle should be placed one block behind and to the right -- note: this script is actually written with the linter _enabled_ -- todo: switch to turtle.suckDown() local mv = require("movement") local function stepOver(go_around) mv.up() if go_around then mv.moveLeft(mv.forward) end mv.nTimes(2, mv.forward) if go_around then mv.moveRight(mv.forward) end mv.down() end local function safeSuck() local success, data = turtle.inspect() if success and data.name:find("turtle") then return end turtle.suck() end local function suck() for i=1,4 do safeSuck() turtle.turnRight() end mv.forward() end local function scanRow(n) local inner_size = (n-1)*4 mv.nTimes(inner_size, suck) turtle.turnRight() stepOver(false) turtle.turnRight() mv.nTimes(inner_size, suck) turtle.turnLeft() stepOver(true) turtle.turnLeft() end local function main(n,m) stepOver(false) for i=1,(m-1) do scanRow(n) end mv.turnAround() stepOver(false) turtle.turnRight() mv.nTimes((m-1)*4, mv.forward) turtle.turnRight() end local args = {...} main(tonumber(args[1] or 5), tonumber(args[2] or 5))