-- Proximity door by Immington Industries (snirkimmington) -- Requires OpenPeripheral Sensor block attached to computer. -- For a door that opens when you sneek, see http://pastebin.com/Qwhb3c2e -- R.S. signal will output when you approach the door. -- Adjust the peripheral wrapping and min/max values. -- Can be set to enable/disable R.S. on detection. local sensor = peripheral.wrap('left') -- where the sensor is local output = 'right' -- Where to output the signal local initial = true -- What to output when no one's around -- How close you need to be to the sensor in order to use it. local minX = -2 local maxX = 2 local minY = 0 local maxY = 2 local minZ = -2 local maxZ = 2 -- Initial output redstone.setOutput(output, initial) while true do players = sensor.getPlayerNames() -- Don't do checks if there are no players. if #players == 0 then redstone.setOutput(output, initial) sleep(0.7) else -- There are players for _, name in pairs(players) do -- You can replace this with "if name == 'yourname'" to check for you -- For example, if name == 'snirkimmington' on my door. if name ~= '' then info = sensor.getPlayerData(name) pos = info.position if pos.x >= minX and pos.x <= maxX and pos.y >= minY and pos.y <= maxY and pos.z >= minZ and pos.z <= maxZ then redstone.setOutput(output, not initial) break end end end -- There are players around, we need to be more responsive sleep(0.5) end end