Files
airship-autopilot/files/autopilot/scan.lua
Stian 4cd2573f56 Airship autopilot: role-based wget installer for server
Mirrors the live CC autopilot (computer 0) and cockpit (computer 4) from the
Modda wii world. install.lua fetches each role's manifest over HTTP so the
system installs on any server regardless of computer id.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-23 12:53:41 +02:00

46 lines
1.0 KiB
Lua

-- scan.lua
-- Oppdager peripheraler paa det monterte luftskipet.
-- Skriver til skjerm OG til scan.txt slik at resultatet kan deles.
-- Kjor paa CC-computeren NAR skipet er montert/lever.
local OUT = "scan.txt"
local file = fs.open(OUT, "w")
local function emit(line)
print(line)
file.writeLine(line)
end
emit("=== PERIPHERAL-SCAN ===")
emit("")
local names = peripheral.getNames()
if #names == 0 then
emit("Ingen peripheraler funnet.")
emit("Sjekk at skipet er montert og at computeren sitter paa contraptionen.")
file.close()
return
end
for _, name in ipairs(names) do
local ptype = peripheral.getType(name)
emit("------------------------------------------")
emit("Navn: " .. tostring(name))
emit("Type: " .. tostring(ptype))
emit("Metoder:")
local methods = peripheral.getMethods(name)
table.sort(methods)
for _, m in ipairs(methods) do
emit(" " .. m)
end
emit("")
end
emit("==========================================")
emit("Totalt " .. #names .. " peripheral(er).")
emit("Lagret til " .. OUT)
file.close()