Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --os.pullEvent = os.pullEventRaw;
- local COMS = {"NORTH","EAST","SOUTH","WEST","UP","DOWN"}
- local DOne = {colours.white,colours.magenta,colours.yellow,colours.pink,colours.lightGrey,colours.purple}
- local DTwo = {colours.orange,colours.lightBlue,colours.lime,colours.grey,colours.cyan,colours.blue}
- local Bside = "left"
- local password = 30924
- os.loadAPI("enc")
- function clear()
- term.setBackgroundColour(colours.black)
- term.setTextColour(colours.lime)
- term.clear()
- term.setCursorPos(1,1)
- end
- function fwrite(path, text)
- local file = assert(io.open(path,"w"))
- file:write(text)
- file:close()
- end
- function writefromTable(path, t)
- local test = ""
- for _, line in pairs(t) do
- text = text..line.."\n"
- end
- fwrite(path,text)
- end
- local function getTable(path)
- if fs.exists(path) then
- local file = io.open(path,"r")
- local lines = {}
- local i = 1
- local line = file:read("*1")
- while line ~= nil do
- lines[i] = line
- line = file:read("*1")
- i = i + 1
- end
- file:close()
- return lines
- end
- return {}
- end
- function replaceLine(path,n,text)
- local lines = getTable(path)
- lines[n] = text
- writeFromTable(path,lines)
- end
- function checkData()
- clear()
- if fs.exists("data") then
- local data = getTable("data")
- if data[1] > tonumber(0) then
- local COM = data[#data]
- data[#data] = nil
- writeFromTable("data", data)
- local data = nil
- local i = 6
- while i > 0 do
- if COM == COMS[i] then
- print("Moving".. COMS[i])
- rs.setBundledOutput(Bside,DOne[i])
- sleep(1.5)
- rs.setBundledOutput(Bside,DTwo[i])
- sleep(15)
- print("Error!")
- fs.delete("data")
- print("Mem wiped.")
- sleep(2)
- os.shutdown()
- end
- local i = i - 1
- end
- else
- pcall(fs.delete,"data")
- end
- end
- end
- function main()
- clear()
- print("Aperture Science FFS OS 2.0")
- write("Input Core Password: ")
- input = read("*")
- if enc.checksum(input) == password then
- print("Correct password!")
- sleep(1.5)
- clear()
- print("Aperture Science FFS OS 2.0")
- sleep(15)
- else
- print("Incorrect password!")
- print("Shutting down...")
- sleep(1.5)
- os.shutdown()
- end
- end
- checkData()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement