mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-05-16 14:24:11 +00:00
Allow GPS to use modems connected through a hub
This commit is contained in:
parent
676fb5fb53
commit
3678fc1845
@ -106,16 +106,10 @@ function locate(_nTimeout, _bDebug)
|
|||||||
return commands.getBlockPosition()
|
return commands.getBlockPosition()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Find a modem
|
-- Open GPS channel to listen for ping responses
|
||||||
local sModemSide = nil
|
local modem = peripheral.find("modem", function(_, m) return m.isWireless() end)
|
||||||
for _, sSide in ipairs(rs.getSides()) do
|
|
||||||
if peripheral.getType(sSide) == "modem" and peripheral.call(sSide, "isWireless") then
|
|
||||||
sModemSide = sSide
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if sModemSide == nil then
|
if modem == nil then
|
||||||
if _bDebug then
|
if _bDebug then
|
||||||
print("No wireless modem attached")
|
print("No wireless modem attached")
|
||||||
end
|
end
|
||||||
@ -126,8 +120,7 @@ function locate(_nTimeout, _bDebug)
|
|||||||
print("Finding position...")
|
print("Finding position...")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Open GPS channel to listen for ping responses
|
local sModemSide = peripheral.getName(modem)
|
||||||
local modem = peripheral.wrap(sModemSide)
|
|
||||||
local bCloseChannel = false
|
local bCloseChannel = false
|
||||||
if not modem.isOpen(CHANNEL_GPS) then
|
if not modem.isOpen(CHANNEL_GPS) then
|
||||||
modem.open(CHANNEL_GPS)
|
modem.open(CHANNEL_GPS)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user