Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("clear")
- dbcol = colors.black
- dtcol = colors.lime
- diskR = ""
- function mbut(cx,cy,text,bcol,tcol)
- if bcol == nil then
- bcol = dbcol
- end
- if tcol == nil then
- tcol = dtcol
- end
- mon.setCursorPos(cx,cy)
- mon.setBackgroundColor(bcol)
- mon.setTextColor(tcol)
- mon.write(text)
- mon.setBackgroundColor(dbcol)
- mon.setTextColor(dtcol)
- end
- function rows()
- mbut(2,y,"|")
- mbut(64,y,"|")
- mbut(33,y,"|")
- end
- state = false
- rs.setOutput("left",false)
- while true do
- x = 2
- y = 2
- machines = {}
- machines = peripheral.getNames()
- mon = ""
- reactors = {}
- for v, k in pairs(machines) do
- if string.find(k,"monitor") ~= nil then
- mon = peripheral.wrap(k)
- mon.setTextScale(0.5)
- end
- if string.find(k,"reactor") ~= nil then
- table.insert(reactors,k)
- end
- if string.find(k,"chest_diamond") ~= nil then
- chest = peripheral.wrap(k)
- chestAPI = k
- end
- if string.find(k,"drive") ~= nil then
- drive = peripheral.wrap(k)
- driveAPI = k
- function readDisk()
- diskR = fs.open("disk/akw.lua","r")
- if diskR == nil then
- create = fs.open("disk/akw.lua","w")
- create.write(false)
- create.close()
- end
- reading = diskR.readAll()
- diskR.close()
- return reading
- end
- function saveDisk(text)
- disk = fs.open("disk/akw.lua","w")
- disk.write(text)
- disk.close()
- end
- end
- end
- sum = 0
- reactorsStats = {}
- mbut(2,y,"Reactors: ")
- y = 4
- mbut(2,y,"+------------------------------+------------------------------+")
- y = 5
- rows()
- y = 6
- for v,k in pairs(reactors) do
- mod = v % 2
- if mod == 0 then
- x = 33
- y = y - 5
- else
- x = 2
- end
- reactor = peripheral.wrap(k)
- reactorAPI = k
- reactorCore = reactor.getReactorCore()
- data = reactorCore.getMetadata()
- stats = data["reactor"]
- reactor_status = stats.active
- reactor_heat = stats.heat
- reactor_eu = stats.euOutput
- reactor_maxHeat = stats.maxHeat
- eu = string.format("%d",reactor_eu)
- sum = sum + eu
- rows()
- col = 0
- if fs.exists("disk/akw.lua") == nil then
- state = false
- saveDisk(state)
- else
- state = readDisk()
- if state == nil then
- state = "false"
- saveDisk(state)
- end
- end
- if reactor_heat >= 2000 then
- state = false
- saveDisk(state)
- end
- print(state)
- if state == "true" then
- rs.setOutput("top",true)
- mbut(12,2,"[+]",colors.green)
- elseif state == "false" or state == "nil" then
- rs.setOutput("top",false)
- mbut(12,2,"[-]",colors.red)
- end
- if reactor_status == true then
- reactor_status = "On"
- col = colors.green
- else
- reactor_status = "Off"
- col = colors.red
- end
- mbut(x+1,y," ")
- mbut(x+2,y,"Reactor " .. v .. " Status " .. reactor_status,nil,col)
- y = y + 1
- rows()
- mbut(x+1,y," ")
- mbut(x+2,y,"Reactor Heatlevel: " .. reactor_heat .. " / " .. reactor_maxHeat)
- y = y + 1
- rows()
- mbut(x+1,y," ")
- mbut(x+2,y,"Reactor EU Output: " .. eu)
- y = y + 1
- rows()
- y = y + 1
- mbut(2,y,"+------------------------------+------------------------------+")
- y = y + 1
- end
- rows()
- mbut(4,y," ")
- mbut(4,y,"Total EU/T: " .. sum, nil, colors.blue)
- y = y + 1
- mbut(2,y,"+------------------------------+------------------------------+")
- sleep(0.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement