From 0b4924911311fc627b05a9f94ba21839a74b7f23 Mon Sep 17 00:00:00 2001 From: JustAGenericUsername <92590792+JustAGenericUsername@users.noreply.github.com> Date: Tue, 18 Feb 2025 16:53:15 -0500 Subject: [PATCH] e-signs and mod detecting machine --- mods/nousersthings.js | 50 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/mods/nousersthings.js b/mods/nousersthings.js index 5185528b..97c7be41 100644 --- a/mods/nousersthings.js +++ b/mods/nousersthings.js @@ -3918,12 +3918,58 @@ elements.sign = { }, movable: false } +elements.e_sign = { + color: "#f3ff88", + darkText: true, + category: "special", + movable: false, + onSelect: () => { + let signi = prompt("What text should the sign display?", signInput||"Hello World!") + signInput = signi; + }, + renderer: function(pixel, ctx){ + if (!pixel.sign){pixel.sign=signInput} + }, + conduct: 1 +} renderPostPixel(function(ctx){ for (pixel of currentPixels){ - if (pixel.element == "sign" && pixel.sign){ + if ((pixel.element == "sign") && pixel.sign){ ctx.font = `12pt Arial` ctx.fillStyle = pixel.color; ctx.fillText(pixel.sign, 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)) + } else { + drawSquare(ctx, pixel.color, pixel.x, pixel.y) + } } } -}) \ No newline at end of file +}) +let machinemodName = "nousersthings.js" +elements.mod_dectector = { + color: "#54681d", + behavior: behaviors.WALL, + category: "machines", + movable: false, + excludeRandom: true, + onSelect: () => { + let newMod = prompt("What mod should this machine detect?", "nousersthings.js"||modName) + machinemodName = newMod + }, + tick: (pixel) => { + if (!pixel.mod){pixel.mod = machinemodName} + if (enabledMods.includes("mods/" + pixel.mod)){ + for (let i = 0; i < adjacentCoords.length; i++){ + let x = adjacentCoords[i][0] + pixel.x; + let y = adjacentCoords[i][1] + pixel.y; + if (!isEmpty(x, y, true) && elements[pixelMap[x][y].element].conduct){ + pixelMap[x][y].charge = 1 + } + } + } + } +} \ No newline at end of file