SHOW:
|
|
- or go back to the newest paste.
| 1 | if not term.isColor() then | |
| 2 | print("Advanced computer required")
| |
| 3 | error() | |
| 4 | end | |
| 5 | ||
| 6 | local sides = peripheral.getNames() | |
| 7 | local mininglasers = {}
| |
| 8 | for _, side in pairs(sides) do | |
| 9 | if peripheral.getType(side) == "warpdriveMiningLaser" then | |
| 10 | print("Wrapping " .. side)
| |
| 11 | table.insert(mininglasers, peripheral.wrap(side)) | |
| 12 | end | |
| 13 | end | |
| 14 | ||
| 15 | local label = os.getComputerLabel() | |
| 16 | if label then | |
| 17 | else | |
| 18 | label = "" .. os.getComputerID() | |
| 19 | end | |
| 20 | term.setBackgroundColor(colors.black) | |
| 21 | term.clear() | |
| 22 | term.setBackgroundColor(colors.lime) | |
| 23 | term.setCursorPos(1, 1) | |
| 24 | print(label) | |
| 25 | ||
| 26 | if #mininglasers == 0 then | |
| 27 | term.setBackgroundColor(colors.red) | |
| 28 | term.setTextColor(colors.white) | |
| 29 | print("No mining laser detected")
| |
| 30 | else | |
| 31 | for key, mininglaser in pairs(mininglasers) do | |
| 32 | term.setCursorPos(1, 2 + key) | |
| 33 | local isEnabled = mininglaser.enable() | |
| 34 | if not isEnabled then | |
| 35 | term.setBackgroundColor(colors.black) | |
| 36 | term.setTextColor(colors.gray) | |
| 37 | term.write("Mining laser " .. key .. " of " .. #mininglasers .. " is already stopped")
| |
| 38 | else | |
| 39 | mininglaser.enable(false) | |
| 40 | term.setBackgroundColor(colors.lime) | |
| 41 | term.setTextColor(colors.blue) | |
| 42 | term.write("Mining laser " .. key .. " of " .. #mininglasers .. " has been stopped")
| |
| 43 | end | |
| 44 | end | |
| 45 | end | |
| 46 | ||
| 47 | term.setBackgroundColor(colors.black) | |
| 48 | term.setTextColor(colors.white) | |
| 49 | ||
| 50 | print() |