Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function turnLeft(Times)
- Times = Times or 1
- for i = 1, Times do
- turtle.turnLeft()
- end
- end
- local function turnRight(Times)
- Times = Times or 1
- for i = 1, Times do
- turtle.turnRight()
- end
- end
- local function turnAround()
- turnRight(2)
- end
- local function IsLava()
- local _, Data = turtle.inspect()
- return Data.name == "minecraft:lava"
- end
- local function SendMessage(Message)
- local WebhookURL = "https://discord.com/api/webhooks/1243847800190406696/LUlW18jdivKSnI63NeBwddMxbqFU_qtPvAON19nWLlFpjv5TFNvJqGcl19NH1fmwdALR"
- http.post(WebhookURL, '{"content": "' .. Message .. '"}', {["Content-Type"] = "application/json"})
- end
- local function DigAndCollect(Side)
- Side = not Side and "f" or string.lower(Side)
- if Side == "f" then
- turtle.dig()
- elseif Side == "l" then
- turnLeft()
- turtle.dig()
- for i = 1, 4 do turnLeft() end
- elseif Side == "r" then
- turnRight()
- turtle.dig()
- turnLeft()
- elseif Side == "b" then
- turnLeft(2)
- turtle.dig()
- turnLeft(2)
- elseif Side == "u" then
- turtle.digUp()
- turtle.suckUp()
- return;
- elseif Side == "d" then
- turtle.digDown()
- turtle.suckDown()
- return;
- end
- turtle.suck()
- end
- while true do
- if turtle.detectUp() then
- DigAndCollect("u")
- end
- if turtle.detect() then
- DigAndCollect("f")
- end
- turtle.forward()
- if not turtle.detectDown() then
- pcall(turtle.placeDown)
- end
- if IsLava() then
- SendMessage("@everyone Came across lava!!")
- turtle.place()
- turnAround()
- if not turtle.detect() then
- turtle.forward()
- turnRight()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement