support for craftos-pc env by supporting modems instead of wireless modems for comms

This commit is contained in:
Mikayla Fischler 2022-07-19 14:02:20 -04:00
parent 2aedc015c8
commit 41cc6b9acc
2 changed files with 6 additions and 2 deletions

View File

@ -11,6 +11,7 @@
"shell", "shell",
"settings", "settings",
"window", "window",
"read" "read",
"periphemu"
] ]
} }

View File

@ -302,12 +302,15 @@ function ppm.get_fission_reactor()
end end
-- get the wireless modem (if multiple, returns the first) -- get the wireless modem (if multiple, returns the first)
--
-- if this is in a CraftOS emulated environment, wired modems will be used instead
---@return table|nil modem function table ---@return table|nil modem function table
function ppm.get_wireless_modem() function ppm.get_wireless_modem()
local w_modem = nil local w_modem = nil
local emulated_env = periphemu ~= nil
for _, device in pairs(_ppm_sys.mounts) do for _, device in pairs(_ppm_sys.mounts) do
if device.type == "modem" and device.dev.isWireless() then if device.type == "modem" and (emulated_env or device.dev.isWireless()) then
w_modem = device.dev w_modem = device.dev
break break
end end