Maengorn

dig1.1

Jan 4th, 2021
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.64 KB | None | 0 0
  1. local a=16;local b="north"local c,d,e=10,10,2;if#arg==3 then c=tonumber(arg[1])d=tonumber(arg[2])e=tonumber(arg[3])else print('None or Malformed Size Given, Defaulting to 10x10x2 up')end;DROPPED_ITEMS={"minecraft:stone","minecraft:dirt","minecraft:basalt","minecraft:granite","minecraft:cobblestone","minecraft:sand","minecraft:gravel","minecraft:redstone","minecraft:flint","railcraft:ore_metal","extrautils2:ingredients","minecraft:dye","thaumcraft:nugget","thaumcraft:crystal_essence","thermalfoundation:material","projectred-core:resource_item","thaumcraft:ore_cinnabar","deepresonance:resonating_ore","forestry:apatite","biomesoplenty:loamy_dirt"}function dropItems()print("Purging Inventory...")for f=1,a,1 do local g=turtle.getItemDetail(f)if g~=nil then for h=1,#DROPPED_ITEMS,1 do if g["name"]==DROPPED_ITEMS[h]then print("Dropping - "..g["name"])turtle.select(f)turtle.dropDown()end end end end end;function getEnderIndex()for f=1,a,1 do local g=turtle.getItemDetail(f)if g~=nil then if g["name"]=="enderstorage:ender_storage"then return f end end end;return nil end;function manageInventory()dropItems()index=getEnderIndex()if index~=nil then turtle.select(index)turtle.digUp()turtle.placeUp()end;for f=1,a,1 do local g=turtle.getItemDetail(f)if g~=nil then if g["name"]~="minecraft:coal_block"and g["name"]~="minecraft:coal"then turtle.select(f)turtle.dropUp()end end end;turtle.digUp()end;function checkFuel()turtle.select(1)if turtle.getFuelLevel()<50 then print("Attempting Refuel...")for f=1,a,1 do turtle.select(f)if turtle.refuel(1)then return true end end;return false else return true end end;function detectAndDig()while turtle.detect()do turtle.dig()turtle.digUp()turtle.digDown()end end;function forward()detectAndDig()turtle.forward()end;function leftTurn()turtle.turnLeft()detectAndDig()turtle.forward()turtle.turnLeft()end;function rightTurn()turtle.turnRight()detectAndDig()turtle.forward()turtle.turnRight()end;function flipDirection()if b=="north"then b="south"elseif b=="south"then b="north"elseif b=="west"then b="east"elseif b=="east"then b="west"end end;function turnAround(i)if i%2==1 then if b=="north"or b=="east"then rightTurn()elseif b=="south"or b=="west"then leftTurn()end else if b=="north"or b=="east"then leftTurn()elseif b=="south"or b=="west"then rightTurn()end end;flipDirection()end;function riseTier()turtle.turnRight()turtle.turnRight()flipDirection()turtle.digUp()turtle.up()end;function start()for i=1,e,1 do for j=1,c,1 do for k=1,d-1,1 do if not checkFuel()then print("Turtle is out of fuel, Powering Down...")return end;forward()print(string.format("Row: %d Col: %d",k,j))end;if j~=c then turnAround(i)end;manageInventory()end;riseTier()end end;start()
Advertisement
Add Comment
Please, Sign In to add comment