SHARE
TWEET

chest.lua

a guest Jun 19th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Chest tampering detection system
  2. -- 620eb42a98a955e79717d0f12d009c94a790d5b7
  3.  
  4. local side = "left"
  5.  
  6. local chest = peripheral.wrap(side)
  7.  
  8. while true do
  9.   local s = textutils.serialize(chest.list())
  10.   local evt = os.pullEvent()
  11.   if evt == "redstone" then
  12.     if rs.getInput(side) then
  13.       print("Chest opened")
  14.       repeat sleep(0.5) until not rs.getInput(side)
  15.       if s == textutils.serialize(chest.list()) then
  16.         print("Chest closed, no items taken")
  17.       else
  18.         print("Chest tampered")
  19.       end
  20.     end
  21.   end
  22. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top