commit 7ec3352f2177eef467929441f1b4869db820dd0c Author: Redo Date: Sun Jul 20 17:48:33 2025 -0700 initial commit diff --git a/Sky_OldIcons.zip b/Sky_OldIcons.zip new file mode 100644 index 0000000..10b31ec Binary files /dev/null and b/Sky_OldIcons.zip differ diff --git a/brickIconFixer/conf.lua b/brickIconFixer/conf.lua new file mode 100644 index 0000000..4fb9f41 --- /dev/null +++ b/brickIconFixer/conf.lua @@ -0,0 +1,7 @@ + +function love.conf(t) + t.window.width = 512 + t.window.height = 512 + t.window.title = "Brick Icon Generator" + t.console = true +end diff --git a/brickIconFixer/fixicons.lua b/brickIconFixer/fixicons.lua new file mode 100644 index 0000000..a0ea32e --- /dev/null +++ b/brickIconFixer/fixicons.lua @@ -0,0 +1,78 @@ +--love 1 + +local le = love.event +local lg = love.graphics +local li = love.image +local lf = love.filesystem + +-------------------------------------------------------------- + +local drawable +local function yieldImage(imagedata) + drawable = lg.newImage(imagedata) + coroutine.yield() +end + +-------------------------------------------------------------- + +local function imageLoad(filename) + local imagedata = li.newImageData(filename..".png") + return imagedata +end + +local function imageStore(imagedata, filename) + local filedata = imagedata:encode("png") + + local outfile = io.open(filename..".png", "wb") + outfile:write(filedata:getString()) + outfile:close() +end + +-------------------------------------------------------------- + +local imageFixIcon = require "imagefixicon" + +-------------------------------------------------------------- + +local function fixAllIcons() + local files = lf.getDirectoryItems("icons-unfixed") + for fileidx, filename in ipairs(files) do + local fileext = filename:match("%.[a-zA-Z0-9]+$") + if fileext==".png" then + local filepart = filename:gsub("%.[a-zA-Z0-9]+$", "") + + local imagedata = imageLoad("icons-unfixed/"..filepart) + print(filepart) + + local newimagedata = imageFixIcon(imagedata, fileidx, true) + + imageStore(newimagedata, "icons-fixed/"..filepart) + + yieldImage(newimagedata) + end + end + print("Done") + love.event.quit() +end + +-------------------------------------------------------------- + +local cor +function love.load() + cor = coroutine.create(fixAllIcons) + --fixAllIcons() +end + +function love.draw() + if drawable then + lg.draw(drawable) + end +end + +function love.update(dt) + coroutine.resume(cor) +end + +function love.keypressed(k) + if k=="escape" then le.quit() end +end diff --git a/brickIconFixer/icons-fixed/16x16.png b/brickIconFixer/icons-fixed/16x16.png new file mode 100644 index 0000000..2d4c431 Binary files /dev/null and b/brickIconFixer/icons-fixed/16x16.png differ diff --git a/brickIconFixer/icons-unfixed/16x16.png b/brickIconFixer/icons-unfixed/16x16.png new file mode 100644 index 0000000..ef79906 Binary files /dev/null and b/brickIconFixer/icons-unfixed/16x16.png differ diff --git a/brickIconFixer/imagefixicon.lua b/brickIconFixer/imagefixicon.lua new file mode 100644 index 0000000..cee5ddc --- /dev/null +++ b/brickIconFixer/imagefixicon.lua @@ -0,0 +1,112 @@ +--love 1 + +local lg = love.graphics +local li = love.image + +local function round(x) + return math.floor(x+0.5) +end + +local function clamp(x, a, b) + return math.min(math.max(x, a), b) +end + +local function imageFixIcon(imagedata, identifier, brickmode) + local xs, ys = imagedata:getDimensions() + + --remove upper skybox bullshit + if brickmode then + for x = 1, xs do + for y = 1, ys/5 do + imagedata:setPixel(x-1, y-1, 1, 0, 1, 1) + end + end + end + + local xmin = xs + local xmax = 1 + local ymin = ys + local ymax = 1 + + for x = 1, xs do + for y = 1, ys do + local r, g, b, a = imagedata:getPixel(x-1, y-1) + + if r==1 and g==0 and b==1 then + imagedata:setPixel(x-1, y-1, 1, 1, 1, 0) + else + if xxmax then xmax = x end + if yymax then ymax = y end + + local l = (r+g+b)/3 + + imagedata:setPixel(x-1, y-1, l, l, l, a) + end + end + end + + local xc = round((xmax-xmin)/2+xmin) + local yc = round((ymax-ymin)/2+ymin) + + local xextent = math.max(xmax-xmin, 96) + local yextent = math.max(ymax-ymin, 96) + + local scale = 1 + if xextent>96 or yextent>96 then + scale = 96/math.max(xextent, yextent) + end + + --[[ + local newimagedata = li.newImageData(96, 96) + for x = 1, 96 do + for y = 1, 96 do + local xp = math.round(xc+x/scale-48/scale), 0, xs-1 + local yp = math.round(yc+y/scale-48/scale), 0, ys-1 + + local r, g, b, a + if xp>=0 and xp<=xs-1 and yp>=0 and yp<=ys-1 then + r, g, b, a = imagedata:getPixel(xp, yp) + else + r, g, b, a = 1, 1, 1, 0 + end + + local l = (r+g+b)/3 + + newimagedata:setPixel(x-1, y-1, l, l, l, a) + end + end]] + + --scale = 1 + if not brickmode then + scale = scale*0.95 + end + + local drawable = lg.newImage(imagedata) + + local canvas = lg.newCanvas(96, 96) + + lg.setCanvas(canvas) lg.push() + lg.clear() + lg.setColor(0,0,0,0) + lg.rectangle("fill", 0, 0, 96, 96) + local v = 1 + --if brickmode then v = 1 end + lg.setColor(v,v,v,1) + local filter = "linear" + --local filter = "nearest" + lg.setDefaultFilter(filter, filter, 2) + lg.draw(drawable, 48, 48, 0, scale, scale, xc, yc) + lg.pop() lg.setCanvas() + + local newimagedata = canvas:newImageData() + + if not brickmode then + --newimagedata:setPixel(identifier%96, math.floor(identifier/96), 1, 1, 1, 1) + end + + return newimagedata +end + +return imageFixIcon diff --git a/brickIconFixer/main.lua b/brickIconFixer/main.lua new file mode 100644 index 0000000..1ffc45d --- /dev/null +++ b/brickIconFixer/main.lua @@ -0,0 +1,2 @@ + +require "fixicons" diff --git a/brickIconFixer/run.bat b/brickIconFixer/run.bat new file mode 100644 index 0000000..dc73ff5 --- /dev/null +++ b/brickIconFixer/run.bat @@ -0,0 +1,2 @@ +cd /d %~dp0 +love . diff --git a/doIcons.cs b/doIcons.cs new file mode 100644 index 0000000..a3ab326 --- /dev/null +++ b/doIcons.cs @@ -0,0 +1,36 @@ + +function serverCmdDoMissingIcons(%client) { + if(!%client.isAdmin) return; + echo("doing all missing icons!"); + doAllMissingIcons(0); +} + +function doAllMissingIcons(%pos) { + if(isObject($iconBrick)) + $iconBrick.delete(); + + while(%pos < getDatablockGroupSize()) { + %db = getDatablock(%pos); + %pos++; + if(%db.getClassName()$="fxDtsBrickData" && + %db.uiName!$="" && + %db.category !$= "" && %db.subCategory !$= "" && + !isFile(%db.iconName) + ) { + talk(%db.getName()); + break; + } else { + %db = ""; + } + } + if(isObject(%db)) { + $iconBrick = new fxDtsBrick() { + datablock = %db; + isPlanted = 1; + }; + $iconBrick.setTransform("0 10 -1005 0 0 1 -1.57"); + schedule(3000, 0, doIconScreenshot); + if(%pos