From 8eab77623315cdfecc21ebffbaa708a19ce23426 Mon Sep 17 00:00:00 2001 From: Igor Timofeev Date: Sun, 20 Dec 2015 06:08:57 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A7=D1=83=D1=82=D1=8C=20=D0=BF=D0=BE=D1=83?= =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=BD=D0=B5=D0=B5=20=D1=81=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B0=D0=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Applications.txt | 50 ++++++---- Applications/ChristmasTree/About.txt | 1 + Applications/ChristmasTree/ChristmasTree.lua | 95 +++++++++++++++++++ Applications/ChristmasTree/Icon.pic | Bin 0 -> 287 bytes Installer/Installer.lua | 90 ++++++------------ 5 files changed, 160 insertions(+), 76 deletions(-) create mode 100644 Applications/ChristmasTree/About.txt create mode 100644 Applications/ChristmasTree/ChristmasTree.lua create mode 100644 Applications/ChristmasTree/Icon.pic diff --git a/Applications.txt b/Applications.txt index 6a6f8c85..0e7930fa 100644 --- a/Applications.txt +++ b/Applications.txt @@ -344,6 +344,7 @@ ["about"]="IgorTimofeev/OpenComputers/master/Applications/Photoshop/About.txt", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/Photoshop/Icon.pic", + ["createShortcut"] = "dock", ["version"]=1.0, }, { @@ -351,6 +352,7 @@ ["url"]="IgorTimofeev/OpenComputers/master/Applications/Shooting/Shooting.lua", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/Shooting/Icon.pic", + ["createShortcut"] = "desktop", ["version"]=1.0, }, { @@ -358,6 +360,7 @@ ["url"]="IgorTimofeev/OpenComputers/master/Applications/Geoscan/Geoscan.lua", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/Geoscan/Icon.pic", + ["createShortcut"] = "desktop", ["version"]=1.0, }, { @@ -365,6 +368,7 @@ ["url"]="IgorTimofeev/OpenComputers/master/Applications/HoloClock/HoloClock.lua", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/HoloClock/Icon.pic", + ["createShortcut"] = "desktop", ["version"]=1.0, }, { @@ -372,6 +376,7 @@ ["url"]="IgorTimofeev/OpenComputers/master/Applications/Pastebin/Pastebin.lua", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/Pastebin/Icon.pic", + ["createShortcut"] = "desktop", ["version"]=1.0, }, { @@ -379,6 +384,7 @@ ["url"]="IgorTimofeev/OpenComputers/master/Applications/Shop/Shop.lua", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/Shop/Icon.pic", + ["createShortcut"] = "desktop", ["version"]=1.0, }, { @@ -387,6 +393,7 @@ ["about"]="IgorTimofeev/OpenComputers/master/Applications/Finder/About.txt", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/Finder/Icon.pic", + ["createShortcut"] = "dock", ["version"]=1.0, }, { @@ -395,6 +402,7 @@ ["about"]="IgorTimofeev/OpenComputers/master/Applications/Control/About.txt", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/Control/Icon.pic", + ["createShortcut"] = "dock", ["version"]=1.0, }, { @@ -402,6 +410,7 @@ ["url"]="IgorTimofeev/OpenComputers/master/Applications/Piano/Piano.lua", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/Piano/Icon.pic", + ["createShortcut"] = "desktop", ["version"]=1.0, }, { @@ -409,6 +418,7 @@ ["url"]="IgorTimofeev/OpenComputers/master/Applications/Calc/Calc.lua", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/Calc/Icon.pic", + ["createShortcut"] = "desktop", ["version"]=1.0, }, { @@ -417,6 +427,7 @@ ["about"]="IgorTimofeev/OpenComputers/master/Applications/Calendar/About.txt", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/Calendar/Icon.pic", + ["createShortcut"] = "dock", ["version"]=1.0, }, { @@ -424,6 +435,7 @@ ["url"]="IgorTimofeev/OpenComputers/master/Applications/Snake/Snake.lua", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/Snake/Icon.pic", + ["createShortcut"] = "desktop", ["version"]=1.0, }, { @@ -432,6 +444,7 @@ ["about"]="IgorTimofeev/OpenComputers/master/Applications/CodeDoor/About.txt", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/CodeDoor/Icon.pic", + ["createShortcut"] = "desktop", ["version"]=1.0, }, { @@ -440,6 +453,7 @@ ["about"]="IgorTimofeev/OpenComputers/master/Applications/Keyboard/About.txt", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/Keyboard/Icon.pic", + ["createShortcut"] = "desktop", ["version"]=1.0, }, { @@ -448,6 +462,7 @@ ["about"]="IgorTimofeev/OpenComputers/master/Applications/Nano/About.txt", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/Nano/Icon.pic", + ["createShortcut"] = "desktop", ["version"]=1.0, }, { @@ -456,6 +471,7 @@ ["about"]="IgorTimofeev/OpenComputers/master/Applications/Camera/About.txt", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/Camera/Icon.pic", + ["createShortcut"] = "desktop", ["version"]=1.0, }, { @@ -464,6 +480,7 @@ ["about"]="IgorTimofeev/OpenComputers/master/Applications/Autorun/About.txt", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/Autorun/Icon.pic", + ["createShortcut"] = "desktop", ["version"]=1.0, }, { @@ -472,6 +489,7 @@ ["about"]="IgorTimofeev/OpenComputers/master/Applications/Matrix/About.txt", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/Matrix/Icon.pic", + ["createShortcut"] = "desktop", ["version"]=1.0, }, { @@ -480,6 +498,16 @@ ["about"]="IgorTimofeev/OpenComputers/master/Applications/HEX/About.txt", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/HEX/Icon.pic", + ["createShortcut"] = "dock", + ["version"]=1.0, + }, + { + ["name"]="MineOS/Applications/ChristmasTree", + ["url"]="IgorTimofeev/OpenComputers/master/Applications/ChristmasTree/ChristmasTree.lua", + ["about"]="IgorTimofeev/OpenComputers/master/Applications/ChristmasTree/About.txt", + ["type"]="Application", + ["createShortcut"] = "desktop", + ["icon"]="IgorTimofeev/OpenComputers/master/Applications/ChristmasTree/Icon.pic", ["version"]=1.0, }, -- Приложение InfoPanel @@ -489,6 +517,7 @@ ["type"]="Application", ["about"]="IgorTimofeev/OpenComputers/master/Applications/InfoPanel/About.txt", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/InfoPanel/Icon.pic", + ["createShortcut"] = "desktop", ["version"]=1.0, }, { @@ -518,29 +547,13 @@ ----------------------------------------------------- Приложения с ресурсами -------------------------------------------------------------------------- - { - ["name"]="MineOS/Applications/MineCode", - ["url"]="IgorTimofeev/OpenComputers/master/Applications/MineCode/MineCode.lua", - ["type"]="Application", - ["icon"]="IgorTimofeev/OpenComputers/master/Applications/MineCode/Icon.pic", - ["version"]=1.0, - ["resources"]={ - { - ["name"]="English.lang", - ["url"]="IgorTimofeev/OpenComputers/master/Applications/MineCode/English.lang", - }, - { - ["name"]="Russian.lang", - ["url"]="IgorTimofeev/OpenComputers/master/Applications/MineCode/Russian.lang", - }, - }, - }, { ["name"]="MineOS/Applications/Crossword", ["url"]="IgorTimofeev/OpenComputers/master/Applications/Crossword/Crossword.lua", ["about"]="IgorTimofeev/OpenComputers/master/Applications/Crossword/About.txt", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/Crossword/Icon.pic", + ["createShortcut"] = "desktop", ["version"]=1.0, ["resources"]={ { @@ -554,6 +567,7 @@ ["url"]="IgorTimofeev/OpenComputers/master/Applications/Highlight/Highlight.lua", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/Highlight/Icon.pic", + ["createShortcut"] = "desktop", ["version"]=1.0, ["resources"]={ { @@ -567,6 +581,7 @@ ["url"]="IgorTimofeev/OpenComputers/master/Applications/HoloEdit/HoloEdit.lua", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/HoloEdit/Icon.pic", + ["createShortcut"] = "desktop", ["version"]=1.0, ["resources"]={ { @@ -585,6 +600,7 @@ ["about"]="IgorTimofeev/OpenComputers/master/Applications/BufferDemo/About.txt", ["type"]="Application", ["icon"]="IgorTimofeev/OpenComputers/master/Applications/BufferDemo/Icon.pic", + ["createShortcut"] = "desktop", ["version"]=1.0, ["resources"]={ { diff --git a/Applications/ChristmasTree/About.txt b/Applications/ChristmasTree/About.txt new file mode 100644 index 00000000..b0f5477c --- /dev/null +++ b/Applications/ChristmasTree/About.txt @@ -0,0 +1 @@ +Красивая новогодняя программа, написанная разработчиком Doob, сотворяющая атмосферу праздника в любом месте, где бы вы ни находились. \ No newline at end of file diff --git a/Applications/ChristmasTree/ChristmasTree.lua b/Applications/ChristmasTree/ChristmasTree.lua new file mode 100644 index 00000000..14d1d4a0 --- /dev/null +++ b/Applications/ChristmasTree/ChristmasTree.lua @@ -0,0 +1,95 @@ +local component = require("component") +local ecs = require("ECSAPI") +local hologram +local c = 23 + +if not component.isAvailable("hologram") then + ecs.error("Этой программе необходим голографический проектор 2 уровня.") + return +else + hologram = component.hologram +end + +-- создаем модель елки +local tSpruce = {3, 2, 2, 2, 2, 8, 9, 10, 9, 8, 7, 6, 5, 4, 3, 4, 6, 8, 7, 6, 5, 4, 3, 6, 5, 4, 3, 2, 3, 2, 1} + +-- создаем таблицу с падающими снежинками +local tSnow = {} + +-- создаем палитру цветов +hologram.setPaletteColor(1, 0xFFFFFF) -- снег +hologram.setPaletteColor(2, 0x221100) -- ствол +hologram.setPaletteColor(3, 0x005522) -- хвоя + +local function cricle(x0, y, z0, R, i) -- задействуем алгоритм Брезенхэма для рисования кругов + local x = R + local z = 0 + local err = -R + while z <= x do + hologram.set(x + x0, y, z + z0, i) + hologram.set(z + x0, y, x + z0, i) + hologram.set(-x + x0, y, z + z0, i) + hologram.set(-z + x0, y, x + z0, i) + hologram.set(-x + x0, y, -z + z0, i) + hologram.set(-z + x0, y, -x + z0, i) + hologram.set(x + x0, y, -z + z0, i) + hologram.set(z + x0, y, -x + z0, i) + z = z + 1 + if err <= 0 then + err = err + (2 * z + 1) + else + x = x - 1 + err = err + (2 * (z - x) + 1) + end + end +end + +local function spruce() -- рисуем ель + for i = 1, 5 do + cricle(c, i, c, tSpruce[i], 2) -- отрисовываем основание ствола + cricle(c, i, c, tSpruce[i]-1, 2) + end + for j = 5, #tSpruce do + cricle(c, j, c, tSpruce[j]-1, 3) -- отрисовываем хвою + cricle(c, j, c, tSpruce[j]-2, 3) + end +end + +local function gen_snow() -- генерируем снежинку + local x, y, z = math.random(1, 46), 32, math.random(1, 46) + table.insert(tSnow,{x=x,y=y,z=z}) + hologram.set(x, y, z, 1) +end + +local function falling_snow() -- сдвигаем снежинки вниз + local i=1 + while i<=#tSnow do + if tSnow[i].y>1 then + local x,y,z=tSnow[i].x+math.random(-1, 1), tSnow[i].y-1, tSnow[i].z+math.random(-1, 1) + if x<1 then x=1 end + if x>46 then x=46 end + if z<1 then z=1 end + if z>46 then z=46 end + c=hologram.get(x, y, z) + if c==0 or c==1 then + hologram.set(tSnow[i].x, tSnow[i].y, tSnow[i].z, 0) + tSnow[i].x, tSnow[i].y, tSnow[i].z=x,y,z + hologram.set(x, y, z, 1) + i=i+1 + else + table.remove(tSnow,i) + end + else + table.remove(tSnow,i) + end + os.sleep(0) + end +end + +ecs.info("auto", "auto", "", "Счастливого нового года!") +hologram.clear() +spruce() +while 1 do + gen_snow() + falling_snow() +end \ No newline at end of file diff --git a/Applications/ChristmasTree/Icon.pic b/Applications/ChristmasTree/Icon.pic new file mode 100644 index 0000000000000000000000000000000000000000..65a6b99a7f0d522d57aea66cc9d3257fa428e3a9 GIT binary patch literal 287 zcmeCoPtHt};^JUo0E7Pu*y!61{~t}850U}1W@1yrz<^!vHi%vz_1}Tv(X<&1K-M-8 zYdXjjuq03JjAR(sDs^U=zXW@tO#7X__YkSg)}P IgvR9~02Z=M!T