Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local heat = 130
- local com = require("component")
- local computer = require("computer")
- local event = require("event")
- local gpu = com.gpu
- local colors = require("colors")
- local w, h = gpu.getResolution()
- local noFuel,sideRed = 0,nil
- print("By GameDoctor")
- if com.isAvailable("reactor") then
- reactor = com.reactor
- elseif com.isAvailable("reactor_chamber") then
- reactor = com.reactor_chamber
- else
- print("Реактор не был обнаружен.")
- os.exit()
- end
- if reactor.getHeat() > heat then
- print("Реактор не может быть запущен, т.к уровень нагрева выше 1%")
- os.exit()
- end
- if com.isAvailable("mfsu") then
- bat = com.mfsu
- print("подключен мфсу")
- elseif com.isAvailable("mfe") then
- bat = com.mfe
- print("подключен мфэ")
- elseif com.isAvailable("cesu") then
- bat = com.cesu
- print("подключен мэх")
- elseif com.isAvailable("asfu") then
- bat = com.asfu
- print("подключен ЭХПФ")
- elseif com.isAvailable("cesu") then
- bat = com.cesu
- print("подключен мэх")
- elseif com.isAvailable("batbox") then
- bat = com.batbox
- print("подключен batbox")
- else
- print("батарея не найдена")
- os.exit()
- end
- local capacity = bat.getCapacity()
- if not com.isAvailable("redstone") then
- print("Ошибка: для работы требуется контроллер красного камня!")
- os.exit()
- end
- local red = com.redstone
- print("Пробный запуск...")
- for i=0,5 do
- red.setOutput(i, 15)
- if reactor.producesEnergy() then
- sideRed = i
- red.setOutput(sideRed, 0)
- print("Редстоун в стороне: "..sideRed)
- os.sleep(1)
- break
- else
- red.setOutput(i, 0)
- end
- if i == 5 then
- print("\n".."Реактор не запускается.")
- os.exit()
- end
- end
- gpu.setResolution(18,8)
- gpu.setBackground(0x000000)
- gpu.fill(1, 1, w, h, " ")
- gpu.setForeground(0xDC143C)
- gpu.set(1,1," Реактор 1 ")
- gpu.setForeground(0xFF00FF)
- gpu.set(1,2,"Всего: "..math.floor(capacity).." ")
- gpu.setForeground(0xFFFFFF)
- while true do
- stored = math.floor(bat.getStored())
- gpu.setForeground(0xFF00FF)
- gpu.set(1,3,"Энергия: "..stored.." ")
- procent = math.floor(stored/capacity*100)
- gpu.setForeground(0xFF00FF)
- gpu.set(1,4,"Хранится: "..procent.." % ")
- gpu.setForeground(0xFF00FF)
- gpu.set(1,5,"EU/T: "..math.floor(reactor.getReactorEUOutput()).." ")
- gpu.setForeground(0xFFFFFF)
- if reactor.getHeat() > heat then
- red.setOutput(sideRed, 0)
- gpu.setForeground(0xFF0000)
- gpu.set(1,6,"Перегрев реактора")
- gpu.set(1,7,"Реактор отключен")
- gpu.setForeground(0xFFFFFF)
- computer.beep(500, 1)
- os.sleep(3)
- else
- gpu.setForeground(0xFF00FF)
- gpu.set(1,6,"Нагрев: "..math.floor(reactor.getHeat()).." ")
- gpu.setForeground(0xFFFFFF)
- if procent < 98 then
- red.setOutput(sideRed, 15)
- elseif procent == 100 then
- red.setOutput(sideRed, 0)
- gpu.setForeground(0xFF0000)
- gpu.set(1,7,"Реактор отключен ")
- gpu.setForeground(0x20AFFF)
- gpu.set(1,8," -= by GameDoctor =- ")
- gpu.setForeground(0xFFFFFF)
- end
- end
- if reactor.producesEnergy() and reactor.getReactorEUOutput() == 0 then
- noFuel = noFuel + 1
- else
- noFuel = 0
- end
- if noFuel >= 3 then
- gpu.setForeground(0xFF0000)
- gpu.set(1,7,"Топливо не найдено ")
- gpu.setForeground(0xFFFFFF)
- computer.beep(500, 1)
- os.sleep(3)
- elseif reactor.producesEnergy() then
- gpu.setForeground(0x00FF00)
- gpu.set(1,7,"Реактор активен ")
- gpu.setForeground(0x20AFFF)
- gpu.set(1,8," -= GameDoctor =- ")
- gpu.setForeground(0xFFFFFF)
- end
- local e = event.pull(1)
- if e == "key_down" then
- red.setOutput(sideRed, 0)
- gpu.setResolution(w, h)
- gpu.fill(1, 1, w, h, " ")
- print("Программа завершена.")
- os.sleep(1)
- if reactor.producesEnergy() then
- print("ВНИМАНИЕ: Реактор всё ещё активен.")
- computer.beep(500, 1)
- os.sleep(1)
- else
- end
- os.exit()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement