SHOW:
|
|
- or go back to the newest paste.
| 1 | local component = require("component")
| |
| 2 | local thread = require("thread")
| |
| 3 | local reactor = component.nc_fission_reactor | |
| 4 | ||
| 5 | local functions = {}
| |
| 6 | ||
| 7 | function functions.checkState() end | |
| 8 | --Will return true if the reactor is processing(on) or false if it is not processing(off) | |
| 9 | --This function returns a boolean value (true or false) | |
| 10 | ||
| 11 | function functions.checkEnergyLevel() end | |
| 12 | --Will return the current energy level of the reactor | |
| 13 | --This function returns a double (0.0100000) | |
| 14 | ||
| 15 | function functions.checkHeatLevel() end | |
| 16 | --Will return the current heat level of the reactor | |
| 17 | --This function returns a double (0.0100000) | |
| 18 | ||
| 19 | function functions.checkMaxHeatLevel() end | |
| 20 | --Will return the maximum heat level of the reactor | |
| 21 | ||
| 22 | function functions.checkEnergyChange() end | |
| 23 | --Returns the power change | |
| 24 | ||
| 25 | function functions.checkProcessHeat() end | |
| 26 | --Returns the reactor's heat output in negative or positive | |
| 27 | ||
| 28 | function functions.powerOutput() end | |
| 29 | --Returns the power output of the reactor | |
| 30 | ||
| 31 | function functions.currentStoredPower() end | |
| 32 | --Returns the currently stored power | |
| 33 | ||
| 34 | function functions.currentHeatLevel() end | |
| 35 | --Returns the current heat level | |
| 36 | ||
| 37 | function functions.fuelName() end | |
| 38 | --Returns the name of the current fuel being processed | |
| 39 | ||
| 40 | function functions.remainingProcessTime() end | |
| 41 | --Returns the remaining processing time for the current fuel type | |
| 42 | ||
| 43 | function functions.efficiency() end | |
| 44 | --Returns the efficiency of the current reactor setup | |
| 45 | ||
| 46 | function functions.changeReactorState() end | |
| 47 | --Will switch the reactor's active state | |
| 48 | ||
| 49 | function functions.auto() end | |
| 50 | --Will automate the reactor temperature and energy level monitoring | |
| 51 | ||
| 52 | function functions.autoWithoutMainUI() end | |
| 53 | --Will run the automation processes except that it will also display a very primitive UI | |
| 54 | ||
| 55 | function functions.main() end | |
| 56 | --This function should only be called if you do not want the primary GUI system. | |
| 57 | ||
| 58 | function functions.checkState() | |
| 59 | return reactor.isProcessing() | |
| 60 | end --end checkState | |
| 61 | ||
| 62 | function functions.checkEnergyLevel() | |
| 63 | return reactor.getEnergyStored() / reactor.getMaxEnergyStored() | |
| 64 | end --end checkEnergyLevel | |
| 65 | ||
| 66 | function functions.checkHeatLevel() | |
| 67 | return reactor.getHeatLevel() / reactor.getMaxHeatLevel() | |
| 68 | end --end cheackHeatLevel | |
| 69 | ||
| 70 | function functions.checkMaxHeatLevel() | |
| 71 | return reactor.getMaxHeatLevel() | |
| 72 | end --end checkMaxHeatLevel | |
| 73 | ||
| 74 | function functions.checkEnergyChange() | |
| 75 | return reactor.getEnergyChange() | |
| 76 | end --end checkEnergyChange | |
| 77 | ||
| 78 | function functions.checkProcessHeat() | |
| 79 | return reactor.getReactorProcessHeat() | |
| 80 | end --end checkProcessHeat | |
| 81 | ||
| 82 | function functions.powerOutput() | |
| 83 | return reactor.getReactorProcessPower() | |
| 84 | end --end powerOutput | |
| 85 | ||
| 86 | function functions.currentStoredPower() | |
| 87 | return reactor.getEnergyStored() | |
| 88 | end --end currentStoredPower | |
| 89 | ||
| 90 | function functions.currentHeatLevel() | |
| 91 | return reactor.getHeatLevel() | |
| 92 | end --end currentHeatLevel | |
| 93 | ||
| 94 | function functions.fuelName() | |
| 95 | return reactor.getFissionFuelName() | |
| 96 | end --end fuelName | |
| 97 | ||
| 98 | function functions.remainingProcessTime() | |
| 99 | return (reactor.getFissionFuelTime() - reactor.getCurrentProcessTime()) | |
| 100 | end --end remainingProcessTime | |
| 101 | ||
| 102 | function functions.efficiency() | |
| 103 | return reactor.getEfficiency() | |
| 104 | end --end efficiency | |
| 105 | ||
| 106 | function functions.changeReactorState() | |
| 107 | if functions.checkState() then | |
| 108 | reactor.deactivate() | |
| 109 | else | |
| 110 | reactor.activate() | |
| 111 | end | |
| 112 | end --end changeReactorState | |
| 113 | ||
| 114 | function functions.auto() | |
| 115 | if (functions.checkState() == false) and (functions.checkEnergyLevel() <= 0.20) and (functions.checkHeatLevel() <= 0.20)then | |
| 116 | functions.changeReactorState() --turn on reactor | |
| 117 | elseif (functions.checkState()) and ((functions.checkEnergyLevel() >= 0.80) or (functions.checkHeatLevel() >= 0.80)) then | |
| 118 | functions.changeReactorState() --turn off reactor | |
| 119 | end | |
| 120 | end --end auto | |
| 121 | ||
| 122 | function functions.autoWithoutMainUI() | |
| 123 | functions.auto() | |
| 124 | print("Estado:", functions.checkState(), "; Nivel de energia:", functions.checkEnergyLevel() * 100, "%", "; ", "Nivel de calor:" , functions.checkHeatLevel() * 100, "%")
| |
| 125 | print("-------------------------------------------------------------------------------------------------------------------------------------------")
| |
| 126 | end --end autoWithoutMainUI | |
| 127 | ||
| 128 | function functions.main() | |
| 129 | functions.autoWithoutMainUI() | |
| 130 | return functions.main() | |
| 131 | end --end main | |
| 132 | ||
| 133 | return functions | |
| 134 |