Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cable_side = "back"
- input_side = "front"
- function load_state()
- file = fs.open("state", "r")
- state = file.readAll()
- return state
- end
- function save_state(state)
- file = fs.open("state", "w")
- file.write(state)
- file.close()
- end
- function open_door()
- for i=0,6 do
- rs.setBundledOutput(cable_side, colors.black)
- sleep(.5)
- rs.setBundledOutput(cable_side, 0)
- sleep(.5)
- end
- end
- function close_door()
- for i=0,6 do
- rs.setBundledOutput(cable_side, colors.white)
- sleep(.5)
- rs.setBundledOutput(cable_side, 0)
- sleep(.5)
- end
- end
- while true do
- os.pullEvent("redstone")
- if rs.getInput(input_side) then
- if load_state() == "true" then --tür auf
- close_door()
- save_state("false")
- elseif load_state() == "false" then --tür zu
- open_door()
- save_state("true")
- end
- end
- end
Add Comment
Please, Sign In to add comment