Advertisement
konalisp

Door (door.lua)

May 26th, 2015
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.47 KB | None | 0 0
  1. --courtesy of Bomb Bloke
  2. local function oc(state)
  3.     redstone.setOutput("back", state)
  4.     redstone.setOutput("front", state)
  5. end
  6.  
  7. while true do
  8.     if redstone.getInput("left") or redstone.getInput("right") then
  9.         oc(false)
  10.         os.pullEvent("redstone")  -- Yield until a redstone state change occurs.
  11.     else
  12.         oc(commands.exec("testfor @a[r=3]"))
  13.         sleep(0.2)  -- Bigger sleep here = less server load, but less frequent checks.
  14.     end
  15. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement