Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --UpdateMods
- --NuAoA
- local on_array = {}
- os.pullEvent = os.pullEventRaw
- local rednetFace = "top"
- local broadcastID = 3
- local list = {
- "";
- "";
- "";
- "";
- "";
- }
- if not fs.exists("wrap") then
- print("Wrap API not found, downloading from http://pastebin.com/g5tBarus")
- shell.run("pastebin get g5tBarus wrap")
- end
- if not fs.exists("Draw") then
- print("Draw API not found, downloading from http://pastebin.com/3sAGiX7j")
- shell.run("pastebin get 3sAGiX7j Draw")
- end
- os.loadAPI("wrap")
- os.loadAPI("Draw")
- mon = wrap.attach("monitor")
- for i=1,16 do
- local temp_tab = {}
- temp_tab["name"] = mod_array[i]
- temp_tab["state"] = false
- on_array[i] = temp_tab
- end
- function deepcopy(orig)
- local orig_type = type(orig)
- local copy
- if orig_type == 'table' then
- copy = {}
- for orig_key, orig_value in next, orig, nil do
- copy[deepcopy(orig_key)] = deepcopy(orig_value)
- end
- setmetatable(copy, deepcopy(getmetatable(orig)))
- else -- number, string, boolean, etc
- copy = orig
- end
- return copy
- end
- function getBroadcast()
- rednet.open(rednetFace)
- while true do
- local id,mess = rednet.receive()
- if id == broadcastID then
- local iter = 1
- for word in string.gmatch(mess,"%S+") do
- on_array[iter]["name"] = string.match(word,"(%S+)|%S+")
- local onOff = string.match(word,"%S+|(%S+)")
- if onOff == "on" then
- on_array[iter]["state"] = true
- elseif onOff == "off" then
- on_array[iter]["state"] = false
- end
- iter = iter+1
- end
- os.queueEvent("Update")
- end
- end
- end
- function update()
- while true do
- local event = os.pullEvent("Update")
- local t_c,t_t = Draw.emptyScreen(mon)
- Draw.tc(t_c,1,1,colors.brown,#t_c[1],#t_c)
- for i=1,#list do
- Draw.tt(t_t,1,i,list[i])
- end
- Draw.draw(mon,t_c,1,1,colors.black,t_t)
- end
- end
- function antiHack()
- print("[AntiHack] Enabled")
- while true do
- local event,side = os.pullEventRaw()
- if event == "peripheral" then
- if peripheral.getType(side) == "drive" then
- -- we got someone putting a drive next to the terminal
- elseif peripheral.getType(side) == "computer" then
- end
- elseif event == "disk" then
- if fs.exists("disk/startup") then
- fs.delete("disk/startup")
- disk.setLabel(side,"Broken Floppy")
- end
- elseif event == "terminate" then
- os.queueEvent("password")
- end
- end
- end
- function password()
- while true do
- local event = os.pullEvent("password")
- sleep(0)
- term.clear()
- term.setCursorPos(1,1)
- if string.lower(read("*")) == "recordmods" then
- shell.run("edit startup")
- os.reboot()
- end
- end
- end
- function reUpdate()
- while true do
- sleep(10)
- os.queueEvent("Update")
- end
- end
- parallel.waitForAll(update,getBroadcast,password,reUpdate)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement