druidbruce

CC tweaked create miner vertical state input

Nov 15th, 2021 (edited)
814
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.59 KB | None | 0 0
  1. local ttv = false   --true if drill is at top
  2. local tbv = false   --true if drill is at bot
  3. local tr = false    --actual top drill check left
  4. local br = false    --actual bot drill check right
  5. local atbot = false --top
  6. local together = false  --back
  7.  
  8.  
  9. while true do
  10.     os.sleep(0.1) --every 2 ticks
  11.  
  12.     tr = redstone.getInput("left")
  13.     br = redstone.getInput("right")
  14.     atbot = redstone.getInput("top")
  15.     together = redstone.getInput("back")
  16.     ttv = not tr and not br
  17.     tbv = tr and not br
  18.    
  19.     if not ttv and not tbv and not together then
  20.         if atbot then           --- doesn't really need this check
  21.             redstone.setAnalogueOutput("front", 9)
  22.             print("vstate 9")
  23.         end
  24.    
  25.     elseif not ttv and not tbv and together then
  26.         redstone.setAnalogueOutput("front", 1)
  27.         print("vstate 1")
  28.     elseif not ttv and tbv and not together then
  29.         if atbot then
  30.             redstone.setAnalogueOutput("front", 8)
  31.             print("vstate 8")
  32.         else
  33.             redstone.setAnalogueOutput("front", 2)
  34.             print("vstate 2")
  35.         end
  36.        
  37.     elseif not ttv and tbv and together then
  38.         redstone.setAnalogueOutput("front", 3)
  39.         print("vstate 3")
  40.     elseif ttv and not tbv and not together then
  41.         if atbot then
  42.             redstone.setAnalogueOutput("front", 10)
  43.             print("vstate 10")
  44.         else
  45.             redstone.setAnalogueOutput("front", 4)
  46.             print("vstate 4")
  47.         end
  48.     elseif ttv and not tbv and together then
  49.         redstone.setAnalogueOutput("front", 5)
  50.         print("vstate 5")
  51.     elseif ttv and tbv and not together then
  52.         redstone.setAnalogueOutput("front", 6)
  53.         print("vstate 6")
  54.     elseif ttv and tbv and together then
  55.         redstone.setAnalogueOutput("front", 7)
  56.         print("vstate 7")
  57.     end
  58. end
Advertisement
Add Comment
Please, Sign In to add comment