Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shape = {2, -1, 10} --
- banned_items = {"minecraft:dirt","chisel:basalt","minecraft:cobblestone", "minecraft:dirt", "minecraft:stone","minecraft:gravel","minecraft:flint"}
- function Strip(a,b,c,d,e,f)
- shape = {a,b,c}
- print("starting stip mining")
- Move(d, e, f)
- turtle.turnRight()
- turtle.dig()
- turtle.select(15)
- turtle.place()
- turtle.turnLeft()
- print("moved")
- MineShape()
- print("stoping shapemining")
- Move(0,0,100)
- print("moved")
- TurnAround()
- CheckDropBannedItems()
- rednet.close()
- print("stoping strip mining")
- end
- function UpDownMine(x,y)
- if y > 0 then
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- end
- if y < 0 then
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- end
- if x > 0 then
- turtle.digUp()
- turtle.up()
- end
- if x < 0 then
- turtle.digDown()
- turtle.down()
- end
- end
- function LeftRightCorner(x)
- if x < 0 then
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- end
- if x > 0 then
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- end
- end
- function MineShape()
- x = shape[1]
- y = shape[2]
- z = shape[3]
- dir_x = 1
- dir_y = 1
- dir_z = 1
- if x < 0 then
- dir_x = -1
- x = x * -1
- end
- if y < 0 then
- dir_y = -1
- y = y * -1
- end
- if z < 0 then
- dir_z = -1
- z = z * -1
- end
- if dir_z == -1 then
- TurnAround()
- end
- for i=1,y do
- for j=1,x do
- for k=1,z do
- if k%10==0 then
- CheckDropBannedItems()
- end
- success, data = turtle.inspect()
- if data.name == "minecraft:wool" then
- return
- end
- turtle.dig()
- turtle.digUp()
- turtle.digDown()
- if i==y and j==1 then
- if k%5==0 then
- PlaceTorch()
- end
- end
- turtle.forward()
- end
- LeftRightCorner(dir_x)
- dir_x = dir_x * -1
- end
- CheckDropBannedItems()
- dir_x = dir_x * -1
- UpDownMine(dir_y, dir_x)
- UpDownMine(dir_y, 0)
- UpDownMine(dir_y, 0)
- end
- end
- function Move(x,y,z)
- if x>0 then
- turtle.turnRight()
- elseif x<0 then
- turtle.turnLeft()
- end
- for i=1,x do
- CheckMine()
- end
- if x>0 then
- turtle.turnLeft()
- elseif x<0 then
- turtle.turnRight()
- end
- if y>0 then
- for i=1,y do
- turtle.digUp()
- turtle.up()
- end
- elseif y<0 then
- y= y*-1
- for i=1,y do
- turtle.digDown()
- turtle.down()
- end
- end
- if z<0 then
- TurnAround()
- end
- for i=1,z do
- success, data = turtle.inspect()
- if data.name ~= nil then
- end
- if data.name == "minecraft:wool" then
- return 0
- else
- turtle.dig()
- turtle.forward()
- end
- end
- end
- function CheckDropBannedItems()
- for i=1,16 do
- for j=1,table.getn(banned_items) do
- if turtle.getItemDetail(i)~=nil then
- if turtle.getItemDetail(i)["name"] == banned_items[j] then
- turtle.select(i)
- turtle.drop()
- end
- end
- end
- end
- end
- function TurnAround()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function Inspect()
- success, data = turtle.inspect()
- return data
- end
- function CheckMine()
- name = Inspect().name
- while name == "computercraft:turtle_expanded" or name == "computercraft:turtle_advanced" do
- name = Inspect().name
- end
- turtle.dig()
- turtle.forward()
- end
- function GoToStartRight(distance)
- turtle.turnRight()
- for i=0,distance do
- MineMove()
- end
- turtle.turnLeft()
- end
- function MineMove ()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.digDown()
- end
- function PlaceTorch()
- turtle.select(16)
- turtle.placeDown(1)
- end
- function StripForward(distance, torch_distance)
- for i=0,distance do
- MineMove()
- if torch_distance ~= 0 then
- if i%torch_distance == 0 then
- PlaceTorch()
- end
- end
- if i%30 == 0 then
- CheckDropBannedItems()
- end
- end
- end
- function MoveForward(distance)
- for i=0,distance do
- turtle.forward()
- end
- end
- function BreakDown(distance)
- for i=1,distance do
- turtle.digDown()
- turtle.down()
- end
- end
- function BreakUp(distance)
- for i=1,distance do
- turtle.digUp()
- turtle.up()
- end
- end
- rednet.open("right")
- while rednet.isOpen() do
- print("rednet opened")
- local sender, message, protocol = rednet.receive()
- if message[1] == "stop" then
- rednet.close()
- print("rednet stoped")
- else
- print(message[1],message[2],message[3],message[4],message[5],message[6])
- Strip(message[1],message[2],message[3],message[4],message[5],message[6])
- message={}
- print()
- end
- end
- print(turtle.getFuelLevel())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement