Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Vars
- local BigMonitor = "monitor_3"
- local SmallMonitors = { "monitor_0", "monitor_2" }
- local bmon = peripheral.wrap(BigMonitor)
- local mons = {}
- local kos = {}
- local user = {}
- local curuser = nil--"root"--nil
- local mde = nil
- user["root"] = { true, "pin123" }
- user["Byloff"] = { false, "4850" }
- os.setComputerLabel("C1")
- for k, v in pairs(SmallMonitors) do
- mons[k] = peripheral.wrap(v)
- end
- function drawText(mon, txt, scale)
- mon.clear()
- local w, h = mon.getSize()
- mon.setCursorPos( math.ceil( w/2 - #txt/2) + 1, h/2 + 1 )
- mon.setTextScale(scale)
- mon.write(txt)
- --mon.setCursorPos(curx,cury+1)
- end
- function displayText(txt)
- drawText(bmon, txt, 5)
- for i=1, #mons do
- drawText(mons[i], txt, 1)
- end
- end
- function kos.print(txt, a)
- write(os.getComputerLabel() .. txt)
- if a == nil then
- print("")
- end
- end
- function kos.stdline(a)
- kos.print("@", true)
- if user[curuser][1] == true then
- term.setTextColor(colors.red)
- else
- term.setTextColor(colors.lime)
- end
- write(curuser)
- term.setTextColor(colors.white)
- write(":~$ ")
- if a == nil then
- print("")
- end
- end
- term.clear()
- --print("KSpace-OS V1")
- --term.setCursorPos(1,0)
- --print ("Enter Password")
- --local input = read("*")
- displayText("10")
- function kos.next()
- kos.stdline(true)
- term.setCursorBlink(true)
- local cmd = read()
- term.setCursorBlink(false)
- kos.next()
- end
- function kos.passentry()
- if type(curuser) == "string" then
- term.clear()
- boot()
- else
- --print(type(mde))
- if type(mde) == "nil" then
- kos.print("@username: ", true)
- local name = read()
- term.setCursorBlink(true)
- if type(user[name]) == "table" then
- mde = name
- term.setCursorBlink(false)
- kos.passentry()
- else
- term.setCursorBlink(false)
- kos.print(": incorrect username!")
- kos.passentry()
- end
- else
- kos.print("@password: ", true)
- term.setCursorBlink(true)
- local password = read("*")
- local usr = user[mde]
- --print(mde)
- if password == usr[2] then
- term.setCursorBlink(false)
- curuser = mde
- kos.passentry()
- --term.clear()
- --boot()
- else
- term.setCursorBlink(false)
- kos.print(": incorrect password!")
- kos.passentry()
- end
- end
- end
- end
- function boot()
- term.setCursorPos(1, 1)
- term.setTextColor(colors.yellow)
- print("KronosOS V1")
- print("Dist. SpaceX-OS")
- print("(C) Kronos Tech Inc.")
- term.setTextColor(colors.white)
- term.setCursorBlink(false)
- print("")
- if type(curuser) == "string" then
- --print("hi")
- kos.next()
- else
- kos.passentry()
- end
- end
- boot()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement