SHOW:
|
|
- or go back to the newest paste.
| 1 | - | local regexes = dash.flatten {
|
| 1 | + | function locationd() |
| 2 | - | "^P/", |
| 2 | + | |
| 3 | - | "ShutdownOS", |
| 3 | + | |
| 4 | - | "^P4/", |
| 4 | + | local m = peripheral.find("modem", function(_, p) return p.isWireless() end)
|
| 5 | - | registry.get "netbootd.extra_regexes" |
| 5 | + | if not m then return "no modem" end |
| 6 | - | } |
| 6 | + | |
| 7 | local x, y, z = gps.locate() | |
| 8 | - | function onsys() |
| 8 | + | if x then |
| 9 | if _G.potatOS then | |
| 10 | _G.potatOS.location = {x, y, z}
| |
| 11 | end | |
| 12 | - | while true do |
| 12 | + | |
| 13 | - | local count = 0 |
| 13 | + | sleep(60) |
| 14 | - | for _, name in pairs(peripheral.getNames()) do |
| 14 | + | |
| 15 | - | if peripheral.getType(name) == "computer" then |
| 15 | + | |
| 16 | - | local l = peripheral.call(name, "getLabel") |
| 16 | + | |
| 17 | - | if l and (l:match "^P/" or l:match "ShutdownOS" or l:match "^P4/") and not peripheral.call(name, "isOn") then |
| 17 | + | |
| 18 | - | peripheral.call(name, "turnOn") |
| 18 | + | name = "locationd", |
| 19 | - | count = count + 1 |
| 19 | + | async = locationd |
| 20 | - | end |
| 20 | + |