-
Notifications
You must be signed in to change notification settings - Fork 5
/
lua-v1-2.json
1 lines (1 loc) · 10.9 KB
/
lua-v1-2.json
1
{"slots":{"0":{"name":"screen","type":{"events":[],"methods":[]}},"1":{"name":"slot2","type":{"events":[],"methods":[]}},"2":{"name":"slot3","type":{"events":[],"methods":[]}},"3":{"name":"slot4","type":{"events":[],"methods":[]}},"4":{"name":"slot5","type":{"events":[],"methods":[]}},"5":{"name":"slot6","type":{"events":[],"methods":[]}},"6":{"name":"slot7","type":{"events":[],"methods":[]}},"7":{"name":"slot8","type":{"events":[],"methods":[]}},"8":{"name":"slot9","type":{"events":[],"methods":[]}},"9":{"name":"slot10","type":{"events":[],"methods":[]}},"-1":{"name":"unit","type":{"events":[],"methods":[]}},"-2":{"name":"system","type":{"events":[],"methods":[]}},"-3":{"name":"library","type":{"events":[],"methods":[]}}},"handlers":[{"code":"screen.activate()\n\nlocal r = 225 --export: red between 0 and 1\nlocal g = 0 --export: green between 0 and 1\nlocal b = 0 --export: blue between 0 and 1\n\nunit.hide()\nsystem.createWidgetPanel('DU-Atlas v1.2')\n\nscreen.setRenderScript([[\n local json = require('dkjson') \n local rslib=require('rslib')\n local speed = 3 --export\n local cornerRadius = 5 --export\n local rd = cornerRadius\n \n rslib.drawQuickImage(\"assets.prod.novaquark.com/74927/4caa44d4-757f-4fe8-b52e-f0021ae4693d.png\")\n \n local l = createLayer()\n local l2 = createLayer()\n local rx, ry = getResolution()\n\n \n setNextFillColor(l,0,0,0,0.5)\n addBox(l,0,0,rx,ry)\n\n setDefaultShadow(l2,Shape_BoxRounded,10,0,0,0,0.5)\n setDefaultShadow(l2,Shape_Box,10,0,0,0,0.5)\n \n\n local fontSize = 20 --export: List font size\n local font = loadFont(\"Montserrat-Light\", fontSize)\n local fontB = loadFont(\"Montserrat-Bold\", fontSize)\n local fontC = loadFont(\"Play\",25)\n local fma, fmd = getFontMetrics(font)\n local params = json.decode(getInput()) or {}\n local cx, ch = getCursor()\n\n local r = params[1]\n local g = params[2]\n local b = params[3]\n local list = params[4]\n\n if not iteration then\n iteration = 0\n end\n\n if not tab then\n tab = 1\n end\n \n \n\n headerH = (ry / 100) * 10\n \n \n aantalHeaders = #list\n headerW = rx / aantalHeaders\n\n for i=1, #list do\n local locationgroup = list[i]\n local name = locationgroup.n\n \n local x = (i-1)*headerW\n local y = 0\n local nextFont = font\n if cx > x and cx < x + headerW and ch > y and ch < y + headerH then\n setNextFillColor(l2, r, g, b, 1)\n \n if getCursorDown() then\n tab = i\n iteration = 0\n end\n nextFont = fontB\n elseif tab == i then\n setNextFillColor(l2, r, g, b, 1)\n nextFont = fontB\n else \n setNextFillColor(l2, r/500, g/500, b/500, 1)\n end\n setNextStrokeWidth(l2,3)\n setNextStrokeColor(l2,0,0,0,0.7)\n addBox(l2, x, y, headerW, headerH)\n local tbw, tbh = getTextBounds(font, name)\n addText(l2, nextFont, name, x + (headerW / 2) - (tbw / 2), headerH/2 + tbh/2)\n end\n\n --\n -- End top\n --\n\n\n local boxH = (ry / 100) * 8\n local boxW = rx * 9/10\n local padding = (ry / 100) * 2\n local listOffset = headerH + padding \n \n setNextFillColor(l2,r/500,g/500,b/500,1)\n local buttonH = headerH\n local buttonW = rx/10-padding*2\n local buttonX = rx-(rx/10)+padding\n local buttonY = headerH+padding\n if ch > buttonY and ch < buttonY+buttonH and cx > buttonX and cx < buttonX+buttonW then\n if getCursorDown() then\n iteration = iteration -1\n setNextFillColor(l2,1,1,1,0.5)\n end\n setNextStrokeColor(l2,1,1,1,0.5)\n setNextStrokeWidth(l2,2)\n end\n addBoxRounded(l2,buttonX,buttonY,buttonW,buttonH,rd)\n setNextTextAlign(l2,AlignH_Center, AlignV_Middle)\n addText(l2, fontC, \"UP\",buttonX+buttonW/2,buttonY+buttonH/2)\n \n buttonY = buttonY+headerH+padding\n\n setNextFillColor(l2,r/500,g/500,b/500,1)\n if ch > buttonY and ch < buttonY+buttonH and cx > buttonX and cx < buttonX+buttonW then\n if getCursorDown() then\n iteration = iteration +1\n setNextFillColor(l2,1,1,1,0.5)\n end\n setNextStrokeColor(l2,1,1,1,0.5)\n setNextStrokeWidth(l2,2)\n end\n\n \n addBoxRounded(l2,buttonX,buttonY,buttonW,buttonH,rd)\n setNextTextAlign(l2,AlignH_Center, AlignV_Middle)\n addText(l2, fontC, \"DOWN\",buttonX+buttonW/2,buttonY+buttonH/2)\n \n \n \n local allBoxes = boxH * #list[tab].l\n \n local animationOffset = speed * iteration\n if animationOffset < 0 then\n animationOffset = 0\n iteration = 0\n end\n -- list\n for y=1, #list[tab].l do\n local item = list[tab].l[y]\n \n local boxStartH = listOffset\n if ch > boxStartH-animationOffset and ch < boxStartH + boxH - animationOffset and cx < boxW then\n setNextFillColor(l, r, g, b, 0.5)\n \n if getCursorDown() then\n setOutput(json.encode({\n action = \"setLocation\",\n group = tab,\n location = y\n }))\n setNextFillColor(l, r, g, b, 0.7)\n end\n \n setNextStrokeColor(l, 1, 1, 1, 1)\n else\n setNextFillColor(l,0,0,0,0.8)\n setNextStrokeColor(l, r, g, b, 0.3)\n end\n \n setNextStrokeWidth(l, 2)\n \n addBoxRounded(l, 10, boxStartH - animationOffset, boxW-20, boxH, rd)\n \n local text = item\n local tbw, tbh = getTextBounds(font, text)\n addText(l, font, text, boxW/2-tbw/2, boxStartH + boxH/2 + tbh/2 - animationOffset)\n \n listOffset = listOffset + boxH + padding\n end\n \n requestAnimationFrame(1)\n\n\n\n\n\n\n]])\n\nlocal screenInput = {};\nfor i=1, #locations do\n local _loc = {}\n for y=1, #locations[i].list do\n table.insert(_loc, locations[i].list[y].name)\n end \n table.insert(screenInput, {\n n = locations[i].name,\n l = _loc\n })\nend \n\nscreen.setScriptInput(json.encode({r,g,b,screenInput}))","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"0"},{"code":"screen.setRenderScript([[\nlocal rx, ry = getResolution()\nlocal dt = 100 * getDeltaTime()\nlocal l = createLayer()\nlocal font = loadFont(\"FiraMono-Bold\", 85)\n\nif not init then \n init = true\n text = {}\n text.header = \"DU-Atlas\"\n \n local tbw, tbh = getTextBounds(font, text.header)\n \n text.w = tbw\n text.h = tbh\n \n text.x = math.random(tbw, rx-tbw)\n text.y = math.random(tbh, ry-tbh)\n text.vx = 0.75\n text.vy = 0.5\nend\n\n \n \ntext.x = text.x + text.vx * dt\ntext.y = text.y + text.vy * dt\n\nif text.x < 0 or text.x > rx - text.w then\n text.x = text.x - text.vx * dt\n text.vx = -text.vx\nend\n\nif text.y < text.h or text.y > ry then\n text.y = text.y - text.vy * dt\n text.vy = -text.vy\nend\n\naddText(l, font, text.header, text.x, text.y)\n\nrequestAnimationFrame(1)\n]])","filter":{"args":[],"signature":"stop()","slotKey":"-1"},"key":"1"},{"code":"local output = screen.getScriptOutput()\nlocal shutoff_distance = 50 --export\nif #output > 0 then\n screen.clearScriptOutput()\n \n _o = json.decode(output)\n if _o.action == 'setLocation' then\n system.setWaypoint(locations[_o.group].list[_o.location].location)\n end \nend\n\nlocal pos = unit.getMasterPlayerPosition()\nif vec3(pos):len() > shutoff_distance then\n unit.exit()\nend","filter":{"args":[],"signature":"update()","slotKey":"-2"},"key":"2"},{"code":"locations = {\n {\n name = 'My Spots',\n list = {\n {\n name = 'My Base',\n location = '::pos{0,2,-67.2215,171.6768,83.4687}'\n }\n }\n },\n {\n name = 'Special Locations',\n list = {\n {\n name = 'The Hedronic library',\n location = '::pos{0,8,1.3405,133.7848,55.9334}'\n },\n {\n name = 'Jasper spacebase',\n location = '::pos{0,2,-9.1616,162.6723,621410.9375}'\n },\n {\n name = 'NQ pixel art',\n location = '::pos{0,0,7541779.0000,22300232.0000,6489264.0000}'\n },\n {\n name = 'Metallic Dugo and Fonds',\n location = '::pos{0,26,7.9501,-19.0057,10.3428}'\n },\n {\n name = 'TicTacs Ship Shop',\n location = '::pos{0,2,-66.2150,156.4984,-0.0000}'\n },\n {\n name = 'Snowhex Sanc',\n location = '::pos{0,26,88.4855,-30.5057,143.2993}'\n },\n {\n name = 'd4nkknight Showroom',\n location = '::pos{0,2,6.6084,80.3590,2.3621}'\n },\n {\n name = 'Infinity Spaceport',\n location = '::pos{0,2,7.9912,79.3320,0.0004}'\n },\n {\n name = 'Utopia Space Center',\n location = '::pos{0,0,13662322.5694,7547220.7030,-215970.4049}'\n }\n }\n },\n {\n name = 'Markets',\n list = {\n {\n name = 'Disctrict market 6',\n location = '::pos{0,2,36.0044,101.3503,220.0897}'\n }\n }\n },\n {\n name = 'My Mining Units',\n list = {\n {\n name = 'Ore 1',\n location = 'Enter Coordinates'\n }\n }\n },\n {\n name = 'Race tracks',\n list = {\n {\n name = 'Obsidian Race Area',\n location = '::pos{0,2,-14.5771,-12.0537,-0.0008}'\n },\n {\n name = 'PINTDeathBlossom',\n location = '::pos{0,2,-9.7257,-166.9100,4.1896}'\n },\n {\n name = 'GWNC',\n location = '::pos{0,2,0.3699,-178.1286,45.0133}'\n },\n {\n name = 'Melanuma',\n location = '::pos{0,2,0.2342,108.8616,62.4634}'\n },\n {\n name = 'Anvilworks ',\n location = '::pos{0,2,-4.9108,94.8415,1.2653}'\n },\n {\n name = 'Pure Velocity Raceway',\n location = '::pos{0,2,4.9829,147.5784,594.0582}'\n },\n {\n name = 'DesertOasis',\n location = '::pos{0,2,-4.1999,117.2064,55.3775}'\n },\n {\n name = 'GTFOval',\n location = '::pos{0,2,0.2342,108.8616,62.4634}'\n }\n }\n }\n}\n\n","filter":{"args":[],"signature":"start()","slotKey":"-3"},"key":"3"}],"methods":[],"events":[]}