mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-05-18 23:34: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()
|
||||
end
|
||||
|
||||
-- Find a modem
|
||||
local sModemSide = nil
|
||||
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
|
||||
-- Open GPS channel to listen for ping responses
|
||||
local modem = peripheral.find("modem", function(_, m) return m.isWireless() end)
|
||||
|
||||
if modem == nil then
|
||||
if _bDebug then
|
||||
print("No wireless modem attached")
|
||||
end
|
||||
@ -126,8 +120,7 @@ function locate(_nTimeout, _bDebug)
|
||||
print("Finding position...")
|
||||
end
|
||||
|
||||
-- Open GPS channel to listen for ping responses
|
||||
local modem = peripheral.wrap(sModemSide)
|
||||
local sModemSide = peripheral.getName(modem)
|
||||
local bCloseChannel = false
|
||||
if not modem.isOpen(CHANNEL_GPS) then
|
||||
modem.open(CHANNEL_GPS)
|
||||
|
Loading…
x
Reference in New Issue
Block a user