Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if os.getComputerID() == 31 then
- error("Is master")
- end
- local blocksNotToMine = {
- ["computercraft:turtle_normal"] = true,
- ["computercraft:turtle_advanced"] = true,
- ["enderstorage:ender_chest"] = true
- }
- if fs.exists("DiscordHook.lua") == false then
- shell.execute("wget", "https://raw.githubusercontent.com/Wendelstein7/DiscordHook-CC/master/DiscordHook.lua", "DiscordHook.lua")
- end
- local DiscordHook = require("./DiscordHook")
- local hookSuccess, hook = DiscordHook.createWebhook("https://discord.com/api/webhooks/889783581839339541/mtTZmSBCoa-KGi2DN5S5_tQMPJhpPjOjDB3dy8EtY-Dxu2CK9pTeBwMy7IkKMGyVpkti")
- if not hookSuccess then
- error("Webhook connection failed! Reason: " .. hook)
- end
- local file = fs.open("/disk/minerParams.lua", "r")
- local minerParams = textutils.unserialise(file.readAll())
- file.close()
- while turtle.detect() == false do
- turtle.turnLeft()
- end
- while turtle.getFuelLevel() < (minerParams["acrossAmt"] * 2 + minerParams["forwardAmt"] * 2 * minerParams["downAmt"] + (minerParams["startDownAmt"] * 2)) and turtle.getFuelLevel() < turtle.getFuelLimit() - 10 do
- turtle.refuel(32)
- sleep(0.1)
- end
- turtle.drop(64)
- turtle.turnLeft()
- turtle.turnLeft()
- function Forward()
- while turtle.forward() == false do
- local has_block, data = turtle.inspect()
- if has_block then
- if blocksNotToMine[data.name] then
- if data.name == "computercraft:turtle_normal" then
- Dump()
- for i = 1, 16 do
- turtle.suck(64)
- end
- Dump()
- end
- hook.send("Found: " .. data.name .. " row: " .. tostring(minerParams["acrossAmt"]), tostring(os.getComputerID()))
- read()
- end
- end
- turtle.dig()
- end
- end
- function Up()
- while turtle.up() == false do
- turtle.digUp()
- end
- end
- function Down()
- while turtle.down() == false do
- turtle.digDown()
- end
- end
- function Dig()
- while turtle.detect() do
- turtle.dig()
- end
- end
- function DigUp()
- while turtle.detectUp() do
- turtle.digUp()
- end
- end
- function DigDown()
- while turtle.detectDown() do
- turtle.digDown()
- end
- end
- function Dump()
- turtle.digDown()
- for i = 1, 16 do
- local item = turtle.getItemDetail(i)
- if item ~= nil then
- turtle.select(i)
- if item.name == "minecraft:coal" then
- turtle.refuel(64)
- else
- turtle.dropDown(64)
- end
- end
- end
- turtle.select(1)
- end
- for accross = 1, minerParams["acrossAmt"] do
- Forward()
- end
- turtle.turnLeft()
- for down = 1, minerParams["startDownAmt"] do
- Down()
- end
- for down = 1, minerParams["downAmt"] do
- Down()
- for i = 1, 2 do
- for forward = 1, minerParams["forwardAmt"] do
- Forward()
- end
- turtle.turnRight()
- Forward()
- turtle.turnRight()
- Dump()
- end
- while turtle.getFuelLevel() < (minerParams["forwardAmt"] * 1.1) do
- hook.send("Need fuel - row: " .. tostring(minerParams["acrossAmt"]), tostring(os.getComputerID()))
- print("Need fuel")
- read()
- end
- end
- for down = 1, (minerParams["downAmt"] + minerParams["startDownAmt"]) do
- Up()
- end
- turtle.turnRight()
- turtle.turnRight()
- Forward()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement