Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Variables
- fuelminx = 1755
- fuelminy = 490
- fuelmaxx = 1805
- fuelmaxy = 740
- RFminx = 1870
- RFminy = 490
- RFmaxx = 1920
- RFmaxy = 740
- DarkGrey = 0x616163
- DarkRed = 0xf80006
- YellowGreen = 0xf5f800
- White = 0xffffff
- -- peripheral searching thanks to /u/kla_sch
- function reactorSearch()
- local names = peripheral.getNames()
- local i, name
- for i, name in pairs(names) do
- if peripheral.getType(name) == "BiggerReactors_Reactor" then
- return peripheral.wrap(name)
- else
- -- return null
- end
- end
- end
- function reactorperi()
- batt = reactor.battery()
- fuel = reactor.fuelTank()
- end
- function ARControllerSearch()
- local names = peripheral.getNames()
- local i, name
- for i, name in pairs(names) do
- if peripheral.getType(name) == "arController" then
- return peripheral.wrap(name)
- else
- -- return null
- end
- end
- end
- function arsetup()
- ar.clear()
- ar.setRelativeMode(true, 1920, 1080)
- end
- function createscreen()
- ar.fill(RFminx, RFminy, RFmaxx, RFmaxy, DarkGrey) -- RF
- ar.fill(fuelminx, fuelminy, fuelmaxx, fuelmaxy, DarkGrey) -- fuel
- -- fill(int minX, int minY, int maxX, int maxY, int color)
- end
- function setup()
- reactor = reactorSearch()
- ar = ARControllerSearch()
- reactorperi()
- arsetup()
- createscreen()
- end
- function RFPercentage()
- local p = batt.stored() / batt.capacity()
- return p * 100
- end
- function fuelPercentage()
- local p = fuel.fuel() / fuel.capacity()
- return p * 100
- end
- function creatPercentage(percent, miny)
- local percentmultiplied = percent * 3
- return miny + percentmultiplied
- end
- setup()
- print(RFPercentage())
- print(RFminy)
- print(RFmaxy)
- while true do
- ar.clear()
- RFPercent = creatPercentage(RFPercentage(), RFminy)
- FuelPercent = creatPercentage(fuelPercentage(), fuelminy)
- print(RFPercent)
- ar.fill(RFminx, RFminy, RFmaxx, RFPercent, DarkRed)
- ar.fill(fuelminx, fuelminy, fuelmaxx, FuelPercent, YellowGreen)
- ar.drawString(tostring(batt.stored()):reverse():gsub("%d%d%d", "%1,"):reverse():gsub("^,", "").. " RF", 1750, 850, DarkGrey)
- ar.drawString(tostring(batt.producedLastTick()):reverse():gsub("%d%d%d", "%1,"):reverse():gsub("^,", "").. " RF/t", 1750, 870, DarkGrey)
- ar.drawString(tostring(string.format("%.2f",fuel.burnedLastTick()) .. " mB/t"), 1750, 890, DarkGrey)
- sleep(0.5)
- end
Add Comment
Please, Sign In to add comment