Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --назвать файл autorun.lua
- event=require("event")
- component=require("component")
- gpu=component.gpu
- term=require("term")
- function printAddedCom()
- oldColor=gpu.getForeground()
- gpu.setForeground(3394611)
- len=string.len(com)+16
- W, H=gpu.getResolution()
- gpu.fill(W-len, 1, W, 1, "-")
- gpu.set(W-len, 2, "----Найден "..com.."-----")
- gpu.set(W-len, 3, "--- Компонент добавлен---")
- gpu.set(W-len, 4, "--В значение "..com.." --")
- oldCursorPosx, oldCursorPosy=term.getCursor()
- term.setCursor(W-len, 5)
- for i=1, len do
- io.write("-")
- end
- term.setCursor(oldCursorPosx, oldCursorPosy)
- gpu.setForeground(oldColor)
- end
- function getTheTerrain()
- _G.line={}
- len=string.len(com)+16
- W, H=gpu.getResolution()
- for y=1, 5 do
- linetmp=""
- for x=W-len, W do
- symbol=gpu.get(x, y)
- linetmp=linetmp..symbol
- end
- line[y]=linetmp
- end
- end
- function restoreTerrain()
- len=string.len(com)+16
- W, H=gpu.getResolution()
- gpu.set(W-len, 1, line[1])
- gpu.set(W-len, 2, line[2])
- gpu.set(W-len, 3, line[3])
- gpu.set(W-len, 4, line[4])
- gpu.set(W-len, 5, line[5])
- end
- function getNewCom(_, address, comName)
- _G.com=comName
- getTheTerrain()
- printAddedCom()
- _G[comName]=component[comName]
- event.timer(3, restoreTerrain)
- end
- event.listen("component_added", getNewCom)
Advertisement
Add Comment
Please, Sign In to add comment