Volpe42

dialer server

Jun 20th, 2024
740
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.74 KB | Gaming | 0 0
  1. local PREFIX = "https://raw.githubusercontent.com/Ktlo/pocket-stargate"
  2. local BRANCH = "develop"
  3.  
  4. --------------------------------
  5.  
  6. local function typeY()
  7.     write("Do you want to continue? (Type Y for continue): ")
  8.     local read = read(nil, nil, nil, "N")
  9.     if read ~= 'Y' then
  10.         print("Exiting...")
  11.         return true
  12.     end
  13. end
  14.  
  15. print("Installing PSG server...")
  16. print("Checking peripherals...")
  17. if not (peripheral.find "advanced_crystal_interface" or peripheral.find "crystal_interface" or peripheral.find "basic_interface") then
  18.     print("Stargate interface not found!")
  19.     if typeY() then return end
  20. end
  21. if not peripheral.find("modem", function(_, modem) return modem.isWireless() end) then
  22.     print("Wireless modem not found!")
  23.     if typeY() then return end
  24. end
  25. print("Peripherals OK")
  26.  
  27. write("Name current solar system: ")
  28. local solarSystem = read(nil, nil, nil, "sgjourney:terra")
  29.  
  30. local galaxies = {}
  31.  
  32. print("Please, enter current galaxies names (empty input means end of list)")
  33. while true do
  34.     write("Name galaxy #"..tostring(#galaxies + 1)..": ")
  35.     local galaxy = read(nil, nil, nil, #galaxies == 0 and "sgjourney:milky_way" or nil)
  36.     if galaxy == "" then break end
  37.     table.insert(galaxies, galaxy)
  38. end
  39.  
  40. print("Modifying configuration file...")
  41. settings.set("solarSystem", solarSystem)
  42. settings.set("galaxies", galaxies)
  43. settings.save()
  44. print("Configuration OK")
  45.  
  46. print("Downloading files...")
  47. local function wget(side, filename)
  48.     local fullUrl = PREFIX.."/"..BRANCH.."/"..side.."/"..filename
  49.     shell.execute("wget", fullUrl, filename)
  50. end
  51.  
  52. wget("common", "concurrent.lua")
  53. wget("server", "startup.lua")
  54.  
  55. print("Files downloaded!")
  56. print("Restarting...")
  57.  
  58. shell.execute 'reboot'
Advertisement
Add Comment
Please, Sign In to add comment