Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local co = require("component")
- local sen = co.motion_sensor
- local event = require("event")
- local sides = require("sides")
- local red = co.redstone
- print("Порог чувствительности: ", sen.getSensitivity())
- print("Отключить сигнализацию - любая клавиша")
- print("Завершить программу - Q")
- print()
- print("Список посетителей:")
- local name, n
- local q = true
- local quests = {}
- -- Вайтлист
- local whiteList = {"cloud", "LeShyj", "entity.Cat.name", "reload", "karnel"}
- -- Сирена
- local function sos()
- local z = true
- for i = 1, #whiteList do
- if whiteList[i] == name then
- z = false
- end
- end
- if z then
- red.setOutput(1, 15) -- Выдаёт сигнал сверху красного контроллера.
- end
- end
- while q do
- local b = true
- n, _, _, m, _, name = event.pull()
- if n == "motion" then
- for i = 1, #quests do
- if quests[i] == name then
- b = false
- end
- end
- if b == true then
- table.insert(quests, name)
- print(name)
- sos()
- end
- end
- if n == "key_down" then
- red.setOutput(1, 0)
- if m == 16 then
- q = false
- print("Программа завершена.")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement