SHOW:
|
|
- or go back to the newest paste.
| 1 | - | mon = peripheral.wrap("monitor_1")
|
| 1 | + | mon = peripheral.wrap("monitor_0")
|
| 2 | - | bank = peripheral.wrap("blockcapacitorbank_2")
|
| 2 | + | cell1 = peripheral.wrap("cofh_thermalexpansion_energycell_0")
|
| 3 | cell2 = peripheral.wrap("cofh_thermalexpansion_energycell_1")
| |
| 4 | cell3 = peripheral.wrap("cofh_thermalexpansion_energycell_2")
| |
| 5 | cell4 = peripheral.wrap("cofh_thermalexpansion_energycell_3")
| |
| 6 | p = peripheral.wrap("back")
| |
| 7 | ----------------------------------- | |
| 8 | rf1 = cell1.getEnergyStored("left")
| |
| 9 | rf2 = cell2.getEnergyStored("left")
| |
| 10 | rf3 = cell3.getEnergyStored("left")
| |
| 11 | rf4 = cell4.getEnergyStored("left")
| |
| 12 | energyPercent = 25 | |
| 13 | ----------------------------------- | |
| 14 | function poweron() | |
| 15 | redstone.setOutput("back", true)
| |
| 16 | end | |
| 17 | ||
| 18 | function poweroff() | |
| 19 | redstone.setOutput("back", false)
| |
| 20 | - | mon.setCursorPos(2,3) |
| 20 | + | |
| 21 | - | mon.write("MJ:" ..mj)
|
| 21 | + | |
| 22 | - | mon.setCursorPos(2,4) |
| 22 | + | |
| 23 | - | mon.write("RF:" ..rf)
|
| 23 | + | |
| 24 | sleep(0.7) | |
| 25 | redstone.setOutput("back", false)
| |
| 26 | end | |
| 27 | ||
| 28 | function info() | |
| 29 | mon.setCursorPos(8,4) | |
| 30 | - | mon.write("CAPACITOR 1")
|
| 30 | + | mon.write("RF:" ..rf1)
|
| 31 | ||
| 32 | - | mon.write("GENERATOR")
|
| 32 | + | mon.setCursorPos(8,5) |
| 33 | mon.write("RF:" ..rf2)
| |
| 34 | - | mj = bank.getMJStored("left")
|
| 34 | + | |
| 35 | - | rf = bank.getEnergyStored("left")
|
| 35 | + | mon.setCursorPos(8,6) |
| 36 | mon.write("RF:" ..rf3)
| |
| 37 | - | if bank.getMJStored("left") <200000 then
|
| 37 | + | |
| 38 | - | p.setFreq(201) |
| 38 | + | mon.setCursorPos(8,7) |
| 39 | - | poweroff() |
| 39 | + | mon.write("RF:" ..rf4)
|
| 40 | - | p.setFreq(202) |
| 40 | + | |
| 41 | - | pulse() |
| 41 | + | |
| 42 | - | info() |
| 42 | + | function getEnergy() |
| 43 | - | mon.setTextColor(colors.red) |
| 43 | + | return cell1.getEnergyStored("left") end
|
| 44 | - | mon.setCursorPos(2,6) |
| 44 | + | |
| 45 | - | mon.write("ENERGY CRITICAL")
|
| 45 | + | function getMaxEnergy() |
| 46 | - | mon.setCursorPos(2,7) |
| 46 | + | return cell1.getMaxEnergyStored("left") end
|
| 47 | - | mon.write("CHARGING...")
|
| 47 | + | |
| 48 | - | sleep(20) |
| 48 | + | function getEnergyPercent() |
| 49 | return math.floor(getEnergy()/getMaxEnergy()*100) end | |
| 50 | - | else if bank.getMJStored("left") >400000 then
|
| 50 | + | |
| 51 | - | p.setFreq(201) |
| 51 | + | |
| 52 | - | poweron() |
| 52 | + | |
| 53 | - | info() |
| 53 | + | |
| 54 | - | mon.setTextColor(colors.green) |
| 54 | + | |
| 55 | - | mon.setCursorPos(2,6) |
| 55 | + | |
| 56 | - | mon.write("ENERGY OK")
|
| 56 | + | mon.write("Energy cells")
|
| 57 | - | mon.setCursorPos(2,7) |
| 57 | + | |
| 58 | - | mon.write("PRODUCING OIL")
|
| 58 | + | mon.write("Generator")
|
| 59 | - | sleep(5) |
| 59 | + | |
| 60 | mon.setCursorPos(2,4) | |
| 61 | - | else if bank.getMJStored("left") >100000 and bank.getMJStored("left") <400000 then
|
| 61 | + | mon.write("CELL1")
|
| 62 | - | p.setFreq(201) |
| 62 | + | mon.setCursorPos(2,5) |
| 63 | - | poweroff() |
| 63 | + | mon.write("CELL2")
|
| 64 | - | p.setFreq(202) |
| 64 | + | mon.setCursorPos(2,6) |
| 65 | - | pulse() |
| 65 | + | mon.write("CELL3")
|
| 66 | - | info() |
| 66 | + | mon.setCursorPos(2,7) |
| 67 | - | mon.setTextColor(colors.yellow) |
| 67 | + | mon.write("CELL4")
|
| 68 | - | mon.setCursorPos(2,6) |
| 68 | + | |
| 69 | - | mon.write("ENERGY LOW")
|
| 69 | + | |
| 70 | - | mon.setCursorPos(2,7) |
| 70 | + | if getEnergyPercent() >= energyPercent then |
| 71 | - | mon.write("STANDBY")
|
| 71 | + | info() |
| 72 | - | sleep(5) |
| 72 | + | else |
| 73 | info() | |
| 74 | end | |
| 75 | sleep(reCheckTimer) | |
| 76 | end |