SHOW:
|
|
- or go back to the newest paste.
| 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 | - | if oh and ov then |
| 25 | + | |
| 26 | - | stateout(7) |
| 26 | + | stateout(7) |
| 27 | - | print("ostate 7")
|
| 27 | + | print("ostate 7")
|
| 28 | - | else |
| 28 | + | |
| 29 | - | stateout(6) |
| 29 | + | |
| 30 | - | print("ostate 6")
|
| 30 | + | |
| 31 | - | end |
| 31 | + | |
| 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 |