Advertisement
knayvik

OC Integrated Tunnels Armor Stripper

Jun 26th, 2022 (edited)
995
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2. south: trapdoor
  3. west: tripwire under trapdoor
  4. east: spike tripwire
  5. ]]
  6.  
  7. local component = require("component")
  8. local sides = require("sides")
  9. local redstone = component.redstone
  10. local isMobStripping = nil
  11.  
  12. function openDoor()
  13.     redstone.setOutput(sides.north, 15)
  14. end
  15.  
  16. function closeDoor()
  17.     redstone.setOutput(sides.north, 0)
  18. end
  19.  
  20. function mobStripping()
  21.     print(redstone.getInput(sides.west))
  22.     if (redstone.getInput(sides.west) ~= 0) then
  23.         isMobStripping = 1
  24.         closeDoor()
  25.     else
  26.         isMobStripping = 0
  27.         openDoor()
  28.     end
  29. end
  30.  
  31. function mobFell()
  32.     if (isMobStripping == 1) then
  33.         return nil
  34.     end
  35.     if (redstone.getInput(sides.east) ~= 0) then
  36.         closeDoor()
  37.     else
  38.         openDoor()
  39.     end
  40. end
  41.  
  42. while (true) do
  43.     mobStripping()
  44.     mobFell()
  45.     os.sleep(1/20)
  46. end
Advertisement
RAW Paste Data Copied
Advertisement