Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function formateNumber(n) --http://richard.warburton.it
- n = string.format("%.f", tostring(n))
- local left,num,right = string.match(n,'^([^%d]*%d)(%d*)(.-)$');
- return left..(num:reverse():gsub('(%d%d%d)','%1,'):reverse())..right;
- end
- function round(num, idp)
- local mult = 10^(idp or 0);
- return math.floor(num * mult + 0.5) / mult;
- end
- local lasers = {}
- local gates = {}
- local monitor = peripheral.wrap("monitor_0")
- local i = 1
- local n = 1
- local LaserEnergy = 0
- local w, h = monitor.getSize()
- for i = 0, 5, 1 do
- lasers[i] = peripheral.wrap("Laser Amplifier_" .. i)
- end
- for i = 0, 5, 1 do
- gates[i] = peripheral.wrap("flux_gate_" .. i)
- end
- for i = 0, 5, 1 do
- gates[i].setOverrideEnabled(true)
- end
- monitor.clear()
- monitor.setTextScale(.5)
- while true do
- i = 0
- n = 1
- for _ in pairs(lasers) do
- LaserEnergy = lasers[i].getEnergy()/2.5
- if LaserEnergy > 1600000000 then
- gates[i].setFlowOverride(0)
- else
- gates[i].setFlowOverride(256000)
- end
- monitor.setCursorPos(2,n)
- monitor.setTextColor(colors.lime)
- monitor.write("Laser " .. i+1 .. " charged with " .. formateNumber(LaserEnergy).. " RF")
- monitor.setCursorPos(2,n+1)
- monitor.write("Laser " .. i+1 .. " is " .. round((LaserEnergy/800000000)*100, 4) .. " % charged for one blast")
- if LaserEnergy > 800000000 then
- monitor.setCursorPos(2,n+3)
- monitor.clearLine()
- monitor.setTextColor(colors.lime)
- monitor.write("Laser Impuls is ready.")
- else
- monitor.setCursorPos(2,n+3)
- monitor.clearLine()
- monitor.setTextColor(colors.red)
- monitor.write("Laser Impuls is NOT ready.")
- end
- i = i + 1
- n = n + 6
- end
- sleep(0.2)
- end
Add Comment
Please, Sign In to add comment