Skortioth

[OC]: Activate Redstone signal from anywhere

Jul 5th, 2020 (edited)
1,281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.17 KB | None | 0 0
  1. --Mod Requirement:
  2. --EnderStorage
  3.  
  4. --Create a Open Computer with an attached adapter. Place a ender chest on top of the adapter (or change the side in settings bellow)
  5. --Create a ender pouch (of course with the same colors as the ender chest). Always when you insert an item on slot 1 the adapter will
  6. --set the redstone output signal to your configurated strength
  7.  
  8. local component = require("component")
  9. local side = require("sides")
  10. local invController = component.inventory_controller
  11. local rs = component.redstone
  12.  
  13. --Settings:
  14. local rsOutputSide = side.right -- The redstone side the attached adapter has to output
  15. local rsOutputStrength = 15 -- The redstone strength 15 is max. 0 is min.
  16. local minimumDelay = 7 -- The minimum delay between redstone signals
  17. local enderChestSide = side.top -- The ender chest side the adapter is attached to
  18. --
  19.  
  20. while true do
  21. if(invController.getStackInSlot(enderChestSide, 1) ~= nil)then
  22. rs.setOutput(rsOutputSide, rsOutputStrength)
  23. print("Redstone output is active")
  24. os.sleep(minimumDelay)
  25. end
  26. rs.setOutput(rsOutputSide, 0) -- the 0 means the redstone signal strength without an item if you have to change that
  27. os.sleep(0.25)
  28. end
Add Comment
Please, Sign In to add comment