druidbruce

CC tweaked create miner main input control 1D

Nov 21st, 2021
1,121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local vertstate = false --vertical state    back
  2. local oh = false    --horizontal obeserver  left
  3. local ov = false    --vertical obeserver    right
  4. local other = false --other input (for manual/returning control)    top
  5. local full = false  --miner is full         bottom
  6. local function stateout(staten)
  7.     redstone.setAnalogueOutput("front", staten)
  8. end
  9. while true do
  10.     oh = redstone.getInput("left")
  11.     ov = redstone.getInput("right")
  12.     os.sleep(0.1) --every 2 ticks
  13.     vertstate = redstone.getAnalogInput("back")
  14.  
  15.     other = redstone.getAnalogInput("top")
  16.     full = redstone.getInput("bottom")
  17.     if other == 15 then
  18.         stateout(0)
  19.     elseif other == 0 then
  20.         if not full then       
  21.             if vertstate == 10 then
  22.                 stateout(8) -- change
  23.                 print("ostate 8")
  24.             elseif vertstate == 9 then
  25.                
  26.                 stateout(7)
  27.                 print("ostate 7")
  28.  
  29.             elseif vertstate == 1 then
  30.                 stateout(11)
  31.                 print("ostate 11")
  32.             elseif vertstate == 2 then             
  33.                 stateout(4)
  34.                 print("ostate 4")
  35.             elseif vertstate == 8 then
  36.                 stateout(5)
  37.                 print("ostate 5")
  38.             elseif vertstate == 4 then
  39.                 if not oh and not ov then
  40.                     stateout(3)         -- could be 3,9,12
  41.                     print("ostate 3")
  42.                 elseif oh and ov then
  43.                     stateout(13)        --new
  44.                     print("ostate 13")
  45.                 end            
  46.            
  47.            
  48.                
  49.             elseif vertstate == 3 then
  50.                 if not oh and not ov then
  51.                     stateout(1)
  52.                 elseif oh and ov then
  53.                     stateout(2)
  54.                 end    
  55.             elseif vertstate == 5 then 
  56.                 stateout(10)
  57.                
  58.             end
  59.         else        -- full
  60.             stateout(15)
  61.        
  62.         end
  63.     end
  64. end
  65.  
Advertisement
Add Comment
Please, Sign In to add comment