SHOW:
|
|
- or go back to the newest paste.
1 | - | --Open door if radar see player |
1 | + | --Open door if radar see player (Component Radar) |
2 | - | --Beelzebub dreamfinity Technocracy for City17 |
2 | + | --Beelzebub dreamfinity Technocracy for clan City17 |
3 | - | ----[ Библиотеки ]---- |
3 | + | --Радар багаеться если в его радиусе находиться 2 или более игроков из вайт листа |
4 | - | local component = require("component") |
4 | + | --Так что советую использовать прогу только в одиночку, либо переделывать под сенсор |
5 | - | local sides = require("sides") |
5 | + | --Из OpenPhieral (но у нас на Technocracy его нету) |
6 | - | local term = require("term") |
6 | + | --Чуть ранее я выкладывал программу для сенсора на моём пастебине, см там. |
7 | - | ----[ Константы ]---- |
7 | + | ----[ Библиотеки ]---- |
8 | - | local gpu = component.gpu |
8 | + | local component = require("component") |
9 | - | ----[ Код ]---- |
9 | + | local sides = require("sides") |
10 | - | --gpu.setResolution(35,10) |
10 | + | local term = require("term") |
11 | - | gpu.setResolution(140,40) |
11 | + | ----[ Константы ]---- |
12 | - | -- Цвета -- |
12 | + | local gpu = component.gpu |
13 | - | color = { |
13 | + | ----[ Код ]---- |
14 | - | green = 0x00ff00, |
14 | + | --gpu.setResolution(10,3) |
15 | - | yellow = 0xffb600, |
15 | + | gpu.setResolution(140,40) |
16 | - | red = 0xff0000 |
16 | + | term.clear() |
17 | - | } |
17 | + | ---- Цвета ---- |
18 | - | -- Белый список --- |
18 | + | color = { |
19 | - | white = { |
19 | + | green = 0x00ff00, |
20 | - | Beelzebub = true, |
20 | + | red = 0xff0000 |
21 | - | rrr_game = true, |
21 | + | } |
22 | - | AlexeyRepin = true, |
22 | + | ---- Белый список ---- |
23 | - | RedMaster12341 = true |
23 | + | white = { |
24 | - | } |
24 | + | Beelzebub = true |
25 | - | |
25 | + | } |
26 | - | while true do |
26 | + | |
27 | - | local sensor = component.radar.getPlayers() |
27 | + | local function CoreScreenFix() |
28 | - | for i = 1, #sensor do |
28 | + | comp.gpu.bind(comp.screen.address,true) |
29 | - | if white[sensor[i].name] then |
29 | + | buffer.setResolution(80,25) |
30 | - | if sensor[i].distance <= 4 then |
30 | + | end |
31 | - | component.redstone.setOutput(sides.up,0) |
31 | + | local antiFreezeTimer = require("event").timer(15,CoreScreenFix,math.huge) |
32 | - | gpu.setForeground(color.green) |
32 | + | |
33 | - | else |
33 | + | while true do |
34 | - | component.redstone.setOutput(sides.up,15) |
34 | + | local sensor = component.radar.getPlayers() |
35 | - | gpu.setForeground(color.red) |
35 | + | for i = 1, #sensor do |
36 | - | end |
36 | + | if white[sensor[i].name] then |
37 | - | term.clear() |
37 | + | if sensor[i].distance <= 4 then |
38 | - | print(sensor[i].name) |
38 | + | name = sensor[i].name |
39 | - | print(sensor[i].distance) |
39 | + | distance = sensor[i].distance |
40 | - | end |
40 | + | component.redstone.setOutput(sides.up,0) |
41 | - | end |
41 | + | gpu.setForeground(color.green) |
42 | - | |
42 | + | else |
43 | - | end |
43 | + | name = sensor[i].name |
44 | distance = sensor[i].distance | |
45 | component.redstone.setOutput(sides.up,15) | |
46 | gpu.setForeground(color.red) | |
47 | end | |
48 | local name2 = tostring(name) | |
49 | local distance2 = tostring(distance) | |
50 | gpu.set(1,2,name2) | |
51 | gpu.set(1,3,distance2) | |
52 | end | |
53 | end | |
54 | os.sleep(0.005) | |
55 | end | |
56 | --В планах сделать программу на 100 процентов рабочей. | |
57 | --И как нибудь закостылить косяки радара дабы он адекватно работал с несколькими игроками. | |
58 | --Fix вывод |