This commit is contained in:
slweeb 2025-11-26 10:07:15 -05:00
commit a532128761
3 changed files with 685 additions and 684 deletions

File diff suppressed because it is too large Load Diff

View File

@ -797,7 +797,7 @@ elements.rgb_led = {
promptInput("Enter red value (0-255):", function (r_inp) {
r_inp = parseInt(r_inp);
if (r_inp > 255 || r_inp < 0 || isNaN(r_inp)) {
logMessage("Red value is invalid, using default/last red value: " + r);
logMessage("Red value is invalid, using default/last red value: " + globals.red);
} else {
globals.red = r_inp;
}
@ -805,7 +805,7 @@ elements.rgb_led = {
promptInput("Enter green value (0-255):", function (g_inp) {
g_inp = parseInt(g_inp);
if (g_inp > 255 || g_inp < 0 || isNaN(g_inp)) {
logMessage("Green value is invalid, using default/last green value: " + g);
logMessage("Green value is invalid, using default/last green value: " + globals.green);
} else {
globals.green = g_inp;
}
@ -813,7 +813,7 @@ elements.rgb_led = {
promptInput("Enter blue value (0-255):", function (b_inp) {
b_inp = parseInt(b_inp);
if (b_inp > 255 || b_inp < 0 || isNaN(b_inp)) {
logMessage("Blue value is invalid, using default/last blue value: " + b);
logMessage("Blue value is invalid, using default/last blue value: " + globals.blue);
} else {
globals.blue = b_inp;
}
@ -823,7 +823,7 @@ elements.rgb_led = {
},
onPlace: (pixel) => {
var ledColor = RGBToHex([red, green, blue]);
var ledColor = RGBToHex([globals.red, globals.green, globals.blue]);
pixel.color = ledColor;
}
};
@ -1321,7 +1321,7 @@ elements.custom_bomb = {
// If pixel is at the bottom or resting on a solid
if (outOfBounds(pixel.x, pixel.y + 1) || (belowPixel && belowPixel.element !== "custom_bomb" && !isEmpty(pixel.x, pixel.y + 1) && belowPixel.element !== "fire" && belowPixel.element !== "smoke")) {
explodeAt(pixel.x, pixel.y, 10, explodeElem);
explodeAt(pixel.x, pixel.y, 10, globals.explodeElem);
deletePixel(pixel.x, pixel.y);
}
}
@ -1667,7 +1667,7 @@ elements.robot_body = {
};
// Robot creator element
var mode = "Aimless"
globals.mode = "Aimless"
elements.robot = {
color: "#b1b1b1",
category: "machines",
@ -1679,10 +1679,10 @@ elements.robot = {
(choice) => {
if (choice === "Controlled" && isMobile) {
logMessage("Controlled mode doesn't work on mobile");
mode = "Aimless";
globals.mode = "Aimless";
} else {
mode = choice || "Aimless";
if (mode === "Controlled") {
globals.mode = choice || "Aimless";
if (globals.mode === "Controlled") {
logMessage("Controls: A/D to move and W to jump or (Not reccomended) ←/→ to move, and ↑ to jump");
}
}
@ -1695,17 +1695,17 @@ elements.robot = {
if (isEmpty(pixel.x, pixel.y - 1)) {
createPixel("robot_head", pixel.x, pixel.y - 1);
const head = getPixel(pixel.x, pixel.y - 1);
head.mode = mode;
head.mode = globals.mode;
changePixel(pixel, "robot_body");
pixel.mode = mode;
pixel.mode = globals.mode;
}
// Try to create body below if above is blocked
else if (isEmpty(pixel.x, pixel.y + 1)) {
createPixel("robot_body", pixel.x, pixel.y + 1);
const body = getPixel(pixel.x, pixel.y + 1);
body.mode = mode;
body.mode = globals.mode;
changePixel(pixel, "robot_head");
pixel.mode = mode;
pixel.mode = globals.mode;
}
// Delete if no space
else {
@ -2017,7 +2017,7 @@ elements.indestructable_filter = {
}
}
globals.glass_hole_expand = false
globals.blackHoleExpand = false
elements.black_hole = {
color: "#111111",
hardness: 1,
@ -2105,7 +2105,7 @@ elements.black_hole = {
}
}
}
if (globals.glass_hole_expand) {
if (globals.blackHoleExpand) {
for (var i = 0; i < adjacentCoords.length; i++) {
var x = pixel.x + adjacentCoords[i][0];
var y = pixel.y + adjacentCoords[i][1];
@ -2127,10 +2127,10 @@ elements.black_hole = {
choice = "No"
}
if (choice == "Yes") {
globals.glass_hole_expand = true
globals.blackHoleExpand = true
}
else {
globals.glass_hole_expand = false
globals.blackHoleExpand = false
}
}
)
@ -3326,4 +3326,3 @@ elements.replace_all_of_element = {
}

42
mods/static.js Normal file
View File

@ -0,0 +1,42 @@
// IIFE to prevent this mod from breaking
(() => {
let staticMode = 0
function randomGrayscale() {
const value = Math.floor(Math.random() * 256);
return `rgb(${value}, ${value}, ${value})`;
}
function randomColor() {
const letters = "0123456789ABCDEF";
let color = "#";
for (let i = 0; i < 6; i++) {
color += letters[Math.floor(Math.random() * 16)];
}
return color;
}
function loopScreen(callback) {
for (let x = 0; x <= width; x++) {
for (let y = 0; y <= height; y++) {
callback(x, y)
}
}
}
keybinds["KeyS"] = () => {
staticMode === 0 ? staticMode = 1 : staticMode === 1 ? staticMode = 2 : staticMode = 0
}
renderPostPixel(function (ctx) {
if (!staticMode) return
loopScreen((x, y) => {
if (staticMode === 1) {
drawSquare(ctx, randomGrayscale(), x, y, 1, 0.2)
}
if (staticMode === 2) {
drawSquare(ctx, randomColor(), x, y, 1, 0.3)
}
})
})
})()