Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local comp = require("component")
- local filesystem = require("filesystem")
- local keyboard = require("keyboard")
- local event = require("event")
- local gpu = comp.gpu
- local reactors = {}
- local red = 0xC14141
- local blue = 0x4286F4
- local yellow = 0xffdb4d
- local white = 0xFFFFFF
- local black = 0x000000
- local height, width = gpu.getResolution()
- local reactors = {}
- local firstreactor
- local energy
- local maxEng = 10000000
- local maxFuel = 100000 --- not correct value change later--
- local widJump = width/100
- local heJump = height/100
- local breite = math.ceil(20*widJump)
- local hohe = math.ceil(80*heJump)
- xcoordout= math.floor(10*widJump)
- xcoordout2= math.floor(40*widJump)
- ycoordout= math.floor(10*heJump)
- xcoordin = math.floor(15*widJump)
- xcoordin2 = math.floor(45*widJump)
- ycoordin = math.floor(11*heJump)
- ---getReactor---
- function getReactor()
- local i = 1
- for adr, type in comp.list("br_reactor") do
- reactors[i] = comp.proxy(adr)
- end
- firstreactor = reactors[1]
- end
- ---energyControl----
- function energyControl()
- energy = firstreactor.getEnergyStored()
- if energy >= 0.9* maxEng then
- firstreactor.getActive(false)
- end
- if energy <= 0.1*maxEng then
- firstreactor.getActive(true)
- end
- energyProz = energy/maxEng
- gpu.setBackground(red)
- gpu.setForeground(red)
- gpu.fill( math.floor(15*widJump),height,breite - 7*widJump,-ycoordin * energyProz," ")
- end
- ----fuelControl----
- function fuelControl()
- fuel = firstreactor.getFuelAmount()
- fuelproz = fuel/maxFuel
- gpu.setBackground(blue)
- gpu.setForeground(blue)
- gpu.fill(math.floor(45*widJump),height-math.floor(height*fuelproz),breite - 7*widJump,hohe- 50* heJump," ")
- end
- ---drawBars---
- function drawBars()
- local breite = math.ceil(20*widJump)
- local hohe = math.ceil(80*heJump)
- xcoordout= math.floor(10*widJump)
- xcoordout2= math.floor(40*widJump)
- ycoordout= math.floor(10*heJump)
- xcoordin = math.floor(15*widJump)
- xcoordin2 = math.floor(45*widJump)
- ycoordin = math.floor(11*heJump)
- gpu.setForeground(white)
- gpu.set(xcoordin, ycoordout -4 *heJump,"Energy")
- gpu.set(xcoordin2,ycoordout-4 * heJump,"Fuel")--- maybe change values for height
- gpu.setBackground(yellow)
- gpu.setForeground(yellow)
- gpu.fill(xcoordout,ycoordout,breite,hohe," ")
- gpu.fill(xcoordout2, ycoordout, breite, hohe," ")
- gpu.setBackground(black)
- gpu.setForeground(black)
- gpu.fill(xcoordin,ycoordin,breite - 7*widJump,hohe- 50* heJump," ")
- gpu.fill(xcoordin2,ycoordin,breite - 7*widJump,hohe- 50* heJump," ")
- end
- ----text---
- function text(x,y,texts,col,bg_color)
- gpu.setBackground(blue)
- gpu.setForeground(white)
- gpu.fill(x,y,100,1," ")
- gpu.set(x,y,texts)
- end
- ---draw Interface------
- function drawInterface()
- gpu.set(10,20,"Uwe Manfred")
- gpu.setBackground(0x4286F4)
- gpu.set(30,40,string.rep(" ",40))
- end
- -----Main----
- drawBars()
- getReactor()
- while true do
- fuelControl()
- energyControl()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement