Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- verze = "19.0612"
- local kabel = "back"
- local myTimer = os.startTimer(1)
- local savedata = 0
- local cooler1_click = 0
- local cooler2_click = 0
- local reactor_start = false
- local cooler1 = true
- local cooler2 = false
- local function prc(text, y)
- local w = term.getSize()
- local _, cy = term.getCursorPos()
- term.setCursorPos(math.ceil((w-#text)/2), y or cy)
- write(text)
- end
- function start ()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.blue)
- term.setCursorPos(20,18)
- print" Pepek"
- term.setCursorPos(28,18)
- print"Soft "
- term.setCursorPos(27,18)
- term.setTextColor(colors.lime)
- print"@"
- term.setCursorPos(5, 14)
- print ("Build "..verze)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.setCursorPos(16,7)
- prc "Pepdroll 7 Nuclear Edition"
- term.setCursorPos(14,9)
- term.setBackgroundColor(colors.green)
- textutils.slowPrint " "
- loaddata()
- term.setCursorPos(14,9)
- term.setBackgroundColor(colors.lightGray)
- textutils.slowPrint " "
- recovery()
- term.setCursorPos(14,10)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.white)
- shell.run("pastebin get eRHQs2wN /online")
- term.setCursorPos(14,9)
- term.setBackgroundColor(colors.green)
- textutils.slowPrint " "
- nuclear()
- end
- function desktop()
- term.setBackgroundColor(colors.cyan)
- term.setTextColor(colors.black)
- term.clear()
- paintutils.drawLine(1, 19, 51, 19, colors.lightGray)
- term.setCursorPos(1,19)
- term.setBackgroundColor(colors.gray)
- write"Power"
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if (x >= 1 and x <= 5 and y == 19) and (button == 1 or button == 2)then
- local myWindow = window.create(term.current(),2,17,8,19)
- myWindow.setBackgroundColor(colors.lightGray)
- myWindow.clear()
- term.setBackgroundColor(colors.gray)
- term.setCursorPos(2,17)
- write " Sleep "
- term.setCursorPos(2,18)
- write " Restart "
- term.setCursorPos(2,19)
- write " Shutdown "
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if (x >= 2 and x <= 10 and y == 17) and (button == 1 or button == 2)then
- spanek ()
- elseif (x >= 2 and x <= 10 and y == 18) and (button == 1 or button == 2)then
- restart ()
- elseif (x >= 2 and x <= 10 and y == 19) and (button == 1 or button == 2)then
- vypnout ()
- else
- desktop()
- end
- end
- end
- end
- end
- function loaddata()
- if fs.exists("status.cfg") then
- data = fs.open("status.cfg","r")
- var1 = data.readLine()
- var2 = data.readLine()
- var3 = data.readLine()
- data.close()
- end
- end
- function recovery()
- if var2 == "true" and var3 == "true" and var1 == "true" then
- redstone.setBundledOutput(kabel, colors.lime+colors.red+colors.yellow+colors.white)
- elseif var2 == "true" and var3 == "true" then
- redstone.setBundledOutput(kabel, colors.lime+colors.red)
- elseif var2 == "true" and var3 == "false" then
- redstone.setBundledOutput(kabel, colors.red)
- elseif var2 == "false" and var3 == "true" then
- redstone.setBundledOutput(kabel, colors.lime)
- end
- end
- function redstoneset()
- term.setCursorPos(1,1)
- write "rs-set"
- if cooler1_click == 1 then
- cooler1_click = 0
- if cooler2 == true then
- redstone.setBundledOutput(kabel, colors.lime+colors.red)
- term.setCursorPos(1,2)
- write "c1/1/1"
- else
- redstone.setBundledOutput(kabel, colors.red)
- term.setCursorPos(1,2)
- write "c1/1/2"
- end
- elseif cooler1_click == 2 then
- cooler1_click = 0
- if cooler2 == true then
- redstone.setBundledOutput(kabel, colors.lime)
- term.setCursorPos(1,2)
- write "c1/2/1"
- else
- redstone.setBundledOutput(kabel, 0)
- term.setCursorPos(1,2)
- write "c2/2/1"
- end
- elseif cooler2_click == 1 then
- cooler2_click = 0
- if cooler1 == true then
- redstone.setBundledOutput(kabel, colors.lime+colors.red)
- term.setCursorPos(1,2)
- write "c2/1/1"
- else
- redstone.setBundledOutput(kabel, colors.lime)
- term.setCursorPos(1,2)
- write "c2/1/2"
- end
- elseif cooler2_click == 2 then
- cooler2_click = 0
- if cooler1 == true then
- redstone.setBundledOutput(kabel, colors.red)
- term.setCursorPos(1,2)
- write "c2/2/1"
- else
- redstone.setBundledOutput(kabel, 0)
- term.setCursorPos(1,2)
- write "c2/2/1"
- end
- end
- end
- function reactorset()
- term.setCursorPos(1,1)
- write "rc-set"
- if reactor_click == 1 and cooler1 == true and cooler2 == true then
- redstone.setBundledOutput(kabel, colors.lime+colors.red+colors.white)
- term.setCursorPos(1,2)
- write "rc-t "
- elseif reactor_click == 2 then
- redstone.setBundledOutput(kabel, colors.lime+colors.red)
- term.setCursorPos(1,2)
- write "rc-f "
- else
- term.setCursorPos(1,2)
- write "ERROR "
- end
- end
- function nuclear()
- while true do
- local f=fs.open("status.cfg","w")
- f.writeLine(reactor_start)
- f.writeLine(cooler1)
- f.writeLine(cooler2)
- f.close()
- energy_read = redstone.testBundledInput(kabel, colors.lightBlue)
- cooler1 = redstone.testBundledInput(kabel, colors.red)
- cooler2 = redstone.testBundledInput(kabel, colors.lime)
- reactor_start = redstone.testBundledInput(kabel, colors.white)
- x,y = term.getSize()
- os.startTimer(0.5)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- paintutils.drawLine(1, 19, 51, 19, colors.lightGray)
- term.setCursorPos(46,19)
- write(textutils.formatTime(os.time(), true))
- term.setBackgroundColor(colors.gray)
- term.setCursorPos(1,19)
- write"MENU"
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.green)
- prc (" Nuclear control", 1)
- term.setTextColor(colors.black)
- term.setCursorPos(35,3)
- write ("Reactor : ")
- term.setCursorPos(35,4)
- write "Cooler 1: "
- term.setCursorPos(35,5)
- write "Cooler 2: "
- term.setCursorPos(35,7)
- write "Energy : "
- term.setCursorPos(45,3)
- if reactor_start == true then
- term.setTextColor(colors.green)
- reactor_status = "Running"
- else
- term.setTextColor(colors.red)
- reactor_status = "Stoped"
- end
- write (reactor_status)
- term.setCursorPos(45,4)
- if cooler1 == true then
- term.setTextColor(colors.green)
- cooler1_status = "Running"
- else
- term.setTextColor(colors.red)
- cooler1_status = "Stoped"
- end
- write (cooler1_status)
- term.setCursorPos(45,5)
- if cooler2 == true then
- term.setTextColor(colors.green)
- cooler2_status = "Running"
- else
- term.setTextColor(colors.red)
- cooler2_status = "Stoped"
- end
- write (cooler2_status)
- term.setCursorPos(45,7)
- if energy_read == true then
- term.setTextColor(colors.green)
- energy_status = "Running"
- else
- term.setTextColor(colors.red)
- energy_status = "Stoped"
- end
- write (energy_status)
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.black)
- term.setCursorPos(5,4)
- write " Cooler 1 "
- term.setCursorPos(5,6)
- write " Cooler 2 "
- term.setCursorPos(5,8)
- write " Reactor "
- term.setCursorPos(5,9)
- if reactor_start == true then
- write " STOP "
- else
- write " START "
- end
- event, param1, x,y = os.pullEvent()
- if event == "mouse_click" and x >= 5 and x <= 16 and y == 4 then
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.white)
- term.setCursorPos(5,4)
- write " Cooler 1 "
- if cooler1 == true then
- cooler1_click = 2
- else
- cooler1_click = 1
- end
- redstoneset()
- sleep (0.5)
- elseif event == "mouse_click" and x >= 5 and x <= 16 and y == 6 then
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.white)
- term.setCursorPos(5,6)
- write " Cooler 2 "
- if cooler2 == true then
- cooler2_click = 2
- else
- cooler2_click = 1
- end
- redstoneset()
- sleep (0.5)
- elseif event == "mouse_click" and x >= 5 and x <= 16 and y >= 8 and y <= 9 then
- term.setBackgroundColor(colors.gray)
- term.setTextColor(colors.white)
- term.setCursorPos(5,8)
- write " Reactor "
- term.setCursorPos(5,9)
- if reactor_start == true then
- write " STOP "
- else
- write " START "
- end
- if reactor_start == true then
- reactor_click = 2
- else
- reactor_click = 1
- end
- reactorset()
- sleep (0.5)
- elseif event == "mouse_click" and x >= 1 and x <= 5 and y == 19 then
- term.setTextColor(colors.white)
- term.setCursorPos(1,19)
- write "MENU"
- local myWindow = window.create(term.current(),2,17,8,19)
- myWindow.setBackgroundColor(colors.lightGray)
- myWindow.clear()
- term.setBackgroundColor(colors.gray)
- term.setCursorPos(2,15)
- write " "
- term.setCursorPos(2,16)
- write " Options "
- term.setCursorPos(2,17)
- write " Sleep "
- term.setCursorPos(2,18)
- write " Restart "
- term.setCursorPos(2,19)
- write " Shutdown "
- while true do
- local event, button, x, y = os.pullEvent("mouse_click")
- xy = x..","..y
- if (x >= 1 and x <= 10 and y == 17) and (button == 1 or button == 2)then
- spanek ()
- elseif (x >= 1 and x <= 10 and y == 18) and (button == 1 or button == 2)then
- restart ()
- elseif (x >= 1 and x <= 10 and y == 19) and (button == 1 or button == 2)then
- vypnout ()
- elseif (x >= 1 and x <= 10 and y == 16) and (button == 1 or button == 2)then
- if not fs.exists ("/setting") then
- shell.run("pastebin get 3KJW5cP0 /setting")
- end
- shell.run("/setting")
- else
- nuclear()
- end
- end
- return
- false -- Here is the important part.
- end
- end
- end
- function setting()
- end
- function spanek ()
- term.setBackgroundColor(colors.lightGray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.gray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.black)
- term.clear()
- while true do
- local event, button, xPos, yPos = os.pullEvent("mouse_click")
- desktop ()
- end
- end
- function vypnout ()
- term.setBackgroundColor(colors.lightGray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.gray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(23, 7)
- prc ("Shutting down")
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.blue)
- term.setCursorPos(20,18)
- print" Pepek"
- term.setCursorPos(28,18)
- print"Soft "
- term.setCursorPos(27,18)
- term.setTextColor(colors.lime)
- print"@"
- sleep (2)
- if fs.exists ("/online") then
- fs.delete ("/online")
- end
- os.shutdown ()
- end
- function restart ()
- term.setBackgroundColor(colors.lightGray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.gray)
- term.clear()
- sleep (0.1)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.clear()
- term.setCursorPos(23, 7)
- prc ("Restarting")
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.blue)
- term.setCursorPos(20,18)
- print" Pepek"
- term.setCursorPos(28,18)
- print"Soft "
- term.setCursorPos(27,18)
- term.setTextColor(colors.lime)
- print"@"
- sleep (1)
- term.setBackgroundColor(colors.black)
- term.clear()
- sleep (2)
- if fs.exists ("/online") then
- fs.delete ("/online")
- end
- os.reboot ()
- end
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement