Advertisement
systox

pamacha tür

Sep 25th, 2020 (edited)
1,091
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. cable_side = "back"
  2. input_side = "front"
  3. state = false --is open
  4.  
  5.  
  6. function close_door()
  7.     rs.setBundledOutput(cable_side, colors.green)
  8.     sleep(.5)
  9.     rs.setBundledOutput(cable_side, 0)
  10.     sleep(.5)
  11.     rs.setBundledOutput(cable_side, colors.yellow)
  12.     sleep(.5)
  13.     rs.setBundledOutput(cable_side, colors.combine(colors.white, colors.yellow))
  14.     sleep(.5)
  15. end
  16.  
  17. function open_door()
  18.     rs.setBundledOutput(cable_side, colors.yellow)
  19.     sleep(.5)
  20.     rs.setBundledOutput(cable_side, 0)
  21.     sleep(.5)
  22.     rs.setBundledOutput(cable_side, colors.green)
  23.     sleep(.5)
  24.     rs.setBundledOutput(cable_side, colors.combine(colors.white, colors.green))
  25.     sleep(.5)
  26.     rs.setBundledOutput(cable_side, colors.green)
  27.     sleep(.5)
  28.     rs.setBundledOutput(cable_side, 0)
  29.     sleep(.5)
  30.     rs.setBundledOutput(cable_side, colors.white)
  31.     sleep(.5)
  32.     rs.setBundledOutput(cable_side, 0)
  33.     sleep(.5)
  34. end
  35.  
  36.  
  37. while true do
  38.     os.pullEvent("redstone")
  39.    
  40.     if rs.getInput(input_side) then
  41.         if state then
  42.             close_door()
  43.             state = false
  44.         else
  45.             open_door()
  46.             state = true
  47.         end
  48.     end
  49. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement