Advertisement
JaMaNi133

block_farm.lua

Oct 26th, 2023 (edited)
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.44 KB | None | 0 0
  1. local gearshift = "right"
  2. local clutch = "top"
  3. local trigger = "bottom"
  4. local enable = "left"
  5. local timing = 0.95
  6. local delay = 0.1
  7.  
  8. local upDir = false
  9. reader = peripheral.wrap("blockReader_0")
  10. data = reader.getBlockData()
  11.  
  12. function homing()
  13.     if data == nil then return true end
  14.     if not data.id == "create:sticker" then return true end
  15.     return false
  16. end
  17.  
  18. while homing() do
  19.     redstone.setOutput(gearshift,not upDir)
  20.     redstone.setOutput(clutch,true)
  21.     sleep(timing)
  22.     redstone.setOutput(clutch,false)
  23.     sleep(0.5)
  24.     data = reader.getBlockData()
  25. end
  26. print("down!!!")
  27. redstone.setOutput(gearshift,not upDir)
  28. redstone.setOutput(clutch,true)
  29. sleep(timing)
  30. redstone.setOutput(clutch,false)
  31. sleep(1)
  32.  
  33.  
  34. redstone.setOutput(gearshift,upDir)
  35. redstone.setOutput(clutch,true)
  36. sleep(timing)
  37. redstone.setOutput(clutch,false)
  38.  
  39. while true do
  40.     while not redstone.getInput(enable) do
  41.         sleep(1)
  42.     end
  43.     sleep(delay)
  44.     redstone.setOutput(trigger,true)
  45.     sleep(delay)
  46.     redstone.setOutput(trigger,false)
  47.    
  48.     redstone.setOutput(gearshift,upDir)
  49.     redstone.setOutput(clutch,true)
  50.     sleep(timing)
  51.     redstone.setOutput(clutch,false)
  52.  
  53.     sleep(delay)
  54.     redstone.setOutput(trigger,true)
  55.     sleep(delay)
  56.     redstone.setOutput(trigger,false)
  57.    
  58.     redstone.setOutput(gearshift,not upDir)
  59.     redstone.setOutput(clutch,true)
  60.     sleep(timing)
  61.     redstone.setOutput(clutch,false)
  62. end
  63. print("completed!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement