SHOW:
|
|
- or go back to the newest paste.
| 1 | -- ### DATOR 1 | |
| 2 | ||
| 3 | rednet.open("SIDA")
| |
| 4 | ||
| 5 | -- COMMAND LIST | |
| 6 | print("Type 'wheat on/off' to enable/disable wheat farm")
| |
| 7 | print("Type 'tree on/off' to enable/disable tree farm")
| |
| 8 | print("Type 'rubber on/off' to enable/disable rubber farm")
| |
| 9 | ||
| 10 | local state_wheat = false | |
| 11 | local state_tree = false | |
| 12 | local state_rubber = false | |
| 13 | ||
| 14 | -- ON | |
| 15 | while ( true ) do | |
| 16 | local message = read() | |
| 17 | ||
| 18 | if message == "wheat on" then | |
| 19 | state_wheat = true | |
| 20 | rednet.send(ID, "won") | |
| 21 | elseif message == "tree on" then | |
| 22 | state_tree = true | |
| 23 | rednet.send(ID, "ton") | |
| 24 | elseif message == "rubber on" then | |
| 25 | state_rubber = true | |
| 26 | rednet.send(ID, "ron") | |
| 27 | end | |
| 28 | ||
| 29 | -- OFF | |
| 30 | if message == "wheat off" then | |
| 31 | state_wheat = false | |
| 32 | rednet.send(ID, "woff") | |
| 33 | elseif message == "tree off" then | |
| 34 | state_tree = false | |
| 35 | rednet.send(ID, "toff") | |
| 36 | elseif message == "rubber off" then | |
| 37 | state_rubber = false | |
| 38 | rednet.send(ID, "roff") | |
| 39 | end | |
| 40 | ||
| 41 | term.clear() | |
| 42 | term.setCursorPos(1, 1) | |
| 43 | -- Lista skiten | |
| 44 | if( state_wheat ) then | |
| 45 | print("Wheat farm [enabled]")
| |
| 46 | else | |
| 47 | print("Wheat farm [disabled]")
| |
| 48 | end | |
| 49 | ||
| 50 | if( state_tree ) then | |
| 51 | print("Tree farm [enabled]")
| |
| 52 | else | |
| 53 | print("Tree farm [disabled]")
| |
| 54 | end | |
| 55 | ||
| 56 | if( state_rubber ) then | |
| 57 | print("Rubber farm [enabled]")
| |
| 58 | else | |
| 59 | print("Rubber farm [disabled]")
| |
| 60 | end | |
| 61 | ||
| 62 | sleep( 0.1 ) | |
| 63 | end |