Advertisement
bennyuoppd

Minecraft CC RP2 Frameship 2.0

Dec 23rd, 2012
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.16 KB | None | 0 0
  1. --os.pullEvent = os.pullEventRaw;
  2. local COMS = {"NORTH","EAST","SOUTH","WEST","UP","DOWN"}
  3. local DOne = {colours.white,colours.magenta,colours.yellow,colours.pink,colours.lightGrey,colours.purple}
  4. local DTwo = {colours.orange,colours.lightBlue,colours.lime,colours.grey,colours.cyan,colours.blue}
  5. local Bside = "left"
  6. local password = 30924
  7. os.loadAPI("enc")
  8.  
  9. function clear()
  10. term.setBackgroundColour(colours.black)
  11. term.setTextColour(colours.lime)
  12. term.clear()
  13. term.setCursorPos(1,1)
  14. end
  15.  
  16. function fwrite(path, text)
  17. local file = assert(io.open(path,"w"))
  18. file:write(text)
  19. file:close()
  20. end
  21.  
  22. function writefromTable(path, t)
  23. local test = ""
  24. for _, line in pairs(t) do
  25. text = text..line.."\n"
  26. end
  27. fwrite(path,text)
  28. end
  29.  
  30. local function getTable(path)
  31.  if fs.exists(path) then
  32.   local file = io.open(path,"r")
  33.   local lines = {}
  34.   local i = 1
  35.   local line = file:read("*1")
  36.   while line ~= nil do
  37.    lines[i] = line
  38.    line = file:read("*1")
  39.    i = i + 1
  40.   end
  41.   file:close()
  42.  return lines
  43. end
  44. return {}
  45. end
  46.  
  47. function replaceLine(path,n,text)
  48.  local lines = getTable(path)
  49.  lines[n] = text
  50.  writeFromTable(path,lines)
  51. end
  52.  
  53. function checkData()
  54. clear()
  55.  if fs.exists("data") then
  56.   local data = getTable("data")
  57.   if data[1] > tonumber(0) then
  58.    local COM = data[#data]
  59.    data[#data] = nil
  60.    writeFromTable("data", data)
  61.    local data = nil
  62.    local i = 6
  63.    while i > 0 do
  64.     if COM == COMS[i] then
  65.      print("Moving".. COMS[i])
  66.      rs.setBundledOutput(Bside,DOne[i])
  67.      sleep(1.5)
  68.      rs.setBundledOutput(Bside,DTwo[i])
  69.      sleep(15)
  70.      print("Error!")
  71.      fs.delete("data")
  72.      print("Mem wiped.")
  73.      sleep(2)
  74.      os.shutdown()
  75.     end
  76.     local i = i - 1
  77.    end
  78.    else
  79.    pcall(fs.delete,"data")
  80.   end
  81.  end
  82. end
  83.  
  84. function main()
  85.  clear()
  86.  print("Aperture Science FFS OS 2.0")
  87.  write("Input Core Password: ")
  88.  input = read("*")
  89.  if enc.checksum(input) == password then
  90.   print("Correct password!")
  91.   sleep(1.5)
  92.   clear()
  93.   print("Aperture Science FFS OS 2.0")
  94.   sleep(15)
  95.   else
  96.   print("Incorrect password!")
  97.   print("Shutting down...")
  98.   sleep(1.5)
  99.   os.shutdown()
  100.  end
  101. end
  102.  
  103. checkData()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement