Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local m = peripheral.wrap("left")
- local senderID = os.getComputerLabel() == nil and "ID:" .. os.getComputerID() or os.getComputerLabel()
- local channels = {
- ["stdout"] = 1000,
- ["stdin"] = 1001,
- ["witherout"] = 1010,
- ["witherin"] = 1011
- }
- m.open(channels.stdin)
- local ticks = 0
- local function checkStop()
- if ticks % 4 == 0 then
- os.startTimer(0.1)
- local a, b, c, d, e
- repeat
- evt, face, sendCh, replyCh, msg, dist = os.pullEvent()
- if evt == "modem_message" and msg.type == "cmd" and msg.cmd == "stop" then
- return true
- end
- until evt == "timer"
- end
- return false
- end
- local function tryRefuel()
- while turtle.getFuelLevel() < 1 do
- for i = 1, 16 do
- turtle.select(i)
- turtle.refuel(1)
- if turtle.getFuelLevel() > 0 then
- break
- end
- end
- turtle.select(1)
- end
- end
- local function forward()
- if checkStop() then
- exit()
- end
- tryRefuel()
- while not turtle.forward() do
- sleep(.25)
- turtle.dig()
- end
- end
- while true do
- turtle.digDown()
- turtle.dig()
- turtle.digUp()
- forward()
- end
Add Comment
Please, Sign In to add comment