Advertisement
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()
- rs.setBundledOutput(cable_side, colors.lime)
- sleep(.5)
- rs.setBundledOutput(cable_side, 0)
- sleep(.5)
- rs.setBundledOutput(cable_side, colors.combine(colors.lime, colors.gray))
- sleep(.5)
- rs.setBundledOutput(cable_side, 0)
- sleep(.5)
- rs.setBundledOutput(cable_side, colors.combine(colors.lime, colors.gray, colors.brown))
- sleep(.5)
- rs.setBundledOutput(cable_side, 0)
- sleep(.5)
- rs.setBundledOutput(cable_side, colors.combine(colors.lime, colors.gray, colors.brown, colors.black))
- sleep(.5)
- end
- function close_door()
- rs.setBundledOutput(cable_side, colors.combine(colors.white, colors.orange, colors.yellow, colors.lightBlue))
- sleep(.5)
- rs.setBundledOutput(cable_side, 0)
- sleep(.5)
- rs.setBundledOutput(cable_side, colors.combine(colors.orange, colors.yellow, colors.lightBlue))
- sleep(.5)
- rs.setBundledOutput(cable_side, 0)
- sleep(.5)
- rs.setBundledOutput(cable_side, colors.combine(colors.yellow, colors.lightBlue))
- sleep(.5)
- rs.setBundledOutput(cable_side, 0)
- sleep(.5)
- rs.setBundledOutput(cable_side, colors.lightBlue)
- sleep(.5)
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement