Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Open door if radar see player (Component Radar)
- --Beelzebub dreamfinity Technocracy for clan City17
- --Радар багаеться если в его радиусе находиться 2 или более игроков из вайт листа
- --Так что советую использовать прогу только в одиночку, либо переделывать под сенсор
- --Из OpenPhieral (но у нас на Technocracy его нету)
- --Чуть ранее я выкладывал программу для сенсора на моём пастебине, см там.
- ----[ Библиотеки ]----
- local component = require("component")
- local sides = require("sides")
- local term = require("term")
- ----[ Константы ]----
- local gpu = component.gpu
- ----[ Код ]----
- --gpu.setResolution(10,3)
- gpu.setResolution(140,40)
- term.clear()
- ---- Цвета ----
- color = {
- green = 0x00ff00,
- red = 0xff0000
- }
- ---- Белый список ----
- white = {
- Beelzebub = true
- }
- local function CoreScreenFix()
- comp.gpu.bind(comp.screen.address,true)
- buffer.setResolution(80,25)
- end
- local antiFreezeTimer = require("event").timer(15,CoreScreenFix,math.huge)
- while true do
- local sensor = component.radar.getPlayers()
- for i = 1, #sensor do
- if white[sensor[i].name] then
- if sensor[i].distance <= 4 then
- name = sensor[i].name
- distance = sensor[i].distance
- component.redstone.setOutput(sides.up,0)
- gpu.setForeground(color.green)
- else
- name = sensor[i].name
- distance = sensor[i].distance
- component.redstone.setOutput(sides.up,15)
- gpu.setForeground(color.red)
- end
- local name2 = tostring(name)
- local distance2 = tostring(distance)
- gpu.set(1,2,name2)
- gpu.set(1,3,distance2)
- end
- end
- os.sleep(0.005)
- end
- --В планах сделать программу на 100 процентов рабочей.
- --И как нибудь закостылить косяки радара дабы он адекватно работал с несколькими игроками.
- --Fix вывод
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement