local open = false
local dlock = "bottom"
local dsafe = "back"
redstone.setBundledOutput(dlock, 1)
redstone.setOutput(dsafe, true)
while true do
local pe1, pe2 = os.pullEvent()
if(pe1 == "monitor_touch") then
print(pe2)
if(open == false) then
redstone.setBundledOutput(dlock, 3)
sleep(2)
redstone.setBundledOutput(dlock, 2)
open = true
elseif(open == true) then
redstone.setBundledOutput(dlock, 3)
sleep(2)
redstone.setBundledOutput(dlock, 1)
open = false
end
elseif(pe1=="mouse_click") then
redstone.setOutput(dsafe, false)
redstone.setBundledOutput(dlock, 0)
os.shutdown()
end
end