Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local TobiasId = 21
- local YannikId = 17
- local RobertId = 20
- local rednetSide = 'top'
- local closeSide = 'right'
- local openSide = 'left'
- local doorOpenTime = 200
- local doorSize = 3
- --Do not change, otherwise you will have problems!
- local counter = 0
- local function isValid(id)
- if id == TobiasId then
- return true
- end
- if id == YannikId then
- return true
- end
- if id == RobertId then
- return true
- end
- return false
- end
- local function openDoor()
- while counter < doorSize do
- redstone.setOutput(openSide, true)
- sleep(5)
- redstone.setOutput(openSide, false)
- counter = counter + 1
- end
- counter = 0
- end
- local function closeDoor()
- while counter < doorSize do
- redstone.setOutput(closeSide, true)
- sleep(5)
- redstone.setOutput(closeSide, false)
- counter = counter + 1
- end
- counter = 0
- end
- --Hauptprogramm
- rednet.open(rednetSide)
- id,message,distance = rednet.receive()
- if isValid(id) == true then
- if distance < 500 then
- openDoor
- sleep(doorOpenTime)
- closeDoor
- sleep(10)
- end
- end
- rednet.close(rednetSide)
- os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement