Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- term.clear()
- term.setCursorPos(1,1)
- ------------------------------------------------------------------------------------
- local m = peripheral.find("monitor")
- local r = {peripheral.find("BigReactors-Reactor")}
- local h = {peripheral.find("harvester")}
- local g = {peripheral.find("grinder")}
- local ra = {peripheral.find("rancher")}
- ------------------------------------------------------------------------------------
- local r2 = peripheral.find("BigReactors-Reactor")
- local h2 = peripheral.find("harvester")
- local g2 = peripheral.find("grinder")
- local ra2 = peripheral.find("rancher")
- ------------------------------------------------------------------------------------
- Long = " "
- ------------------------------------------------------------------------------------
- function MachineBuilder(Name,BlockName,Letter,Letter2,Mod)
- local Letter = {peripheral.find(BlockName)}
- local Letter2 = peripheral.find(BlockName)
- ListMachine(Name,Letter,Mod)
- end
- function Header()
- m.setTextScale(1)
- m.setCursorPos(1,1)
- m.setBackgroundColor(colors.gray)
- m.write("[Factory Overview]")
- m.setCursorPos(1,2)
- m.write("-------------------")
- end
- function Running()
- m.setBackgroundColor(colors.blue)
- m.setCursorPos(1,YPos)
- m.write(Long)
- m.setCursorPos(15,YPos)
- m.write("[ON]")
- end
- function NotRunning()
- m.setBackgroundColor(colors.red)
- m.setCursorPos(1,YPos)
- m.write(Long)
- m.setCursorPos(14,YPos)
- m.write("[OFF]")
- end
- function NotSureRunning()
- m.setBackgroundColor(colors.orange)
- m.setCursorPos(1,YPos)
- m.write(Long)
- m.setCursorPos(14,YPos)
- m.write("[IDK]")
- end
- function ListMachine(Name,Peripherals,comparison)
- for i = 1, #Peripherals do
- m.setBackgroundColor(colors.orange)
- if comparison == nil then
- NotSureRunning()
- elseif comparison == "Reactor" then --- Big Reactors Reactor
- if Peripherals[i].getActive() then
- Running()
- else
- NotRunning()
- end
- elseif comparison == "MineFactory" then --- Minefactory Reloaded Machines
- if Peripherals[i].getEnergyStored() == nil then
- elseif Peripherals[i].getEnergyStored() > 0 then
- Running()
- else
- NotRunning()
- end
- --- space for new type of machine
- end
- m.setCursorPos(1,YPos)
- m.write(Name.." #"..i)
- YPos = YPos + 1
- end
- end
- function Connected(name,letter)
- if letter then
- term.setTextColor(colors.lime)
- print(name.."[s] Connected!")
- print()
- else
- term.setTextColor(colors.red)
- print("No "..name.. "[s] Connected!")
- print()
- end
- end
- function Connected2()
- Connected("Monitor",m)
- Connected("Reactor",r2)
- Connected("Harvester",h2)
- Connected("Grinder",g2)
- Connected("Rancher",ra2)
- m.setBackgroundColor(colors.black)
- end
- function FindPeripherals()
- m = peripheral.find("monitor")
- r = {peripheral.find("BigReactors-Reactor")}
- h = {peripheral.find("harvester")}
- g = {peripheral.find("grinder")}
- r = {peripheral.find("rancher")}
- end
- function RunThrough()
- Header()
- YPos = 3
- ListMachine("Reactor",r,"Reactor")
- ListMachine("Harvester",h,"MineFactory")
- ListMachine("Grinder",g,"MineFactory")
- ListMachine("Rancher",ra,"MineFactory")
- end
- CONNECTED2 = 1
- --------- LOOP -----------
- local OSTimer = os.startTimer(0)
- m.clear()
- while true do
- m.setBackgroundColor(colors.black)
- local Event, EventType = os.pullEvent()
- if Event == "peripheral_detach" then
- term.setTextColor(colors.orange)
- print(EventType.." has been detached.")
- print("Screen has been reset")
- FindPeripherals()
- m.clear()
- elseif Event == "peripheral" then
- term.setTextColor(colors.blue)
- print(EventType.." has been attached.")
- print("Screen has been reset")
- FindPeripherals()
- m.clear()
- elseif Event == "timer" then
- OSTimer = os.startTimer(1)
- end
- if CONNECTED2 == 1 then
- Connected2()
- CONNECTED2 = 0
- end
- RunThrough()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement