Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("ocs/apis/sensor")
- door = peripheral.wrap("monitor_1")
- door.setTextScale(0.5)
- radar = sensor.wrap("right")
- --You'll need to alter these to set the names of people you want to allows for
- allow = {}
- allow.Glitcher = true
- allow.buncible = true
- allow.nipde = true
- allow.DaveChaos = true
- allow._gar = false
- --You'll need to alter these/this to set the names of people you don't want to allow in
- avoid = {}
- avoid._gar = true
- --You'll need to alter these to match the distances you want to look for.
- xMin = -5
- xMax = -1
- yMin = -6
- yMax = -4
- term.redirect(door)
- handGood = paintutils.loadImage("handGood")
- handBad = paintutils.loadImage("handBad")
- handNormal = paintutils.loadImage("hand")
- paintutils.drawImage(handNormal,1,1)
- local function checkInRange(number, min, max)
- return number >= min and number <= max
- end
- local function checkTargets(targets, compare)
- for k,v in pairs(compare) do
- if targets[k] then
- --print(targets[k].Position.X," ", targets[k].Position.Z)
- --sleep(8)
- if checkInRange(targets[k].Position.X, xMin, xMax) then
- if checkInRange(targets[k].Position.Z, yMin, yMax) then
- return true
- end
- end
- end
- end
- return false
- end
- while true do
- timer = os.startTimer(9)
- e, k = os.pullEvent()
- if e == "monitor_touch" then
- if checkTargets(radar.getTargets(),allow) and not checkTargets(radar.getTargets(), avoid) then
- paintutils.drawImage(handGood, 1,1)
- rs.setOutput("front", true)
- sleep(2)
- os.reboot()
- else
- paintutils.drawImage(handBad, 1,1)
- sleep(3)
- os.reboot()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement