Advertisement
MrScoots

Machine Controller

Apr 26th, 2024 (edited)
611
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.18 KB | Gaming | 0 0
  1. local utils = require "utils"
  2.  
  3. OP_PLATE = "PLATE"
  4. OP_WIRE = "WIRE"
  5. OP_CABLE = "CABLE"
  6.  
  7. run = false
  8.  
  9. in_barrel_name = "minecraft:barrel_1"
  10. in_barrel = peripheral.wrap(in_barrel_name)
  11. compressor_name = "modern_industrialization:electric_compressor_1"
  12. compressor = peripheral.wrap(compressor_name)
  13. wiremill_name = "modern_industrialization:electric_wiremill_0"
  14. wiremill = peripheral.wrap(wiremill_name)
  15. out_barrel_name = "minecraft:barrel_2"
  16. out_barrel = peripheral.wrap(out_barrel_name)
  17.  
  18. repeat
  19.     --run = redstone.getInput("front")
  20.     starting_item = in_barrel.list()[1]
  21.     sleep(0.05)
  22. until starting_item ~= nil
  23.  
  24. print("Moving from barrel to compressor")
  25.  
  26. -- move from barrel to compressor
  27. while #in_barrel.list() ~= 0  
  28. do
  29.     compressor.pullItem(in_barrel_name, starting_item.name)
  30.     sleep(0.05)
  31. end
  32.  
  33. print("Moving from compressor to next step")
  34.  
  35. compressor_item_out = compressor.items()[1]
  36.  
  37. while #compressor.items() ~= 0
  38. do
  39.     local destination = wiremill_name
  40.     if redstone.getInput("front") then destination = out_barrel_name end
  41.     compressor.pushItem(destination, compressor_item_out.name)
  42.     sleep(0.05)
  43. end
  44.  
  45. sleep(2)
  46. print(#compressor.items())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement