knayvik

OC Entropinnyum Automation

Jun 24th, 2022 (edited)
241
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.55 KB | None
  1. local component = require("component")
  2. local sides = require("sides")
  3. local redstone = component.redstone
  4. local timer = 0
  5.  
  6. function spawnTNT()
  7.     redstone.setOutput(sides.front, 10)
  8.     print("BOOM")
  9.     os.sleep(5)
  10.     redstone.setOutput(sides.front, 0)
  11.     timer = 0
  12. end
  13.  
  14. function checkPulse()
  15.     for i = 1, 5 do
  16.         if (redstone.getInput(sides.top) == 0) then
  17.             if (timer == 5) then
  18.                 spawnTNT()
  19.                 return 0
  20.             end
  21.             timer = timer + 1
  22.         else
  23.             timer = 0
  24.         end
  25.         os.sleep(1)
  26.     end
  27. end
  28.  
  29. while true do
  30.     checkPulse(timer)
  31.     os.sleep(1/20)
  32. end
  33.  
RAW Paste Data Copied