improved opening of modem
This commit is contained in:
parent
61303835f7
commit
af6ff4e7dd
12
client
12
client
@ -1,3 +1,13 @@
|
|||||||
|
local sides = peripheral.getNames()
|
||||||
|
for i = 1, #sides do
|
||||||
|
if peripheral.getType(sides[i]) == "modem" then
|
||||||
|
modemSide = sides[i]
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
rednet.open(modemSide)
|
||||||
|
|
||||||
function dump(o)
|
function dump(o)
|
||||||
if o == nil then
|
if o == nil then
|
||||||
return ""
|
return ""
|
||||||
@ -15,7 +25,6 @@ function dump(o)
|
|||||||
return tostring(o)
|
return tostring(o)
|
||||||
end
|
end
|
||||||
|
|
||||||
rednet.open("left")
|
|
||||||
rednet.host("rmm", "t0-turtle01")
|
rednet.host("rmm", "t0-turtle01")
|
||||||
local master = rednet.lookup("rmm", "master")
|
local master = rednet.lookup("rmm", "master")
|
||||||
while true do
|
while true do
|
||||||
@ -45,3 +54,4 @@ while true do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
rednet.close(modemSide)
|
||||||
|
12
control
12
control
@ -1,3 +1,13 @@
|
|||||||
|
local sides = peripheral.getNames()
|
||||||
|
for i = 1, #sides do
|
||||||
|
if peripheral.getType(sides[i]) == "modem" then
|
||||||
|
modemSide = sides[i]
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
rednet.open(modemSide)
|
||||||
|
|
||||||
function dump(o)
|
function dump(o)
|
||||||
if o == nil then
|
if o == nil then
|
||||||
return ""
|
return ""
|
||||||
@ -73,10 +83,10 @@ function control()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
rednet.open("back")
|
|
||||||
rednet.host("rmm", "master")
|
rednet.host("rmm", "master")
|
||||||
|
|
||||||
while true do
|
while true do
|
||||||
parallel.waitForAny(recv, control)
|
parallel.waitForAny(recv, control)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
rednet.close(modemSide)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user