Advertisement
AssortedBrunoz

radar

Oct 27th, 2024 (edited)
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.55 KB | None | 0 0
  1. local max_x, max_y = term.getSize()
  2. local radius,c_x,c_z = ...
  3. local black_list = {["Nunoto"]=true, ["Paratiel_"]=true, ["Krossegurke"]=true, ["Galaxy1121"]=true, ["BillyBopBeans"]=true, ["Hunterman4488"]=true,["thediamondman199"]=true}
  4.  
  5. if not radius then
  6.     write("INSERT RADIUS: ")
  7.     radius = tonumber(read())
  8.     write("INSERT X: ")
  9.     c_x = tonumber(read())
  10.     write("INSERT Z: ")
  11.     c_z = tonumber(read())
  12. else
  13.     radius,c_x,c_z = ...
  14. end
  15.  
  16. monitor = peripheral.wrap("top")
  17.  
  18. term.redirect(monitor)
  19.  
  20. function string.split(str, sep)
  21.     if sep == nil then
  22.         sep = "%s"
  23.     end
  24.     local t = {}
  25.     for sr in string.gmatch(str, "([^"..sep.."]+)") do
  26.         table.insert(t, sr)
  27.     end
  28.     return t
  29. end
  30. function int(n)
  31.     return tonumber(n)
  32. end
  33.  
  34. local interpolate = (c_z*2)/max_y
  35. term.clear()
  36. term.setCursorPos(1,1)
  37. while true do
  38.     local git = http.get("https://raw.githubusercontent.com/banana-boye/cannon-thingy/refs/heads/test/main.json")
  39.     local info = textutils.unserialiseJSON(git.readAll())
  40.     term.clear()
  41.     term.setCursorPos(1,1)
  42.  
  43.     for player, c_string in pairs(info) do
  44.         local spl = string.split(string.sub(c_string,2,#c_string-1), " | ")
  45.         local x,y,z = tonumber(spl[1]),tonumber(spl[2]),tonumber(spl[3])
  46.         if (x >= c_x-radius and x <= c_x+radius) and (z >= c_z-radius and z <= c_z+radius) and not black_list[player] then
  47.             write(player.." found at "..c_string..os.date(" -> %H:%M:%S \n"))
  48.         end
  49.     end
  50.  
  51.     paintutils.drawPixel(max_x/2,max_y/2)
  52.  
  53.     os.sleep(5)
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement