Gintarus

ls2

Jul 1st, 2026
9
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.01 KB | None | 0 0
  1. local component = require("component")
  2. local event = require("event")
  3. local computer = require("computer")
  4. local keyboard = require("keyboard")
  5. local unicode = require("unicode")
  6. local gpu = component.gpu
  7.  
  8. local function get(...)
  9. for _, n in ipairs({...}) do
  10. local a = component.list(n)()
  11. if a then return component.proxy(a) end
  12. end
  13. return nil
  14. end
  15.  
  16. local rf = get("draconic_rf_storage")
  17. local gate = get("flux_gate")
  18. local me = get("me_interface", "ae2_interface")
  19. local chat = get("chat_box")
  20. local opb = get("openperipheral_bridge", "terminal_glasses_bridge", "terminal")
  21. local sensor = get("sensor", "radar")
  22.  
  23. if chat then chat.setName("§3[PRISMA CORE]§r") end
  24. local w, h = gpu.getResolution()
  25. local col1_w, col4_w, col3_w = 28, 32, 30
  26. local col2_w = w - col1_w - col3_w - col4_w - 3
  27.  
  28. local cfg = {
  29. target = 200 * 10^9,
  30. maxDiff = 25000, step = 10000, flowMin = 1000, flowMax = 40000000,
  31. ar_chat_enabled = true, ar_radar_enabled = true, ar_me_enabled = true,
  32. me_scan_enabled = true,
  33. hudX = 2, hudY = 2,
  34. hudW = 260,
  35. ar_chat_width = 35,
  36. me_name = "dwcity:Vis_materia",
  37. me_label = "Вис Материя",
  38. playerConfig = {
  39. ignore = {"LiwMorgan"},
  40. prefixes = { ["GintaRus"] = "[Чорт]", ["Noney"] = "[Girl]" }
  41. }
  42. }
  43.  
  44. local lastE, filVal, currentFlow = 0, 0, 0
  45. local chatLog, arChatLog, nearbyPlayers, buttons = {}, {}, {}, {}
  46. local showFlowMenu, showIgnoreMenu, needFullRedraw, chatUpdated = false, false, true, true
  47. local ar_error = nil
  48. local matter_current, matter_last, matter_rate, me_timer = 0, 0, 0, 0
  49. local tick_counter = 0
  50.  
  51. local C = {
  52. BG = 0x02060D, FRAME = 0x1A4059, FRAME_DIM = 0x0C1F2E,
  53. TEXT_MAIN = 0x00E5FF, TEXT_DIM = 0x4A7B9C, TEXT_WHITE = 0xE0F7FA,
  54. ALERT = 0xFF2A2A, OK = 0x00FF9D, BTN_OFF = 0x0B1B26, BTN_ON = 0x004D40
  55. }
  56.  
  57. local mc_colors = {
  58. ["0"]=0x000000, ["1"]=0x0000AA, ["2"]=0x00AA00, ["3"]=0x00AAAA,
  59. ["4"]=0xAA0000, ["5"]=0xAA00AA, ["6"]=0xFFAA00, ["7"]=0xAAAAAA,
  60. ["8"]=0x555555, ["9"]=0x5555FF, ["a"]=0x55FF55, ["b"]=0x55FFFF,
  61. ["c"]=0xFF5555, ["d"]=0xFF55FF, ["e"]=0xFFFF55, ["f"]=0xFFFFFF, ["r"]=C.TEXT_WHITE
  62. }
  63.  
  64. local function clamp(v, a, b) if v < a then return a end; if v > b then return b end; return v end
  65. local function formatNum(n)
  66. if type(n) ~= "number" or n ~= n then return "0" end
  67. local absN = math.abs(n)
  68. if absN >= 10^9 then return string.format("%.2fG", n / 10^9) end
  69. if absN >= 10^6 then return string.format("%.2fM", n / 10^6) end
  70. if absN >= 10^3 then return string.format("%.1fk", n / 10^3) end
  71. return tostring(math.floor(n))
  72. end
  73.  
  74. local function text(x, y, s, fg, bg)
  75. if fg then gpu.setForeground(fg) end
  76. if bg then gpu.setBackground(bg) else gpu.setBackground(C.BG) end
  77. gpu.set(x, y, s)
  78. end
  79.  
  80. local function drawTechFrame(x, y, bw, bh, title)
  81. gpu.setBackground(C.BG); gpu.setForeground(C.FRAME)
  82. gpu.set(x, y, "┌" .. string.rep("─", bw - 2) .. "┐")
  83. for i = 1, bh - 2 do gpu.set(x, y + i, "│"); gpu.set(x + bw - 1, y + i, "│") end
  84. gpu.set(x, y + bh - 1, "└" .. string.rep("─", bw - 2) .. "┘")
  85. if title then text(x + 2, y, "┤ " .. title .. " ├", C.TEXT_MAIN, C.BG) end
  86. end
  87.  
  88. local function drawButton(id, x, y, bw, bh, label, bg, fg)
  89. buttons[id] = {x = x, y = y, w = bw, h = bh}
  90. gpu.setBackground(bg); gpu.setForeground(fg)
  91. gpu.fill(x, y, bw, bh, " ")
  92. local lx = x + math.floor((bw - unicode.wlen(label)) / 2)
  93. local ly = y + math.floor(bh / 2)
  94. gpu.set(lx, ly, label); gpu.setBackground(C.BG)
  95. end
  96.  
  97. local function drawColoredText(x, y, textLine, defaultColor)
  98. gpu.setBackground(C.BG)
  99. local cx, currentColor = x, defaultColor or C.TEXT_WHITE
  100. local safeText = textLine:gsub("§", "&")
  101. local lastIdx = 1
  102. while lastIdx <= #safeText do
  103. local idx = safeText:find("&", lastIdx, true)
  104. if not idx then
  105. gpu.setForeground(currentColor); gpu.set(cx, y, safeText:sub(lastIdx)); break
  106. end
  107. if idx > lastIdx then
  108. local chunk = safeText:sub(lastIdx, idx - 1)
  109. gpu.setForeground(currentColor); gpu.set(cx, y, chunk)
  110. cx = cx + unicode.wlen(chunk)
  111. end
  112. local colorCode = safeText:sub(idx + 1, idx + 1):lower()
  113. if mc_colors[colorCode] then currentColor = mc_colors[colorCode]; lastIdx = idx + 2
  114. else gpu.setForeground(currentColor); gpu.set(cx, y, "&"); cx = cx + 1; lastIdx = idx + 1 end
  115. end
  116. end
  117.  
  118. local function fetchMatterAmount()
  119. if not cfg.me_scan_enabled or not me then return 0 end
  120. local amount = 0
  121. pcall(function()
  122. local items = nil
  123. if me.getItemsInNetwork then items = me.getItemsInNetwork()
  124. elseif me.getAvailableItems then items = me.getAvailableItems() end
  125. if type(items) == "table" then
  126. for i = 1, #items do
  127. local v = items[i]
  128. if v and (v.name == cfg.me_name or v.label == cfg.me_label) then
  129. amount = v.size or v.amount or 0
  130. break
  131. end
  132. end
  133. end
  134. end)
  135. return amount
  136. end
  137.  
  138. local function wrapText(textStr, maxW)
  139. local lines = {}
  140. local currentLine = ""
  141. for word in textStr:gmatch("%S+") do
  142. if unicode.wlen(currentLine) + unicode.wlen(word) + 1 > maxW then
  143. if currentLine ~= "" then table.insert(lines, currentLine) end
  144. currentLine = word
  145. while unicode.wlen(currentLine) > maxW do
  146. table.insert(lines, unicode.sub(currentLine, 1, maxW))
  147. currentLine = unicode.sub(currentLine, maxW + 1)
  148. end
  149. else
  150. currentLine = currentLine == "" and word or (currentLine .. " " .. word)
  151. end
  152. end
  153. if currentLine ~= "" then table.insert(lines, currentLine) end
  154. return lines
  155. end
  156.  
  157. local function updateAR()
  158. if not opb then return end
  159. local success, err = pcall(function()
  160. opb.clear()
  161. local leftColH = 8
  162. if cfg.ar_radar_enabled then leftColH = leftColH + 12 + (#nearbyPlayers > 0 and #nearbyPlayers * 8 or 8) end
  163. if cfg.ar_me_enabled then leftColH = leftColH + 20 end
  164. local rightColH = 8
  165. if cfg.ar_chat_enabled then rightColH = rightColH + 8 + (#arChatLog * 8) end
  166. local totalH = math.max(leftColH, rightColH) + 10
  167. if totalH < 25 then totalH = 25 end
  168. local bx, by, bw = cfg.hudX, cfg.hudY, cfg.hudW
  169. opb.addBox(bx, by, bw, totalH, 0x050F1A, 0.4)
  170. opb.addBox(bx, by, bw, 1, 0x00E5FF, 0.5)
  171. opb.addBox(bx, by + totalH - 1, bw, 1, 0x00E5FF, 0.5)
  172. local divX = bx + 95
  173. opb.addBox(divX, by + 2, 1, totalH - 4, 0x1A4059, 0.5)
  174. local leftX = bx + 5
  175. local rightX = divX + 5
  176. local curY = by + 3
  177.  
  178. if cfg.ar_radar_enabled then
  179. opb.addText(leftX, curY, "CONTACTS IN RANGE", 0xFF2A2A).setScale(0.7)
  180. curY = curY + 11
  181. if #nearbyPlayers == 0 then
  182. opb.addText(leftX, curY, "NO CONTACTS", 0x4A7B9C).setScale(0.7)
  183. curY = curY + 9
  184. else
  185. for _, pName in ipairs(nearbyPlayers) do
  186. opb.addText(leftX, curY, pName, 0xFF7A7A).setScale(0.7)
  187. curY = curY + 9
  188. end
  189. end
  190. curY = curY + 4
  191. end
  192.  
  193. if cfg.ar_me_enabled then
  194. opb.addText(leftX, curY, "TRACKING: VIS", 0x00FF9D).setScale(0.7)
  195. curY = curY + 10
  196. if cfg.me_scan_enabled then
  197. opb.addText(leftX, curY, "Храниться: " .. formatNum(matter_current), 0xE0F7FA).setScale(0.7)
  198. curY = curY + 8
  199. local rateSign = matter_rate >= 0 and "+" or ""
  200. opb.addText(leftX, curY, string.format("STATUS: %s%s/min", rateSign, formatNum(matter_rate)), 0x00E5FF).setScale(0.7)
  201. curY = curY + 10
  202. else
  203. opb.addText(leftX, curY, "Храниться: -- PAUSED --", 0x4A7B9C).setScale(0.7)
  204. curY = curY + 8
  205. opb.addText(leftX, curY, "STATUS: STANDBY", 0x4A7B9C).setScale(0.7)
  206. curY = curY + 10
  207. end
  208. end
  209.  
  210. if cfg.ar_chat_enabled then
  211. local chatY = by + 3
  212. for _, item in ipairs(arChatLog) do
  213. if item.type == "name" then opb.addText(rightX, chatY, item.text, 0x00E5FF).setScale(0.7)
  214. else local cleanMsg = item.text:gsub("^> ", ""); opb.addText(rightX, chatY, cleanMsg, 0xE0F7FA).setScale(0.7) end
  215. chatY = chatY + 9
  216. end
  217. end
  218. opb.sync()
  219. end)
  220. if not success then ar_error = tostring(err) else ar_error = nil end
  221. end
  222.  
  223. local function addChatMessage(name, msg)
  224. if msg:sub(1,1) == "!" then return end
  225. local pc_max_w = col2_w - 6
  226. local prefixLen = unicode.wlen(name) + 4
  227. local wrappedPC = wrapText(msg, pc_max_w - prefixLen)
  228. for i, line in ipairs(wrappedPC) do
  229. if i == 1 then table.insert(chatLog, string.format("&8> &b%s&8:&f %s", name, line))
  230. else table.insert(chatLog, "&f " .. line) end
  231. end
  232. local maxChatLines = h - 7
  233. while #chatLog > maxChatLines do table.remove(chatLog, 1) end
  234. table.insert(arChatLog, {type = "name", text = name})
  235. local wrappedAR = wrapText(msg, cfg.ar_chat_width)
  236. for _, line in ipairs(wrappedAR) do table.insert(arChatLog, {type = "msg", text = "> " .. line}) end
  237. while #arChatLog > 12 do table.remove(arChatLog, 1) end
  238. chatUpdated = true; updateAR()
  239. end
  240.  
  241. local function scanEnvironment()
  242. nearbyPlayers = {}
  243. if sensor then
  244. pcall(function()
  245. local result = sensor.getPlayers()
  246. if type(result) == "table" then
  247. for k, v in pairs(result) do
  248. local pName = "Unknown"
  249. if type(v) == "table" and v.name then pName = v.name
  250. elseif type(v) == "string" then pName = v
  251. elseif type(k) == "string" then pName = k end
  252. if pName ~= "Unknown" then
  253. local isIgnored = false
  254. for _, ignoredName in ipairs(cfg.playerConfig.ignore) do if pName:lower() == ignoredName:lower() then isIgnored = true break end end
  255. if not isIgnored then
  256. local displayName = pName
  257. if cfg.playerConfig.prefixes[pName] then displayName = cfg.playerConfig.prefixes[pName] .. pName end
  258. table.insert(nearbyPlayers, displayName)
  259. end
  260. end
  261. end
  262. end
  263. end)
  264. end
  265. updateAR()
  266. end
  267.  
  268. local function drawStaticUI()
  269. gpu.setBackground(C.BG); gpu.fill(1, 1, w, h, " ")
  270. text(2, 1, "PRISMA NEURAL CORE v3.2 // SECURE UPLINK", C.TEXT_MAIN)
  271. text(w - 25, 1, "STATUS: INTEGRITY OK", C.OK)
  272. gpu.setForeground(C.FRAME); gpu.set(1, 2, string.rep("─", w))
  273. drawTechFrame(1, 3, col1_w, h - 3, "PWR MATRIX")
  274. drawTechFrame(col1_w + 2, 3, col2_w, h - 3, "TTY // COMMS")
  275. drawTechFrame(col1_w + col2_w + 3, 3, col3_w, math.floor(h/2) - 1, "RADAR TOPOGRAPHY")
  276. drawTechFrame(col1_w + col2_w + 3, math.floor(h/2) + 3, col3_w, h - math.floor(h/2) - 3, "ASSETS // ME")
  277. drawTechFrame(w - col4_w + 1, 3, col4_w, h - 3, "SYS CONTROLS")
  278. text(3, 5, "PWR LVL:", C.TEXT_DIM); text(3, 6, "TGT LVL:", C.TEXT_DIM); text(3, 7, "NET FLW:", C.TEXT_DIM)
  279. local by = h - 6
  280. drawButton("tplus", 3, by, 9, 1, "[+1G]", C.BTN_ON, C.OK); drawButton("tmid", 13, by, 3, 1, "%", C.BTN_OFF, C.TEXT_WHITE); drawButton("tminus", 17, by, 9, 1
  281. drawButton("flowcfg", 3, by + 2, col1_w - 4, 1, "OVERRIDE LIMITS", C.BTN_OFF, C.TEXT_MAIN)
  282. local barX, barY, barH = col1_w - 3, 9, h - 17
  283. for i = 0, 5 do local p = 100 - (i * 20); text(barX - 4, barY + math.floor((i/5)*(barH-1)), string.format("%3d", p), C.TEXT_DIM) end
  284. needFullRedraw = false; chatUpdated = true
  285. end
  286.  
  287. local function updateDynamicUI(flow)
  288. text(12, 5, string.format("%-9s", formatNum(lastE)), C.TEXT_WHITE); text(12, 6, string.format("%-9s", formatNum(cfg.target)), C.TEXT_MAIN); text(12, 7, stri
  289. local maxE = (rf and rf.getMaxEnergyStored and rf.getMaxEnergyStored()) or 1; local pct = clamp(maxE > 0 and (lastE / maxE) or 0, 0, 1); local barX, barY, b
  290. if chatUpdated then local cx = col1_w + 4; gpu.setBackground(C.BG); gpu.fill(cx, 4, col2_w - 4, h - 5, " "); for i, line in ipairs(chatLog) do drawColoredTe
  291. local rx = col1_w + col2_w + 5; local ry = 5; text(rx, ry, "SCAN COMPLETE.", C.TEXT_DIM); text(rx, ry + 2, "CONTACTS IN RANGE: " .. #nearbyPlayers, C.TEXT_W
  292. for i=1, 5 do if nearbyPlayers[i] then text(rx, ry + 3 + i, "> " .. string.sub(nearbyPlayers[i], 1, 24), C.ALERT) else text(rx, ry + 3 + i, string.rep(" ",
  293.  
  294. local my = math.floor(h/2) + 5
  295. drawButton("btn_me_scan", rx, my, 14, 1, cfg.me_scan_enabled and "[ SCAN: ON ]" or "[ SCAN: OFF]", cfg.me_scan_enabled and C.BTN_ON or C.BTN_OFF, cfg.me_sca
  296. text(rx + 16, my, (me and "LINKED" or "OFFLINE"), me and C.OK or C.ALERT)
  297. text(rx, my + 2, "TRACKING: VIS", C.TEXT_DIM)
  298.  
  299. if cfg.me_scan_enabled then
  300. text(rx, my + 4, "Храниться: " .. formatNum(matter_current), C.TEXT_WHITE)
  301. local rateSign = matter_rate >= 0 and "+" or ""
  302. local rateColor = matter_rate > 0 and C.OK or (matter_rate < 0 and C.ALERT or C.TEXT_WHITE)
  303. text(rx, my + 6, string.format("STATUS: %s%s / min", rateSign, formatNum(matter_rate)), rateColor)
  304. else
  305. text(rx, my + 4, "Храниться: -- PAUSED --", C.TEXT_DIM)
  306. text(rx, my + 6, "STATUS: STANDBY", C.TEXT_DIM)
  307. end
  308.  
  309. local sx = w - col4_w + 3; local bridgeStatus = ar_error and "API ERROR" or (opb and "LINKED" or "OFFLINE"); text(sx, 5, "AR BRIDGE: " .. bridgeStatus, ar_e
  310. drawButton("tog_chat", sx, 7, 12, 1, cfg.ar_chat_enabled and "[CHT:ON]" or "[CHT:OFF]", cfg.ar_chat_enabled and C.BTN_ON or C.BTN_OFF, cfg.ar_chat_enabled a
  311. drawButton("tog_radar", sx + 14, 7, 12, 1, cfg.ar_radar_enabled and "[RDR:ON]" or "[RDR:OFF]", cfg.ar_radar_enabled and C.BTN_ON or C.BTN_OFF, cfg.ar_radar_
  312. drawButton("tog_me", sx, 9, 12, 1, cfg.ar_me_enabled and "[ ME:ON]" or "[ ME:OFF]", cfg.ar_me_enabled and C.BTN_ON or C.BTN_OFF, cfg.ar_me_enabled and C.OK
  313.  
  314. drawButton("btn_ignore", sx, 11, 26, 1, "[MANAGE IGNORE LIST]", C.BTN_OFF, C.TEXT_WHITE)
  315. drawButton("btn_prefix", sx, 13, 26, 1, "[SET PLAYER PREFIX]", C.BTN_OFF, C.TEXT_MAIN)
  316. end
  317.  
  318. local function drawFlowMenu()
  319. local mw, mh = 42, 8; local mx, my = math.floor((w - mw) / 2), math.floor((h - mh) / 2); gpu.setBackground(C.FRAME_DIM); gpu.fill(mx, my, mw, mh, " ")
  320. gpu.setForeground(C.TEXT_MAIN); gpu.set(mx + 2, my + 1, "/// OVERRIDE CONFIGURATION"); gpu.setForeground(C.TEXT_WHITE); gpu.set(mx + 2, my + 3, string.forma
  321. drawButton("f_minus10m", mx + 2, my + 5, 8, 1, "-10M", 0x471C1C, C.ALERT); drawButton("f_minus1m", mx + 11, my + 5, 8, 1, "-1M", 0x471C1C, C.TEXT_WHITE); dr
  322. end
  323.  
  324. local function drawIgnoreMenu()
  325. local mw, mh = 46, 14
  326. local mx, my = math.floor((w - mw) / 2), math.floor((h - mh) / 2)
  327. gpu.setBackground(C.FRAME_DIM); gpu.fill(mx, my, mw, mh, " ")
  328. drawTechFrame(mx, my, mw, mh, "MANAGE IGNORE LIST")
  329.  
  330. local startY = my + 2
  331. if #cfg.playerConfig.ignore == 0 then
  332. text(mx + 4, startY + 2, "Ignore list is completely empty.", C.TEXT_DIM, C.FRAME_DIM)
  333. for i = 1, 6 do buttons["unig_" .. i] = nil end
  334. else
  335. for i = 1, 6 do
  336. local name = cfg.playerConfig.ignore[i]
  337. if name then
  338. text(mx + 3, startY + i - 1, string.format("%d. %-18s", i, name), C.TEXT_WHITE, C.FRAME_DIM)
  339. drawButton("unig_" .. i, mx + 30, startY + i - 1, 12, 1, "[REMOVE]", 0x471C1C, C.ALERT)
  340. else
  341. gpu.setBackground(C.FRAME_DIM); gpu.fill(mx + 3, startY + i - 1, mw - 6, 1, " ")
  342. buttons["unig_" .. i] = nil
  343. end
  344. end
  345. end
  346.  
  347. drawButton("ig_add", mx + 3, my + mh - 3, 16, 1, "[+ ADD PLAYER]", C.BTN_ON, C.OK)
  348. drawButton("ig_close", mx + mw - 15, my + mh - 3, 12, 1, "[CLOSE]", C.BTN_OFF, C.TEXT_WHITE)
  349. end
  350.  
  351. local function readInput(title, promptText)
  352. while event.pull(0) do end
  353. local mw, mh = 54, 8
  354. local mx, my = math.floor((w - mw) / 2), math.floor((h - mh) / 2)
  355. local textStr = ""
  356. local inputX = mx + 2 + unicode.wlen(promptText) + 2
  357. local maxInputW = mw - (inputX - mx) - 4
  358. local needRedraw = true
  359.  
  360. while true do
  361. if needRedraw then
  362. gpu.setBackground(C.FRAME_DIM)
  363. gpu.fill(mx, my, mw, mh, " ")
  364. drawTechFrame(mx, my, mw, mh, title)
  365. text(mx + 2, my + 3, promptText .. ": ", C.TEXT_WHITE, C.FRAME_DIM)
  366. gpu.setBackground(C.BTN_OFF)
  367. gpu.fill(inputX, my + 3, maxInputW, 1, " ")
  368. gpu.setForeground(C.TEXT_MAIN)
  369. local displayText = textStr .. "|"
  370. gpu.set(inputX, my + 3, unicode.sub(displayText, -maxInputW + 1))
  371. drawButton("inp_ok", mx + 6, my + 5, 16, 1, "[ OK ]", C.BTN_ON, C.OK)
  372. drawButton("inp_cancel", mx + 32, my + 5, 16, 1, "[ CANCEL ]", 0x471C1C, C.ALERT)
  373. needRedraw = false
  374. end
  375.  
  376. local ev, _, a1, a2, a3 = event.pull()
  377. if ev == "key_down" then
  378. if a2 == 28 then break
  379. elseif a2 == 14 then
  380. if unicode.wlen(textStr) > 0 then textStr = unicode.sub(textStr, 1, -2); needRedraw = true end
  381. elseif a2 == 1 then textStr = nil; break
  382. elseif a1 >= 32 then
  383. if unicode.wlen(textStr) < 25 then
  384. local ok, ch = pcall(unicode.char, a1)
  385. if ok and ch then textStr = textStr .. ch; needRedraw = true end
  386. end
  387. end
  388. elseif ev == "touch" then
  389. local tx, ty = a1, a2
  390. if tx >= mx + 6 and tx < mx + 22 and ty == my + 5 then break
  391. elseif tx >= mx + 32 and tx < mx + 48 and ty == my + 5 then textStr = nil; break end
  392. end
  393. end
  394.  
  395. buttons["inp_ok"] = nil; buttons["inp_cancel"] = nil
  396. needFullRedraw = true
  397. return textStr
  398. end
  399.  
  400. local lastStats, lastScan = 0, 0
  401.  
  402. gpu.setResolution(w, h); gpu.setBackground(C.BG); gpu.fill(1, 1, w, h, " ")
  403. while true do
  404. local ev, addr, arg1, arg2, arg3, arg4 = event.pull(0.5)
  405.  
  406. if ev == "chat_message" then addChatMessage(arg1, arg2)
  407. elseif ev == "touch" then
  408. local x, y = arg1, arg2
  409. if showFlowMenu then
  410. local b = buttons
  411. if b["f_close"] and x >= b["f_close"].x and x < b["f_close"].x + b["f_close"].w and y == b["f_close"].y then showFlowMenu = false; needFullRedraw =
  412. elseif b["f_minus10m"] and x >= b["f_minus10m"].x and x < b["f_minus10m"].x + b["f_minus10m"].w and y == b["f_minus10m"].y then cfg.flowMax = clamp(
  413. elseif b["f_minus1m"] and x >= b["f_minus1m"].x and x < b["f_minus1m"].x + b["f_minus1m"].w and y == b["f_minus1m"].y then cfg.flowMax = clamp(cfg.f
  414. elseif b["f_plus1m"] and x >= b["f_plus1m"].x and x < b["f_plus1m"].x + b["f_plus1m"].w and y == b["f_plus1m"].y then cfg.flowMax = clamp(cfg.flowMa
  415. elseif b["f_plus10m"] and x >= b["f_plus10m"].x and x < b["f_plus10m"].x + b["f_plus10m"].w and y == b["f_plus10m"].y then cfg.flowMax = clamp(cfg.f
  416. if showFlowMenu then drawFlowMenu() end
  417.  
  418. elseif showIgnoreMenu then
  419. local b = buttons
  420. if b["ig_close"] and x >= b["ig_close"].x and x < b["ig_close"].x + b["ig_close"].w and y == b["ig_close"].y then
  421. showIgnoreMenu = false
  422. buttons["ig_close"] = nil; buttons["ig_add"] = nil
  423. for i = 1, 6 do buttons["unig_" .. i] = nil end
  424. needFullRedraw = true
  425. elseif b["ig_add"] and x >= b["ig_add"].x and x < b["ig_add"].x + b["ig_add"].w and y == b["ig_add"].y then
  426. local pName = readInput("ADD TO IGNORE", "Nickname")
  427. if pName and pName ~= "" then
  428. local found = false
  429. for _, name in ipairs(cfg.playerConfig.ignore) do
  430. if name:lower() == pName:lower() then found = true; break end
  431. end
  432. if not found then table.insert(cfg.playerConfig.ignore, pName) end
  433. scanEnvironment()
  434. end
  435. needFullRedraw = true
  436. else
  437. for i = 1, 6 do
  438. local id = "unig_" .. i
  439. if b[id] and x >= b[id].x and x < b[id].x + b[id].w and y == b[id].y then
  440. table.remove(cfg.playerConfig.ignore, i)
  441. buttons[id] = nil
  442. scanEnvironment()
  443. needFullRedraw = true
  444. break
  445. end
  446. end
  447. end
  448. if showIgnoreMenu then drawIgnoreMenu() end
  449.  
  450. else
  451. local b = buttons
  452. if b["tplus"] and x >= b["tplus"].x and x < b["tplus"].x + b["tplus"].w and y == b["tplus"].y then cfg.target = cfg.target + (keyboard.isShiftDown()
  453. elseif b["tminus"] and x >= b["tminus"].x and x < b["tminus"].x + b["tminus"].w and y == b["tminus"].y then cfg.target = math.max(0, cfg.target - (k
  454. elseif b["flowcfg"] and x >= b["flowcfg"].x and x < b["flowcfg"].x + b["flowcfg"].w and y == b["flowcfg"].y then showFlowMenu = true; drawFlowMenu()
  455. elseif b["tog_chat"] and x >= b["tog_chat"].x and x < b["tog_chat"].x + b["tog_chat"].w and y == b["tog_chat"].y then cfg.ar_chat_enabled = not cfg.
  456. elseif b["tog_radar"] and x >= b["tog_radar"].x and x < b["tog_radar"].x + b["tog_radar"].w and y == b["tog_radar"].y then cfg.ar_radar_enabled = no
  457. elseif b["tog_me"] and x >= b["tog_me"].x and x < b["tog_me"].x + b["tog_me"].w and y == b["tog_me"].y then cfg.ar_me_enabled = not cfg.ar_me_enable
  458. elseif b["btn_ignore"] and x >= b["btn_ignore"].x and x < b["btn_ignore"].x + b["btn_ignore"].w and y == b["btn_ignore"].y then showIgnoreMenu = tru
  459. elseif b["btn_me_scan"] and x >= b["btn_me_scan"].x and x < b["btn_me_scan"].x + b["btn_me_scan"].w and y == b["btn_me_scan"].y then
  460. cfg.me_scan_enabled = not cfg.me_scan_enabled; needFullRedraw = true; updateAR()
  461. elseif b["btn_prefix"] and x >= b["btn_prefix"].x and x < b["btn_prefix"].x + b["btn_prefix"].w and y == b["btn_prefix"].y then
  462. local pName = readInput("PREFIX CONFIG", "Player Nick")
  463. if pName and pName ~= "" then
  464. local pPref = readInput("PREFIX CONFIG", "Prefix (or leave empty)")
  465. if pPref then
  466. if pPref == "" then cfg.playerConfig.prefixes[pName] = nil
  467. else cfg.playerConfig.prefixes[pName] = pPref end
  468. scanEnvironment()
  469. end
  470. end
  471. end
  472. end
  473. lastStats = 0
  474. end
  475.  
  476. local now = computer.uptime()
  477. if now - lastScan >= 2 then scanEnvironment(); lastScan = now end
  478. if now - lastStats >= 1 then
  479. tick_counter = tick_counter + 1
  480.  
  481. if rf and gate then local cur = rf.getEnergyStored(); currentFlow = gate.getFlow() or 0; filVal = filVal + ((cur - lastE) - filVal) * 0.3; local desired
  482.  
  483. if cfg.me_scan_enabled then
  484. matter_current = fetchMatterAmount()
  485. if now - me_timer >= 10 then
  486. if me_timer > 0 then matter_rate = (matter_current - matter_last) * 6 end
  487. matter_last = matter_current; me_timer = now; updateAR()
  488. end
  489. else
  490. matter_current = 0; matter_rate = 0; me_timer = now
  491. end
  492.  
  493. if needFullRedraw then drawStaticUI() end
  494. if showFlowMenu then drawFlowMenu()
  495. elseif showIgnoreMenu then drawIgnoreMenu()
  496. else updateDynamicUI(currentFlow) end
  497. lastStats = now
  498. end
  499. end
  500.  
Advertisement
Add Comment
Please, Sign In to add comment