Advertisement
oswald_the_void

Destiny

Jun 13th, 2025
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.27 KB | None | 0 0
  1. -— Stargate Universe controller for SGJourney
  2.  
  3. -- === Peripherals ===
  4. local gate = peripheral.find("advanced_crystal_interface")
  5. if not gate then error("No advanced_crystal_interface found!") end
  6.  
  7. local display = peripheral.find("monitor")
  8. if not display then error("No monitor found!") end
  9.  
  10. -- === Address List ===
  11. local addressList = {
  12.     {1,2,3,4,5,6,7,8,0},
  13.     {8,1,22,14,36,19,0},
  14.     {10,11,12,13,14,15,16,17,0}
  15.     -- Add more if needed
  16. }
  17.  
  18. -- === Timers (in seconds) ===
  19. local minReentryWait = 3200    -- 1 hour
  20. local maxReentryWait = 7200    -- 2 hours
  21. local minGateTime     = 1800   -- 30 minutes
  22. local maxGateTime     = 7200   -- 2 hours
  23.  
  24. -- === Network Setup ===
  25. local destinyNetworkID = 450321
  26.  
  27. -- === Logging ===
  28. local function timestamp()
  29.     return "[" .. textutils.formatTime(os.time(), true) .. "]"
  30. end
  31.  
  32. local function log(msg)
  33.     print(timestamp() .. " " .. msg)
  34. end
  35.  
  36. -- === Monitor Output ===
  37. display.setTextScale(0.5)
  38. display.setBackgroundColor(colors.black)
  39.  
  40. local function updateMonitor(status)
  41.     display.clear()
  42.     display.setCursorPos(2, 2)
  43.     display.setTextColor(colors.yellow)
  44.     display.write("DESTINY STATUS")
  45.     display.setCursorPos(2, 4)
  46.     display.setTextColor(colors.lime)
  47.     display.write(status)
  48. end
  49.  
  50. -- === Strip origin symbol (0) ===
  51. local function stripOrigin(address)
  52.     local clean = {}
  53.     for _, symbol in ipairs(address) do
  54.         if symbol ~= 0 then table.insert(clean, symbol) end
  55.     end
  56.     return clean
  57. end
  58.  
  59. -- === Dial Address ===
  60. local function dialAddress(address)
  61.     for _, symbol in ipairs(address) do
  62.         gate.engageSymbol(symbol)
  63.         sleep(1)
  64.     end
  65. end
  66.  
  67. -- === Countdown with no visible timer (SGU style) ===
  68. local function countdown(duration)
  69.     updateMonitor("IN FTL")
  70.     for i = duration, 0, -1 do
  71.         sleep(1) -- Quiet FTL travel, no time shown
  72.     end
  73. end
  74.  
  75. -- === Random Address Picker ===
  76. local lastIndex = nil
  77. local function pickNewTarget()
  78.     local index
  79.     repeat
  80.         index = math.random(1, #addressList)
  81.     until index ~= lastIndex
  82.     lastIndex = index
  83.     return addressList[index]
  84. end
  85.  
  86. -- === Main Loop ===
  87. log("Destiny controller started.")
  88. updateMonitor("IN FTL")
  89.  
  90. while true do
  91.     -- PHASE 1: FTL Countdown (no visible time)
  92.     local ftlWait = math.random(minReentryWait, maxReentryWait)
  93.     log("Destiny in FTL. Countdown to re-entry started.")
  94.     countdown(ftlWait)
  95.  
  96.     -- PHASE 2: Re-entry — pick and dial destination
  97.     local target = pickNewTarget()
  98.     log("Re-entry complete. Dialing: {" .. table.concat(target, ",") .. "}")
  99.  
  100.     gate.clearWhitelist()
  101.     gate.addToWhitelist(stripOrigin(target))
  102.     gate.setFilterType(1) -- Whitelist mode
  103.     gate.setNetwork(destinyNetworkID)
  104.     gate.restrictNetwork(true)
  105.  
  106.     dialAddress(target)
  107.  
  108.     log("Whitelist and network restriction set.")
  109.     updateMonitor("GATE ONLINE")
  110.  
  111.     -- PHASE 3: Gate window remains open
  112.     local openTime = math.random(minGateTime, maxGateTime)
  113.     log("Gate will remain open for " .. math.floor(openTime / 60) .. " minutes.")
  114.     sleep(openTime)
  115.  
  116.     -- PHASE 4: FTL resumes
  117.     gate.clearWhitelist()
  118.     gate.setFilterType(1) -- Keep gate locked
  119.     updateMonitor("IN FTL")
  120.     log("Gate locked. Destiny has re-entered FTL.")
  121. end
Tags: sgjourney
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement