Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local monitor = peripheral.find("monitor")
- local reactor = peripheral.find("BigReactors-Reactor")
- local rodSize = 4
- function clear()
- term.clear()
- term.setBackgroundColor(colors.black)
- term.setCursorPos(1,1)
- end
- function drawRods(sx, sy)
- local controlRods = reactor.getNumberOfControlRods()
- for i=1,controlRods do
- term.setCursorPos(1,1)
- local percent = reactor.getControlRodLevel(i-1)/100.0
- local h = math.floor(percent*rodSize)
- if percent == 1 then
- h = rodSize-1
- end
- local left = (rodSize-h)-1
- local x = sx+i*2
- local y = sy
- if i > 10 then
- y = y + rodSize+1
- x = sx + (i-10)*2
- end
- --write(tostring(i)..' '..tostring(h))
- --x,y,width,height
- paintutils.drawFilledBox(x, y, x, y+h, colours.green)
- if percent < 1 then
- paintutils.drawFilledBox(x, y+h, x, (y+h)+left, colours.red)
- end
- end
- term.setBackgroundColor(colours.black)
- end
- function drawHeader()
- local activeText = "Active"
- if not reactor.getActive() then
- activeText = "Disabled"
- end
- write("Reactor "..activeText.."\n")
- end
- function discordNotify(botName, message)
- local postDataTable = {
- username = botName,
- content = message
- }
- local postData = textutils.serializeJSON( postDataTable )
- local headers = {
- ["Content-Type"] = "application/json"
- }
- write(postData)
- -- Make a HTTP request
- local request,err = http.post("https://discordapp.com/api/webhooks/696901545643606046/Ki7Un8TIliV9qpMNtOaWdevL_z1YcRYw-kpZsVo18TvueOqI3UesNowY2b5ZlZhYq4Zj", postData, headers)
- if not request then error(err) end
- request.close()
- end
- term.redirect(monitor)
- monitor.setTextScale(0.5)
- local updates = 0
- local screenUpdateEvery = 10
- while true do
- --if updates >= screenUpdateEvery then
- -- clear()
- -- drawHeader()
- -- drawRods(1, 4)
- -- updates = 0
- --end
- clear()
- local time = textutils.formatTime(os.time("local"), true)
- write(time)
- if time == "17:00" or time == "10:00" then
- discordNotify("Reactor", "Test")
- end
- sleep(10)
- --updates = updates + 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement