robathome

AutoMiner - GPS startup

Oct 25th, 2025 (edited)
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. -- startup.lua — GPS beacon using the built-in 'gps host' program
  2. -- EDIT COORDS FOR THIS NODE:
  3. local X, Y, Z = -925, 105, -1096
  4.  
  5. -- open wireless/Ender modem
  6. local m = peripheral.find("modem", function(_,p) return p.isWireless() end)
  7. assert(m, "no wireless modem")
  8. rednet.open(peripheral.getName(m))
  9.  
  10. term.clear(); term.setCursorPos(1,1)
  11. print(("GPS beacon @ (%.1f, %.1f, %.1f)"):format(X,Y,Z))
  12. print("Hosting via 'gps host'...")
  13.  
  14. -- keep hosting; auto-restart if it exits
  15. while true do
  16. local ok, err = pcall(function()
  17. shell.run("gps","host", tostring(X), tostring(Y), tostring(Z))
  18. end)
  19. if not ok then print("gps host error: "..tostring(err)) else print("gps host exited; restarting") end
  20. sleep(2)
  21. end
  22.  
Advertisement
Add Comment
Please, Sign In to add comment