From 7f3e5c74055e1366a0abaff3cf9dd592f274900e Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Thu, 19 May 2022 12:22:07 -0400 Subject: [PATCH 01/20] Mod that adds color tools add, subtract, multiply, grayscale, invert, and 2 shitpost tools --- mods/color_tools.js | 203 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 203 insertions(+) create mode 100644 mods/color_tools.js diff --git a/mods/color_tools.js b/mods/color_tools.js new file mode 100644 index 00000000..7ce8b948 --- /dev/null +++ b/mods/color_tools.js @@ -0,0 +1,203 @@ +function _rgbToHex(color) { + if(typeof(color) == "object") { //Expects object like "{r: 172, g: 11, b: 34}" + //console.log("Loading colors"); + //console.log("Loading R"); + var red = color.r; + //console.log("Loading G"); + var green = color.g; + //console.log("Loading B"); + var blue = color.b; + //console.log("Rounding R"); + red = Math.round(red); + //console.log("Rounding G"); + green = Math.round(green); + //console.log("Rounding B"); + blue = Math.round(blue); + //console.log("Bounding R"); + red = Math.min(255,Math.max(0,red)); + //console.log("Bounding G"); + green = Math.min(255,Math.max(0,green)); + //console.log("Bounding B"); + blue = Math.min(255,Math.max(0,blue)); + //console.log("Converting R"); + red = red.toString(16); + //console.log("Converting G"); + green = green.toString(16); + //console.log("Converting B"); + blue = blue.toString(16); + //console.log("Padding R"); + while(red.length < 2) { + red = "0" + red; + }; + //console.log("Padding G"); + while(green.length < 2) { + green = "0" + green; + }; + //console.log("Padding B"); + while(blue.length < 2) { + blue = "0" + blue; + }; + //console.log("Concatenating"); + return "#" + red + green + blue; + } else if(typeof(color) == "string") { //Expects string like "rgb(20,137,4)". + //console.log("Splitting string") + color = color.split(","); + //console.log("Getting R"); + var red = parseFloat(color[0].substring(4)) + //console.log("Getting G"); + var green = parseFloat(color[1]) + //console.log("Getting B"); + var blue = parseFloat(color[2].slice(0,-1)) + //console.log("Rounding R"); + red = Math.round(red); + //console.log("Rounding G"); + green = Math.round(green); + //console.log("Rounding B"); + blue = Math.round(blue); + //console.log("Bounding R"); + red = Math.min(255,Math.max(0,red)); + //console.log("Bounding G"); + green = Math.min(255,Math.max(0,green)); + //console.log("Bounding B"); + blue = Math.min(255,Math.max(0,blue)); + //console.log("Converting R"); + red = red.toString(16); + //console.log("Converting G"); + green = green.toString(16); + //console.log("Converting B"); + blue = blue.toString(16); + //console.log("Padding R"); + while(red.length < 2) { + red = "0" + red; + }; + //console.log("Padding G"); + while(green.length < 2) { + green = "0" + green; + }; + //console.log("Padding B"); + while(blue.length < 2) { + blue = "0" + blue; + }; + //console.log("Concatenating"); + return "#" + red + green + blue; + } else { + throw "error: Only objects and strings are supported." + }; +}; + +elements.multiply_color = { + color: ["#c27070","#c29c70","#c2c270","#70c270","#70c2c2","#7070c2","#c270c2"], + tool: function(pixel) { + // convert the hex of currentColor to rgb and set it as a string + var rgb = currentColor.replace("#","").match(/.{1,2}/g); + for (var i = 0; i < rgb.length; i++) { + rgb[i] = parseInt(rgb[i],16); + } + var oldColor = hexToRGB(_rgbToHex(pixel.color)) + var finalColor = [Math.round(oldColor.r * (rgb[0] / 255)), Math.round(oldColor.g * (rgb[1] / 255)), Math.round(oldColor.b * (rgb[2] / 255))] + pixel.color = "rgb(" + finalColor.join(",") + ")" + }, + customColor: true, + category: "color tools", //the toolbar is getting cluttered + excludeRandom: true, //the toolbar is getting cluttered +} + +/*elements.divide_color = { //can't get it to work how I want it to work + color: ["#c27070","#c29c70","#c2c270","#70c270","#70c2c2","#7070c2","#c270c2"], + tool: function(pixel) { + // convert the hex of currentColor to rgb and set it as a string + var rgb = currentColor.replace("#","").match(/.{1,2}/g); + for (var i = 0; i < rgb.length; i++) { + rgb[i] = parseInt(rgb[i],16); + } + var oldColor = hexToRGB(_rgbToHex(pixel.color)) + var finalColor = [Math.round(256 / ((rgb[0] + 1) / (oldColor.r + 1))), Math.round(256 / ((rgb[1] + 1) / (oldColor.g + 1))), Math.round(256 / ((rgb[2] + 1) / (oldColor.b + 1)))] + pixel.color = "rgb(" + finalColor.join(",") + ")" + }, + customColor: true, + category: "color tools", + excludeRandom: true, +}*/ + +elements.add_color = { + color: ["#c27070","#c29c70","#c2c270","#70c270","#70c2c2","#7070c2","#c270c2"], + tool: function(pixel) { + // convert the hex of currentColor to rgb and set it as a string + var rgb = currentColor.replace("#","").match(/.{1,2}/g); + for (var i = 0; i < rgb.length; i++) { + rgb[i] = parseInt(rgb[i],16); + } + var oldColor = hexToRGB(_rgbToHex(pixel.color)) + var finalColor = [Math.min(oldColor.r + rgb[0], 255), Math.min(oldColor.g + rgb[1], 255), Math.min(oldColor.b + rgb[2], 255)] + pixel.color = "rgb(" + finalColor.join(",") + ")" + }, + customColor: true, + category: "color tools", + excludeRandom: true, +} + +elements.subtract_color = { + color: ["#c27070","#c29c70","#c2c270","#70c270","#70c2c2","#7070c2","#c270c2"], + tool: function(pixel) { + // convert the hex of currentColor to rgb and set it as a string + var rgb = currentColor.replace("#","").match(/.{1,2}/g); + for (var i = 0; i < rgb.length; i++) { + rgb[i] = parseInt(rgb[i],16); + } + var oldColor = hexToRGB(_rgbToHex(pixel.color)) + var finalColor = [Math.max(oldColor.r - rgb[0], 0), Math.max(oldColor.g - rgb[1], 0), Math.max(oldColor.b - rgb[2], 0)] + pixel.color = "rgb(" + finalColor.join(",") + ")" + }, + customColor: true, + category: "color tools", + excludeRandom: true, +} + +elements.grayscale = { + color: ["#7f7f7f"], + tool: function(pixel) { + // convert the hex of currentColor to rgb and set it as a string + var oldColor = hexToRGB(_rgbToHex(pixel.color)) + var lightness = Math.round((oldColor.r * 0.299) + (oldColor.g * 0.587) + (oldColor.b * 0.114)) + var finalColor = [lightness, lightness, lightness] + pixel.color = "rgb(" + finalColor.join(",") + ")" + }, + category: "color tools", + excludeRandom: true, +} + +elements.invert = { + color: ["#ff0000", "#00ffff"], + tool: function(pixel) { + // convert the hex of currentColor to rgb and set it as a string + var oldColor = hexToRGB(_rgbToHex(pixel.color)) + var finalColor = [(255 - oldColor.r), (255 - oldColor.g), (255 - oldColor.b)] + pixel.color = "rgb(" + finalColor.join(",") + ")" + }, + category: "color tools", + excludeRandom: true, +} + +elements.reverse_R_G_B = { + color: ["#7f7f7f"], + tool: function(pixel) { + // convert the hex of currentColor to rgb and set it as a string + var oldColor = hexToRGB(_rgbToHex(pixel.color)) + var finalColor = [oldColor.b, oldColor.g, oldColor.r] + pixel.color = "rgb(" + finalColor.join(",") + ")" + }, + category: "color tools", + excludeRandom: true, +} + +elements.shift_R_G_B = { + color: ["#7f7f7f"], + tool: function(pixel) { + // convert the hex of currentColor to rgb and set it as a string + var oldColor = hexToRGB(_rgbToHex(pixel.color)) + var finalColor = [oldColor.g, oldColor.b, oldColor.r] + pixel.color = "rgb(" + finalColor.join(",") + ")" + }, + category: "color tools", + excludeRandom: true, +} \ No newline at end of file From 9d18b314735fb417e968aee732159cab8a72c810 Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Fri, 20 May 2022 19:18:07 -0400 Subject: [PATCH 02/20] simple invisible wall element invisible_wall is wall but sets itself to the bg color --- mods/invisible_wall.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 mods/invisible_wall.js diff --git a/mods/invisible_wall.js b/mods/invisible_wall.js new file mode 100644 index 00000000..7edeb535 --- /dev/null +++ b/mods/invisible_wall.js @@ -0,0 +1,20 @@ +if(!settings) { + settings = {} +} + +if(!settings.bg) { + settings.bg = "#000000" +} + +elements.invisible_wall = { + color: settings.bg, + behavior: behaviors.WALL, + tick: function(pixel) { + var backgroundColor = hexToRGB(settings.bg); + var rgbValue = "rgb("+backgroundColor.r+","+backgroundColor.g+","+backgroundColor.b+")"; + pixel.color = rgbValue; + }, + hardness: 1, + category: "special", + state: "solid", +}; \ No newline at end of file From a6a6393c6206dac4eb4bdd2295cb6d89e4ffd64f Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Fri, 20 May 2022 19:22:07 -0400 Subject: [PATCH 03/20] inviswall now insulates --- mods/invisible_wall.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/invisible_wall.js b/mods/invisible_wall.js index 7edeb535..3aeb3549 100644 --- a/mods/invisible_wall.js +++ b/mods/invisible_wall.js @@ -14,7 +14,8 @@ elements.invisible_wall = { var rgbValue = "rgb("+backgroundColor.r+","+backgroundColor.g+","+backgroundColor.b+")"; pixel.color = rgbValue; }, + insulate: true, hardness: 1, category: "special", state: "solid", -}; \ No newline at end of file +}; From d3fe08b9242d1a942468fc50b78cd5b7b1c2e63a Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Fri, 20 May 2022 20:13:45 -0400 Subject: [PATCH 04/20] error suppression --- mods/miscible_psoup_and_birthpool.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mods/miscible_psoup_and_birthpool.js b/mods/miscible_psoup_and_birthpool.js index f27e2df5..16c8dff9 100644 --- a/mods/miscible_psoup_and_birthpool.js +++ b/mods/miscible_psoup_and_birthpool.js @@ -1,11 +1,13 @@ if(enabledMods.includes("mods/fey_and_more.js")) { - elements.birthpool.density = elements.primordial_soup.density; + elements.birthpool.density = 1250 + elements.primordial_soup.density = 1250 elements.birthpool.state = "liquid"; }; runAfterLoad(function() { if(enabledMods.includes("mods/fey_and_more.js")) { - elements.birthpool.density = elements.primordial_soup.density; + elements.birthpool.density = 1250 + elements.primordial_soup.density = 1250 elements.birthpool.state = "liquid"; }; }); From 702fe31028ad7b16b8348056263198ccc9a94ddc Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Sat, 21 May 2022 20:09:06 -0400 Subject: [PATCH 05/20] send move tools to their own category --- mods/move_tools.js | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/mods/move_tools.js b/mods/move_tools.js index 8a3bc940..fa239d5f 100644 --- a/mods/move_tools.js +++ b/mods/move_tools.js @@ -3,7 +3,8 @@ elements.move_up = { tool: function(pixel) { tryMove(pixel,pixel.x,pixel.y-1); }, - category: "tools", + category: "movement tools", + excludeRandom: true, }, elements.move_down = { @@ -11,7 +12,8 @@ elements.move_down = { tool: function(pixel) { tryMove(pixel,pixel.x,pixel.y+1); }, - category: "tools", + category: "movement tools", + excludeRandom: true, }, elements.move_left = { @@ -19,7 +21,8 @@ elements.move_left = { tool: function(pixel) { tryMove(pixel,pixel.x-1,pixel.y); }, - category: "tools", + category: "movement tools", + excludeRandom: true, }, elements.move_right = { @@ -27,7 +30,8 @@ elements.move_right = { tool: function(pixel) { tryMove(pixel,pixel.x+1,pixel.y); }, - category: "tools", + category: "movement tools", + excludeRandom: true, }, elements.move_up_left = { @@ -35,7 +39,8 @@ elements.move_up_left = { tool: function(pixel) { tryMove(pixel,pixel.x-1,pixel.y-1); }, - category: "tools", + category: "movement tools", + excludeRandom: true, }, elements.move_down_left = { @@ -43,7 +48,8 @@ elements.move_down_left = { tool: function(pixel) { tryMove(pixel,pixel.x-1,pixel.y+1); }, - category: "tools", + category: "movement tools", + excludeRandom: true, }, elements.move_up_right = { @@ -51,7 +57,8 @@ elements.move_up_right = { tool: function(pixel) { tryMove(pixel,pixel.x+1,pixel.y-1); }, - category: "tools", + category: "movement tools", + excludeRandom: true, }, elements.move_down_right = { @@ -59,5 +66,6 @@ elements.move_down_right = { tool: function(pixel) { tryMove(pixel,pixel.x+1,pixel.y+1); }, - category: "tools", -} \ No newline at end of file + category: "movement tools", + excludeRandom: true, +} From f3893ab1da480fa7b82f68dda9cd23b569b6d010 Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Sat, 21 May 2022 20:24:36 -0400 Subject: [PATCH 06/20] splitting bacteria off --- mods/randomness_but_tick.js | 93 ------------------------------------- 1 file changed, 93 deletions(-) diff --git a/mods/randomness_but_tick.js b/mods/randomness_but_tick.js index 73a09366..8150af72 100644 --- a/mods/randomness_but_tick.js +++ b/mods/randomness_but_tick.js @@ -1,96 +1,3 @@ -elements.bacteria = { - color: ["#e6d3f2", "#c098d9", "#6e318f", "#6e318f"], - behavior: behaviors.WALL, - tick: function(pixel) { - neighbors = [[-1,0],[0,-1],[1,0],[0,1]] - if(pixel.charge) { //when shocked - if(!outOfBounds(pixel.x,pixel.y+1) && !isEmpty(pixel.x,pixel.y+1)) { //check if a pixel exists below to store the element of - if(!pixel.active && !pixel.target && pixelMap[pixel.x][pixel.y+1].element != pixel.element) { //exclude self and only fire once - pixel.target = pixelMap[pixel.x][pixel.y+1].element - pixel.active = true - } else if(pixel.active || pixel.target || pixelMap[pixel.x][pixel.y+1].element == pixel.element) { - pixel.active = pixel.active - pixel.target = pixel.target - } - } - } - if(pixel.active) { - if(pixel.target) { //safety - for(i = 0; i < neighbors.length; i++) { //iterate through neighbor spots - if(!isEmpty(pixel.x+neighbors[i][0],pixel.y+neighbors[i][1],true)) { //check for neighbors - if(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].element == pixel.target) { //if neighbor element is the target - changePixel(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]],pixel.element) //change neighbors to itself - pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].target = pixel.target //set new bacteria target - pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].active = true //activate new bacteria - } - } - } - } - if(Math.random() < 0.02) { //decay - if(!isEmpty(pixel.x,pixel.y)) { //check if position is empty - if(pixelMap[pixel.x][pixel.y].element == pixel.element) { //check if position is still bacteria - deletePixel(pixel.x,pixel.y) - } - } - } - } - /*if(pixel.active && pixel.target) { //debug - pixel.color = "rgb(255,0,0)" - }*/ - }, - category: "special", - state: "solid", - density: 1, - conduct: elements.water.conduct + 0.1, -}, - -elements.replacer_bacteria = { - color: ["#fcbbc0", "#f28089", "#f04f5c", "#f04f5c"], - behavior: behaviors.WALL, - tick: function(pixel) { - neighbors = [[-1,0],[0,-1],[1,0],[0,1]] - if(pixel.charge) { //when shocked - if(!outOfBounds(pixel.x,pixel.y+1) && !isEmpty(pixel.x,pixel.y+1) && !outOfBounds(pixel.x,pixel.y-1) && !isEmpty(pixel.x,pixel.y-1)) { //check if pixels exists above and below to store the elements of - if(!pixel.active && !pixel.target && !pixel.replacement && pixelMap[pixel.x][pixel.y+1].element != pixel.element) { //exclude self and only fire once - pixel.target = pixelMap[pixel.x][pixel.y+1].element - pixel.replacement = pixelMap[pixel.x][pixel.y-1].element - pixel.active = true - } else if(pixel.active || pixel.target || pixel.replacement || pixelMap[pixel.x][pixel.y+1].element == pixel.element) { - pixel.active = pixel.active - pixel.target = pixel.target - pixel.replacement = pixel.replacement - } - } - } - if(pixel.active) { - if(pixel.target && pixel.replacement) { //safety - for(i = 0; i < neighbors.length; i++) { //iterate through neighbor spots - if(!isEmpty(pixel.x+neighbors[i][0],pixel.y+neighbors[i][1],true)) { //check for neighbors - if(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].element == pixel.target) { //if neighbor element is the target - changePixel(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]],pixel.element) //change neighbors to itself - pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].target = pixel.target //set new bacteria target - pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].replacement = pixel.replacement //set new bacteria replacement - pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].active = true //activate new bacteria - } - } - } - if(!isEmpty(pixel.x,pixel.y)) { //check if own position is empty - if(pixelMap[pixel.x][pixel.y].element == pixel.element) { //check if own position is still bacteria - changePixel(pixelMap[pixel.x][pixel.y],pixel.replacement) - } - } - } - } - /*if(pixel.active && pixel.target && pixel.replacement) { //debug - pixel.color = "rgb(0,255,0)" - }*/ - }, - category: "special", - state: "solid", - density: 1, - conduct: elements.water.conduct + 0.1, -}, - elements.test337 = { color: "#7f7f7f", conduct: 1, From ba173f7b7bef364d9f945ea7a4c599b938a17573 Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Sat, 21 May 2022 20:25:16 -0400 Subject: [PATCH 07/20] now with a jammer --- mods/bacteria_mod.js | 121 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 mods/bacteria_mod.js diff --git a/mods/bacteria_mod.js b/mods/bacteria_mod.js new file mode 100644 index 00000000..92a10c89 --- /dev/null +++ b/mods/bacteria_mod.js @@ -0,0 +1,121 @@ +elements.bacteria = { + color: ["#e6d3f2", "#c098d9", "#6e318f", "#6e318f"], + behavior: behaviors.WALL, + tick: function(pixel) { + neighbors = [[-1,0],[0,-1],[1,0],[0,1]] + if(pixel.charge) { //when shocked + if(!outOfBounds(pixel.x,pixel.y+1) && !isEmpty(pixel.x,pixel.y+1)) { //check if a pixel exists below to store the element of + if(!pixel.active && !pixel.target && pixelMap[pixel.x][pixel.y+1].element != pixel.element) { //exclude self and only fire once + pixel.target = pixelMap[pixel.x][pixel.y+1].element + pixel.active = true + } else if(pixel.active || pixel.target || pixelMap[pixel.x][pixel.y+1].element == pixel.element) { + pixel.active = pixel.active + pixel.target = pixel.target + } + } + } + if(pixel.active) { + if(pixel.target) { //safety + for(i = 0; i < neighbors.length; i++) { //iterate through neighbor spots + if(!isEmpty(pixel.x+neighbors[i][0],pixel.y+neighbors[i][1],true)) { //check for neighbors + if(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].element == pixel.target) { //if neighbor element is the target + changePixel(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]],pixel.element) //change neighbors to itself + pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].target = pixel.target //set new bacteria target + pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].active = true //activate new bacteria + } + } + } + } + if(Math.random() < 0.02) { //decay + if(!isEmpty(pixel.x,pixel.y)) { //check if position is empty + if(pixelMap[pixel.x][pixel.y].element == pixel.element) { //check if position is still bacteria + deletePixel(pixel.x,pixel.y) + } + } + } + } + /*if(pixel.active && pixel.target) { //debug + pixel.color = "rgb(255,0,0)" + }*/ + }, + category: "special", + state: "solid", + density: 1, + conduct: elements.water.conduct + 0.1, +}, + +elements.replacer_bacteria = { + color: ["#fcbbc0", "#f28089", "#f04f5c", "#f04f5c"], + behavior: behaviors.WALL, + tick: function(pixel) { + neighbors = [[-1,0],[0,-1],[1,0],[0,1]] + if(pixel.charge) { //when shocked + if(!outOfBounds(pixel.x,pixel.y+1) && !isEmpty(pixel.x,pixel.y+1) && !outOfBounds(pixel.x,pixel.y-1) && !isEmpty(pixel.x,pixel.y-1)) { //check if pixels exists above and below to store the elements of + if(!pixel.active && !pixel.target && !pixel.replacement && pixelMap[pixel.x][pixel.y+1].element != pixel.element) { //exclude self and only fire once + pixel.target = pixelMap[pixel.x][pixel.y+1].element + pixel.replacement = pixelMap[pixel.x][pixel.y-1].element + pixel.active = true + } else if(pixel.active || pixel.target || pixel.replacement || pixelMap[pixel.x][pixel.y+1].element == pixel.element) { + pixel.active = pixel.active + pixel.target = pixel.target + pixel.replacement = pixel.replacement + } + } + } + if(pixel.active) { + if(pixel.target && pixel.replacement) { //safety + for(i = 0; i < neighbors.length; i++) { //iterate through neighbor spots + if(!isEmpty(pixel.x+neighbors[i][0],pixel.y+neighbors[i][1],true)) { //check for neighbors + if(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].element == pixel.target) { //if neighbor element is the target + changePixel(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]],pixel.element) //change neighbors to itself + pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].target = pixel.target //set new bacteria target + pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].replacement = pixel.replacement //set new bacteria replacement + pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].active = true //activate new bacteria + } + } + } + if(!isEmpty(pixel.x,pixel.y)) { //check if own position is empty + if(pixelMap[pixel.x][pixel.y].element == pixel.element) { //check if own position is still bacteria + changePixel(pixelMap[pixel.x][pixel.y],pixel.replacement) + } + } + } + } + /*if(pixel.active && pixel.target && pixel.replacement) { //debug + pixel.color = "rgb(0,255,0)" + }*/ + }, + category: "special", + state: "solid", + density: 1, + conduct: elements.water.conduct + 0.1, +}, + +elements.jammer_block = { + color: "#c0cf7e", + behavior: behaviors.WALL, + tick: function(pixel) { + neighbors = [[-1,0],[0,-1],[1,0],[0,1]] + if(pixel.charge) { //when shocked + for (var i = 0; i < width; i++) { + for (var j = 0; j < height; j++) { + if(isEmpty(i,j,true) == false) { + if(pixelMap[i][j].element == "bacteria") { + if(isEmpty(i,j,true) == false) { deletePixel(i,j) } + } else if(pixelMap[i][j].element == "replacer_bacteria") { + if(pixelMap[i][j].replacement) { + if(isEmpty(i,j,true) == false) { changePixel(pixelMap[i][j],pixelMap[i][j].replacement) } + } else { + if(isEmpty(i,j,true) == false) { deletePixel(i,j) } + } + } + } + } + } + } + }, + category: "special", + state: "solid", + density: 1, + conduct: elements.water.conduct + 0.1, +} \ No newline at end of file From 0066cea82345a5bc3a990df858239104e8ca9d44 Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Sat, 21 May 2022 20:43:14 -0400 Subject: [PATCH 08/20] tool to replace all (read desc) use like replacer bacteria * target below, replacement above * then shock and it will replace all target pixels with replacement pixels --- mods/replace_all.js | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 mods/replace_all.js diff --git a/mods/replace_all.js b/mods/replace_all.js new file mode 100644 index 00000000..e04bda90 --- /dev/null +++ b/mods/replace_all.js @@ -0,0 +1,45 @@ +elements.replace_all = { + color: "#ef7f3f", + behavior: behaviors.WALL, + tick: function(pixel) { + if(pixel.charge) { //when shocked + //console.log("ouch") + if(!outOfBounds(pixel.x,pixel.y+1) && !isEmpty(pixel.x,pixel.y+1) && !outOfBounds(pixel.x,pixel.y-1) && !isEmpty(pixel.x,pixel.y-1)) { //check if pixels exists above and below to store the elements of + //console.log("elems stored") + if(pixelMap[pixel.x][pixel.y-1].element != pixel.element) { //exclude self and only fire once + //console.log("self excluded from replacement") + pixel.target = pixelMap[pixel.x][pixel.y+1].element + //console.log("target set to " + pixel.target) + pixel.replacement = pixelMap[pixel.x][pixel.y-1].element + //console.log("replacement set to " + pixel.replacement) + pixel.active = true + //console.log("replacer activated") + } + } + } + if(pixel.active) { + //console.log("is this on now?") + if(pixel.target && pixel.replacement) { //safety + //console.log("target and replacement exist, iterating...") + for (var i = 0; i < width; i++) { + for (var j = 0; j < height; j++) { + if(isEmpty(i,j,true) == false) { + //console.log("pixel at (" + i + "," + j + ") exists") + if(pixelMap[i][j].element == pixel.target) { + //console.log(pixel.target + " detected, replacing") + if(isEmpty(i,j,true) == false) { changePixel(pixelMap[i][j],pixel.replacement) } + } + } + } + } + } + pixel.active = false //de-activate + if(pixel.charge) { delete pixel.charge} + if(pixel.chargeCD) { delete pixel.chargeCD} + } + }, + category: "special", + state: "solid", + density: 1, + conduct: elements.water.conduct + 0.1, +} \ No newline at end of file From 423e678cea44b6817ed1c0cdb029cd7ab9c46117 Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Sun, 22 May 2022 18:21:43 -0400 Subject: [PATCH 09/20] added blood clouds --- mods/randomness.js | 65 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/mods/randomness.js b/mods/randomness.js index bc02149f..eedac66a 100644 --- a/mods/randomness.js +++ b/mods/randomness.js @@ -1,5 +1,70 @@ //i made some stupid things +//rain of blood (cliche') +elements.blood_cloud = { + color: "#9c3e35", + behavior: [ + "XX|XX|XX", + "XX|CH:blood%0.05|M1%2.5 AND BO", + "XX|XX|XX", + ], + category:"gases", + temp: 30, + state: "gas", + density: 0.5, + ignoreAir: true, + conduct: 0.03, + stain: 0.02, +}, + +elements.heavy_blood_cloud = { + color: "#c22d23", + behavior: [ + "XX|XX|XX", + "XX|CH:blood%0.1|M1%2.5 AND BO", + "XX|CR:blood%0.05|XX", + ], + category:"gases", + temp: 30, + state: "gas", + density: 0.7, + ignoreAir: true, + conduct: 0.03, + stain: 0.03, +}, + +elements.heavier_blood_cloud = { + color: "#b02219", + behavior: [ + "XX|XX|XX", + "XX|CH:blood%0.2|M1%2.5 AND BO", + "XX|CR:blood%0.1|XX", + ], + category:"gases", + temp: 30, + state: "gas", + density: 0.9, + ignoreAir: true, + conduct: 0.03, + stain: 0.04, +}, + +elements.heaviest_blood_cloud = { + color: "#910f07", + behavior: [ + "XX|XX|XX", + "XX|CH:blood%0.4|M1%2.5 AND BO", + "XX|CR:blood%0.2|XX", + ], + category:"gases", + temp: 30, + state: "gas", + density: 1.1, + ignoreAir: true, + conduct: 0.03, + stain: 0.05, +}, + //TPT reference elements.warp = { name: "warp", From 240d2e9d8b56c43012481647376cde5d3b40c385 Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Sun, 22 May 2022 18:40:21 -0400 Subject: [PATCH 10/20] solid rock --- mods/solid_rock.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 mods/solid_rock.js diff --git a/mods/solid_rock.js b/mods/solid_rock.js new file mode 100644 index 00000000..009a8330 --- /dev/null +++ b/mods/solid_rock.js @@ -0,0 +1,24 @@ +elements.solid_rock = { + color: ["#808080","#4f4f4f","#949494"], + behavior: behaviors.WALL, + reactions: { + "water": {elem1: "wet_sand", chance: 0.00035}, + "salt_water": {elem1: "wet_sand", chance: 0.0005}, + "sugar_water": {elem1: "wet_sand", chance: 0.0004}, + "seltzer": {elem1: "wet_sand", chance: 0.0004}, + "dirty_water": {elem1: "wet_sand", chance: 0.0004}, + "soda": {elem1: "wet_sand", chance: 0.0004}, + "lichen": {elem1: "dirt", chance: 0.0025}, + "grape": {elem2: "juice", chance: 0.1, color2: "#291824"}, + "root": {elem1: "sand", chance: 0.0004}, + "wheat": {elem2: "flour"}, + "primordial_soup": {elem1: "wet_sand", chance: 0.001} + }, + tempHigh: 950, + stateHigh: "magma", + category: "land", + state: "solid", + density: 2600, + hardness: 0.55, + breakInto: "rock", +} \ No newline at end of file From f71d7e142ab260f2b28f0e4bd0e0e2c3e0d4f476 Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Sun, 22 May 2022 19:34:15 -0400 Subject: [PATCH 11/20] background colored dye --- mods/invisible_dye.js | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 mods/invisible_dye.js diff --git a/mods/invisible_dye.js b/mods/invisible_dye.js new file mode 100644 index 00000000..54790d6f --- /dev/null +++ b/mods/invisible_dye.js @@ -0,0 +1,41 @@ +if(!settings) { + settings = {} +} + +if(!settings.bg) { + settings.bg = "#000000" +} + +elements.invisible_dye = { + color: settings.bg, + behavior: behaviors.LIQUID, + tick: function(pixel) { + var backgroundColor = hexToRGB(settings.bg); + var rgbValue = "rgb("+backgroundColor.r+","+backgroundColor.g+","+backgroundColor.b+")"; + pixel.color = rgbValue; + }, + hardness: 0.8, + breakInto: "invisible_dye_gas", + tempHigh: 110, + stateHigh: "invisible_dye_gas", + category: "special", + state: "solid", + stain: elements.dye.stain, +}; + +elements.invisible_dye_gas = { + color: settings.bg, + behavior: behaviors.GAS, + tick: function(pixel) { + var backgroundColor = hexToRGB(settings.bg); + var rgbValue = "rgb("+backgroundColor.r+","+backgroundColor.g+","+backgroundColor.b+")"; + pixel.color = rgbValue; + }, + hardness: 0.5, + breakInto: "invisible_dye_gas", + tempLow: 109, + stateLow: "invisible_dye", + category: "special", + state: "solid", + stain: elements.spray_paint.stain, +}; From 9cc737172cf9dfb84114b2bedd2253af68fa7df6 Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Mon, 23 May 2022 11:27:06 -0400 Subject: [PATCH 12/20] fire slime I am fire Burn those who dare to care for me And my fuel are memories Fuel are memories of you They perish with the heat Perish with the heat So I can move on Flower of iron Shrivelled up to hide the imposter in me (sus) --- mods/fire_slime.js | 68 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 mods/fire_slime.js diff --git a/mods/fire_slime.js b/mods/fire_slime.js new file mode 100644 index 00000000..3d0913da --- /dev/null +++ b/mods/fire_slime.js @@ -0,0 +1,68 @@ +elements.fire_slime = { + color: ["#e6683e", "#e37636", "#e38f3b", "#e3b039"], + behavior: [ + "XX|CR:fire%5|XX", + "M2|XX|M2", + "M1%1 AND M2|M1|M1%1 AND M2" + ], + reactions: { + "bomb": { "elem2":"sticky_bomb", "elem2":null }, + }, + tick: function(pixel) { + if(Math.random() < 0.01) { + pixel.temp++; + pixelTempCheck(pixel); + }; + if(pixel.temp < 700) { + if(Math.random() < 0.02) { + pixel.temp++; + pixelTempCheck(pixel); + }; + }; + }, + viscosity: 3000, + temp: 700, + tempHigh: 6000, + stateHigh: "plasma", + tempLow: -13, + stateLow: "suppressed_fire_slime", + category: "liquids", + state: "liquid", + burning: true, + burnTime: Number.MAX_SAFE_INTEGER, + burn: 85, + burnInto: "fire_slime", + density: 1400, + stain: 0.05 +} + +elements.suppressed_fire_slime = { + color: "#bf6a4e", + behavior: [ + "XX|CR:smoke%1|XX", + "M2|XX|M2", + "M1%0.5 AND M2|M1|M1%0.5 AND M2" + ], + reactions: { + "bomb": { "elem2":"sticky_bomb", "elem2":null }, + }, + tick: function(pixel) { + if(Math.random() < 0.001) { + pixel.temp++; + pixelTempCheck(pixel); + }; + }, + viscosity: 4000, + temp: -20, + tempHigh: -13, + stateHigh: "fire_slime", + category: "liquids", + state: "liquid", + burning: false, + burnTime: 1000, + burn: 1, + burnInto: "fire_slime", + density: 1550, + stain: 0.04, + hidden: true +} \ No newline at end of file From 19c8c01ae1ae655907a6b0986edc191d60ce45ec Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Tue, 24 May 2022 08:44:47 -0400 Subject: [PATCH 13/20] ejected test337 for being sus --- mods/randomness_but_tick.js | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/mods/randomness_but_tick.js b/mods/randomness_but_tick.js index 8150af72..c3201102 100644 --- a/mods/randomness_but_tick.js +++ b/mods/randomness_but_tick.js @@ -1,28 +1,3 @@ -elements.test337 = { - color: "#7f7f7f", - conduct: 1, - viscosity: 0.000001, - colorOn: ["#cf7fff"], - density: 2000, - behavior: behaviors.POWDER, - state: "solid", - category: "solids", - tick: function(pixel) { - for(i = 0; i < 3; i++) { - var moveSpotsA = [[0,1]] - var moveSpotsB = [[-1,1],[1,1]] - var msaChoice = randomArrayChoice(moveSpotsA) - var msbChoice = randomArrayChoice(moveSpotsB) - if(isEmpty(msaChoice[0],pixel.y+msaChoice[1],true)) { - if(!tryMove(pixel,pixel.x+msaChoice[0],pixel.y+msaChoice[1])) { - tryMove(pixel,pixel.x+msbChoice[0],pixel.y+msbChoice[1]) - } - } - pixelTick(pixel) - } - }, -}, - elements.sencc = { //same element neighbor count check color: "#000000", uwu: 0, From eeab29fc68bc9dfd337babef106864c917b57f34 Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Tue, 24 May 2022 08:50:19 -0400 Subject: [PATCH 14/20] state fix --- mods/invisible_dye.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mods/invisible_dye.js b/mods/invisible_dye.js index 54790d6f..e9f09a23 100644 --- a/mods/invisible_dye.js +++ b/mods/invisible_dye.js @@ -19,7 +19,8 @@ elements.invisible_dye = { tempHigh: 110, stateHigh: "invisible_dye_gas", category: "special", - state: "solid", + state: "liquid", + density: 1, stain: elements.dye.stain, }; @@ -36,6 +37,7 @@ elements.invisible_dye_gas = { tempLow: 109, stateLow: "invisible_dye", category: "special", - state: "solid", + state: "liquid", + density: 1, stain: elements.spray_paint.stain, }; From 0b3ea500ca117dde3741ac05da651afec3582e05 Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Tue, 24 May 2022 08:51:44 -0400 Subject: [PATCH 15/20] nerf --- mods/icb.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mods/icb.js b/mods/icb.js index 86831870..4bd4a851 100644 --- a/mods/icb.js +++ b/mods/icb.js @@ -3,9 +3,9 @@ for (var i = 3; i <= 15; i++) { name: `${i}- cluster bomb`, color: "#7d776d", behavior: [ - `XX|EX:10>smoke,smoke,smoke,smoke,smoke,cluster_bomb_${i-1}|XX`, + `XX|EX:8>smoke,smoke,smoke,smoke,smoke,cluster_bomb_${i-1}%10|XX`, "XX|XX|XX", - `M2|M1 AND EX:10>smoke,smoke,smoke,smoke,smoke,cluster_bomb_${i-1}|M2`, + `M2|M1 AND EX:8>smoke,smoke,smoke,smoke,smoke,cluster_bomb_${i-1}%10|M2`, ], category: "weapons", state: "solid", @@ -19,9 +19,9 @@ for (var i = 3; i <= 15; i++) { elements.cluster_bomb_2 = { color: "#7d776d", behavior: [ - "XX|EX:10>smoke,smoke,smoke,smoke,smoke,cluster_bomb|XX", + "XX|EX:8>smoke,smoke,smoke,smoke,smoke,cluster_bomb%10|XX", "XX|XX|XX", - "M2|M1 AND EX:10>smoke,smoke,smoke,smoke,smoke,cluster_bomb|M2", + "M2|M1 AND EX:8>smoke,smoke,smoke,smoke,smoke,cluster_bomb%10|M2", ], category: "weapons", state: "solid", From 2b318b04b33b16b30935c1f2cc39c3289130010e Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Tue, 24 May 2022 09:11:14 -0400 Subject: [PATCH 16/20] e e --- mods/bioooze.js | 81 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 mods/bioooze.js diff --git a/mods/bioooze.js b/mods/bioooze.js new file mode 100644 index 00000000..31f23e20 --- /dev/null +++ b/mods/bioooze.js @@ -0,0 +1,81 @@ +elements.bioooze = { + color: ["#53FF4F", "#53FF4F", "#06DE00", "#04A600", "#036E00"], + behavior: behaviors.LIQUID, + tempHigh: 100, + stateHigh: ["plague","slime","steam","poison"], + //tempLow: -4, + //stateLow: "bioooze_ice", + category: "liquids", + heatCapacity: 3.52, //unimplemented feature + name: "bio-ooze", + reactions: { + "water": { "elem1":"slime", "elem2":"slime" }, //balance + "poison": { "elem1":"slime", "elem2":"slime" }, //balance + //"acid": { "elem1":"wastestone" }, //acid should be sulfuric acid and product should be wastestone + //"elder_fluid": { "elem1":"corrupt_slime" }, //acid should be sulfuric acid and product should be wastestone + //"mercury": { "elem1":"liquid_protocite" }, //acid should be sulfuric acid and product should be wastestone + //"blue_grav_liquid": { "elem1":"blue_grav_liquid" }, //bgl would set gravity to upwards gravity + //thank fuck that elements are rotatable in sandboxels or else this + //would be meaningless and unimplementable + "blood": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "infection" }, + "soap": { "elem1": "slime", "chance": 0.02 }, + "plant": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "dead_plant" }, + "grass": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "dead_plant" }, + "algae": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "dead_plant" }, + "mushroom_spore": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "dead_plant" }, + "lichen": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "dead_plant" }, + "rat": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "rotten_meat" }, + "frog": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "rotten_meat" }, + "fish": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "rotten_meat" }, + "bird": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "rotten_meat" }, + "head": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "rotten_meat" }, + "body": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "rotten_meat" }, + "ant": { "elem1": ["bioooze","bioooze","bioooze","bioooze","poison","slime",null], "elem2": "dust" }, + "worm": { "elem1": ["bioooze","bioooze","bioooze","bioooze","poison","slime",null], "elem2": "dust" }, + "fly": { "elem1": ["bioooze","bioooze","bioooze","bioooze","poison","slime",null], "elem2": "dust" }, + "firefly": { "elem1": ["bioooze","bioooze","bioooze","bioooze","poison","slime",null], "elem2": "dust" }, + "bee": { "elem1": ["bioooze","bioooze","bioooze","bioooze","poison","slime",null], "elem2": "dust" }, + "slug": { "elem1": ["bioooze","bioooze","bioooze","bioooze","poison","slime",null], "elem2": "dust" }, + "snail": { "elem1": ["bioooze","bioooze","bioooze","bioooze","poison","slime",null], "elem2": "calcium" }, + "sapling": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "dead_plant" }, + "root": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "dead_plant" }, + "flower_seed": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "dead_plant" }, + "pistil": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "dead_plant" }, + "petal": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "dead_plant" }, + "grass_seed": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "dead_plant" }, + "meat": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "rotten_meat" }, + "wood": { "elem1": ["bioooze","bioooze","poison","slime",null], "elem2": "sawdust", "chance": 0.25 } + }, + /*reactions: { + "dirt": { // React with (water reacts with dirt to make mud) + "elem1": null, // First element transforms into; in this case, water deletes itself + "elem2": "mud", // Second element transforms into; in this case, dirt turns to mud + }, + "sand": { "elem1": null, "elem2": "wet_sand", }, + "salt": { "elem1": "salt_water", "elem2": null }, + "sugar": { "elem1": "sugar_water", "elem2": null, }, + "dust": { "elem1": "dirty_water", "elem2": null, }, + "ash": { "elem1": "dirty_water", "elem2": null, }, + "cyanide": { "elem1": "dirty_water", "elem2": null, }, + "carbon_dioxide": { "elem1": "seltzer", "elem2": null, "oneway":true }, + "sulfur": { "elem1": "dirty_water", "elem2": null, }, + "rat": { "elem1": "dirty_water", chance:0.005 }, + "plague": { "elem1": "dirty_water", "elem2": null, }, + "rust": { "elem1": "dirty_water", chance:0.005 }, + "fallout": { "elem1": "dirty_water", chance:0.25 }, + "radiation": { "elem1": "dirty_water", chance:0.25 }, + "uranium": { "elem1": "dirty_water", chance:0.25 }, + "quicklime": { "elem1": null, "elem2": "slaked_lime", }, + "rock": { "elem2": "wet_sand", "chance": 0.00035 }, + "ruins": { "elem2": "rock", "chance": 0.00035 }, + "mudstone": { "elem2": "mud", "chance": 0.00035 }, + "methane": { "elem1":"primordial_soup", "elem2":"primordial_soup", tempMin:60, charged:true }, + "ammonia": { "elem1":"primordial_soup", "elem2":"primordial_soup", tempMin:60, charged:true }, + },*/ + state: "liquid", + density: 1.03, + conduct: 0.0008, + stain: 0.2, + viscosity: 60, + description: "A particularly potent toxic sludge loaded with parasites and ickiness.", +} From 9e76eb63f95ccf8627707b1232e5e1d97be7f7f5 Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Tue, 24 May 2022 11:38:39 -0400 Subject: [PATCH 17/20] splitting blood clouds off --- mods/cover_yourself_in.js | 149 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 mods/cover_yourself_in.js diff --git a/mods/cover_yourself_in.js b/mods/cover_yourself_in.js new file mode 100644 index 00000000..f8baccb0 --- /dev/null +++ b/mods/cover_yourself_in.js @@ -0,0 +1,149 @@ +function highBloodColumn(xx,yy) { + //console.log("from " + xx + "," + yy) + if(!outOfBounds(xx,yy)) { + for(i = yy; i < pixelMap[xx].length; i++) { + if(isEmpty(xx,i,false)) { + if(Math.random() < 0.5) { + createPixel("blood",xx,i) + } + if(Math.random() < 0.3) { + if(!isEmpty(xx,yy,true)) { + deletePixel(xx,yy) + } + } + } else if(!isEmpty(xx,i,false) && !outOfBounds(xx,i)) { + break; + } else if(!isEmpty(xx,i,false) && outOfBounds(xx,i)) { + break; + } else { + break; + } + } + } +} + +//cliche' +elements.blood_cloud = { + color: "#9c3e35", + behavior: [ + "XX|XX|XX", + "XX|CH:blood%0.05|M1%2.5 AND BO", + "XX|XX|XX", + ], + category:"gases", + temp: 30, + state: "gas", + density: 0.5, + ignoreAir: true, + conduct: 0.03, + stain: 0.02, +}, + +elements.heavy_blood_cloud = { + color: "#c22d23", + behavior: [ + "XX|XX|XX", + "XX|CH:blood%0.1|M1%2.5 AND BO", + "XX|CR:blood%0.05|XX", + ], + category:"gases", + temp: 30, + state: "gas", + density: 0.7, + ignoreAir: true, + conduct: 0.03, + stain: 0.03, +}, + +elements.heavier_blood_cloud = { + color: "#b02219", + behavior: [ + "XX|XX|XX", + "XX|CH:blood%0.2|M1%2.5 AND BO", + "XX|CR:blood%0.1|XX", + ], + category:"gases", + temp: 30, + state: "gas", + density: 0.9, + ignoreAir: true, + conduct: 0.03, + stain: 0.04, +}, + +elements.heaviest_blood_cloud = { + color: "#910f07", + behavior: [ + "XX|XX|XX", + "XX|CH:blood%0.4|M1%2.5 AND BO", + "XX|CR:blood%0.2|XX", + ], + category:"gases", + temp: 30, + state: "gas", + density: 1.1, + ignoreAir: true, + conduct: 0.03, + stain: 0.05, +}, + +elements.heaviester_blood_cloud = { + color: "#690600", + behavior: [ + "XX|XX|XX", + "XX|CH:blood%0.8|M1%2.5 AND BO", + "XX|CR:blood%0.4|XX", + ], + tick: function(pixel) { + if(Math.random() < 0.01) { + for(i = pixel.y + 1; i < pixelMap[i].length; i++) { + if(isEmpty(pixel.x,i,false)) { + if(Math.random() < 0.5) { + createPixel("blood",pixel.x,i) + } + if(Math.random() < 0.3) { + if(!isEmpty(pixel.x,pixel.y,true)) { + deletePixel(pixel.x,pixel.y) + } + } + } else if(!isEmpty(pixel.x,i,false) && !outOfBounds(pixel.x,i)) { + break; + } else if(!isEmpty(pixel.x,i,false) && outOfBounds(pixel.x,i)) { + break; + } else { + break; + } + } + } + }, + category:"gases", + temp: 30, + state: "gas", + density: 1.15, + ignoreAir: true, + conduct: 0.03, + stain: 0.06, +}, + +elements.heaviestest_blood_cloud = { + color: "#330301", + behavior: [ + "XX|CR:blood%0.8|XX", + "CR:blood%0.05|CH:blood%3|CR:blood%0.05 AND M1%2.5 AND BO", + "XX|CR:blood%0.8|XX", + ], + tick: function(pixel) { + if(Math.random() < 0.02) { + highBloodColumn(pixel.x-1,pixel.y + 1) + highBloodColumn(pixel.x,pixel.y + 1) + highBloodColumn(pixel.x+1,pixel.y + 1) + } + }, + category:"gases", + temp: 30, + state: "gas", + density: 1.2, + ignoreAir: true, + conduct: 0.03, + stain: 0.07, +} From 69cbfcc6a265e072e214383d6cf4a30adff682e3 Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Tue, 24 May 2022 11:39:05 -0400 Subject: [PATCH 18/20] (2) --- mods/randomness.js | 65 ---------------------------------------------- 1 file changed, 65 deletions(-) diff --git a/mods/randomness.js b/mods/randomness.js index eedac66a..bc02149f 100644 --- a/mods/randomness.js +++ b/mods/randomness.js @@ -1,70 +1,5 @@ //i made some stupid things -//rain of blood (cliche') -elements.blood_cloud = { - color: "#9c3e35", - behavior: [ - "XX|XX|XX", - "XX|CH:blood%0.05|M1%2.5 AND BO", - "XX|XX|XX", - ], - category:"gases", - temp: 30, - state: "gas", - density: 0.5, - ignoreAir: true, - conduct: 0.03, - stain: 0.02, -}, - -elements.heavy_blood_cloud = { - color: "#c22d23", - behavior: [ - "XX|XX|XX", - "XX|CH:blood%0.1|M1%2.5 AND BO", - "XX|CR:blood%0.05|XX", - ], - category:"gases", - temp: 30, - state: "gas", - density: 0.7, - ignoreAir: true, - conduct: 0.03, - stain: 0.03, -}, - -elements.heavier_blood_cloud = { - color: "#b02219", - behavior: [ - "XX|XX|XX", - "XX|CH:blood%0.2|M1%2.5 AND BO", - "XX|CR:blood%0.1|XX", - ], - category:"gases", - temp: 30, - state: "gas", - density: 0.9, - ignoreAir: true, - conduct: 0.03, - stain: 0.04, -}, - -elements.heaviest_blood_cloud = { - color: "#910f07", - behavior: [ - "XX|XX|XX", - "XX|CH:blood%0.4|M1%2.5 AND BO", - "XX|CR:blood%0.2|XX", - ], - category:"gases", - temp: 30, - state: "gas", - density: 1.1, - ignoreAir: true, - conduct: 0.03, - stain: 0.05, -}, - //TPT reference elements.warp = { name: "warp", From dbac3886763f0338a8baa7d9431e0cf0de55508b Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Tue, 24 May 2022 13:56:31 -0400 Subject: [PATCH 19/20] Test controllable pixel Read description **Uses keyboard; not likely to work on mobile** ##Notes This *will* move if you are typing in a menu, but not in an alert. Non-shifted presses will behave *unpredictably* if there are multiple pixels. Shift-hold presses will behave more predictably. Using multiple pixels is not supported. The pixel has a state of "solid" and a density of 2. It might be able to move through liquids and gases according to this density. ##Controls## WASD to move Z to shock X to explode Hold shift to repeat action Q to stop repetition if it doesn't stop after you let go of shift --- mods/controllable_pixel_test.js | 86 +++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 mods/controllable_pixel_test.js diff --git a/mods/controllable_pixel_test.js b/mods/controllable_pixel_test.js new file mode 100644 index 00000000..0ec30b38 --- /dev/null +++ b/mods/controllable_pixel_test.js @@ -0,0 +1,86 @@ +sussyKey = null, + +document.addEventListener("keyup", function(sussyListener) { + switch (sussyListener.keyCode) { + case 87: + sussyKey = "W"; + break; + case 65: + sussyKey = "A"; + break; + case 83: + sussyKey = "S"; + break; + case 68: + sussyKey = "D"; + break; + case 81: + sussyKey = "Q"; + break; + case 88: + sussyKey = "X"; + break; + case 90: + sussyKey = "Z"; + break; + }; +}); + +elements.controllable_pixel = { + color: "#FFFFFF", + colorOn: "#FFFF00", + behavior: behaviors.WALL, + state: "solid", + density: 2000, + conduct: 1, + hardness: 1, + tick: function(pixel) { + var xx = pixel.x + var yy = pixel.y + if(sussyKey !== null) { + switch (sussyKey) { + case "W": + tryMove(pixel,xx,yy-1) + if(shiftDown === 0) { + sussyKey = null; + } + break; + case "A": + tryMove(pixel,xx-1,yy) + if(shiftDown === 0) { + sussyKey = null; + } + break; + case "S": + tryMove(pixel,xx,yy+1) + if(shiftDown === 0) { + sussyKey = null; + } + break; + case "D": + tryMove(pixel,xx+1,yy) + if(shiftDown === 0) { + sussyKey = null; + } + break; + case "X": + explodeAt(xx,yy,4) + if(shiftDown === 0) { + sussyKey = null; + } + break; + case "Z": + if (!pixel.charge && !pixel.chargeCD && !isEmpty(pixel.x,pixel.y,true)) { + pixel.charge = 1; + } + if(shiftDown === 0) { + sussyKey = null; + } + break; + case "Q": + sussyKey = null; + break; + } + } + }, +} From 58dfa9477f2ed7ec9c44b00a35162e7c63bc129c Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Wed, 25 May 2022 09:14:19 -0400 Subject: [PATCH 20/20] Add placing capability Read description **Uses keyboard; not likely to work on mobile** ##Notes This *will* move if you are typing in a menu, but not in an alert. Non-shifted presses will behave *unpredictably* if there are multiple pixels. Shift-hold presses will behave more predictably. Using multiple pixels is not supported. The pixel has a state of "solid" and a density of 2. It might be able to move through liquids and gases according to this density. ##Controls## WASD to move Z to shock X to explode Hold shift to repeat action Hold alt with movement keys to place the current element * It cannot place itself * You can also use Alt+H to place on the right Q to reset keys (current action, shift status, alt status) if they get stuck --- mods/controllable_pixel_test.js | 108 +++++++++++++++++++++++++++----- 1 file changed, 93 insertions(+), 15 deletions(-) diff --git a/mods/controllable_pixel_test.js b/mods/controllable_pixel_test.js index 0ec30b38..574ebc57 100644 --- a/mods/controllable_pixel_test.js +++ b/mods/controllable_pixel_test.js @@ -1,4 +1,28 @@ -sussyKey = null, +sussyKey = null; +isShift = false; +isAlt = false; + +document.addEventListener("keydown", function(modifierDownListener) { + // User presses shift + if (modifierDownListener.keyCode == 16) { + isShift = true; + } + // User presses alt + if (modifierDownListener.keyCode == 18) { + isAlt = true; + } +}); + +document.addEventListener("keyup", function(modifierUpListener) { + // User releases shift + if (modifierUpListener.keyCode == 16) { + isShift = false; + } + // User releases alt + if (modifierUpListener.keyCode == 18) { + isAlt = false; + } +}); document.addEventListener("keyup", function(sussyListener) { switch (sussyListener.keyCode) { @@ -23,49 +47,101 @@ document.addEventListener("keyup", function(sussyListener) { case 90: sussyKey = "Z"; break; + case 72: + sussyKey = "H"; + break; }; }); +function tryCreatePixel(_element,_x,_y) { + if(!elements[_element]) { + throw new Error("Element " + _element + " doesn't exist!"); + }; + if(isEmpty(_x,_y)) { + createPixel(_element,_x,_y); + return true; + } else { + return false; + } +} + +function controllablePixelTryCreatePixelNullCheck(_element,_x,_y) { + if(!elements[_element]) { //catch the null + return false; + }; + if(isEmpty(_x,_y)) { + tryCreatePixel(_element,_x,_y); + return true; + } else { + return false; + } +} + elements.controllable_pixel = { color: "#FFFFFF", colorOn: "#FFFF00", behavior: behaviors.WALL, state: "solid", density: 2000, + maxSize: 1, conduct: 1, hardness: 1, tick: function(pixel) { - var xx = pixel.x - var yy = pixel.y + var xx = pixel.x; + var yy = pixel.y; + userElement = currentElement; + if(userElement === pixel.element) { + userElement = null; + }; + if(isShift && !isAlt) { + sussyKey === "Z" ? pixel.color = "rgb(255,191,127)" : pixel.color = "rgb(255,127,127)"; + } + if(isAlt && !isShift) { + sussyKey === "Z" ? pixel.color = "rgb(191,255,127)" : pixel.color = "rgb(127,255,127)"; + } + if(isAlt && isShift) { + sussyKey === "Z" ? pixel.color = "rgb(255,255,0)" : pixel.color = "rgb(255,255,127)"; + } + if(!isAlt && !isShift) { + sussyKey === "Z" ? pixel.color = "rgb(255,255,191)" : pixel.color = "rgb(255,255,255)"; + } if(sussyKey !== null) { switch (sussyKey) { case "W": - tryMove(pixel,xx,yy-1) - if(shiftDown === 0) { + isAlt ? controllablePixelTryCreatePixelNullCheck(userElement,xx,yy-1) : tryMove(pixel,xx,yy-1); + if(!isShift) { sussyKey = null; } break; case "A": - tryMove(pixel,xx-1,yy) - if(shiftDown === 0) { + isAlt ? controllablePixelTryCreatePixelNullCheck(userElement,xx-1,yy) : tryMove(pixel,xx-1,yy); + if(!isShift) { sussyKey = null; } break; case "S": - tryMove(pixel,xx,yy+1) - if(shiftDown === 0) { + isAlt ? controllablePixelTryCreatePixelNullCheck(userElement,xx,yy+1) : tryMove(pixel,xx,yy+1); + if(!isShift) { sussyKey = null; } break; case "D": - tryMove(pixel,xx+1,yy) - if(shiftDown === 0) { + tryMove(pixel,xx+1,yy); + if(!isShift) { + sussyKey = null; + } + break; + case "H": //Alt+D is something else in some browsers. + if(isAlt) { + controllablePixelTryCreatePixelNullCheck(userElement,xx+1,yy); + }; + if(!isShift) { sussyKey = null; } break; case "X": - explodeAt(xx,yy,4) - if(shiftDown === 0) { + explodeAt(xx,yy,5) + if(!isShift) { sussyKey = null; } break; @@ -73,12 +149,14 @@ elements.controllable_pixel = { if (!pixel.charge && !pixel.chargeCD && !isEmpty(pixel.x,pixel.y,true)) { pixel.charge = 1; } - if(shiftDown === 0) { + if(!isShift === 0) { sussyKey = null; } break; - case "Q": + case "Q": //Use if a key gets stuck sussyKey = null; + isShift = null; + isAlt = null; break; } }