From f786d9842b81d8e8959f3e0522306762fed99503 Mon Sep 17 00:00:00 2001 From: JustAGenericUsername Date: Sun, 17 Mar 2024 12:51:06 -0400 Subject: [PATCH 1/3] this looks good --- mods/heatglow.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mods/heatglow.js b/mods/heatglow.js index 3f2cbd6d..99824fb4 100644 --- a/mods/heatglow.js +++ b/mods/heatglow.js @@ -1,3 +1,6 @@ +function weightedAverage(num1, num2, weight){ + return ((weight * num1)+((1-weight)*num2)) +} const heatfunc = function(pixel){ if (pixel.ogR == null || pixel.ogG == null || pixel.ogB == null || !(pixel.element == pixel.ogElement)){ pixel.ogR = parseInt(pixel.color.slice(4, pixel.color.indexOf(',')), 10) @@ -21,7 +24,8 @@ const heatfunc = function(pixel){ pixel.newG = ((510*pixel.ctemp)-255); pixel.newB= ((280*pixel.ctemp)-140); } - pixel.color = "rgb(" + pixel.newR + "," + pixel.newG + "," + pixel.newB + ")"; + let weight = (1-(pixel.ctemp/1.3)) + pixel.color = "rgb(" + weightedAverage(pixel.ogR, pixel.newR, weight) + "," + weightedAverage(pixel.ogG, pixel.newG, weight) + "," + weightedAverage(pixel.ogB, pixel.newB, weight) + ")"; } }; if (!eLists.metals) { eLists.metals = [] } @@ -53,9 +57,6 @@ elements.color_baker = { desc: "Use to bake a metals paint color into its 'true' color, for heating purposes.", } /* -function weightedAverage(num1, num2, weight){ - return ((weight * num1)+((1-weight)*num2)) -} const plantfunc = function(pixel){ if (pixel.ogR == null || pixel.ogG == null || pixel.ogB == null){ pixel.ogR = parseInt(pixel.color.slice(4, pixel.color.indexOf(',')), 10) From 1ee40ca3fc90a8328b89e956f3c7b58346c3679a Mon Sep 17 00:00:00 2001 From: JustAGenericUsername Date: Sun, 17 Mar 2024 13:06:51 -0400 Subject: [PATCH 2/3] ooo nice --- mods/heatglow.js | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/mods/heatglow.js b/mods/heatglow.js index 99824fb4..568d58fd 100644 --- a/mods/heatglow.js +++ b/mods/heatglow.js @@ -8,24 +8,24 @@ const heatfunc = function(pixel){ pixel.ogB = parseInt(pixel.color.slice(pixel.color.lastIndexOf(',') + 1, -1), 10) pixel.ogElement = pixel.element }else{ - pixel.gethigh = (elements[pixel.element].tempHigh) - pixel.halftemp = ((20+pixel.gethigh)/2) - if (pixel.temp <= (pixel.gethigh) - pixel.halftemp){ - pixel.ctemp = 0; - } else if (pixel.temp > (pixel.gethigh)-pixel.halftemp && pixel.temp <= pixel.gethigh){ - pixel.ctemp = ((1/pixel.halftemp)*pixel.temp)-(((pixel.gethigh)-pixel.halftemp)/pixel.halftemp) + var gethigh = (elements[pixel.element].tempHigh) + var halftemp = ((20+gethigh)/2) + if (pixel.temp <= (gethigh) - halftemp){ + var ctemp = 0; + } else if (pixel.temp > (gethigh)-halftemp && pixel.temp <= gethigh){ + var ctemp = ((1/halftemp)*pixel.temp)-(((gethigh)-halftemp)/halftemp) } - if (pixel.ctemp <= 0.5){ - pixel.newR = (((510-(2*pixel.ogR))*pixel.ctemp)+pixel.ogR); - pixel.newG = ((0-((2*pixel.ogG)*pixel.ctemp))+pixel.ogG); - pixel.newB = ((0-((2*pixel.ogB)*pixel.ctemp))+pixel.ogB); - }else if (pixel.ctemp > 0.5){ - pixel.newR = 255; - pixel.newG = ((510*pixel.ctemp)-255); - pixel.newB= ((280*pixel.ctemp)-140); + if (ctemp <= 0.5){ + var newR = (((510-(2*pixel.ogR))*ctemp)+pixel.ogR); + var newG = ((0-((2*pixel.ogG)*ctemp))+pixel.ogG); + var newB = ((0-((2*pixel.ogB)*ctemp))+pixel.ogB); + }else if (ctemp > 0.5){ + var newR = 255; + var newG = ((510*ctemp)-255); + var newB= ((280*ctemp)-140); } - let weight = (1-(pixel.ctemp/1.3)) - pixel.color = "rgb(" + weightedAverage(pixel.ogR, pixel.newR, weight) + "," + weightedAverage(pixel.ogG, pixel.newG, weight) + "," + weightedAverage(pixel.ogB, pixel.newB, weight) + ")"; + let weight = (1-(ctemp/1.3)) + pixel.color = "rgb(" + weightedAverage(pixel.ogR, newR, weight) + "," + weightedAverage(pixel.ogG, newG, weight) + "," + weightedAverage(pixel.ogB, newB, weight) + ")"; } }; if (!eLists.metals) { eLists.metals = [] } From 7184451fafe461a63a8cae089075114e04a47da4 Mon Sep 17 00:00:00 2001 From: JustAGenericUsername Date: Sun, 17 Mar 2024 14:49:54 -0400 Subject: [PATCH 3/3] scuffed circle brush --- mods/nousersthings.js | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/mods/nousersthings.js b/mods/nousersthings.js index 525a40c7..72b0f520 100644 --- a/mods/nousersthings.js +++ b/mods/nousersthings.js @@ -2302,4 +2302,44 @@ elements.selective_void = { } } } -} \ No newline at end of file +} +let radiusVar = 0 +let circleElem = 0 +let circleRep = false +elements.scuffed_circle_brush = { + category: "special", + color: elements.drag.color, + excludeRandom: true, + state: "solid", + movable: "false", + onSelect: function(){ + var answerR = prompt("Radius of the brush.",(radiusVar||undefined)); + if (!answerR) { return } + radiusVar = answerR; + var answerE = prompt("Element of the brush.",(circleElem||undefined)); + if (!answerE) { return } + circleElem = answerE; + var answerH = prompt("Replace? y or n. May be laggy.",(circleRep||undefined)); + if (!answerH) { return } + circleRep = answerH; + }, + tick: function(pixel){ + var circlec = circleCoords(pixel.x, pixel.y, radiusVar) + for (var i = 0; i < circlec.length; i++){ + var coord = circlec[i] + var x = coord.x + var y = coord.y + if (isEmpty(x, y)){ + createPixel(circleElem, x, y) + } + else if (!isEmpty(x, y, true) && !(circleRep == "n")){ + deletePixel(x, y) + createPixel(circleElem, x, y) + } + } + var thisx = pixel.x + var thisy = pixel.y + deletePixel(thisx, thisy) + createPixel(circleElem, thisx, thisy) + } +} \ No newline at end of file