Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local SERVER_PORT = 56
- function detectAndDig()
- while turtle.detect() do
- turtle.dig()
- end
- end
- function digAndMove()
- turtle.dig()
- turtle.forward()
- end
- -- I STOLE --
- function split (inputstr, sep)
- if sep == nil then
- sep = "%s"
- end
- local t={}
- for str in string.gmatch(inputstr, "([^"..sep.."]+)") do
- table.insert(t, str)
- end
- return t
- end
- local modem = peripheral.wrap("left")
- local running = true
- modem.open(SERVER_PORT)
- while running do
- print("Waiting to receive...")
- local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- local args = split(message, " ")
- local command = args[1]
- for i = 1, #args do
- print(args[i])
- end
- if command == "dig" then
- digAndMove()
- elseif command == "shellrun" then
- shell.run(args[2])
- elseif command == "stop" then
- running = false
- elseif command == "stripmine" then
- if #args ~=3 then
- print("Usage:stripmine <length> <tunnels>")
- else
- shell.run("stripmine", args[2], args[3])
- end
- else
- print("Invalid command")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement