/
levas95
/
minecraft_Lua_turtle
Обзор
Документация
Войти
/
levas95
/
minecraft_Lua_turtle
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
tunnel
105 строк
2 KB
levas95
Create
27 июн 2026, 13:23
Верифицирован
27 июн 2026, 13:23
8bcbb4f
Код
Авторство
О чём код?
local tArgs = { ... } if #tArgs ~= 1 then print( "Usage: excavate <diameter>" ) return end local size = tonumber( tArgs[1] ) if size < 1 then print( "Excavate diameter must be positive" ) return end local function turnLeft() turtle.turnLeft() ugl=ugl-1 if ugl==0 then ugl=4 end end local function turnRight() turtle.turnRight() ugl=ugl+1 if ugl==5 then ugl=1 end end function goTo( x, y, > x then while xDir ~= -1 do turnLeft() end while xPos > x do if turtle.forward() then xPos = xPos - 1 elseif turtle.dig() or turtle.attack() then collect() else sleep( 0.5 ) end end elseif xPos < x then while xDir ~= 1 do turnLeft() end while xPos < x do if turtle.forward() then xPos = xPos + 1 elseif turtle.dig() or turtle.attack() then collect() else sleep( 0.5 ) end end end if zPos > z then while zDir ~= -1 do turnLeft() end while zPos > z do if turtle.forward() then zPos = zPos - 1 elseif turtle.dig() or turtle.attack() then collect() else sleep( 0.5 ) end end elseif zPos < z then while zDir ~= 1 do turnLeft() end while zPos < z do if turtle.forward() then zPos = zPos + 1 elseif turtle.dig() or turtle.attack() then collect() else sleep( 0.5 ) end end end while depth < y do if turtle.down() then depth = depth + 1 elseif turtle.digDown() or turtle.attackDown() then collect() else sleep( 0.5 ) end end while zDir ~= zd or xDir ~= xd do turnLeft() end l=1 while l<17 do turtle.select(l) if turtle.refuel(turtle.getitemCount) then l=16 end l=l+1 end end Return to where we started