Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- things not to veinmine
- local blacklist = {
- "minecraft:stone",
- "minecraft:dirt",
- "minecraft:diorite",
- "minecraft:andesite",
- "minecraft:granite",
- "minecraft:gravel",
- "quark:slate"
- }
- -- vars to identify the current pos relative to start point
- local x = 0
- local y = 0
- local z = 0
- local rotation = 0
- -- params
- local x_size, y_size, depth, increment = ...
- x_size, y_size, depth, increment = tonumber(x_size), tonumber(y_size) - 1, tonumber(depth), tonumber(increment)
- --this is mostly for gravel
- local function better_forward()
- while not turtle.forward() do
- turtle.dig()
- turtle.attack()
- end
- end
- -- function that returns to start point
- local function return_to_origin(up)
- --switch for when something is blocking its way
- local offset = false
- -- rotating it to face the starting wall
- if rotation ~= 2 then
- if rotation > 2 then
- repeat turtle.turnLeft() rotation = rotation - 1 until rotation == 2
- elseif rotation < 2 then
- repeat turtle.turnRight() rotation = rotation + 1 until rotation == 2
- end
- end
- -- moving it out of the way if theres a block in front of it
- if turtle.detect() and x ~= 0 then
- offset = true
- turtle.turnRight()
- better_forward()
- turtle.turnLeft()
- end
- -- returning to start
- for i = 1,y do
- better_forward()
- end
- turtle.turnRight()
- if offset then
- for i = 1,x-1 do
- better_forward()
- end
- else
- for i = 1,x do
- better_forward()
- end
- end
- --rotating back to 0
- turtle.turnRight()
- -- going back to the top if desired
- if up then
- for i = 1, z do
- turtle.up()
- end
- end
- end
- local function mine_sector()
- -- switch to alternate digging left/right
- local left = false
- for i = 1, x_size do
- --digging forward
- for i = 1, y_size do
- better_forward()
- if not left then y = y + 1
- else y = y - 1 end
- end
- --turning using switch
- if x ~= x_size - 1 then
- if not left then
- turtle.turnRight()
- better_forward()
- turtle.turnRight()
- left = true
- rotation = 2
- x = x + 1
- else
- turtle.turnLeft()
- better_forward()
- turtle.turnLeft()
- left = false
- rotation = 0
- x = x + 1
- end
- end
- end
- end
- local function dig_deeper()
- return_to_origin(false)
- for i = 1, increment do
- z = z + 1
- turtle.digDown()
- turtle.down()
- if z == depth then return end
- end
- end
- local function quarry()
- for i = 1,4 do
- dig_deeper()
- x,y,rotation = 0,0,0
- if z >= depth then break end
- mine_sector()
- end
- return_to_origin(true)
- end
- quarry()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement