SHOW:
|
|
- or go back to the newest paste.
| 1 | - | -- champs |
| 1 | + | --temps de repos (s) |
| 2 | - | local mainFields = {}
|
| 2 | + | rest=3600 |
| 3 | - | table.insert(mainFields, colors.orange) --NO |
| 3 | + | --temps d'arrosage par champ (s) |
| 4 | - | table.insert(mainFields, colors.magenta) --N |
| 4 | + | watering=300 |
| 5 | - | table.insert(mainFields, colors.lightBlue) --NE |
| 5 | + | --connection side |
| 6 | - | table.insert(mainFields, colors.yellow) --O |
| 6 | + | side="top" |
| 7 | - | table.insert(mainFields, colors.lime) --center |
| 7 | + | |
| 8 | - | table.insert(mainFields, colors.pink) --E |
| 8 | + | local fields = {} --fields colors config
|
| 9 | - | table.insert(mainFields, colors.gray) --SO |
| 9 | + | table.insert(fields, colors.orange) --NO |
| 10 | - | table.insert(mainFields, colors.lightGray) --S |
| 10 | + | table.insert(fields, colors.magenta) --N |
| 11 | - | table.insert(mainFields, colors.cyan) --SE |
| 11 | + | table.insert(fields, colors.lightBlue) --NE |
| 12 | table.insert(fields, colors.yellow) --O | |
| 13 | table.insert(fields, colors.lime) --center | |
| 14 | table.insert(fields, colors.pink) --E | |
| 15 | table.insert(fields, colors.gray) --SO | |
| 16 | table.insert(fields, colors.lightGray) --S | |
| 17 | table.insert(fields, colors.cyan) --SE | |
| 18 | ||
| 19 | ----------------------------------------------------------- | |
| 20 | ||
| 21 | function fertilize(field) | |
| 22 | print("Watering "..field)
| |
| 23 | add(side,field) | |
| 24 | sleep(watering) | |
| 25 | rem(side,field) | |
| 26 | return get(side) | |
| 27 | end | |
| 28 | ||
| 29 | function get(side) | |
| 30 | return redstone.getBundledOutput(side) | |
| 31 | end | |
| 32 | ||
| 33 | function set(side, value) | |
| 34 | return redstone.setBundledOutput(side, value) | |
| 35 | end | |
| 36 | ||
| 37 | function test(side, color) | |
| 38 | return colors.test(get(side), color) | |
| 39 | end | |
| 40 | ||
| 41 | function add(side, color) | |
| 42 | return set(side, colors.combine(get(side), color)) | |
| 43 | end | |
| 44 | ||
| 45 | function rem(side, color) | |
| 46 | return set(side, colors.subtract(get(side), color)) | |
| 47 | end | |
| 48 | ||
| 49 | ----------------------------------------------------------- | |
| 50 | ||
| 51 | while true do | |
| 52 | print("Regulating watering cans for "..#fields.." fields")
| |
| 53 | print("Connected side to rednet cable : "..side)
| |
| 54 | print("Sleep Time : "..rest.." seconds")
| |
| 55 | print("Watering Time /per field : "..watering.." seconds")
| |
| 56 | ||
| 57 | for i=1,#fields do | |
| 58 | fertilize(fields[i]) | |
| 59 | end | |
| 60 | ||
| 61 | print("Sleeping for"..rest.." seconds.")
| |
| 62 | sleep(rest) | |
| 63 | end |