Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local mon = peripheral.wrap("left")
- local son = peripheral.wrap("top")
- term.redirect(mon)
- local reactor
- local link = false
- local wifi = peripheral.wrap("right")
- wifi.open(16)
- local function reset()
- term.setBackgroundColor(colors.black)
- term.clear()
- end
- local function energie()
- term.setBackgroundColor(colors.black)
- term.setCursorPos(2,23)
- local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- term.write("Stock Energie : "..message.." %")
- end
- local function tactile(xmin,xmax, ymin, ymax)
- os.startTimer(0.5)
- event, side, xPos, yPos = os.pullEvent("monitor_touch")
- if xPos <= xmax and xPos >= xmin and yPos <= ymax and yPos >= ymin then
- return true
- end
- end
- local function prod()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- if peripheral.find("BigReactors-Reactor") then
- link = true
- reactor = peripheral.find("BigReactors-Reactor")
- else link = false end
- if link == true then
- local rf = reactor.getEnergyProducedLastTick()
- local fuel = reactor.getFuelAmount()/1000
- local isOk = reactor.getActive()
- local temp = reactor.getFuelTemperature()
- term.setBackgroundColor(colors.black)
- term.setCursorPos(4,27)
- term.clearLine()
- term.write("Link : ok")
- wifi.transmit(10,20,isOk)
- if isOk == true then
- term.setCursorPos(4,28)
- term.clearLine()
- term.write("Status : Allumé")
- else
- term.setCursorPos(4,28)
- term.clearLine()
- term.write("Status : Eteint")
- end
- term.setCursorPos(4,29)
- term.clearLine()
- term.write("Prod : "..math.ceil(rf/1000).." KRF/t")
- term.setCursorPos(4,30)
- term.write("Fuel : "..math.floor(fuel).." B")
- term.setCursorPos(4,31)
- term.clearLine()
- term.write("Heat : "..math.ceil(temp).." °C")
- elseif link == false then
- term.setCursorPos(4,27)
- term.clearLine()
- term.write("Link : error")
- term.setCursorPos(4,28)
- term.clearLine()
- term.write("Status : error")
- term.setCursorPos(4,29)
- term.clearLine()
- term.write("Prod : xxx")
- term.setCursorPos(4,30)
- term.clearLine()
- term.write("Fuel : xxx")
- term.setCursorPos(4,31)
- term.clearLine()
- term.write("Heat : xxx")
- end
- term.setCursorPos(10,26)
- term.write("Réacteur")
- paintutils.drawBox(2,25,24,32,colors.lightGray)
- paintutils.drawFilledBox(26,25,30,27,colors.green)
- term.setTextColor(colors.black)
- term.setCursorPos(27,26)
- term.write("ON")
- paintutils.drawFilledBox(26,30,30,32,colors.red)
- term.setCursorPos(27,31)
- term.write("OFF")
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- --if tactile(26,30,25,27) == true then
- -- reactor.setActive(true)
- --end
- --if tactile(26,30,30,32) == true then
- -- reactor.setActive(false)
- --end
- end
- local function erreur()
- term.setBackgroundColor(colors.black)
- term.setCursorPos(3,5)
- term.setTextColor(colors.red)
- mon.setTextScale(3.5)
- term.write("Connexion Perdue")
- end
- local function chest()
- term.setBackgroundColor(colors.black)
- if refinedstorage.isConnected() == true then
- mon.setTextScale(1)
- term.setTextColor(colors.white)
- term.setCursorPos(1,1)
- local tbl = refinedstorage.getStorages()
- local t = tbl.total.item.capacity
- local u = tbl.total.item.usage
- local p = (u * 100) / t
- local x = 14
- local temp = 14
- if temp ~= x then
- if p < 10 then x = 11
- elseif p > 10 and p < 20 then x = 14
- elseif p > 20 and p < 30 then x = 19
- elseif p > 30 and p < 40 then x = 24
- elseif p > 40 and p < 50 then x = 29
- elseif p > 50 and p < 60 then x = 34
- elseif p > 60 and p < 70 then x = 39
- elseif p > 70 and p < 80 then x = 44
- elseif p > 80 and p < 90 then x = 39
- elseif p > 90 and p < 100 then x = 54
- elseif p == 100 then x = 59
- end
- temp = x
- else
- if p < 10 then x = 11
- elseif p > 10 and p < 20 then x = 14
- elseif p > 20 and p < 30 then x = 19
- elseif p > 30 and p < 40 then x = 24
- elseif p > 40 and p < 50 then x = 29
- elseif p > 50 and p < 60 then x = 34
- elseif p > 60 and p < 70 then x = 39
- elseif p > 70 and p < 80 then x = 44
- elseif p > 80 and p < 90 then x = 49
- elseif p > 90 and p < 100 then x = 54
- elseif p == 100 then x = 59
- end
- end
- if p < 50 then couleur = colors.green
- elseif p > 50 and p < 80 then couleur = colors.orange
- elseif p > 80 then couleur = colors.red
- end
- term.setCursorPos(2,24)
- volt = refinedstorage.getEnergyUsage()
- term.write("Conso Applied : "..math.ceil(volt).." RF/tick")
- paintutils.drawBox(10,2,60,8,colors.lightGray)
- if temp < x then
- paintutils.drawFilledBox(11,3,x,7,couleur)
- else
- --paintutils.drawFilledBox(2,4,6,6,colors.black)
- paintutils.drawFilledBox(11,3,59,7,colors.black)
- paintutils.drawFilledBox(11,3,x,7,couleur)
- end
- term.setBackgroundColor(colors.black)
- paintutils.drawFilledBox(64,4,68,6,colors.black)
- term.setCursorPos(65,5)
- term.write(math.ceil(p).."%")
- paintutils.drawFilledBox(2,4,6,6,colors.black)
- term.setCursorPos(3,5)
- term.write(math.ceil(u/1000).."K")
- os.sleep(1)
- end
- if refinedstorage.isConnected() == false then
- erreur()
- end
- end
- reset()
- while true do
- chest()
- --energie()
- if refinedstorage.isConnected() == true then
- prod()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement