Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #SOURCE()
- #GLIBFUNC(module/netlib.lua, loadModem)
- #GLIBFUNC(module/netlib.lua, openPort)
- #GLIBFUNC(module/netlib.lua, listen)
- #GLIBFUNC(module/netlib.lua, listenStop)
- #GLIBFUNC(module/netlib.lua, closePort)
- #IMPORTLIB(module/netlib.lua, bcNet)
- #GLIBFUNC(module/selfdestroy.lua, onAnyContact)
- #GLIBFUNC(module/selfdestroy.lua, now)
- #IMPORTLIB(module/selfdestroy.lua, bcDestroy)
- #GLIBFUNC(module/turtle.lua, refuelAll)
- #GLIBFUNC(module/turtle.lua, forward)
- #GLIBFUNC(module/turtle.lua, turnRight)
- #IMPORTLIB(module/turtle.lua, bcTurtle)
- local net = loadstring(bcNet)()
- local destroy = loadstring(bcDestroy)()
- local worker = loadstring(bcTurtle)()
- local modem = net.loadModem("left")
- if modem == false then
- printError("Unable to setup modem")
- return
- end
- net.openPort(modem, 26345)
- local fListner, nListner = net.listen(modem, 26345)
- worker.refuelAll()
- if fListner == false then
- printError("Unable to setup listner")
- return
- end
- os.sleep(1)
- destroy.onAnyContact()
- parallel.waitForAny(
- function()
- while true do
- worker.forward()
- worker.turnRight()
- os.sleep(0)
- end
- end,
- function()
- while true do
- local _, nid, _, message =
- os.pullEvent(net.listenEvent)
- if nid == nListner then
- break
- end
- end
- end,
- fListner)
- net.listenStop(modem, 26345)
- net.closePort(modem, 26345)
- destroy.now()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement