From 1f66f9e36830db8cf13e39d3394f72078270213f Mon Sep 17 00:00:00 2001 From: JustAGenericUsername <92590792+JustAGenericUsername@users.noreply.github.com> Date: Sun, 30 Mar 2025 14:56:05 -0400 Subject: [PATCH] variable signs --- mods/nousersthings.js | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/mods/nousersthings.js b/mods/nousersthings.js index 68163580..161d9d2c 100644 --- a/mods/nousersthings.js +++ b/mods/nousersthings.js @@ -3939,12 +3939,12 @@ renderPostPixel(function(ctx){ if ((pixel.element == "sign") && pixel.sign){ ctx.font = `12pt Arial` ctx.fillStyle = pixel.color; - ctx.fillText(pixel.sign, canvasCoord(pixel.x), canvasCoord(pixel.y)) + ctx.fillText(pixel.sign.replace(/\$\{(\w+)\}/g, (_, k) => globalThis[k] ?? ''), canvasCoord(pixel.x), canvasCoord(pixel.y)) } else if (pixel.element == "e_sign" && pixel.sign){ if (pixel.charge || pixel.chargeCD){ ctx.font = `12pt Arial` ctx.fillStyle = pixel.color; - ctx.fillText(pixel.sign, canvasCoord(pixel.x), canvasCoord(pixel.y)) + ctx.fillText(pixel.sign.replace(/\$\{(\w+)\}/g, (_, k) => globalThis[k] ?? ''), canvasCoord(pixel.x), canvasCoord(pixel.y)) } else { drawSquare(ctx, pixel.color, pixel.x, pixel.y) } @@ -3974,4 +3974,24 @@ elements.mod_dectector = { } } } -} \ No newline at end of file +} +smoothColor = function(color1, color2, amount){ + let rgb1 = getPixelColor({color: color1}) + let rgb2 = getPixelColor({color: color2}) + return {r:((1-amount)*rgb1.r)+(amount*rgb2.r),g:((1-amount)*rgb1.g)+(amount*rgb2.g),b:((1-amount)*rgb1.b)+(amount*rgb2.b)} +} +/* +elements.delay = { + color: ["#df3b3b","#200909"], + behavior: behaviors.WALL, + category: "machines", + movable: false, + insulate: true, + onSelect: () => { + logMessage("Will delay incoming signals by its temperature in Kelvin. -273C for 0 delay.") + }, + tick: function(pixel){ + + } +} + */ \ No newline at end of file