Darknio icon

Big Reactor

Darknio | PRO | 11/29/14 06:30:23 PM UTC | 0 ⭐ | 563 👁️ | Never ⏰ | []
Lua |

5.61 KB

|

None

|

0 👍

/

0 👎

    
 
            BigReactor = "BigReactors-Reactor_1" --Reactor Slot
            Monitor_Slot = "monitor_1"                       --Monitor Slot
     
        monitor = peripheral.wrap(Monitor_Slot)
        monitor.clear()
        monitor.setTextScale(1)
        term.setBackgroundColor(2048)
           
     
            local stored= 10000000 --Anzeige Max Interner Speicher
           
           
        local reactor = peripheral.wrap(BigReactor)
        local reactorTemp=reactor.getFuelTemperature()
        local reactorCasingTemp=reactor.getCasingTemperature()
        local reactorFuel=reactor.getFuelAmount()
        local reactorRFTick = reactor.getEnergyProducedLastTick()
        local reactorEnergy = reactor.getEnergyStored()
        local backgoundColor = 32
        local onoff = 1
         
            local PosX = 0
            local PosY = 0
            local AnAus = true
            local autostart = "Aus"
             
            local zeileX = 24
            local zeileY = 3
             
        function Clear()
        term.clear()
        term.setCursorPos(1,1)
        end
         
             function Autostart()
             if autostart == "An" then
                    if (reactorEnergy < storedTwo) and (storedTwo<(stored/2))  then
                            reactor.setActive(true)
                    else
                            reactor.setActive(false)
                    end
            end
            end
     
        function Update()
        local reactor = peripheral.wrap(BigReactor)
        local reactorTemp=reactor.getFuelTemperature()
        local reactorCasingTemp=reactor.getCasingTemperature()
        local reactorFuel=reactor.getFuelAmount()
        local reactorRFTick = reactor.getEnergyProducedLastTick()
        local reactorEnergy = reactor.getEnergyStored()
         
        reactorTempNew=math.ceil(reactorTemp)
        reactorCasingTempNew=math.ceil(reactorCasingTemp)
        reactorFuelNew=math.ceil(reactorFuel)
        reactorRFTickNew=math.ceil(reactorRFTick)
        reactorEnergyNew=math.ceil(reactorEnergy)
        eprozent = reactorEnergy/stored*100
            eprozentNew =math.ceil(eprozent)
            local zeileX = 24
            local zeileY = 3
           
            OnOff()
            end
         
    function OnOff()
     
    if reactorOnline == true then
            AnAus = false
            Status = "An"
    elseif reactorOnline == false then
            AnAus = true
            Status = "Aus"
             
    end      
    end
     
     
     
     
        function Active()
        write("Online: ")
        reactorOnline = reactor.getActive()
            term.setCursorPos(23,3)
       
            if reactorOnline == true then
        backgoundColor = 32
        term.setTextColor(32)
        print(Status)
        term.setTextColor(32768)
        else
        backgoundColor = 16384
        term.setTextColor(16384)
         
        print(Status)
         
        term.setTextColor(32768)
         
        end
        end
     
           
       function Time()
    write(textutils.formatTime(os.time(), true))
     
    end
     
     
    function Header()
    term.setBackgroundColor(colors.lightBlue)
    monitor.setTextScale(1)
    write("Reactor Monitor      ")
    monitor.setTextScale(1)
    term.setBackgroundColor(colors.red)
    term.setTextColor(colors.white)
    write(" ")
    Time()
    print("    ")
    term.setBackgroundColor(colors.white)
    term.setTextColor(colors.black)
     
    end
     
    function Screen()
    term.setTextColor(colors.black)
    term.setBackgroundColor(colors.lightGray)
    print("Autostart                          ")
    term.setCursorPos(23,2)
    print(autostart)
    term.setBackgroundColor(colors.white)
    Active()
    term.setBackgroundColor(colors.lightGray)
    write("Temp:                              ")
    term.setCursorPos(23,4)
    print(reactorTempNew)
    term.setBackgroundColor(colors.white)
    write("Casing:                       ")
    term.setCursorPos(23,5)
    print(reactorCasingTempNew)
    term.setBackgroundColor(colors.lightGray)
    write("Fuel:                             ")
    term.setCursorPos(23,6)
    print(reactorFuelNew)
    term.setBackgroundColor(colors.white)
    write("RF/Tick:                             ")
    term.setCursorPos(23,7)
    print(reactorRFTickNew)
    term.setBackgroundColor(colors.lightGray)
    write("Energie:                              ")          
    term.setCursorPos(23,8)
    print (eprozentNew .."/100%")
     
     
     
     
    term.setBackgroundColor(colors.white)
    end
     
    function Run()
    Clear()
    Update()
    Header()
    Screen()
    Autostart()
    --print("x " .. PosX)
    --print("y " .. PosY)
     
     
     
     
    sleep(0.5)
    end
     
     
     
    function Touch()
     
            event,side,PosX,PosY = os.pullEvent("monitor_touch")
                    if PosY == 3 then
                            reactor.setActive(AnAus)
                    elseif PosY == 2 then
     
                            if autostart == "Aus" then
                                     autostart = "An"
                            elseif autostart == "An" then
                                     autostart = "Aus"
                            end
                           
     
                            end
     
     
                            end
     
     
     
     
                   
    while true do
    parallel.waitForAny(Run,Touch)
    end

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎