Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("clear")
- energy="none"
- monitor="none"
- local peripheralList = peripheral.getNames()
- monnum=0
- enrnum=0
- title=""
- tablica = {
- monitor ={"test","test"},
- energy={"test","test"}
- }
- Resonant_Cell = {
- List = {},
- Ilosc = 0,
- Merge = false
- }
- Cuby = {
- List = {}
- }
- print ("Wybierz Monitor:")
- for Index = 1, #peripheralList do
- if string.find(peripheralList[Index], "monitor") then
- monnum = monnum + 1
- tablica.monitor[monnum]=peripheralList[Index]
- print (monnum..". " ..peripheralList[Index])
- end
- end --for
- monitor = tostring(tablica.monitor[tonumber(io.read())])
- function centerText(text,yVal)
- length = string.len(text)
- minus = math.floor(27-length)
- x = math.floor(minus/2)
- monitor.setCursorPos(x+1,yVal)
- monitor.write(text)
- end
- shell.run("clear")
- print ("Wybierz Magazyn Energi:")
- for Index = 1, #peripheralList do
- if string.find(peripheralList[Index], "cell") then
- enrnum = enrnum + 1
- tablica.energy[enrnum]=peripheralList[Index]
- print (enrnum..". " ..peripheralList[Index])
- if string.find(peripheralList[Index], "resonant") then
- Resonant_Cell.Ilosc = Resonant_Cell.Ilosc + 1
- Resonant_Cell.List[Resonant_Cell.Ilosc] = peripheralList[Index]
- end
- elseif string.find(peripheralList[Index], "Cube") then
- enrnum = enrnum + 1
- tablica.energy[enrnum]=peripheralList[Index]
- print (enrnum..". " ..peripheralList[Index])
- elseif string.find(peripheralList[Index], "Mekanism") then
- enrnum = enrnum + 1
- tablica.energy[enrnum]=peripheralList[Index]
- print (enrnum..". " ..peripheralList[Index])
- elseif string.find(peripheralList[Index], "capacitorbank") then
- enrnum = enrnum + 1
- tablica.energy[enrnum]=peripheralList[Index]
- print (enrnum..". " ..peripheralList[Index])
- end
- end
- energy = tostring(tablica.energy[tonumber(io.read())])
- --if Resonant_Cell.Ilosc > 1 then
- -- shell.run("clear")
- -- print ("Znaleziono wiecej niz jeden Resonant Cell, Czy chcesz je polaczyc ? (Ilosc: "..Resonant_Cell.Ilosc..")")
- -- if io.read() == "tak" then
- -- Resonant_Cell.Merge = true
- -- for x = 1, Resonant_Cell.Ilosc do
- -- energy = tostring(Resonant_Cell.List[x])
- -- end
- -- Resonant_Cell.Merge = true
- -- elseif io.read() == "nie" then
- -- shell.run("clear")
- -- print("Wybierz numer:")
- -- energy = tostring(tablica.energy[tonumber(io.read())])
- --
- -- else
- -- energy = tostring(tablica.energy[tonumber(io.read())])
- -- shell.run("clear")
- -- if string.find(energy, "resonant") then
- -- title = "Resonant Energy Cell"
- -- end
- --
- -- end
- --end
- if Resonant_Cell.Merge == true then
- for x = 1, Resonant_Cell.Ilosc do
- Cuby.List[x] = peripheral.wrap(Resonant_Cell.List[x])
- end
- shell.run("clear")
- print("Poloczono: " ..Resonant_Cell.Ilosc.." Resonant Cell!")
- title = "Resonant Energy Celle"
- end
- energy = peripheral.wrap(energy)
- monitor = peripheral.wrap(monitor)
- monitor.setBackgroundColour(colors.black)
- monitor.setTextColour(colors.red)
- monitor.setTextScale(1.0)
- monitor.setCursorPos(1,1)
- centerText(string.rep(" ",string.len(title)+2),1)
- centerText(title,1)
- while true do
- if Resonant_Cell.Merge == true then
- maxRF = Cuby.List[1].getMaxEnergyStored("unknown")
- curRF = Cuby.List[1].getEnergyStored("unknown")
- end
- maxRF = energy.getMaxEnergyStored("unknown")
- curRF = energy.getEnergyStored("unknown")
- curKRF = curRF / 1000
- curMRF = curKRF / 1000
- curGRF = curMRF / 1000
- if curRF < 9999 then
- monitor.setBackgroundColour(colors.black)
- monitor.setTextColour(colors.blue)
- centerText("Energia: "..curKRF.." KRF",3)
- elseif curRF < 99999999 then
- monitor.setBackgroundColour(colors.black)
- monitor.setTextColour(colors.blue)
- centerText("Energia: "..curMRF.." MRF",3)
- elseif curRF < 9999999999999 then
- monitor.setBackgroundColour(colors.black)
- monitor.setTextColour(colors.blue)
- centerText("Energia: "..curGRF.." GRF",3)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement