SHOW:
|
|
- or go back to the newest paste.
| 1 | local wi = peripheral.find("WorldInterface")
| |
| 2 | ||
| 3 | local block | |
| 4 | local function isGlass(x,y,z) | |
| 5 | block = wi.getBlockInfos(x,y,z) | |
| 6 | return block.blockName=="minecraft:glass" | |
| 7 | or block.blockName=="minecraft:stained_glass" | |
| 8 | end | |
| 9 | ||
| 10 | local function isBroken(o) | |
| 11 | if o[1]==o[2] and o[1]==o[3] then | |
| 12 | return false | |
| 13 | else | |
| 14 | return true | |
| 15 | end | |
| 16 | end | |
| 17 | ||
| 18 | local function valid(a,b) | |
| 19 | return a[1] ~= b[1] | |
| 20 | end | |
| 21 | ||
| 22 | --verif gates | |
| 23 | --Trieur fermé -586 23~25 121 | |
| 24 | --local trieur_close = {
| |
| 25 | -- isGlass(-586,23,121), | |
| 26 | -- isGlass(-586,24,121), | |
| 27 | -- isGlass(-586,25,121), | |
| 28 | --} | |
| 29 | --Trieur ouvert -587 23~25 121 | |
| 30 | local trieur_open = {
| |
| 31 | isGlass(-587,23,121), | |
| 32 | isGlass(-587,24,121), | |
| 33 | isGlass(-587,25,121), | |
| 34 | } | |
| 35 | --Tueur fermé -586 23~25 123 | |
| 36 | --local tueur_close = {
| |
| 37 | -- isGlass(-586,23,123), | |
| 38 | -- isGlass(-586,24,123), | |
| 39 | -- isGlass(-586,25,123), | |
| 40 | --} | |
| 41 | --Tueur ouvert -587 23~25 123 | |
| 42 | local tueur_open = {
| |
| 43 | isGlass(-587,23,123), | |
| 44 | isGlass(-587,24,123), | |
| 45 | isGlass(-587,25,123), | |
| 46 | } | |
| 47 | ||
| 48 | if isBroken(tueur_open) | |
| 49 | or isBroken(trieur_open) | |
| 50 | or not valid(trieur_open,tueur_open) | |
| 51 | then | |
| 52 | rs.setOutput("top",true)
| |
| 53 | sleep(.3) | |
| 54 | rs.setOutput("top",false)
| |
| 55 | sleep(.3) | |
| 56 | end |