From 5c1117944ba48cf9539e57abf038642e0bd2614b Mon Sep 17 00:00:00 2001 From: JustAGenericUsername <92590792+JustAGenericUsername@users.noreply.github.com> Date: Sun, 30 Mar 2025 16:56:08 -0400 Subject: [PATCH] asd --- mods/nousersthings.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/mods/nousersthings.js b/mods/nousersthings.js index c7a5bc7b..a8c6cbfa 100644 --- a/mods/nousersthings.js +++ b/mods/nousersthings.js @@ -3939,17 +3939,25 @@ renderPostPixel(function(ctx){ if ((pixel.element == "sign") && pixel.sign){ ctx.font = `12pt Arial` ctx.fillStyle = pixel.color; - ctx.fillText(pixel.sign.replace(/\$\{([\w.]+)\}/g, (_, path) => { - const value = path.split('.').reduce((obj, key) => obj?.[key], globalThis); - return typeof value === 'object' ? JSON.stringify(value) : value ?? ''; + ctx.fillText(pixel.sign = pixel.sign.replace(/\$\{([\w.\[\]]+)\}/g, (_, path) => { + try { + const value = new Function('return globalThis.' + path)(); + return typeof value === 'object' ? JSON.stringify(value) : value ?? ''; + } catch { + return ''; + } }), 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.replace(/\$\{([\w.]+)\}/g, (_, path) => { - const value = path.split('.').reduce((obj, key) => obj?.[key], globalThis); - return typeof value === 'object' ? JSON.stringify(value) : value ?? ''; + ctx.fillText(pixel.sign = pixel.sign.replace(/\$\{([\w.\[\]]+)\}/g, (_, path) => { + try { + const value = new Function('return globalThis.' + path)(); + return typeof value === 'object' ? JSON.stringify(value) : value ?? ''; + } catch { + return ''; + } }), canvasCoord(pixel.x), canvasCoord(pixel.y)) } else { drawSquare(ctx, pixel.color, pixel.x, pixel.y)