Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local mon = peripheral.wrap("monitor_4")
- --local mon = peripheral.wrap("left")
- local rec = peripheral.wrap("back")
- local dt = peripheral.wrap("fluid_gate_0")
- version = 1.1
- max = 80
- min = 20
- local standard = 44
- local text = colors.lightBlue
- local normal = colors.white
- local rahmen = colors.gray
- activ = 0
- blink = 0
- tabelMax = 4
- tabel = 1
- nDT = 0
- -- DNT
- --local Cap = max/100
- --local softCap = min/100
- function alert()
- if Deut <= 500 or Trit <= 500 then
- rec.setInjectionRate(2)
- rs.setOutput("top", true)
- term.setTextColor(colors.red)
- else
- rs.setOutput("top", false)
- end
- end
- function reactor()
- local Cap = max/100
- local softCap = min/100
- Trit = rec.getTritium()
- Deut = rec.getDeuterium()
- energy = rec.getEnergy()
- energyMax = rec.getMaxEnergy()
- mon.clear()
- term.redirect(mon)
- term.setCursorPos(2,19)
- term.setTextColor(colors.gray)
- write("V"..version.." written by adreaner ©")
- term.setTextColor(colors.white)
- paintutils.drawBox(2,2,12,18,rahmen)
- term.setCursorPos(4,7)
- local posX, posY = term.getCursorPos()
- -- Fuel
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- mon.setCursorPos(4,2)
- term.setTextColor(text)
- write(" Fuel ")
- term.setTextColor(normal)
- local DeutF= 10-((Deut*100/1000)/10)
- local TritF= 10-((Trit*100/1000)/10)
- paintutils.drawFilledBox(4,4,6,16, colors.orange)
- paintutils.drawFilledBox(4,4,6,4+DeutF, colors.lightGray)
- paintutils.drawFilledBox(8,4,10,16, colors.lightBlue)
- paintutils.drawFilledBox(8,4,10,4+TritF, colors.lightGray)
- term.setBackgroundColor(colors.black)
- -- Fuel end
- -- Energy Capacity
- paintutils.drawBox(14,2,38,6, rahmen)
- term.setCursorPos(16,2)
- term.setBackgroundColor(colors.black)
- term.setTextColor(text)
- write(" Energy level ")
- term.setTextColor(normal)
- local EnergyF = (energy*100/energyMax)/10
- local energyRF = math.floor(energy/2500,0.5)
- local energyMaxRF = energyMax/2500
- paintutils.drawFilledBox(16,4,36,4, colors.red)
- paintutils.drawFilledBox(16,4,16+EnergyF*2,4, colors.lime)
- if blink == 2 then
- paintutils.drawBox(16+20*Cap,4,16+20*Cap,4, colors.orange)
- paintutils.drawBox(16+20*softCap,4,16+20*softCap,4, colors.cyan)
- blink = 0
- else
- blink = blink+1
- end
- term.setCursorPos(17,3)
- term.setBackgroundColor(colors.black)
- write(energyRF.."/"..energyMaxRF.." KRF")
- term.setBackgroundColor(colors.black)
- -- Energy Capacity end
- -- Info
- -- Production
- paintutils.drawBox(14,8,38,13, rahmen)
- term.setCursorPos(16,8)
- term.setBackgroundColor(colors.black)
- term.setTextColor(text)
- write(" Info ")
- term.setTextColor(normal)
- term.setCursorPos(16,9)
- local IsActiv = rec.isIgnited()
- write("Status: ")
- if IsActiv == true and nDT == 0 then
- term.setTextColor(colors.lime)
- write("Activ")
- elseif IsActiv == true and nDT > 0 then
- term.setTextColor(colors.purple)
- write("Overclocked ")
- else
- term.setTextColor(colors.red)
- write("Offline")
- end
- term.setTextColor(colors.white)
- term.setCursorPos(16,11)
- write("Energy in %: ")
- local EnergyPer = (math.floor(energy*1000/energyMax, 0.5))/10
- write(EnergyPer)
- term.setCursorPos(16,10)
- write("Production: ")
- local RFpT = (rec.getProducing()/250000)/10
- if RFpT < 1 then
- RFpT = (rec.getProducing()/250)/10
- write(RFpT)
- term.setTextColor(colors.orange)
- term.setCursorPos(33,10)
- write("KRF/T")
- else
- write(RFpT)
- term.setTextColor(colors.yellow)
- term.setCursorPos(32,10)
- write(" MRF/T")
- end
- -- Production end
- -- Injection Rate
- term.setCursorPos(16,12)
- term.setTextColor(colors.white)
- write("InjectionRate: ")
- -- Injection Rate end
- -- Info end
- -- alert
- paintutils.drawBox(14,15,38,18, rahmen)
- term.setCursorPos(16,15)
- term.setBackgroundColor(colors.black)
- term.setTextColor(text)
- write(" Alerts ")
- term.setTextColor(normal)
- if activ == 1 then
- term.setCursorPos(16,16)
- term.setTextColor(colors.orange)
- write("Energy cap reached!")
- term.setCursorPos(16,17)
- write("Lowering Injection!")
- end
- if Trit <= 500 then
- paintutils.drawBox(15,16,37,17, colors.black)
- term.setCursorPos(16,16)
- rahmen = colors.red
- term.setTextColor(colors.red)
- write("Tritium LOW!")
- term.setCursorPos(16,17)
- write("LvL: "..Trit)
- elseif Deut <= 500 then
- paintutils.drawBox(15,16,37,17, colors.black)
- term.setCursorPos(16,16)
- rahmen = colors.red
- term.setTextColor(colors.red)
- write("Deuterium LOW!")
- term.setCursorPos(16,17)
- write("LvL: "..Deut)
- else
- rahmen = colors.gray
- end
- -- alert off
- -- Injection Hard Cap
- term.setTextColor(colors.yellow)
- if energy >= energyMax*Cap then
- rec.setInjectionRate(4)
- term.setTextColor(colors.orange)
- activ = 1
- elseif energy <= energyMax*softCap then
- term.setTextColor(colors.green)
- rec.setInjectionRate(standard)
- activ = 0
- end
- if activ == 0 then
- rec.setInjectionRate(standard)
- end
- -- Injection Hard Cap end
- term.setCursorPos(31,12)
- write(rec.getInjectionRate())
- if exit == 1 then
- paintutils.drawBox(2,6,39,15, colors.white)
- paintutils.drawFilledBox(3,7,38,14, colors.black)
- term.setTextColor(colors.white)
- term.setCursorPos(4,8)
- --mon.setTextScale(0.5)
- write("This will ")
- term.setTextColor(colors.red)
- write("shutdown ")
- term.setTextColor(colors.white)
- write("the Reactor!")
- term.setCursorPos(4,9)
- write("You need ")
- term.setTextColor(colors.orange)
- write("1x Hohlraum ")
- term.setTextColor(colors.white)
- write("loaded with")
- term.setCursorPos(4,10)
- term.setTextColor(colors.purple)
- write("D-T fuel ")
- term.setTextColor(colors.white)
- write("to restart the Reactor!")
- term.setCursorPos(4,11)
- write("Continue?")
- paintutils.drawBox(7,13,12,13, colors.red)
- term.setCursorPos(9,13)
- write("Yes")
- paintutils.drawBox(29,13,34,13, colors.lime)
- term.setCursorPos(31,13)
- write("No!")
- --mon.setTextScale(1)
- end
- paintutils.drawBox(40,17,49,18, colors.gray)
- paintutils.drawBox(42,18,47,18, colors.black)
- term.setCursorPos(41,17)
- term.setTextColor(text)
- write(" DTFuel ")
- term.setTextColor(colors.purple)
- term.setCursorPos(42,18)
- if string.len(nDT) == 1 then
- write("0")
- end
- write(nDT.."mb/t")
- --term.setCursorPos(3,1-17)
- --write("time")
- --write(clock())
- term.setBackgroundColor(colors.black)
- alert()
- --term.setCursorPos(31,12)
- --write(rec.getInjectionRate())
- sleep(0.5)
- end
- function click()
- local dtf = dt.getSignalLowFlow()
- term.setTextColor(colors.white)
- paintutils.drawBox(50,1,50,1, colors.red)
- term.setCursorPos(50,1)
- write("X")
- paintutils.drawBox(40,2,49,15, rahmen)
- term.setCursorPos(40,15)
- write("< >")
- term.setCursorPos(42,2)
- term.setBackgroundColor(colors.black)
- term.setTextColor(text)
- if tabel <= 0 then
- tabel = 1
- elseif tabel > tabelMax then
- tabel = tabelMax
- elseif tabel == 1 then
- write("Inject")
- term.setCursorPos(42,15)
- write(" rate ")
- term.setTextColor(normal)
- elseif tabel == 2 then
- write("Energy")
- term.setCursorPos(42,15)
- write(" min. ")
- elseif tabel == 3 then
- write("Energy")
- term.setCursorPos(42,15)
- write(" max. ")
- elseif tabel == 4 then
- write("DTFuel")
- term.setCursorPos(42,15)
- write(" inj. ")
- end
- term.setTextColor(colors.white)
- paintutils.drawFilledBox(42,4,47,4, colors.lime)
- term.setCursorPos(43,4)
- write("+10")
- paintutils.drawFilledBox(42,6,47,6, colors.green)
- term.setCursorPos(43,6)
- write(" +1")
- paintutils.drawFilledBox(42,8,47,8, colors.lightBlue)
- term.setCursorPos(43,8)
- if tabel == 1 then
- write(" =4")
- elseif tabel == 2 or tabel == 3 then
- write(" 50")
- elseif tabel == 4 then
- write(" =0")
- end
- paintutils.drawFilledBox(42,10,47,10,colors.orange)
- term.setCursorPos(43,10)
- write(" -1")
- paintutils.drawFilledBox(42,12,47,12,colors.red)
- term.setCursorPos(43,12)
- write("-10")
- paintutils.drawBox(41,14,48,14, rahmen)
- term.setCursorPos(43,14)
- term.setBackgroundColor(colors.black)
- if tabel == 1 then
- write(" "..standard.." ")
- elseif tabel == 2 then
- write(" "..min.."%")
- elseif tabel == 3 then
- write(" "..max.."%")
- elseif tabel == 4 then
- write(" "..dtf.." ")
- end
- event, side, xPos, yPos = os.pullEvent("monitor_touch")
- if xPos >= 42 and xPos <= 47 and yPos == 4 then
- if tabel == 1 then
- standard = standard+10
- elseif tabel == 2 then
- min = min+10
- elseif tabel == 3 then
- max = max+10
- elseif tabel == 4 then
- nDT = nDT+10
- end
- elseif xPos >= 42 and xPos <= 47 and yPos == 6 then
- if tabel == 1 then
- standard = standard+1
- elseif tabel == 2 then
- min = min+1
- elseif tabel == 3 then
- max = max+1
- elseif tabel == 4 then
- nDT = nDT+1
- end
- elseif xPos >= 42 and xPos <= 47 and yPos == 8 then
- if tabel == 1 then
- standard = 4
- elseif tabel == 2 then
- min=50
- elseif tabel == 3 then
- max=50
- elseif tabel == 4 then
- nDT=0
- end
- elseif xPos >= 42 and xPos <= 47 and yPos == 10 then
- if tabel == 1 then
- standard = standard-1
- elseif tabel == 2 then
- min = min-1
- elseif tabel == 3 then
- max = max-1
- elseif tabel == 4 then
- nDT = nDT-1
- end
- elseif xPos >= 42 and xPos <= 47 and yPos == 12 then
- if tabel == 1 then
- standard = standard-10
- elseif tabel == 2 then
- min = min-10
- elseif tabel == 3 then
- max = max-10
- elseif tabel == 4 then
- nDT = nDT-10
- end
- elseif xPos == 50 and yPos == 1 then
- exit = 1
- elseif xPos >= 7 and xPos <= 12 and yPos == 13 and exit == 1 then
- exit = 0
- rec.setInjectionRate(0)
- sleep(0.5)
- rec.setInjectionRate(standard)
- elseif xPos >= 29 and xPos <= 34 and yPos == 13 and exit == 1 then
- exit = 0
- elseif xPos == 40 and yPos == 15 then
- tabel = tabel-1
- if tabel == 0 then
- tabel = tabelMax
- end
- elseif xPos == 49 and yPos == 15 then
- tabel = tabel+1
- if tabel > tabelMax then
- tabel = 1
- end
- end
- if standard <= 1 then
- standard = 2
- end
- if nDT < 0 then
- nDT = 0
- elseif nDT > 99 then
- nDT = 99
- end
- dt.setSignalLowFlow(nDT)
- term.setBackgroundColor(colors.black)
- sleep(0.5)
- end
- while true do
- parallel.waitForAny(reactor, click)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement