serafim7

OpenSecurity сенсор entity detector [OpenComputers]

Nov 8th, 2020 (edited)
2,216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. local term = require('term')
  2. local computer = require("computer")
  3. local com = require('component')
  4. local sensor = com.isAvailable("os_entdetector") and com.os_entdetector or error("нет сенсора entity detector")
  5. local gpu = com.gpu
  6.  
  7. -- Белый список ---
  8. white = {
  9.   none = false
  10. }
  11.  
  12. gpu.setResolution(35,15)
  13.  
  14. while true do
  15.   pl = sensor.scanPlayers(64)
  16.   term.clear()
  17.   gpu.setForeground(0xffb600)
  18.   gpu.set(2,1, 'В зоне обнаружения радара: '..#pl..' чел.')
  19.   for i = 1, #pl do
  20.     if white[pl[i].name] then
  21.       gpu.setForeground(0x00ff00)
  22.     else
  23.       gpu.setForeground(0xff0000)
  24.       computer.beep(440, 1)
  25.     end
  26.     gpu.set(2, i+1, i..'. '..pl[i].name)
  27.     gpu.set(25, i+1, ' - '..math.floor(pl[i].range)..' м')
  28.   end
  29.   os.sleep(5)
  30. end
Add Comment
Please, Sign In to add comment