From beac8d40c741d178b240d72db2af477ddfe6389e Mon Sep 17 00:00:00 2001 From: sb <155691462+stefanblox@users.noreply.github.com> Date: Fri, 9 Feb 2024 21:56:18 -0300 Subject: [PATCH 01/47] single color just like the skin element! --- mods/singleColor.js | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 mods/singleColor.js diff --git a/mods/singleColor.js b/mods/singleColor.js new file mode 100644 index 00000000..7d6e23a4 --- /dev/null +++ b/mods/singleColor.js @@ -0,0 +1,3 @@ +for (var element in elements) { + elements[element].singleColor = true; +} \ No newline at end of file From 9ece7c832c8d5478998054e95f9c1e43e517a7cf Mon Sep 17 00:00:00 2001 From: Jayd-Rubies <155784127+Jayd-Rubies@users.noreply.github.com> Date: Sat, 10 Feb 2024 12:08:09 -0500 Subject: [PATCH 02/47] weapons.js update --- mods/weapons.js | 63 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/mods/weapons.js b/mods/weapons.js index 04ed8a20..deeae4e4 100644 --- a/mods/weapons.js +++ b/mods/weapons.js @@ -96,4 +96,67 @@ elements.right_missile = { category: "weapons", state: "solid", density: 1300, +}, + elements.RL_cluster_munition = { + color: "#444444", + behavior: [ + "XX|XX|XX", + "CRcluster%20|XX|CR:cluster%20", + "M2|M1|M2", + ], + category: "weapons", + state: "solid", + density: 1300, +}, + elements.cluster = { + color: "#444444", + behavior: [ + "XX|EX:10%10|XX", + "XX|XX|XX", + "M2|M1 AND EX:10%10|M2", + ], + category: "weapons", + state: "solid", + density: 1300, + hidden: true, +}, + elements.machine_gun_left = { + color: "#C0C0C0", + behavior: [ + "XX|XX|XX", + "CR:left_bullet|XX|XX", + "XX|XX|XX", + ], + category: "weapons", + state: "solid", + density: 1300, +}, + elements.machine_gun_right = { + color: "#C0C0C0", + behavior: [ + "XX|XX|XX", + "XX|XX|CR:right_bullet", + "XX|XX|XX", + ], + category: "weapons", + state: "solid", + density: 1300, +}, +elements.left_bullet = { + color: "#4c4e42", + behavior: [ + "M2|XX|XX", + "M1 AND EX:5|XX|XX", + "M2|XX|XX", + ], + category:"weapons", +}, + elements.right_bullet = { + color: "#4c4e42", + behavior: [ + "XX|XX|M2", + "XX|XX|M1 AND EX:5", + "XX|XX|M2", + ], + category:"weapons", }; \ No newline at end of file From d9e2d88323524b3edf8fdb13c459aa0bcac5be21 Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Sat, 10 Feb 2024 22:31:14 -0500 Subject: [PATCH 03/47] Create survival.js --- mods/survival.js | 329 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 329 insertions(+) create mode 100644 mods/survival.js diff --git a/mods/survival.js b/mods/survival.js new file mode 100644 index 00000000..16a84345 --- /dev/null +++ b/mods/survival.js @@ -0,0 +1,329 @@ +if (!settings.survival) { + settings.survival = { + "wall": 999, + "dirt": 999, + "sapling": 1, + "seeds": 5, + "water": 25, + "cloner": 1, + } +} +settings.survival.cloner = 1; +// settings.survivalClone=null; settings.survival = null; saveSettings(); + +survivalTimeout = null; +function survivalSave() { + if (survivalTimeout) { clearTimeout(survivalTimeout); } + survivalTimeout = setTimeout(function(){ + saveSettings(); + },1000); +} +function survivalAdd(element,amount,skipSave) { + if (settings.survival[element]) { + settings.survival[element] += amount; + } + else { + settings.survival[element] = amount; + } + survivalUpdate(element); + if (!skipSave) {survivalSave()} +} +function survivalRemove(element,amount,skipSave) { + if (settings.survival[element]) { + settings.survival[element] -= amount; + survivalUpdate(element); + } + if (settings.survival[element] <= 0) { + delete settings.survival[element]; + var btn = document.getElementById("elementButton-"+element); + if (btn) { btn.remove(); } + } + if (!skipSave) {survivalSave()} +} +function survivalCount(element) { + return settings.survival[element] || 0; +} +function survivalUpdate(element) { + var btn = document.getElementById("elementButton-"+element); + if (btn) { + btn.innerHTML = btn.innerHTML.split("(")[0]+"("+settings.survival[element]+")"; + } + else if (elements[element]) { + createElementButton(element); + document.getElementById("elementButton-"+element).innerHTML += "("+settings.survival[element]+")"; + } +} + +runAfterAutogen(function(){ + elements.erase.name = "pick_up"; + delete elements.paint.category; + delete elements.pick; + for (var element in elements) { + if (elements[element].category !== "tools") { + elements[element].hidden = true; + elements[element].category = "survival"; + } + } + for (var element in settings.survival) { + if (!elements[element]) { continue; } + createElementButton(element); + document.getElementById("elementButton-"+element).innerHTML += "("+settings.survival[element]+")"; + } +}); + +/* +Cloner +Sell +*/ + +delete elements.cloner.behavior; +elements.cloner.tick = function(pixel) { + if (settings.survivalClone) { + if (Math.random() < 0.025) { + // 1 or -1 + var x = pixel.x + (Math.random() < 0.5 ? 1 : -1); + var y = pixel.y + (Math.random() < 0.5 ? 1 : -1); + if (isEmpty(x,y)) { + createPixel(settings.survivalClone,x,y); + } + } + } + else { + for (var i = 0; i < adjacentCoords.length; i++) { + var coords = adjacentCoords[i]; + var x = pixel.x + coords[0]; + var y = pixel.y + coords[1]; + if (!isEmpty(x,y,true)) { + if (pixelMap[x][y].clone) { pixel.clone = pixelMap[x][y].clone; break } + var element = pixelMap[x][y].element; + if (element === pixel.element || elements[pixel.element].ignore.indexOf(element) !== -1) { continue } + settings.survivalClone = element; + survivalSave(); + break; + } + } + } +}; + +elementWorth = { + "gold_coin": 1, + "diamond": 100, + "sap": 5, + "cloner": 0, + "wall": 0, +} +elements.sell = { + color: ["#fff0b5","#ffe680","#c48821","#986a1a","#eca832","#f0bb62"], + tool: function(pixel) { + if (elementWorth[pixel.element] === 0) { return; } + deletePixel(pixel.x,pixel.y); + survivalAdd("gold_coin",elementWorth[pixel.element]||1); + }, + category: "tools", +} + +window.addEventListener("load",function(){ + // move to start of tools + var erase = document.getElementById("elementButton-erase"); + var sell = document.getElementById("elementButton-sell"); + var parent = erase.parentElement; + parent.removeChild(sell); + parent.insertBefore(sell,parent.firstChild); + parent.removeChild(erase); + parent.insertBefore(erase,parent.firstChild); + document.getElementById("replaceButton").remove(); + document.getElementById("savesButton").remove(); + document.getElementById("elemSelectButton").remove(); + doRandomEvents = function() {} + worldGen = function() {} + loadSave = function() {} + showSaves = function() {} + placeImage = function() {} + chooseElementPrompt = function() {} +}); +runAfterLoad(function(){ + checkUnlock = function(element) { + return; + } + oldClearAll = clearAll; + clearAll = function() { + if (currentPixels && currentPixels.length > 0) { + for (var i = 0; i < currentPixels.length; i++) { + var pixel = currentPixels[i]; + if (pixel && pixel.element) { + survivalAdd(pixel.element,1); + } + } + } + oldClearAll(); + } + mouseAction = function(e,mouseX,mouseY,startPos) { + if (mouseType == "left") { + mouse1Action(e,mouseX,mouseY,startPos); + } + else if (mouseType == "right") { mouse2Action(e,mouseX,mouseY,startPos); } + else if (mouseType == "middle") { mouseMiddleAction(e,mouseX,mouseY); } + } + mouse1Action = function(e,mouseX=undefined,mouseY=undefined,startPos) { + if (currentElement === "erase") { mouse2Action(e,mouseX,mouseY); return; } + else if (currentElement === "pick") { mouseMiddleAction(e,mouseX,mouseY); return; } + // If x and y are undefined, get the mouse position + if (mouseX == undefined && mouseY == undefined) { + // var canvas = document.getElementById("game"); + // var ctx = canvas.getContext("2d"); + lastPos = mousePos; + mousePos = getMousePos(canvas, e); + var mouseX = mousePos.x; + var mouseY = mousePos.y; + } + var cooldowned = false; + if ((mouseSize===1 || elements[currentElement].maxSize===1) && elements[currentElement].cooldown) { + if (pixelTicks-lastPlace < elements[currentElement].cooldown) { + return; + } + cooldowned = true; + } + lastPlace = pixelTicks; + startPos = startPos || lastPos + if (!(isMobile || (cooldowned && startPos.x===lastPos.x && startPos.y===lastPos.y) || elements[currentElement].tool || elements[currentElement].category==="tools")) { + var coords = lineCoords(startPos.x,startPos.y,mouseX,mouseY); + } + else { var coords = mouseRange(mouseX,mouseY); } + var element = elements[currentElement]; + var mixList = []; + // For each x,y in coords + for (var i = 0; i < coords.length; i++) { + var x = coords[i][0]; + var y = coords[i][1]; + + if (currentElement === "mix") { + if (!isEmpty(x,y,true)) { + var pixel = pixelMap[x][y]; + if (!(elements[pixel.element].movable !== true || elements[pixel.element].noMix === true) || shiftDown) { + mixList.push(pixel); + } + } + } + else if (currentElement === "shock") { + if (!isEmpty(x,y,true)) { + // One loop that repeats 5 times if shiftDown else 1 time + for (var j = 0; j < (shiftDown ? 5 : 1); j++) { + var pixel = pixelMap[x][y]; + var con = elements[pixel.element].conduct; + if (con == undefined) {continue} + if (Math.random() < con) { // If random number is less than conductivity + if (!pixel.charge && !pixel.chargeCD) { + pixel.charge = 1; + if (elements[pixel.element].colorOn) { + pixel.color = pixelColorPick(pixel); + } + } + } + else if (elements[pixel.element].insulate != true) { // Otherwise heat the pixel (Resistance simulation) + pixel.temp += 0.25; + pixelTempCheck(pixel); + } + } + } + } + else if (elements[currentElement].tool && !(elements[currentElement].canPlace && isEmpty(x,y))) { + // run the tool function on the pixel + if (!isEmpty(x,y,true)) { + var pixel = pixelMap[x][y]; + // if the current element has an ignore property and the pixel's element is in the ignore property, don't do anything + if (elements[currentElement].ignore && elements[currentElement].ignore.indexOf(pixel.element) != -1) { + continue; + } + elements[currentElement].tool(pixel); + } + } + else if (isEmpty(x, y)) { + if (survivalCount(currentElement) < 1) { + return; + } + survivalRemove(currentElement,1); + currentPixels.push(new Pixel(x, y, currentElement)); + if (elements[currentElement].customColor || elements[currentElement].singleColor) { + pixelMap[x][y].color = pixelColorPick(currentElement,currentColor); + } + if (currentElementProp) { + for (var key in currentElementProp) { + pixelMap[x][y][key] = currentElementProp[key] + } + } + } + } + if (currentElement == "mix") { + for (var i = 0; i < mixList.length; i++) { + var pixel1 = mixList[Math.floor(Math.random()*mixList.length)]; + var pixel2 = mixList[Math.floor(Math.random()*mixList.length)]; + swapPixels(pixel1,pixel2); + mixList.splice(mixList.indexOf(pixel1),1); + mixList.splice(mixList.indexOf(pixel2),1); + if (elements[pixel1.element].onMix) { + elements[pixel1.element].onMix(pixel1,pixel2); + } + if (elements[pixel2.element].onMix) { + elements[pixel2.element].onMix(pixel2,pixel1); + } + } + + } + } + mouse2Action = function(e,mouseX=undefined,mouseY=undefined,startPos) { + // Erase pixel at mouse position + if (mouseX == undefined && mouseY == undefined) { + // var canvas = document.getElementById("game"); + // var ctx = canvas.getContext("2d"); + lastPos = mousePos; + mousePos = getMousePos(canvas, e); + var mouseX = mousePos.x; + var mouseY = mousePos.y; + } + if (dragStart) { + dragStart = 0; + for (var i = 0; i < draggingPixels.length; i++) { + var pixel = draggingPixels[i]; + delete pixel.drag; + } + draggingPixels = null; + } + // If the current element is "pick" or "lookup", coords = [mouseX,mouseY] + if (currentElement == "pick" || currentElement == "lookup") { + var coords = [[mouseX,mouseY]]; + } + else if (!isMobile) { + startPos = startPos || lastPos + var coords = lineCoords(startPos.x,startPos.y,mouseX,mouseY); + } + else { + var coords = mouseRange(mouseX,mouseY); + } + // For each x,y in coords + for (var i = 0; i < coords.length; i++) { + var x = coords[i][0]; + var y = coords[i][1]; + + if (!isEmpty(x, y)) { + if (outOfBounds(x,y)) { + continue + } + var pixel = pixelMap[x][y]; + survivalAdd(pixel.element,1); + delete pixelMap[x][y]; + // Remove pixel from currentPixels + for (var j = 0; j < currentPixels.length; j++) { + if (currentPixels[j].x == x && currentPixels[j].y == y) { + currentPixels.splice(j, 1); + break; + } + } + } + } + } +}) + +window.addEventListener("beforeunload",function(){ + clearAll(); + saveSettings(); +}); \ No newline at end of file From b638f12156c65891cf1afe04f3f7dedb758fa5e9 Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Sat, 10 Feb 2024 22:43:34 -0500 Subject: [PATCH 04/47] Update survival.js --- mods/survival.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mods/survival.js b/mods/survival.js index 16a84345..676ae7d1 100644 --- a/mods/survival.js +++ b/mods/survival.js @@ -9,6 +9,7 @@ if (!settings.survival) { } } settings.survival.cloner = 1; +settings.unhide = 0; // settings.survivalClone=null; settings.survival = null; saveSettings(); survivalTimeout = null; @@ -140,6 +141,7 @@ window.addEventListener("load",function(){ showSaves = function() {} placeImage = function() {} chooseElementPrompt = function() {} + document.getElementById("toolControls").insertAdjacentHTML("beforeend",``); }); runAfterLoad(function(){ checkUnlock = function(element) { From 38c5e3ba4add8953a139c8d015dba36abd05e4a6 Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Sat, 10 Feb 2024 23:06:10 -0500 Subject: [PATCH 05/47] Update survival.js --- mods/survival.js | 49 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/mods/survival.js b/mods/survival.js index 676ae7d1..8030a4da 100644 --- a/mods/survival.js +++ b/mods/survival.js @@ -46,6 +46,7 @@ function survivalCount(element) { } function survivalUpdate(element) { var btn = document.getElementById("elementButton-"+element); + if (elements[element] && elements[element].category === "tools") { return } if (btn) { btn.innerHTML = btn.innerHTML.split("(")[0]+"("+settings.survival[element]+")"; } @@ -58,7 +59,9 @@ function survivalUpdate(element) { runAfterAutogen(function(){ elements.erase.name = "pick_up"; delete elements.paint.category; + delete elements.lookup.category; delete elements.pick; + elements.radiation.category = "tools"; for (var element in elements) { if (elements[element].category !== "tools") { elements[element].hidden = true; @@ -105,6 +108,44 @@ elements.cloner.tick = function(pixel) { } } }; +elements.cloner.ignore = elements.cloner.ignore.concat(["gold","gold_coin","molten_gold"]); + +elements.smash.tool = function(pixel) { + if (elements[pixel.element].seed === true) { return } + if (elements[pixel.element].breakInto !== undefined || (elements[pixel.element].seed !== undefined && elements[pixel.element].seed !== true)) { + // times 0.25 if not shiftDown else 1 + if (Math.random() < (elements[pixel.element].hardness || 1) * (shiftDown ? 1 : 0.25)) { + var breakInto = elements[pixel.element].breakInto; + if (!breakInto && elements[pixel.element].seed) { + if (Math.random() < 0.1) { + breakInto = elements[pixel.element].seed; + } + else { + breakInto = null; + } + } + // if breakInto is an array, pick one + if (Array.isArray(breakInto)) { + breakInto = breakInto[Math.floor(Math.random() * breakInto.length)]; + } + if (breakInto === null) { + if (elements[pixel.element].seed) { + breakInto = elements[pixel.element].seed; + } + else { + deletePixel(pixel.x,pixel.y); + return; + } + } + var oldelement = pixel.element; + changePixel(pixel,breakInto); + pixelTempCheck(pixel); + if (elements[oldelement].breakIntoColor) { + pixel.color = pixelColorPick(pixel, elements[oldelement].breakIntoColor); + } + } + } +}; elementWorth = { "gold_coin": 1, @@ -112,12 +153,16 @@ elementWorth = { "sap": 5, "cloner": 0, "wall": 0, + "fire": 0, + "smoke": 0, + "plasma": 0, } elements.sell = { color: ["#fff0b5","#ffe680","#c48821","#986a1a","#eca832","#f0bb62"], tool: function(pixel) { if (elementWorth[pixel.element] === 0) { return; } deletePixel(pixel.x,pixel.y); + if (elementWorth[pixel.element] === -1) { return; } survivalAdd("gold_coin",elementWorth[pixel.element]||1); }, category: "tools", @@ -240,10 +285,10 @@ runAfterLoad(function(){ } } else if (isEmpty(x, y)) { - if (survivalCount(currentElement) < 1) { + if (survivalCount(currentElement) < 1 && elements[currentElement].category !== "tools") { return; } - survivalRemove(currentElement,1); + if (elements[currentElement].category !== "tools") { survivalRemove(currentElement,1); } currentPixels.push(new Pixel(x, y, currentElement)); if (elements[currentElement].customColor || elements[currentElement].singleColor) { pixelMap[x][y].color = pixelColorPick(currentElement,currentColor); From 1194d7ce455ea8deb900457816ff7643fcccce0d Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Sat, 10 Feb 2024 23:15:05 -0500 Subject: [PATCH 06/47] Update survival.js --- mods/survival.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/mods/survival.js b/mods/survival.js index 8030a4da..0efa5ced 100644 --- a/mods/survival.js +++ b/mods/survival.js @@ -20,6 +20,7 @@ function survivalSave() { },1000); } function survivalAdd(element,amount,skipSave) { + if (elements[element].category === "tools") { return } if (settings.survival[element]) { settings.survival[element] += amount; } @@ -30,6 +31,7 @@ function survivalAdd(element,amount,skipSave) { if (!skipSave) {survivalSave()} } function survivalRemove(element,amount,skipSave) { + if (elements[element].category === "tools") { return } if (settings.survival[element]) { settings.survival[element] -= amount; survivalUpdate(element); @@ -116,8 +118,8 @@ elements.smash.tool = function(pixel) { // times 0.25 if not shiftDown else 1 if (Math.random() < (elements[pixel.element].hardness || 1) * (shiftDown ? 1 : 0.25)) { var breakInto = elements[pixel.element].breakInto; - if (!breakInto && elements[pixel.element].seed) { - if (Math.random() < 0.1) { + if (elements[pixel.element].seed) { + if (Math.random() < 0.2) { breakInto = elements[pixel.element].seed; } else { @@ -129,13 +131,8 @@ elements.smash.tool = function(pixel) { breakInto = breakInto[Math.floor(Math.random() * breakInto.length)]; } if (breakInto === null) { - if (elements[pixel.element].seed) { - breakInto = elements[pixel.element].seed; - } - else { - deletePixel(pixel.x,pixel.y); - return; - } + deletePixel(pixel.x,pixel.y); + return; } var oldelement = pixel.element; changePixel(pixel,breakInto); @@ -156,6 +153,7 @@ elementWorth = { "fire": 0, "smoke": 0, "plasma": 0, + "petal": -1, } elements.sell = { color: ["#fff0b5","#ffe680","#c48821","#986a1a","#eca832","#f0bb62"], From dc0e58f946827d56aaff2e278465c104a93ff4fd Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Sat, 10 Feb 2024 23:26:27 -0500 Subject: [PATCH 07/47] Update survival.js --- mods/survival.js | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/survival.js b/mods/survival.js index 0efa5ced..7b21da4e 100644 --- a/mods/survival.js +++ b/mods/survival.js @@ -72,6 +72,7 @@ runAfterAutogen(function(){ } for (var element in settings.survival) { if (!elements[element]) { continue; } + if (elements[element].category === "tools") { continue; } createElementButton(element); document.getElementById("elementButton-"+element).innerHTML += "("+settings.survival[element]+")"; } From b47f718eebc9a4ec198aa61fdec51e03759c3f2a Mon Sep 17 00:00:00 2001 From: Ilikepizza2006 <146470829+Ilikepizza2006@users.noreply.github.com> Date: Sun, 11 Feb 2024 16:25:46 +0100 Subject: [PATCH 08/47] Update 1.9 --- mods/pizzasstuff.js | 172 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 158 insertions(+), 14 deletions(-) diff --git a/mods/pizzasstuff.js b/mods/pizzasstuff.js index 463e692b..7e4fb53b 100644 --- a/mods/pizzasstuff.js +++ b/mods/pizzasstuff.js @@ -1,3 +1,34 @@ +elements.freeze_ray = { + color: ["#9ae4f5","#84d6e8"], + tick: function(pixel) { + var x = pixel.x; + for (var y = pixel.y; y < height; y++) { + if (outOfBounds(x, y)) { + break; + } + if (isEmpty(x, y)) { + if (Math.random() > 0.05) { continue } + createPixel("flash", x, y); + pixelMap[x][y].color = "#aedbe6"; + pixelMap[x][y].temp = -257; + } + else { + if (elements[pixelMap[x][y].element].isGas) { continue } + if (elements[pixelMap[x][y].element].id === elements.heat_ray.id) { break } + pixelMap[x][y].temp -= 100; + pixelTempCheck(pixelMap[x][y]); + break; + } + } + deletePixel(pixel.x, pixel.y); + }, + temp: -257, + category: "energy", + state: "gas", + excludeRandom: true, + noMix: true +}; + elements.beer = { color: ["#ffc43d","#ffc43d"], behavior: behaviors.LIQUID, @@ -16,6 +47,9 @@ elements.root_beer = { elements.fruit_slushy = { color: ["#d43968","#ec5885","#f57ca1","#fba9c2","#ffe3eb"], + stateLowColorMultiplier: 1.3, + stateLow: "slushy_ice", + tempLow: "-50", behavior: behaviors.LIQUID, category: "food", state: "solid", @@ -32,6 +66,9 @@ elements.mold = { elements.chocolate_slushy = { color: ["#c3ae9a","#ae967f","#977b5f","#876b4f","#816346"], + stateLowColorMultiplier: 1.3, + tempLow: "-50", + stateLow: "slushy_ice", behavior: behaviors.LIQUID, category: "food", state: "solid", @@ -136,7 +173,7 @@ elements.fruit_yogurt = { elements.frozen_fruit_yogurt = { color: ["#ffdfdf","#ffc0c0","#ff9b9b"], - stateLowColorMultiplier: 0.7, + stateHighColorMultiplier: 0.7, behavior: behaviors.STURDYPOWDER, category: "food", state: "solid", @@ -149,7 +186,7 @@ elements.frozen_fruit_yogurt = { elements.frozen_chocolate_yogurt = { color: ["#a87848","#a57e57","#c1a07f","#e2c5ac","#efd0b1"], - stateLowColorMultiplier: 0.7, + stateHighColorMultiplier: 0.7, behavior: behaviors.STURDYPOWDER, category: "food", state: "solid", @@ -418,7 +455,7 @@ elements.moss = { }; elements.moth = { - color: "#665233", + color: ["#df8830","#e9b477","#a1591a","#a87a46","#4e3212"], behavior: behaviors.FLY, category: "life", state: "solid", @@ -661,7 +698,6 @@ elements.banana = { breakInto: "juice", breakIntoColor: "#f0f060", reactions: { - "steam": { elem1: "potassium", elem2: null }, "sugar": { elem1: "jelly", elem2: null, tempMin: 100, color1: ["#fdf8d6","#f9efa6"] }, } }; @@ -1074,14 +1110,6 @@ elements.eggplant = { breakIntoColor: ["#674ea7","#351c75"], }; -elements.potassium = { - color: "#a3a333", - behavior: behaviors.POWDER, - category: "states", - state: "solid", - breakInto: "juice", -}; - elements.onion = { color: ["#62121b","#a92940","#c04b65","#d8699e"], behavior: @@ -1282,7 +1310,7 @@ elements.legacy_rocket = { "XX|DL%1|XX", "CR:smoke|CR:fire|CR:smoke", ], - category: "special", + category: "legacy", hidden:true, state: "solid", temp:700, @@ -1292,6 +1320,84 @@ elements.legacy_rocket = { stateHigh: "molten_steel" }; +elements.legacy_dough = { + color: "#bfac91", + behavior: behaviors.STURDYPOWDER, + onMix: function(dough,ingredient) { + if (elements[ingredient.element].isFood && elements[ingredient.element].id !== elements.dough.id && elements[ingredient.element].id !== elements.flour.id && elements[ingredient.element].id !== elements.batter.id && elements[ingredient.element].id !== elements.bread.id) { + var rgb1 = dough.color.match(/\d+/g); + var rgb2 = ingredient.color.match(/\d+/g); + // average the colors + var rgb = [ + Math.round((parseInt(rgb1[0])+parseInt(rgb2[0]))/2), + Math.round((parseInt(rgb1[1])+parseInt(rgb2[1]))/2), + Math.round((parseInt(rgb1[2])+parseInt(rgb2[2]))/2) + ]; + changePixel(ingredient, "dough") + // convert rgb to hex + var hex = RGBToHex(rgb); + dough.color = pixelColorPick(dough, hex); + // 50% change to delete ingredient + if (Math.random() < 0.5) { deletePixel(ingredient.x, ingredient.y); } + else { + ingredient.color = pixelColorPick(ingredient, hex); + } + } + }, + reactions: { + "milk": { elem2:"broth", color2:"#ECC891", tempMin:70 }, + "cream": { elem2:"broth", color2:"#ECC891", tempMin:70 }, + }, + category: "legacy", + tempHigh: 94, + stateHigh: "bread", + //stateHighColorMultiplier: 0.9, + burn:40, + burnTime:25, + burnInto:"ash", + state: "solid", + density: 526.9, + isFood: true +}; + +elements.legacy_batter = { + color: "#d4bc85", + behavior: behaviors.LIQUID, + onMix: function(batter,ingredient) { + if (elements[ingredient.element].isFood && elements[ingredient.element].id !== elements.batter.id && elements[ingredient.element].id !== elements.flour.id && elements[ingredient.element].id !== elements.yolk.id && elements[ingredient.element].id !== elements.dough.id && elements[ingredient.element].id !== elements.baked_batter.id) { + var rgb1 = batter.color.match(/\d+/g); + var rgb2 = ingredient.color.match(/\d+/g); + // average the colors + var rgb = [ + Math.round((parseInt(rgb1[0])+parseInt(rgb2[0]))/2), + Math.round((parseInt(rgb1[1])+parseInt(rgb2[1]))/2), + Math.round((parseInt(rgb1[2])+parseInt(rgb2[2]))/2) + ]; + changePixel(ingredient, "batter") + // convert rgb to hex + var hex = RGBToHex(rgb); + batter.color = pixelColorPick(batter, hex); + // 50% change to delete ingredient + if (Math.random() < 0.5) { deletePixel(ingredient.x, ingredient.y); } + else { + ingredient.color = pixelColorPick(ingredient, hex); + } + } + }, + category: "legacy", + tempHigh: 94, + stateHigh: "baked_batter", + stateHighColorMultiplier: 0.9, + burn:40, + burnTime:25, + burnInto:"ash", + state: "liquid", + viscosity: 10000, + density: 1001, + hidden: true, + isFood: true +}; + elements.legacy_lattice = { color: "#cb4cd9", behavior: [ @@ -1300,7 +1406,7 @@ elements.legacy_lattice = { "CL|XX|CL", ], hidden: true, - category:"special", + category:"legacy", excludeRandom: true }; @@ -1352,6 +1458,37 @@ elements.left_lattice = { excludeRandom: true }; +elements.amethyst = { + color: ["#9868e0","#482888","#7848b8","#c898f0","#a878f0"], + behavior: behaviors.POWDER, + hidden: true, + category: "powders", +}; + +elements.quartz = { + color: ["#f6fff9","#f3f9f9","#f6fcf9","#fefefe","#fdfffe"], + behavior: behaviors.POWDER, + hidden: true, + category: "powders", + tempHigh: 1900, + stateHigh: "magma", + reactions: { + "molten_iron": { elem1: "amethyst", elem2: null }, + } +}; + +elements.slushy_ice = { + color: ["#f6fff9","#f3f9f9","#f6fcf9","#fefefe","#fdfffe"], + behavior: behaviors.WALL, + temp: -5, + tempHigh: 5, + stateHigh: "smashed_ice", + category: "states", + state: "solid", + density: 917, + breakInto: "smashed_ice", +}; + elements.toorhpaste = { color: ["#31ffe0","#65ffe8","#97ffef","#c9fff7","#f3fffd"], behavior: behaviors.LIQUID, @@ -1428,10 +1565,17 @@ elements.algae.breakInto = "seafoam" elements.battery.breakInto = "battery_acid" +elements.art.burn = 5 +elements.art.burnTime = 300 +elements.art.burnInto = ["ember","charcoal","fire"] + + elements.herb.breakInto = "seasoning" elements.chocolate.breakInto = "chocolate_sauce" +elements.magma.stateLow = ["basalt","basalt","basalt","basalt","basalt","basalt","basalt","rock","quartz"] + if (!elements.bless.reactions) elements.bless.reactions = {}; elements.bless.reactions.mold = { elem2: null } From 98d69c2d855959d7422c6405fcb97fc3e539dfae Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 11 Feb 2024 12:04:27 -0500 Subject: [PATCH 09/47] even cursor sizes, electric gas lightning --- mods/a_mod_by_alice.js | 160 +++++++++++++++++++++++++++++++++++------ 1 file changed, 140 insertions(+), 20 deletions(-) diff --git a/mods/a_mod_by_alice.js b/mods/a_mod_by_alice.js index ddd46a35..804e1714 100644 --- a/mods/a_mod_by_alice.js +++ b/mods/a_mod_by_alice.js @@ -1163,10 +1163,11 @@ try { }; function convertHslObjects(color,outputType="rgb") { + if(color == null) { console.error("convertHslObjects: Color is null"); color = {h: 300, s: 100, l: 50} }; switch(outputType.toLowerCase()) { //RGB cases case "rgb": - color = hexToRGB(hslToHex(...Object.values(color))); //hsl to hex, hex to rgb_json, and rgb_json to rgb() + color = convertColorFormats(hslToHex(...Object.values(color)),"json"); //hsl to hex, hex to rgb_json, and rgb_json to rgb() return `rgb(${color.r},${color.g},${color.b})`; break; case "hex": @@ -1202,8 +1203,8 @@ try { break; default: throw new Error("outputType must be \"rgb\", \"hex\", \"rgb_json\", \"rgb_array\", \"hsl\", \"hsl_json\", or \"hsl_array\""); - }; - } + } + }; function changeSaturation(color,saturationChange,operationType="add",outputType="rgb",arrayType=null,doRounding=true) { color = normalizeColorToHslObject(color,arrayType); @@ -2094,13 +2095,15 @@ try { //fix -1-caused ghost pixels function deletePixel(x,y) { + if(isEmpty(x,y,true)) { return false }; // remove pixelMap[x][y] from currentPixels var pixelIndex = currentPixels.indexOf(pixelMap[x][y]); if(pixelIndex !== -1) { currentPixels.splice(pixelIndex,1) + if (pixelMap[x][y]) { delete pixelMap[x][y] }; }; - if (pixelMap[x][y]) {pixelMap[x][y].del = true} - if (pixelMap[x][y]) { delete pixelMap[x][y] }; + //if (pixelMap[x][y]) {pixelMap[x][y].del = true} + //if (pixelMap[x][y]) { delete pixelMap[x][y] }; /*for (var i = 0; i < currentPixels.length; i++) { if (currentPixels[i].x == x && currentPixels[i].y == y) { currentPixels.splice(i, 1); @@ -3217,6 +3220,32 @@ color1 and color2 spread through striped paint like dye does with itself. col } }; + //redefine mouseRange to support even sizes + function mouseRange(mouseX,mouseY,size) { + var coords = []; + size = size || mouseSize; + if (elements[currentElement].maxSize < mouseSize) { + var mouseOffset = Math.trunc(elements[currentElement].maxSize/2); + } + else { + var mouseOffset = Math.trunc(size/2); + } + var topLeft = [mouseX-mouseOffset,mouseY-mouseOffset]; + var bottomRight = [mouseX+mouseOffset,mouseY+mouseOffset]; + if(size % 2 == 0) { + bottomRight[0]--; + bottomRight[1]--; + }; + // Starting at the top left, go through each pixel + for (var x = topLeft[0]; x <= bottomRight[0]; x++) { + for (var y = topLeft[1]; y <= bottomRight[1]; y++) { + // If the pixel is empty, add it to coords + coords.push([x,y]); + } + } + return coords; + }; + //this part defines basically all of the keybinds function addKeyboardListeners() { document.addEventListener("keydown", function(e) { @@ -3259,16 +3288,26 @@ color1 and color2 spread through striped paint like dye does with itself. col } return; } + // If the user presses [ or -, decrease the mouse size by 2 if (e.keyCode == 219 || e.keyCode == 189) { - if (shiftDown) {mouseSize = 1} + //If a shift key is pressed, set to 1 + if (shiftDown && shiftDown % 2 == 1) {mouseSize = 1} + //If an alt key is pressed, decrease by 1 + else if (shiftDown && shiftDown % 2 == 0) { + mouseSize--; + if (mouseSize < 1) { mouseSize = 1 } + } else { mouseSize -= 2; - if (mouseSize < 1) { mouseSize = 1; } + if (mouseSize < 1) { mouseSize = 1 } } } // If the user presses ] or =, increase the mouse size by 2 if (e.keyCode == 221 || e.keyCode == 187) { - if (shiftDown) {mouseSize = (mouseSize+15)-((mouseSize+15) % 15)} + //If a shift key is pressed, increase by 15 + if (shiftDown && shiftDown % 2 == 1) {mouseSize = (mouseSize+15)-((mouseSize+15) % 15)} + //If an alt key is pressed, increase by 1 + else if (shiftDown && shiftDown % 2 == 0) {mouseSize++} else {mouseSize += 2;} // if height>width and mouseSize>height, set mouseSize to height, if width>height and mouseSize>width, set mouseSize to width if (mouseSize > (height > width ? height : width)) { mouseSize = (height > width ? height : width); } @@ -3607,6 +3646,11 @@ color1 and color2 spread through striped paint like dye does with itself. col velocityBlacklist = []; function explodeAtPlus(x,y,radius,firee="fire",smokee="smoke",beforeFunction=null,afterFunction=null,changeTemp=true) { + var message = "Explosion "; + var pixel = pixelMap[x]?.[y]; + if(pixel) { message += `of ${pixel.element} ` }; + message += `with radius ${radius} at (${x},${y})`; + // if fire contains , split it into an array if(firee !== null) { if (firee.indexOf(",") !== -1) { @@ -3730,6 +3774,15 @@ color1 and color2 spread through striped paint like dye does with itself. col }; oldExplodeAt = explodeAt; + /*explodeAt = function(x,y,radius,fire="fire") { + var message = "Explosion "; + var pixel = pixelMap[x]?.[y]; + if(pixel) { message += `of ${pixel.element} ` }; + message += `with radius ${radius} with "${fire}" at (${x},${y})`; + console.log(message); + + oldExplodeAt(x,y,radius,fire="fire") + };*/ explodeAt = explodeAtPlus; //MORE CONFIGURABLE REACTION TEMPERATURE CHANGES ## @@ -5029,11 +5082,10 @@ color1 and color2 spread through striped paint like dye does with itself. col if (pixel.charge && elementInfo.colorOn) { customColor = elementInfo.colorOn; } - if (customColor != null) { + if (customColor !== null) { if (Array.isArray(customColor)) { customColor = customColor[Math.floor(Math.random() * customColor.length)]; - } - if (customColor.startsWith("#")) { + } else if (customColor.startsWith?.("#")) { customColor = hexToRGB(customColor); } var rgb = customColor; @@ -5224,7 +5276,7 @@ color1 and color2 spread through striped paint like dye does with itself. col if (!settings["bg"]) {ctx.clearRect(0, 0, canvas.width, canvas.height)} else { if(settings["bg"] instanceof Array) { - settings.bgAngle ??= 0; + settings.bgAngle ??= 90; var angle = (settings.bgAngle) * Math.PI / 180; ctx.fillStyle = ctx.createLinearGradient( 0, @@ -5560,6 +5612,10 @@ color1 and color2 spread through striped paint like dye does with itself. col } var topLeft = [mousePos.x-mouseOffset,mousePos.y-mouseOffset]; var bottomRight = [mousePos.x+mouseOffset,mousePos.y+mouseOffset]; + if(mouseSize % 2 == 0) { + bottomRight[0]--; + bottomRight[1]--; + }; // Draw a square around the mouse ctx.strokeStyle = "white"; ctx.strokeRect(topLeft[0]*pixelSize,topLeft[1]*pixelSize,(bottomRight[0]-topLeft[0]+1)*pixelSize,(bottomRight[1]-topLeft[1]+1)*pixelSize); @@ -7930,7 +7986,7 @@ color1 and color2 spread through striped paint like dye does with itself. col } //1010 and 0101 if(pixel.dc1 && !pixel.dc2 && pixel.dc3 && !pixel.dc4) { - if(!pixel.changeTo) { + if(!pixel.changeTo) { //7989 yay soshi! if(ggg < 1/2) { pixel.changeTo = pixel.dc1 } else { @@ -8069,7 +8125,7 @@ color1 and color2 spread through striped paint like dye does with itself. col if(isEmpty(pixel.x+1,pixel.y-1) && isEmpty(pixel.x+1,pixel.y-2) && !outOfBounds(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-2)) { tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x+1,pixel.y-1) tryMove(pixelMap[pixel.x][pixel.y-2],pixel.x+1,pixel.y-2) - } //7989 yay soshi! + } } } else { if(isEmpty(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-1)) { @@ -17191,9 +17247,9 @@ Pixel size (rendering only): (Use if the save looks cut o elements.electric_gas = { color: ["#3693b3", "#246e64"], behavior: [ - "M2%33.3 AND CR:electric%1|M1%33.3 AND CR:electric%1|M2%33.3 AND CR:electric%1", - "M1%33.3 AND CR:electric%1|XX%0000000000000000000000|M1%33.3 AND CR:electric%1", - "M2%33.3 AND CR:electric%1|M1%33.3 AND CR:electric%1|M2%33.3 AND CR:electric%1", + "M2%33.3 AND CR:electric%1 AND CR:lightning%0.005|M1%33.3 AND CR:electric%1 AND CR:lightning%0.005|M2%33.3 AND CR:electric%1 AND CR:lightning%0.005", + "M1%33.3 AND CR:electric%1 AND CR:lightning%0.005|XX%000000000000000000000000000000000000000000000|M1%33.3 AND CR:electric%1 AND CR:lightning%0.005", + "M2%33.3 AND CR:electric%1 AND CR:lightning%0.005|M1%33.3 AND CR:electric%1 AND CR:lightning%0.005|M2%33.3 AND CR:electric%1 AND CR:lightning%0.005", ], hardness: 0.8, reactions: { @@ -17202,7 +17258,7 @@ Pixel size (rendering only): (Use if the save looks cut o }, category: "gases", density: 1.225, - state: "gas", + state: "gas" }; corrosiveGasMaxHardness = 0.6 @@ -19256,9 +19312,10 @@ Pixel size (rendering only): (Use if the save looks cut o */ function heejinitoidTick(pixel) { + pixel.color ??= pixelColorPick(pixel); if(pixel.oldColor === null) { pixel.oldColor = pixel.color }; if(pixel.oldColor === undefined) { pixel.oldColor = pixelColorPick(pixel) }; - var color = rgbStringToHSL(convertColorFormats(pixel.oldColor,"rgb"),"json"); + var color = rgbStringToHSL((convertColorFormats(pixel.oldColor,"rgb") ?? pixelColorPick(pixel)),"json"); var heejiniteHueSpread = 30 + (pixel.temp/9.25) var hueOffset = (Math.sin(pixelTicks / 11) * heejiniteHueSpread) + 15; color.h += hueOffset; var color = convertHslObjects(color,"rgb"); @@ -26448,6 +26505,8 @@ Pixel size (rendering only): (Use if the save looks cut o elements.molten_copper ??= {}; elements.molten_copper.tempHigh = 4700; elements.molten_alumina ??= {}; elements.molten_alumina.tempHigh = 5400; + elements.molten_alumina.state = "liquid"; + elements.molten_alumina.autoType = "gas"; elements.molten_alumina.reactions ??= {}; elements.molten_alumina.reactions.iron_scrap = {elem1: "molten_sapphire", elem2: ["molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron",null] }; elements.molten_alumina.reactions.molten_iron = {elem1: "molten_sapphire", elem2: ["molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron","molten_iron",null] }; @@ -35842,7 +35901,7 @@ Make sure to save your command in a file if you want to add this preset again.` }; elements.sponge.onTryMoveInto = function(pixel,otherPixel) { - var absorbedElements = Object.keys(pixel.absorbed); + var absorbedElements = Object.keys(pixel.absorbed ?? {}); if(absorbedElements.length == 0) { return false; }; @@ -45937,6 +45996,67 @@ maxPixels (default 1000): Maximum amount of pixels/changes (if xSpacing and ySpa maxColorOffset: 0 }; + + runAfterLoad(function() { + //Emergency bug fix + elemfillerVar = null; + elements.element_filler = { + category: "special", + color: elements.filler.color, + state: "solid", + movable: "false", + onSelect: function() { + var answer6 = prompt("Please input the desired element of this filler. It will not work if you do multiple filter types while paused.",(elemfillerVar||undefined)); + if (!answer6) { return } + elemfillerVar = answer6; + }, + excludeRandom: true, + tick: function(pixel){ + if(!(elementExists(elemfillerVar))) { + deletePixel(pixel.x,pixel.y); + return + }; + var neighbors = 0; + if(!pixel.changeElem){ + pixel.changeElem = elemfillerVar; + } + for (var i = 0; i < squareCoords.length; i++) { + var coord = squareCoords[i]; + var x = pixel.x+coord[0]; + var y = pixel.y+coord[1]; + if (!isEmpty(x,y, true)) { + neighbors = neighbors + 1; + } else if (isEmpty(x, y)){ + createPixel("element_filler", x, y) + pixelMap[x][y].changeElem = pixel.changeElem; + } else ( + changePixel(pixel, pixel.changeElem) + ) + } + if (neighbors >= 8){ + changePixel(pixel, pixel.changeElem) + } + } + } + + if(elementExists("ohio")) { + elements.ohio.excludeRandom = true + }; + if(elementExists("rainbow_bomb")) { + elements.rainbow_bomb.excludeRandom = true + }; + if(elementExists("fart")) { + elements.fart.excludeRandom = true + }; + if(elementExists("dark_energy")) { + elements.dark_energy.excludeRandom = true + }; + if(elementExists("rainbow_flash")) { + elements.rainbow_flash.excludeRandom = true; + delete elements.rainbow_flash.reactions.fire + }; + }) + //END ## } catch (error) { alert(`Load failed (try reloading).\nThis is likely a sporadic failure caused by inconsistencies in how mods are loaded, and will likely fix itself in a refresh or two. If it persists, then it's an issue.\nError: ${error.stack}`); From 9b27bd9e0eab7fd31641807f01b0f7d907e835c1 Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Sun, 11 Feb 2024 13:05:26 -0500 Subject: [PATCH 10/47] Update survival.js --- mods/survival.js | 143 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 130 insertions(+), 13 deletions(-) diff --git a/mods/survival.js b/mods/survival.js index 7b21da4e..4ccccd72 100644 --- a/mods/survival.js +++ b/mods/survival.js @@ -4,7 +4,7 @@ if (!settings.survival) { "dirt": 999, "sapling": 1, "seeds": 5, - "water": 25, + "ice": 25, "cloner": 1, } } @@ -40,6 +40,7 @@ function survivalRemove(element,amount,skipSave) { delete settings.survival[element]; var btn = document.getElementById("elementButton-"+element); if (btn) { btn.remove(); } + selectElement("unknown"); } if (!skipSave) {survivalSave()} } @@ -47,6 +48,13 @@ function survivalCount(element) { return settings.survival[element] || 0; } function survivalUpdate(element) { + if (element === "gold_coin") { + // if it is not an integer, round it to 0.1 + if (settings.survival.gold_coin % 1 !== 0) { + settings.survival.gold_coin = Math.round(settings.survival.gold_coin*10)/10; + } + document.getElementById("coinCount").innerHTML = settings.survival.gold_coin||0; + } var btn = document.getElementById("elementButton-"+element); if (elements[element] && elements[element].category === "tools") { return } if (btn) { @@ -67,7 +75,7 @@ runAfterAutogen(function(){ for (var element in elements) { if (elements[element].category !== "tools") { elements[element].hidden = true; - elements[element].category = "survival"; + elements[element].category = "inventory"; } } for (var element in settings.survival) { @@ -78,11 +86,6 @@ runAfterAutogen(function(){ } }); -/* -Cloner -Sell -*/ - delete elements.cloner.behavior; elements.cloner.tick = function(pixel) { if (settings.survivalClone) { @@ -112,6 +115,7 @@ elements.cloner.tick = function(pixel) { } }; elements.cloner.ignore = elements.cloner.ignore.concat(["gold","gold_coin","molten_gold"]); +elements.cloner.desc = "You can only clone one element at a time!" elements.smash.tool = function(pixel) { if (elements[pixel.element].seed === true) { return } @@ -148,13 +152,38 @@ elements.smash.tool = function(pixel) { elementWorth = { "gold_coin": 1, "diamond": 100, + "ketchup": 15, + "jelly": 10, + "soda": 10, + "toast": 10, + "bread": 3, + "glass": 5, + "rad_glass": 6, + "glass_shard": 2, + "rad_shard": 3, + "paper": 5, + "broth": 5, "sap": 5, + "caramel": 5, + "candy": 5, + "popcorn": 2, + "flour": 2, + "lettuce": 2, + "sauce": 2, + "wood": 0.2, + "tree_branch": 0.1, + "plant": 0.1, + "mushroom_cap": 0.1, + "mushroom_gill": 0.3, + "vine": 0.1, "cloner": 0, "wall": 0, "fire": 0, "smoke": 0, "plasma": 0, "petal": -1, + "cell": -1, + "cancer": -1, } elements.sell = { color: ["#fff0b5","#ffe680","#c48821","#986a1a","#eca832","#f0bb62"], @@ -165,6 +194,59 @@ elements.sell = { survivalAdd("gold_coin",elementWorth[pixel.element]||1); }, category: "tools", + desc: "Exchanges pixels for their market value in Gold Coins" +} +elements.seeds.name = "seed"; + +/* +~Cloner +~Sell +Shop + Cloner Reset + ~Ammonia + ~Dirt + ~Water + ~Seeds + ~Sapling + ~Pinecone + ~Primordial Soup + ~Worm + ~Bee + ~Human + ~TNT + Seller (Runs Sell tool on pixels that touch it) + Buyer (Cloner but uses store price every time, prompt to select item on select) +Prices tab +*/ +survivalShop = { + "dirt*25": 25, + "water*25": 250, + "ammonia*25": 500, + "seeds*1": 500, + "sapling*1": 500, + "pinecone*1": 500, + "tnt*25": 1000, + "worm*1": 1000, + "bee*1": 5000, + "primordial_soup*5": 10000, + "human*1": 50000, + "sun*25": 500000, +} +function survivalBuy(element) { + var price = survivalShop[element]; + if (!price) { alert("The shop isn't selling "+element+"!"); return } + if (settings.survival.gold_coin < price) { alert("You can't afford that!"); return } + survivalRemove("gold_coin",price); + var amount = 1; + if (element.indexOf("*") !== -1) { amount = parseInt(element.split("*")[1]); element = element.split("*")[0]; } + survivalAdd(element,amount); + selectElement(element); +} +function survivalResetCloner() { + if (settings.survival.gold_coin < 1000) { alert("You can't afford that!"); return } + survivalRemove("gold_coin",1000); + settings.survivalClone = null; + survivalSave(); } window.addEventListener("load",function(){ @@ -186,6 +268,46 @@ window.addEventListener("load",function(){ placeImage = function() {} chooseElementPrompt = function() {} document.getElementById("toolControls").insertAdjacentHTML("beforeend",``); + createCategoryDiv("shop"); + var shopDiv = document.getElementById("category-shop"); + shopDiv.style.display = "none"; + shopDiv.insertAdjacentHTML("beforeend",`
You have $${settings.survival.gold_coin||0}
`); + for (var element in survivalShop) { + var price = survivalShop[element]; + var button = document.createElement("button"); + var name = element; + var amount = 1; + if (element.indexOf("*") !== -1) { amount = parseInt(element.split("*")[1]); name = element.split("*")[0]; } + var elemname = name; + name = (elements[elemname].name||name).replace(/_/g, " ").replace("."," ").replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}).replace(" ",".").replace(/ /g, ""); + button.classList.add("elementButton"); + button.setAttribute("element",element); + button.setAttribute("category","shop"); + button.setAttribute("title",amount+" "+name+" for $"+price); + button.innerHTML = name+" ("+amount+" for $"+price+")"; + if (elements[elemname]) { + if (elements[elemname].color instanceof Array) { + button.style.backgroundImage = "linear-gradient(to bottom right, "+elements[elemname].color.join(", ")+")"; + // choose the middlemost item in array + var colorObject = elements[elemname].colorObject[Math.floor(elements[elemname].colorObject.length/2)]; + if (elements[elemname].darkText !== false && (elements[elemname].darkText || (colorObject.r+colorObject.g+colorObject.b)/3 > 200)) { + button.className += " bright" + } + } + else { + button.style.background = elements[elemname].color; + var colorObject = elements[elemname].colorObject; + if (elements[elemname].darkText !== false && (elements[elemname].darkText || (colorObject.r+colorObject.g+colorObject.b)/3 > 200)) { + button.className += " bright" + } + } + } + button.addEventListener("click",function(){ + survivalBuy(this.getAttribute("element")); + }); + shopDiv.appendChild(button); + } + shopDiv.insertAdjacentHTML("beforeend",``); }); runAfterLoad(function(){ checkUnlock = function(element) { @@ -287,16 +409,11 @@ runAfterLoad(function(){ if (survivalCount(currentElement) < 1 && elements[currentElement].category !== "tools") { return; } - if (elements[currentElement].category !== "tools") { survivalRemove(currentElement,1); } currentPixels.push(new Pixel(x, y, currentElement)); if (elements[currentElement].customColor || elements[currentElement].singleColor) { pixelMap[x][y].color = pixelColorPick(currentElement,currentColor); } - if (currentElementProp) { - for (var key in currentElementProp) { - pixelMap[x][y][key] = currentElementProp[key] - } - } + if (elements[currentElement].category !== "tools") { survivalRemove(currentElement,1); } } } if (currentElement == "mix") { From c94fc64b8e30dccff3197abae5a3990b02572637 Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Sun, 11 Feb 2024 13:11:32 -0500 Subject: [PATCH 11/47] Update survival.js --- mods/survival.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/mods/survival.js b/mods/survival.js index 4ccccd72..0a2e214b 100644 --- a/mods/survival.js +++ b/mods/survival.js @@ -308,6 +308,18 @@ window.addEventListener("load",function(){ shopDiv.appendChild(button); } shopDiv.insertAdjacentHTML("beforeend",``); + + createCategoryDiv("prices"); + var pricesDiv = document.getElementById("category-prices"); + pricesDiv.style.display = "none"; + for (var element in elementWorth) { + var name = (elements[element].name||element).replace(/_/g, " ").replace("."," ").replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}).replace(" ","."); + // create text with the name of the element and its worth, separated by • + var text = name+"="+elementWorth[element] + " • "; + pricesDiv.insertAdjacentHTML("beforeend",`${text}`); + } + pricesDiv.innerHTML = pricesDiv.innerHTML.slice(0,-2); + pricesDiv.innerHTML = ""+pricesDiv.innerHTML+"
"; }); runAfterLoad(function(){ checkUnlock = function(element) { From 0440d37a21b870b2c1cc134877d8e13036719f7f Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Sun, 11 Feb 2024 13:14:59 -0500 Subject: [PATCH 12/47] Update survival.js --- mods/survival.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/survival.js b/mods/survival.js index 0a2e214b..6ff7e339 100644 --- a/mods/survival.js +++ b/mods/survival.js @@ -235,7 +235,7 @@ survivalShop = { function survivalBuy(element) { var price = survivalShop[element]; if (!price) { alert("The shop isn't selling "+element+"!"); return } - if (settings.survival.gold_coin < price) { alert("You can't afford that!"); return } + if (!settings.survival.gold_coin || settings.survival.gold_coin < price) { alert("You can't afford that!"); return } survivalRemove("gold_coin",price); var amount = 1; if (element.indexOf("*") !== -1) { amount = parseInt(element.split("*")[1]); element = element.split("*")[0]; } @@ -243,7 +243,7 @@ function survivalBuy(element) { selectElement(element); } function survivalResetCloner() { - if (settings.survival.gold_coin < 1000) { alert("You can't afford that!"); return } + if (!settings.survival.gold_coin || settings.survival.gold_coin < 1000) { alert("You can't afford that!"); return } survivalRemove("gold_coin",1000); settings.survivalClone = null; survivalSave(); From 4b663406993cf8adaf5cb6ddd4abeca35c061cf5 Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Sun, 11 Feb 2024 13:16:54 -0500 Subject: [PATCH 13/47] Update survival.js --- mods/survival.js | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/survival.js b/mods/survival.js index 6ff7e339..e7010657 100644 --- a/mods/survival.js +++ b/mods/survival.js @@ -313,6 +313,7 @@ window.addEventListener("load",function(){ var pricesDiv = document.getElementById("category-prices"); pricesDiv.style.display = "none"; for (var element in elementWorth) { + if (elementWorth[element] <= 0) { continue } var name = (elements[element].name||element).replace(/_/g, " ").replace("."," ").replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();}).replace(" ","."); // create text with the name of the element and its worth, separated by • var text = name+"="+elementWorth[element] + " • "; From 19eff2e9babd56b0cf18f6477365ba32dfd29056 Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Sun, 11 Feb 2024 14:08:15 -0500 Subject: [PATCH 14/47] Update survival.js --- mods/survival.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mods/survival.js b/mods/survival.js index e7010657..195aa814 100644 --- a/mods/survival.js +++ b/mods/survival.js @@ -71,6 +71,7 @@ runAfterAutogen(function(){ delete elements.paint.category; delete elements.lookup.category; delete elements.pick; + delete elements.prop; elements.radiation.category = "tools"; for (var element in elements) { if (elements[element].category !== "tools") { @@ -114,7 +115,7 @@ elements.cloner.tick = function(pixel) { } } }; -elements.cloner.ignore = elements.cloner.ignore.concat(["gold","gold_coin","molten_gold"]); +elements.cloner.ignore = elements.cloner.ignore.concat(["gold","gold_coin","molten_gold","sun","supernova"]); elements.cloner.desc = "You can only clone one element at a time!" elements.smash.tool = function(pixel) { @@ -123,7 +124,7 @@ elements.smash.tool = function(pixel) { // times 0.25 if not shiftDown else 1 if (Math.random() < (elements[pixel.element].hardness || 1) * (shiftDown ? 1 : 0.25)) { var breakInto = elements[pixel.element].breakInto; - if (elements[pixel.element].seed) { + if (elements[pixel.element].seed && (!breakInto || Math.random() < 0.5)) { if (Math.random() < 0.2) { breakInto = elements[pixel.element].seed; } @@ -181,6 +182,7 @@ elementWorth = { "fire": 0, "smoke": 0, "plasma": 0, + "light": 0, "petal": -1, "cell": -1, "cancer": -1, From ce7974b2d7f7f1e081ecf7d85bba36403cd975c7 Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Sun, 11 Feb 2024 14:09:08 -0500 Subject: [PATCH 15/47] Update survival.js --- mods/survival.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/survival.js b/mods/survival.js index 195aa814..d23b2039 100644 --- a/mods/survival.js +++ b/mods/survival.js @@ -232,7 +232,7 @@ survivalShop = { "bee*1": 5000, "primordial_soup*5": 10000, "human*1": 50000, - "sun*25": 500000, + "sun*1": 500000, } function survivalBuy(element) { var price = survivalShop[element]; From a71cc0c237ef29ec5ec4893f0787fa1488fe7cc5 Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Sun, 11 Feb 2024 14:11:30 -0500 Subject: [PATCH 16/47] Update survival.js --- mods/survival.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/survival.js b/mods/survival.js index d23b2039..933a2dae 100644 --- a/mods/survival.js +++ b/mods/survival.js @@ -152,7 +152,7 @@ elements.smash.tool = function(pixel) { elementWorth = { "gold_coin": 1, - "diamond": 100, + "diamond": 50, "ketchup": 15, "jelly": 10, "soda": 10, From ad597c16c0e51a62a681e6f67ede435f881652b5 Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Sun, 11 Feb 2024 14:22:07 -0500 Subject: [PATCH 17/47] Update survival.js --- mods/survival.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mods/survival.js b/mods/survival.js index 933a2dae..2667769a 100644 --- a/mods/survival.js +++ b/mods/survival.js @@ -115,7 +115,7 @@ elements.cloner.tick = function(pixel) { } } }; -elements.cloner.ignore = elements.cloner.ignore.concat(["gold","gold_coin","molten_gold","sun","supernova"]); +elements.cloner.ignore = elements.cloner.ignore.concat(["gold","gold_coin","molten_gold","sun","supernova","diamond"]); elements.cloner.desc = "You can only clone one element at a time!" elements.smash.tool = function(pixel) { @@ -152,7 +152,7 @@ elements.smash.tool = function(pixel) { elementWorth = { "gold_coin": 1, - "diamond": 50, + "diamond": 100, "ketchup": 15, "jelly": 10, "soda": 10, @@ -183,6 +183,9 @@ elementWorth = { "smoke": 0, "plasma": 0, "light": 0, + "laser": 0, + "liquid_light": 0.1, + "flash": 0, "petal": -1, "cell": -1, "cancer": -1, From c2069456801fcc7e8d90df03cdc313566e23c6c8 Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Sun, 11 Feb 2024 14:23:11 -0500 Subject: [PATCH 18/47] Update mod-list.html --- mod-list.html | 1 + 1 file changed, 1 insertion(+) diff --git a/mod-list.html b/mod-list.html index 45665bb6..ec35b37d 100644 --- a/mod-list.html +++ b/mod-list.html @@ -112,6 +112,7 @@tY(tDiY)kpcz`n-OwPMx z4Ii%7sd9Wu9vhoDJIiEa6KArD!g4+#z!Veq&~vUy@UeteUC+8AI8^;vXlY5R>zx%{U>l`Dve@rBJAQq+@AZc7Y<|X#5X`vD#cq~<>d%}(zr2l% zUOt_tR5jPm&sAQPU(0q?ReeUzSx!Ekquv8iMmtT*bW$h8t7795ztFXb=S$8<{TBi! zd-GUHY{bGod$2>svZN&t;v>sqV+?JorUA8NFE0qBEkkPt)vQ*-cUEWWIVD7iP^&Qn zm^#=U@o3c `;jHH$LaodlrE6>Xt9d;%=&>@ 7;<~!H~C*PW&g~dzO7ab7W@a*|nT=H8Zo2n{lU?l7+Te z88=Jsv*bU^!=0_MGjVfR9XS{OQiW3Wu{CR-&bIFfu546xF3wrF%&E8DbuIdywE0WO zxK^VTea$oXHZKqmJS(yE|2hD-R;FvMW?$<#F^K7SQ1PshK^^yhugcr1EPnNT*q*`8 z^@dS7^Fjcl!bZTg*lP0@9qloF67lg*6lk62hF76oAiaaOk`Zjqg7z}YJ6WX0>}mZs zMUI=ynpib`xIhLgYmr5Xj+YfF*9}>}^R#~W$Y9p*?2ulr=D+01 7ekZR!`m=WB zPil^sKfx1k5PJ#exm0zx!pE$oB2$c@%ztT!x_Y7bU)wrYwv}qx*V5u-k@D&qdW}DR zx^7 7)dv(|A~G>pyTkBLS1~dmOqR2{8kM zrFzQZis(MobC}rLQRpAVSE4Tr7!R;zJZf=mquj?74dRGpv?AO}ykidrL(w*$MiV(0 zQZ+gBcCzHDaSXhAH(#VBATd{x52tv1>s $JIkR_m$f0*v>Hu zEnh{;(PXRM)yM+_Xf}o>z^awE_oww`1$#@whaC-|F&U{*$jW-NWV2&3zY4LMw3H0~ z&RQd*>69GyBUbfcfNbV}IPBii!k}4Dj5PCnZk33IPmwS+dJ_XH@)=GiokWz&=+E=* zgW`D-Z%_BBH>RJ|hV0-7PPG??dN3I7BG^eX)EzvV%HI)YjOIcVS4U2A$d3Gq!XM*X z^Jauay!7sv0$e)#=$6VEe6P;2vSbWY>7wqR6=upa{_U0lMPr|U4lZCU!XpgW@OB^u z1|>GviGGAZ6OT1xCdfcl%mMUF4{f)#aXjcGg#y6oKdSt)RaAm#*3U#wwQE8IteB;X zX8BW0?U-~G^Joe84A RJ){n7No$9;bi?&@6k;kq*>oSJc zvA9CID${voHJDBs84*K6^?7-P38q=yVtCWbd5Q)8Ym+=mHn>7I&F2DYmM@JUi|jve zTu{S)nMVFj0OoKbXgR e;u^#8-wv$mYITNS$wc)!Q);Dw^2ieydt z2j-4@hy3*uW1XqOlRu3dJ3nsmTMbv-8^3v?7>mwy7rQ0QttN(RBU`FEP+J%k$cqHm zCmuJsO0=Ueg=$Vu-3jNxTOAAw*d#)FOOchEyMwZ_Lm{`1fETvTl&(j~fv5F&GWE4a ziCL5TF|&ne=C(lMC?Oto>TpXZO{Q$2vS}7c?@#HgdiK9i%FRZ#8>o_xnXElL*&lh! z|J0G-u+MwT(E%1;2+=#BsLUtcO_=m%)MOz02fh{eWh~?Ldf?~V6>*N+DQ{V2$E%^Z zrpA}d8u6MgzCE`kZZG8On`u{)>Ozk6^My9wuE6V8;fn<+9_|(ls@{6Ze^TO&8y; zdpT||3`>)R?`qw4*N)MNo3DOX;~h6`ZrreI=dL&2+?u#^`>vghOD?+j;_`Omt>Y8h zcQh`!bYtVvi!ZrsV`KZy?Yp;+?r2Q3cC<$CY(WGXB5}jS4Wm0-yZKmMi;u_M6?X7p zx(O7xnj;N9WOoyvxNGoHyIp)%ZWo`xyP4}I!kuBe9cl1F#YN#_=J}2{_)y+BcWj5U zuD;aFb}4sU!pHSw!tGGr9(MB^wQDBeu!G+yTv|~Qmm`zn2I$?u`JJ5KE#Jkj1)jQq zZ|G%y)A4NjCL8*;;Q!y>3)FY@9tubKn%-}Nk}vUnz5A0&l7`<&s(dZ*k3q{Zz9;!8 z-v)e^FD-uAz6_`@cm5S-YV)PPzX{(Ae;vLR{( K{UH22*JG y*x{~hj@nk`=Fj vha zFTVJyOXGStuHR7Iv3+8+YrJ)5YxijNZFf!V>fSxEee|}8-M-$j&DYJHzP@XG;poJ~ zuDf@%w(VYITNB%FyM1@JZDuE%yYAlUm)*K+_wC>z;k%mpN^D{<@uee1+lz?xrM{b= zU&OZ~FAB+y(cL@wN?ujRp`ojjZ4;wo9CIuRYh8S6(#~+S!Y{!V`clLSyDzaL8#%Km dH0 { + if (n <= views.length - 1 && n > 1) { + view = n; + } else { + view = null; + } + setSetting('view', parseInt(view)); + document.querySelector('span[setting="view"]').children[0].value = view ?? 0; +} + +for (const i in views) { + if (i < 5) continue; + const option = document.createElement("option"); + option.setAttribute("value", i); + option.innerText = views[i]; + document.querySelector('.setting-span[setting="view"]').querySelector("select").appendChild(option); + viewKey[i] = views[i]; +} + +const vcrFont = new FontFace("VCR", "url(mods/VCR_OSD_MONO.ttf)"); +vcrFont.load().then(font => { + console.log(font); + document.fonts.add(font); +}) + +function blending(color, color2, t = 0.5) { + const [r, g, b] = parseColor(color).replace("#", "").match(/../g).map(a => parseInt(a, 16)); + const [r2, g2, b2] = parseColor(color2).replace("#", "").match(/../g).map(a => parseInt(a, 16)); + if ([r, g, b].includes(undefined) || [r, g, b, t].includes(NaN)) console.log([r, g, b, t], parseColor(color), color); + return `#${[ + (1 - t) * r + t * r2, + (1 - t) * g + t * g2, + (1 - t) * b + t * b2 + ].map(a => Math.floor(a).toString(16).padStart(2, "0")).join("")}`; +} + +const cache = new Map(); + +function mixColors(color, color2) { + if (cache.has(`${color}_${color2}`) || cache.has(`${color2}_${color}`)) return cache.get(`${color}_${color2}`) ?? cache.get(`${color2}_${color}`); + const [r, g, b] = parseColor(color).replace("#", "").match(/../g).map(a => parseInt(a, 16)); + const [r2, g2, b2] = parseColor(color2).replace("#", "").match(/../g).map(a => parseInt(a, 16)); + const res = [ + Math.max(r, r2), + Math.max(g, g2), + Math.max(b, b2) + ]; + cache.set(`${color}_${color2}`, `#${res.map(a => (Math.floor(a) % 256).toString(16).padStart(2, "0")).join("")}`); + return `#${res.map(a => (Math.floor(a) % 256).toString(16).padStart(2, "0")).join("")}`; +} + +const parseColor = (colorString) => { + if (colorString instanceof Array) return parseColor(colorString[0]); + if (typeof colorString != "string") return "#ffffff"; + if (colorString.startsWith("rgb(")) { + const color = colorString.replace("rgb(", "").replace(")", ""); + return `#${color.split(",").map(a => parseInt(a).toString(16).length == 1 ? `0${parseInt(a).toString(16)}` : parseInt(a).toString(16)).join("")}`; + } else if (colorString.startsWith("rgba(")) { + const color = colorString.replace("rgba(", "").replace(")", ""); + return `#${color.split(",").filter((_, i) => i <= 2).map(a => parseInt(a).toString(16).length == 1 ? `0${parseInt(a).toString(16)}` : parseInt(a).toString(16)).join("")}`; + } else { + if (colorString.startsWith("#")) { + const color = colorString.slice(1); + if (color.length == 3) return `#${color.split(a => a.repeat(2)).join()}`; + else if (color.length >= 6) return `#${color.slice(0, 6)}`; + else return `#${color}`; + } + } +} + +const rgbToHsl = (r, g, b) => { + const r1 = r / 255; + const g1 = g / 255; + const b1 = b / 255; + + const cmax = Math.max(r1, g1, b1); + const cmin = Math.min(r1, g1, b1); + + const delta = cmax - cmin; + const l = (cmax + cmin) / 2; + const s = delta == 0 ? 0 : delta / (1 - Math.abs(2 * l - 1)); + let h = 0; + if (delta != 0) { + switch (cmax) { + case r1: + h = 60 * (((g1 - b1) / delta) % 6); + break; + case g1: + h = 60 * ((b1 - r1) / delta + 2); + break; + default: + h = 60 * ((r1 - g1) / delta + 4); + } + } + + return {h, s, l}; +} + +const thetaSetting = new Setting("3D View Angle (0-90)", "theta", settingType.NUMBER, false, parseFloat((Math.atan(2) * 180 / Math.PI).toPrecision(3))); + +const tab = new SettingsTab("moreViews.js"); +tab.registerSetting(thetaSetting); + +let maxDistance = -1; +const colorCache = new Map(); + +function getModeColor(color, distance = 0) { + if (!colorCache.has(view)) colorCache.set(view, new Map()); + if (view == 18) { + if (colorCache.get(view).has(color) && colorCache.get(view).get(color).has(distance)) return colorCache.get(view).get(color).get(distance); + } else if (colorCache.get(view).has(color)) return colorCache.get(view).get(color); + switch (view) { + case 6: { + const newColor = "#" + (parseInt(`0x1${parseColor(color).slice(1)}`) ^ 0xffffff).toString(16).slice(1); + colorCache.get(view).set(color, newColor); + return newColor; + } + case 7: { + const newColor = blending(pixel.color, "#000000"); + colorCache.get(view).set(color, newColor); + return newColor; + } + case 8: { + const newColor = blending(pixel.color, "#ffffff"); + colorCache.get(view).set(color, newColor); + return newColor; + } + case 9: { + const [r, g, b] = parseColor(color).slice(1).match(/.{1,2}/g).map(a => parseInt(a, 16)).slice(0, 3); + const {h, l} = rgbToHsl(r, g, b); + const newColor = `hsl(${Math.round(h)}, 0%, ${Math.round(l * 100)}%)`; + colorCache.get(view).set(color, newColor); + return newColor; + } + case 10: { + const [r, g, b] = parseColor(color).replace("#", "").match(/../g).map(a => parseInt(a, 16)); + const [r2, g2, b2] = [ + Math.min(255, (r * 0.393) + (g * 0.769) + (b * 0.189)), + Math.min(255, (r * 0.349) + (g * 0.686) + (b * 0.168)), + Math.min(255, (r * 0.272) + (g * 0.534) + (b * 0.131)) + ]; + const newColor = `#${Math.floor(r2).toString(16).padStart(2, "0")}${Math.floor(g2).toString(16).padStart(2, "0")}${Math.floor(b2).toString(16).padStart(2, "0")}`; + colorCache.get(view).set(color, newColor); + return newColor; + } + case 11: { + const [r, g, b] = parseColor(color).slice(1).match(/.{1,2}/g).map(a => parseInt(a, 16)).slice(0, 3); + const {h, s, l} = rgbToHsl(r, g, b); + const newColor = `hsl(${(Math.round(h) + 180 % 360)}, ${Math.round(s * 100)}%, ${Math.round(l * 100)}%)`; + colorCache.get(view).set(color, newColor); + return newColor; + } + case 12: { + const [r, g, b] = parseColor(color).slice(1).match(/.{1,2}/g).map(a => parseInt(a, 16)).slice(0, 3); + const {h, s, l} = rgbToHsl(r, g, b); + const newColor = `hsl(${Math.round(h)}, ${Math.round(s * 100) * 4}%, ${Math.round(l * 100)}%)`; + colorCache.get(view).set(color, newColor); + return newColor; + } + case 15: { + const [r, g, b] = parseColor(color).replace("#", "").match(/../g); + const [r2, g2, b2] = [parseInt(r, 16) * 0.75, parseInt(g, 16) * 0.75, parseInt(b, 16) * 0.75]; + const newColor = `rgb(${r2}, ${g2}, ${b2})`; + colorCache.get(view).set(color, newColor); + return newColor; + } + case 18: { + const newColor = blending(pixel.color, "#000000", (1 / maxDistance) * distance); + colorCache.get(view).has(color) + ? colorCache.get(view).get(color).set(distance, newColor) + : colorCache.get(view).set(color, new Map([[distance, newColor]])); + return newColor; + } + } + return color; +} + +settingsManager.registerTab(tab); + +runAfterLoadList.push(() => drawPixels = (function() { + const oldDrawPixels = drawPixels; + + return function(forceTick = false) { + if (view >= 5) { + if (maxDistance = -1) maxDistance = Math.sqrt((width / 2) ** 2 + (height / 2) ** 2) * 2; + + const canvas = document.getElementById("game"); + const ctx = canvas.getContext("2d"); + var newCurrentPixels = currentPixels.slice(); + var pixelsFirst = []; + var pixelsLast = []; + if (!paused || forceTick) { + shuffleArray(newCurrentPixels); + } + + for (var i = 0; i < newCurrentPixels.length; i++) { + pixel = newCurrentPixels[i]; + if (pixel.del) {continue} + if (!paused || forceTick) { + if (elements[pixel.element].tick) { + elements[pixel.element].tick(pixel); + } + if (pixel.del) {continue} + if (elements[pixel.element].behavior) { + pixelTick(pixel); + } + }; + if (pixel.con) { pixel = pixel.con } + if (elements[pixel.element].isGas || elements[pixel.element].glow) { + pixelsLast.push(pixel); + } + else { + pixelsFirst.push(pixel); + } + } + + if (hiding) { + if (ctx.globalAlpha < 1) { + ctx.globalAlpha = 1; + } + + if (elements[currentElement].maxSize < mouseSize) { + var mouseOffset = Math.trunc(elements[currentElement].maxSize/2); + } + else { + var mouseOffset = Math.trunc(mouseSize/2); + } + var topLeft = [mousePos.x-mouseOffset,mousePos.y-mouseOffset]; + var bottomRight = [mousePos.x+mouseOffset,mousePos.y+mouseOffset]; + + ctx.strokeStyle = "white"; + ctx.strokeRect(topLeft[0]*pixelSize,topLeft[1]*pixelSize,(bottomRight[0]-topLeft[0]+1)*pixelSize,(bottomRight[1]-topLeft[1]+1)*pixelSize); + + if (settings.precision) { + ctx.fillStyle = "rgba(255,255,255,0.5)"; + ctx.fillRect(mousePos.x*pixelSize,mousePos.y*pixelSize,pixelSize,pixelSize); + } + if ((!paused) || forceTick) {pixelTicks++}; + return; + } + + if (!settings["bg"]) {ctx.clearRect(0, 0, canvas.width, canvas.height)} + else { + ctx.fillStyle = settings["bg"]; + ctx.fillRect(0, 0, canvas.width, canvas.height); + } + var pixelDrawList = pixelsFirst.concat(pixelsLast); + for (var i = 0; i < pixelDrawList.length; i++) { + pixel = pixelDrawList[i]; + if (pixelMap[pixel.x][pixel.y] == undefined) {continue} + if (pixel.con) { pixel = pixel.con }; + ctx.fillStyle = getModeColor(pixel.color, view == 18 ? Math.sqrt((width / 2 - pixel.x) ** 2 + (height / 2 - pixel.y) ** 2) : 0); + // 3D VIEW + if (view == 5) { + const neighborRight = !outOfBounds(pixel.x + 1, pixel.y) && !!pixelMap[pixel.x + 1][pixel.y]; + const neighborUp = !outOfBounds(pixel.x, pixel.y - 1) && !!pixelMap[pixel.x][pixel.y - 1]; + const neighborUpRight = !outOfBounds(pixel.x + 1, pixel.y - 1) && !!pixelMap[pixel.x + 1][pixel.y - 1]; + let size = 0; + let currentY = pixel.y; + while (!outOfBounds(pixel.x, currentY) && pixelMap[pixel.x][currentY] && pixelMap[pixel.x][currentY].element == pixel.element) { + currentY++; + size++; + } + ctx.globalAlpha = 1; + ctx.fillStyle = pixel.color; + ctx.fillRect(pixel.x * pixelSize, pixel.y * pixelSize, pixelSize, pixelSize); + const px = pixel.x * pixelSize; + const py = pixel.y * pixelSize; + const theta = Math.max(Math.min(thetaSetting.get(), 90), 0) * Math.PI / 180; + const a = Math.cos(theta); + const b = Math.sin(theta); + const w = pixelSize; + const px2 = px + a * w; + const py2 = py - b * w; + const parts = [[[px, py], [[px2, py2], [px + w, py2], [px + w, py]], !neighborUp], [[px + w, py + w], [[px2 + w, py2 + w], [px2 + w, py], [px + w, py]], !neighborRight], [[px + w, py], [[px + w, py2], [px2 + w, py2], [px + w, py]], !neighborUp && !neighborUpRight], [[px + w, py], [[px2 + w, py2], [px2 + w, py], [px + w, py]], !neighborRight && !neighborUpRight]] + for (const part of parts.filter(p => p[2])) { + ctx.fillStyle = blending(pixel.color, "#000000"); + ctx.beginPath(); + ctx.moveTo(...part[0]); + for (const v of part[1]) { + ctx.lineTo(...v); + } + ctx.closePath(); + ctx.fill(); + } + } else if (view == 13) { + const hue = 225 - (Math.log(pixel.start) / Math.log(pixelTicks)) * 225; + ctx.globalAlpha = 1; + ctx.fillStyle = `hsl(${Math.min(Math.round(hue), 250)}, 100%, 50%)`; + ctx.fillRect(pixel.x * pixelSize, pixel.y * pixelSize, pixelSize, pixelSize); + } else if (view == 14) { + ctx.globalAlpha = 1; + ctx.fillStyle = pixel.color; + ctx.fillRect(pixel.x * pixelSize, pixel.y * pixelSize, pixelSize, pixelSize); + + if (outOfBounds(pixel.x - 1, pixel.y) || !pixelMap[pixel.x - 1][pixel.y]) { + ctx.fillStyle = "#ff0000"; + ctx.globalAlpha = 0.5; + ctx.fillRect(pixel.x * pixelSize - 0.5 * pixelSize, pixel.y * pixelSize, pixelSize, pixelSize); + } + if (outOfBounds(pixel.x + 1, pixel.y) || !pixelMap[pixel.x + 1][pixel.y]) { + ctx.fillStyle = "#00ffff"; + ctx.globalAlpha = 0.5; + ctx.fillRect(pixel.x * pixelSize + 0.5 * pixelSize, pixel.y * pixelSize, pixelSize, pixelSize); + } + } else if (view == 15) { + const [r, g, b] = parseColor(pixel.color).replace("#", "").match(/../g); + const [r2, g2, b2] = [parseInt(r, 16) * 0.75, parseInt(g, 16) * 0.75, parseInt(b, 16) * 0.75] + // scrolling effect + const offset = (pixelTicks + 6) % height >= pixel.y && (pixelTicks - 3) % height <= pixel.y + || (pixelTicks + 66) % height >= pixel.y && (pixelTicks - 57) % height <= pixel.y; + if (!pixelMap[pixel.x - 1] || !pixelMap[pixel.x - 1][pixel.y]) { + ctx.globalAlpha = 0.5; + ctx.fillStyle = `#${r.padStart(2, "0")}0000`; + ctx.fillRect(pixel.x * pixelSize - 0.75 * pixelSize - (offset ? 0.5 * pixelSize : 0) , pixel.y * pixelSize, pixelSize, pixelSize); + } + if (!pixelMap[pixel.x + 1] || !pixelMap[pixel.x + 1][pixel.y]) { + ctx.globalAlpha = 0.5; + ctx.fillStyle = `#0000${b.padStart(2, "0")}`; + ctx.fillRect(pixel.x * pixelSize + 0.75 * pixelSize - (offset ? 0.5 * pixelSize : 0), pixel.y * pixelSize, pixelSize, pixelSize); + } + ctx.globalAlpha = 1; + ctx.fillStyle = `rgb(${r2}, ${g2}, ${b2})` + ctx.fillRect(pixel.x * pixelSize - (offset ? 0.5 * pixelSize : 0), pixel.y * pixelSize, pixelSize, pixelSize); + ctx.globalAlpha = 1; + // i fucking hate it but at least it works + // and i dont feel like finding something that is fast and pretty + } else if (view == 16) { + ctx.globalAlpha = 1; + ctx.strokeStyle = pixel.color; + ctx.lineWidth = 2; + const cond1 = outOfBounds(pixel.x - 1, pixel.y) + || !pixelMap[pixel.x - 1][pixel.y] + || pixelMap[pixel.x - 1][pixel.y].element != pixel.element; + const cond2 = outOfBounds(pixel.x + 1, pixel.y) + || !pixelMap[pixel.x + 1][pixel.y] + || pixelMap[pixel.x + 1][pixel.y].element != pixel.element; + const cond3 = outOfBounds(pixel.x, pixel.y - 1) + || !pixelMap[pixel.x][pixel.y - 1] + || pixelMap[pixel.x][pixel.y - 1].element != pixel.element; + const cond4 = outOfBounds(pixel.x, pixel.y + 1) + || !pixelMap[pixel.x][pixel.y + 1] + || pixelMap[pixel.x][pixel.y + 1].element != pixel.element; + const cond5 = outOfBounds(pixel.x - 1, pixel.y - 1) + || !pixelMap[pixel.x - 1][pixel.y - 1] + || pixelMap[pixel.x - 1][pixel.y - 1].element != pixel.element; + const cond6 = outOfBounds(pixel.x + 1, pixel.y - 1) + || !pixelMap[pixel.x + 1][pixel.y - 1] + || pixelMap[pixel.x + 1][pixel.y - 1].element != pixel.element; + const cond7 = outOfBounds(pixel.x - 1, pixel.y + 1) + || !pixelMap[pixel.x - 1][pixel.y + 1] + || pixelMap[pixel.x - 1][pixel.y + 1].element != pixel.element; + const cond8 = outOfBounds(pixel.x + 1, pixel.y + 1) + || !pixelMap[pixel.x + 1][pixel.y + 1] + || pixelMap[pixel.x + 1][pixel.y + 1].element != pixel.element; + + if (cond1) { + ctx.beginPath(); + ctx.moveTo(pixel.x * pixelSize + ctx.lineWidth / 2, pixel.y * pixelSize); + ctx.lineTo(pixel.x * pixelSize + ctx.lineWidth / 2, (pixel.y + 1) * pixelSize); + ctx.stroke(); + } + if (cond2) { + ctx.beginPath(); + ctx.moveTo((pixel.x + 1) * pixelSize - ctx.lineWidth / 2, pixel.y * pixelSize); + ctx.lineTo((pixel.x + 1) * pixelSize - ctx.lineWidth / 2, (pixel.y + 1) * pixelSize); + ctx.stroke(); + } + if (cond3) { + ctx.beginPath(); + ctx.moveTo(pixel.x * pixelSize, pixel.y * pixelSize + ctx.lineWidth / 2); + ctx.lineTo((pixel.x + 1) * pixelSize, pixel.y * pixelSize + ctx.lineWidth / 2); + ctx.stroke(); + } + if (cond4) { + ctx.beginPath(); + ctx.moveTo(pixel.x * pixelSize, (pixel.y + 1) * pixelSize - ctx.lineWidth / 2); + ctx.lineTo((pixel.x + 1) * pixelSize, (pixel.y + 1) * pixelSize - ctx.lineWidth / 2); + ctx.stroke(); + } + if (!cond2 && !cond4 && cond8) ctx.fillRect((pixel.x + 1) * pixelSize - ctx.lineWidth, (pixel.y + 1) * pixelSize - ctx.lineWidth, ctx.lineWidth, ctx.lineWidth); + if (!cond2 && !cond3 && cond6) ctx.fillRect((pixel.x + 1) * pixelSize - ctx.lineWidth, pixel.y * pixelSize, ctx.lineWidth, ctx.lineWidth); + if (!cond1 && !cond3 && cond5) ctx.fillRect(pixel.x * pixelSize, pixel.y * pixelSize, ctx.lineWidth, ctx.lineWidth); + if (!cond1 && !cond4 && cond7) ctx.fillRect(pixel.x * pixelSize, (pixel.y + 1) * pixelSize - ctx.lineWidth, ctx.lineWidth, ctx.lineWidth); + } else if (view == 17) { + ctx.fillRect(pixel.x * pixelSize, (height - pixel.y) * pixelSize, pixelSize, pixelSize); + } else { + ctx.fillRect(pixel.x*pixelSize, pixel.y*pixelSize, pixelSize, pixelSize); + } + if (pixel.charge && view !== 2) { // Yellow glow on charge + if (!elements[pixel.element].colorOn) { + ctx.fillStyle = "rgba(255,255,0,0.5)"; + ctx.fillRect(pixel.x*pixelSize, pixel.y*pixelSize, pixelSize, pixelSize); + } + } + } + if (view == 15) { + // TRACK READ NOISE + for (let n = 0; n < 3; n++) { + const number = Math.floor(Math.random() * height); + ctx.globalAlpha = Math.random(); + ctx.fillStyle = "#fff"; + ctx.fillRect(0, (number + 0.5) * pixelSize, width * pixelSize, 0.2); + ctx.globalAlpha = 1; + } + const {font, textAlign} = ctx; + ctx.font = "30px VCR"; + ctx.textAlign = "start"; + ctx.fillText(paused ? "PAUSE" : "PLAY", (0.025 * width) * pixelSize, (0.025 * width) * pixelSize + 15); + if (paused) { + ctx.fillRect((0.05 * width) * pixelSize + ctx.measureText("PAUSE").width, (0.025 * width) * pixelSize - 7.5, 5, 22.5); + ctx.fillRect((0.05 * width) * pixelSize + ctx.measureText("PAUSE").width + 8, (0.025 * width) * pixelSize - 7.5, 5, 22.5); + } else { + ctx.fillStyle = "#fff"; + ctx.beginPath(); + ctx.moveTo((0.05 * width) * pixelSize + ctx.measureText("PLAY").width, (0.025 * width) * pixelSize - 7.5); + ctx.lineTo((0.05 * width) * pixelSize + ctx.measureText("PLAY").width, (0.025 * width) * pixelSize + 15); + ctx.lineTo((0.05 * width) * pixelSize + ctx.measureText("PLAY").width + 17.5, (0.025 * width) * pixelSize + 3.75); + ctx.lineTo((0.05 * width) * pixelSize + ctx.measureText("PLAY").width, (0.025 * width) * pixelSize - 7.5); + ctx.fill(); + } + const base = Math.floor(pixelTicks / tps); + const seconds = base % 60 + ""; + const minutes = Math.floor(base / 60) % 60 + ""; + const hours = Math.floor(base / 60 / 60) + ""; + ctx.textAlign = "end"; + ctx.fillText(`${hours.padStart(2, "0")}:${minutes.padStart(2, "0")}:${seconds.padStart(2, "0")}`, (0.975 * width) * pixelSize, (0.025 * width) * pixelSize + 15); + ctx.font = font; + ctx.textAlign = textAlign; + } + if (ctx.globalAlpha < 1) { + ctx.globalAlpha = 1; + } + + if (elements[currentElement].maxSize < mouseSize) { + var mouseOffset = Math.trunc(elements[currentElement].maxSize/2); + } + else { + var mouseOffset = Math.trunc(mouseSize/2); + } + var topLeft = [mousePos.x-mouseOffset,mousePos.y-mouseOffset]; + var bottomRight = [mousePos.x+mouseOffset,mousePos.y+mouseOffset]; + // Draw a square around the mouse + ctx.strokeStyle = "white"; + ctx.strokeRect(topLeft[0]*pixelSize,topLeft[1]*pixelSize,(bottomRight[0]-topLeft[0]+1)*pixelSize,(bottomRight[1]-topLeft[1]+1)*pixelSize); + // draw one transparent pixel in the center + if (settings.precision) { + ctx.fillStyle = "rgba(255,255,255,0.5)"; + ctx.fillRect(mousePos.x*pixelSize,mousePos.y*pixelSize,pixelSize,pixelSize); + } + if ((!paused) || forceTick) {pixelTicks++}; + } else oldDrawPixels.apply(this, arguments); + } +}())); +} \ No newline at end of file From ffd61ea2d36cc56de87b0f5f28d46d4c8ef54532 Mon Sep 17 00:00:00 2001 From: Alexthetransfem <124483815+theenchantedsword@users.noreply.github.com> Date: Thu, 15 Feb 2024 16:02:12 -0600 Subject: [PATCH 35/47] Create plants.js --- mods/plants.js | 1190 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1190 insertions(+) create mode 100644 mods/plants.js diff --git a/mods/plants.js b/mods/plants.js new file mode 100644 index 00000000..dd304907 --- /dev/null +++ b/mods/plants.js @@ -0,0 +1,1190 @@ +//This mod was made by Adora the transfem, https://discord.com/users/778753696804765696 on discord and https://www.tiktok.com/@alextheagenenby?_t=8hoCVI3NRhu&_r=1 on tiktok. +let fruits = ["plum", "peach", "pear", "orange", "apple", "cherry", "mango"]; +let vineExclude = ["tomato", "grape", "fruit_vine", "kiwi"]; +let vines = ['tomato', 'grape', 'kiwi']; +let bushes = ["blackberry", "blueberry", "raspberry"]; +let allFruits = fruits.concat(vines, bushes) +function interpolateRgb(rgb1, rgb2, ratio) { + const interpolatedRgb = { + r: Math.round(rgb1.r + (rgb2.r - rgb1.r) * ratio), + g: Math.round(rgb1.g + (rgb2.g - rgb1.g) * ratio), + b: Math.round(rgb1.b + (rgb2.b - rgb1.b) * ratio), + }; + return interpolatedRgb; +} + +elements.fruit_branch = { + color: elements.tree_branch.color, + behavior: [ + "CR:fruit_leaves,fruit_branch%2|CR:fruit_leaves,fruit_leaves,fruit_leaves,fruit_branch%2|CR:fruit_leaves,fruit_branch%2", + "XX|XX|XX", + "XX|XX|XX", + ], + tempHigh: 100, + stateHigh: "wood", + tempLow: -30, + stateLow: "wood", + category: "life", + burn: 40, + burnTime: 50, + burnInto: ["sap","ember","charcoal"], + hidden: true, + state: "solid", + density: 1500, + hardness: 0.15, + breakInto: ["sap","sawdust"], + seed: "apple_seed", + tick: function(pixel){ + for(var i = 0; i < adjacentCoords.length; i++){ + let x = pixel.x+adjacentCoords[i][0]; + let y = pixel.y+adjacentCoords[i][1]; + if(isEmpty(x, y) || outOfBounds(x, y)) { continue; } + let pixel2 = pixelMap[x][y]; + if(pixel2.element == "fruit_branch" || pixel2.element == "fruit_leaves" || pixel2.element == "wood"){ + if(pixel.fruit && !pixel2.fruit){ + pixel2.fruit = pixel.fruit; + } else if (!pixel.fruit && pixel2.fruit){ + pixel.fruit = pixel2.fruit; + } + } + } + } +} +elements.fruit_leaves = { + color: elements.plant.color, + behavior: [ + "XX|XX|XX", + "XX|XX|XX", + "XX|XX|XX", + ], + reactions: { + "vinegar": { elem1:"dead_plant", elem2:null, chance:0.035 }, + "baking_soda": { elem1:"dead_plant", elem2:null, chance:0.01 }, + "bleach": { elem1:"dead_plant", elem2:null, chance:0.05 }, + "alcohol": { elem1:"dead_plant", elem2:null, chance:0.035 } + }, + category:"life", + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -1.66, + stateLow: "frozen_plant", + burn:65, + burnTime:60, + burnInto: "dead_plant", + breakInto: "dead_plant", + state: "solid", + density: 1050, + hidden: true, + tick: function(pixel){ + if(pixelTicks == pixel.start + 1 && pixel.blooming == undefined){ + if(Math.floor(Math.random() * 3) == 2){ + pixel.blooming = true; + pixel.color = "#FFE2E2"; + } else { + pixel.blooming = false; + } + } + for(var i = 0; i < adjacentCoords.length; i++){ + let x = pixel.x+adjacentCoords[i][0]; + let y = pixel.y+adjacentCoords[i][1]; + if(isEmpty(x, y) || outOfBounds(x, y)) { continue; } + let pixel2 = pixelMap[x][y]; + if(pixel2.element == "fruit_branch" || pixel2.element == "fruit_leaves" || pixel2.element == "wood" || (elements[pixel2.element].properties && elements[pixel2.element].properties.type == "fruit")){ + if(pixel.fruit && !pixel2.fruit){ + pixel2.fruit = pixel.fruit; + } else if (!pixel.fruit && pixel2.fruit){ + pixel.fruit = pixel2.fruit; + } + } + } + if(pixel.blooming){ + if(pixelTicks > pixel.start + 150){ + if(Math.floor(Math.random() * 400) == 3){ + if(pixel.fruit){ + if(pixel.fruit == "random"){ + changePixel(pixel, fruits[Math.floor(Math.random() * fruits.length)]); + } else { + changePixel(pixel, pixel.fruit); + } + } + } + } + } + } +} + +elements.apple_seed = { + color: "#1A0E00", + tick: function(pixel) { + if (isEmpty(pixel.x,pixel.y+1)) { + movePixel(pixel,pixel.x,pixel.y+1); + } + else { + if (Math.random() < 0.02 && pixel.age > 50 && pixel.temp < 100) { + if (!outOfBounds(pixel.x,pixel.y+1)) { + var dirtPixel = pixelMap[pixel.x][pixel.y+1]; + if (dirtPixel.element === "dirt" || dirtPixel.element === "mud" || dirtPixel.element === "sand" || dirtPixel.element === "wet_sand" || dirtPixel.element === "clay_soil" || dirtPixel.element === "mycelium") { + changePixel(dirtPixel,"root"); + } + } + if (isEmpty(pixel.x,pixel.y-1)) { + movePixel(pixel,pixel.x,pixel.y-1); + createPixel(Math.random() > 0.5 ? "wood" : "fruit_branch",pixel.x,pixel.y+1); + if (pixelMap[pixel.x][pixel.y+1].element == "fruit_branch" || pixelMap[pixel.x][pixel.y+1].element == "fruit_leaves" || pixelMap[pixel.x][pixel.y+1].element == "wood"){ + pixelMap[pixel.x][pixel.y+1].fruit = "apple"; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + fruit:"apple" + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +elements.apple = { + behavior: [["XX", "ST:fruit_leaves AND ST:fruit_branch", "XX"],["ST:fruit_leaves AND ST:fruit_branch", "XX", "ST:fruit_leaves AND ST:fruit_branch"],["M2", "ST:fruit_leaves AND ST:fruit_branch AND M1", "M2"]], + color: "#ff0004", + category: "food", + breakInto: "juice", + breakIntoColor: "#FF4747", + isFood: true, + properties: { + fruit: "apple", + type: "fruit", + } +} +elements.pear_seed = { + color: "#1A0E00", + tick: function(pixel) { + if (isEmpty(pixel.x,pixel.y+1)) { + movePixel(pixel,pixel.x,pixel.y+1); + } + else { + if (Math.random() < 0.02 && pixel.age > 50 && pixel.temp < 100) { + if (!outOfBounds(pixel.x,pixel.y+1)) { + var dirtPixel = pixelMap[pixel.x][pixel.y+1]; + if (dirtPixel.element === "dirt" || dirtPixel.element === "mud" || dirtPixel.element === "sand" || dirtPixel.element === "wet_sand" || dirtPixel.element === "clay_soil" || dirtPixel.element === "mycelium") { + changePixel(dirtPixel,"root"); + } + } + if (isEmpty(pixel.x,pixel.y-1)) { + movePixel(pixel,pixel.x,pixel.y-1); + createPixel(Math.random() > 0.5 ? "wood" : "fruit_branch",pixel.x,pixel.y+1); + if (pixelMap[pixel.x][pixel.y+1].element == "fruit_branch" || pixelMap[pixel.x][pixel.y+1].element == "fruit_leaves"){ + pixelMap[pixel.x][pixel.y+1].fruit = "pear"; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + fruit:"pear" + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +elements.pear = { + behavior: [["XX", "ST:fruit_leaves AND ST:fruit_branch", "XX"],["ST:fruit_leaves AND ST:fruit_branch", "XX", "ST:fruit_leaves AND ST:fruit_branch"],["M2", "ST:fruit_leaves AND ST:fruit_branch AND M1", "M2"]], + color: "#97FF43", + category: "food", + breakInto: "juice", + breakIntoColor: "#ABFF8D", + isFood: true, + properties: { + fruit: "pear", + type: "fruit", + } +} +elements.cherry_seed = { + color: "#b56233", + tick: function(pixel) { + if (isEmpty(pixel.x,pixel.y+1)) { + movePixel(pixel,pixel.x,pixel.y+1); + } + else { + if (Math.random() < 0.02 && pixel.age > 50 && pixel.temp < 100) { + if (!outOfBounds(pixel.x,pixel.y+1)) { + var dirtPixel = pixelMap[pixel.x][pixel.y+1]; + if (dirtPixel.element === "dirt" || dirtPixel.element === "mud" || dirtPixel.element === "sand" || dirtPixel.element === "wet_sand" || dirtPixel.element === "clay_soil" || dirtPixel.element === "mycelium") { + changePixel(dirtPixel,"root"); + } + } + if (isEmpty(pixel.x,pixel.y-1)) { + movePixel(pixel,pixel.x,pixel.y-1); + createPixel(Math.random() > 0.5 ? "wood" : "fruit_branch",pixel.x,pixel.y+1); + if (pixelMap[pixel.x][pixel.y+1].element == "fruit_branch" || pixelMap[pixel.x][pixel.y+1].element == "fruit_leaves"){ + pixelMap[pixel.x][pixel.y+1].fruit = "cherry"; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + fruit:"cherry" + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +elements.cherry = { + behavior: [["XX", "ST:fruit_leaves AND ST:fruit_branch", "XX"],["ST:fruit_leaves AND ST:fruit_branch", "XX", "ST:fruit_leaves AND ST:fruit_branch"],["M2", "ST:fruit_leaves AND ST:fruit_branch AND M1", "M2"]], + color: "#750000", + category: "food", + breakInto: "juice", + breakIntoColor: "#8a0000", + isFood: true, + properties: { + fruit: "cherry", + type: "fruit", + } +} +elements.milk = { + color: "#fafafa", + behavior: behaviors.LIQUID, + onMix: function(milk1, milk2) { + if (shiftDown && Math.random() < 0.01) { + changePixel(milk1,"butter") + } + }, + reactions: { + "melted_chocolate": { elem1:"chocolate_milk", elem2:null }, + "chocolate": { elem1:"chocolate_milk", elem2:"melted_chocolate", chance:0.05 }, + "coffee_ground": { elem1:"chocolate_milk", chance:0.05 }, + "juice": { elem1:"fruit_milk", elem2:null, chance:0.05, func: function(pixel1, pixel2){ + let newrgb = interpolateRgb(getRGB('rgb(250,250,250)'), getRGB(pixel2.color), 0.25); + pixel1.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`; + }}, + "soda": { elem1:"pilk", elem2:null, chance:0.1 }, + "yolk": { elem1:"eggnog", elem2:null, chance:0.1 }, + "dirt": { elem1: null, elem2: "mud" }, + "sand": { elem1: null, elem2: "wet_sand" }, + "clay_soil": { elem1: null, elem2: "clay" }, + "caramel": { color1:"#C8B39A", elem2:null, chance:0.05 }, + "sugar": { elem2:null, chance:0.005}, + }, + tempLow: 0, + stateLow: "ice_cream", + stateLowColorMultiplier: [0.97,0.93,0.87], + tempHigh: 93, + stateHigh: "yogurt", + viscosity: 1.5, + category: "liquids", + state: "liquid", + density: 1036.86, + isFood: true +} +elements.cream = { + color: "#f7f7f7", + behavior: behaviors.LIQUID, + onMix: function(milk1, milk2) { + if ((shiftDown && Math.random() < 0.01) || (elements[milk2.element].id === elements.milk.id && Math.random() < 0.00025)) { + changePixel(milk1,"butter") + } + }, + reactions: { + "dirt": { elem1: null, elem2: "mud" }, + "sand": { elem1: null, elem2: "wet_sand" }, + "clay_soil": { elem1: null, elem2: "clay" }, + "melted_chocolate": { color1:"#664934", elem2:null }, + "chocolate": { color1:"#664934", elem2:"melted_chocolate", chance:0.05 }, + "juice": { elem1:"fruit_milk", elem2:null, chance:0.05, func: function(pixel1, pixel2){ + let newrgb = interpolateRgb(getRGB('rgb(250,250,250)'), getRGB(pixel2.color), 0.25); + pixel1.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`; + }}, + "soda": { elem1:"pilk", elem2:null, chance:0.1 }, + "yolk": { elem1:"#eggnog", elem2:null, chance:0.1 }, + "caramel": { color1:"#C8B39A", chance:0.05 }, + "sugar": { elem2:null, chance:0.005}, + }, + viscosity: 1.5, + tempHigh: 1000, + stateHigh: ["smoke","smoke","smoke","steam","steam","calcium"], + tempLow: 0, + stateLow: "ice_cream", + stateLowColorMultiplier: 0.97, + category: "liquids", + hidden: true, + isFood: true, + state: "liquid", + density: 959.97, +} +function getRGB(rgb){ + let rgb2 = rgb.replace(")", "").replace("rgb(", "").replace(/,/g, "r").split("r") + return { r: parseInt(rgb2[0]), g: parseInt(rgb2[1]), b: parseInt(rgb2[2]) }; +} +elements.peach = { + behavior: [["XX", "ST:fruit_leaves AND ST:fruit_branch", "XX"],["ST:fruit_leaves AND ST:fruit_branch", "XX", "ST:fruit_leaves AND ST:fruit_branch"],["M2", "ST:fruit_leaves AND ST:fruit_branch AND M1", "M2"]], + color: ["#ffb485", "#ffa770", "#ff7b61", "#ff512e", "#ff350d"], + category: "food", + breakInto: "juice", + breakIntoColor: "#ffa74f", + isFood: true, + properties: { + fruit: "peach", + type: "fruit", + } +} +elements.peach_seed = { + color: "#240c00", + tick: function(pixel) { + if (isEmpty(pixel.x,pixel.y+1)) { + movePixel(pixel,pixel.x,pixel.y+1); + } + else { + if (Math.random() < 0.02 && pixel.age > 50 && pixel.temp < 100) { + if (!outOfBounds(pixel.x,pixel.y+1)) { + var dirtPixel = pixelMap[pixel.x][pixel.y+1]; + if (dirtPixel.element === "dirt" || dirtPixel.element === "mud" || dirtPixel.element === "sand" || dirtPixel.element === "wet_sand" || dirtPixel.element === "clay_soil" || dirtPixel.element === "mycelium") { + changePixel(dirtPixel,"root"); + } + } + if (isEmpty(pixel.x,pixel.y-1)) { + movePixel(pixel,pixel.x,pixel.y-1); + createPixel(Math.random() > 0.5 ? "wood" : "fruit_branch",pixel.x,pixel.y+1); + if (pixelMap[pixel.x][pixel.y+1].element == "fruit_branch" || pixelMap[pixel.x][pixel.y+1].element == "fruit_leaves"){ + pixelMap[pixel.x][pixel.y+1].fruit = "peach"; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + fruit:"peach" + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +elements.plum = { + behavior: [["XX", "ST:fruit_leaves AND ST:fruit_branch", "XX"],["ST:fruit_leaves AND ST:fruit_branch", "XX", "ST:fruit_leaves AND ST:fruit_branch"],["M2", "ST:fruit_leaves AND ST:fruit_branch AND M1", "M2"]], + color: "#1c0030", + category: "food", + breakInto: "juice", + breakIntoColor: "#d2880a", + isFood: true, + properties: { + fruit: "plum", + type: "fruit", + } +} +elements.plum_seed = { + color: "#240c00", + tick: function(pixel) { + if (isEmpty(pixel.x,pixel.y+1)) { + movePixel(pixel,pixel.x,pixel.y+1); + } + else { + if (Math.random() < 0.02 && pixel.age > 50 && pixel.temp < 100) { + if (!outOfBounds(pixel.x,pixel.y+1)) { + var dirtPixel = pixelMap[pixel.x][pixel.y+1]; + if (dirtPixel.element === "dirt" || dirtPixel.element === "mud" || dirtPixel.element === "sand" || dirtPixel.element === "wet_sand" || dirtPixel.element === "clay_soil" || dirtPixel.element === "mycelium") { + changePixel(dirtPixel,"root"); + } + } + if (isEmpty(pixel.x,pixel.y-1)) { + movePixel(pixel,pixel.x,pixel.y-1); + createPixel(Math.random() > 0.5 ? "wood" : "fruit_branch",pixel.x,pixel.y+1); + if (pixelMap[pixel.x][pixel.y+1].element == "fruit_branch" || pixelMap[pixel.x][pixel.y+1].element == "fruit_leaves"){ + pixelMap[pixel.x][pixel.y+1].fruit = "plum"; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + fruit:"plum" + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +elements.juice.reactions.juice = { + func: function(pixel1, pixel2){ + if(pixel1.color != pixel2.color){ + if(Math.floor(Math.random() * 1000) == 1){ + let newrgb = interpolateRgb(getRGB(pixel1.color), getRGB(pixel2.color), 0.5); + pixel1.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`; + pixel2.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`; + } + } + } +} +elements.juice.onMix = function(pixel){ + let num = Math.floor(Math.random() * 4); + let x = pixel.x + adjacentCoords[num][0]; + let y = pixel.y + adjacentCoords[num][1]; + if(!isEmpty(x,y) && !outOfBounds(x,y)){ + let pixel2 = pixelMap[x][y]; + if(pixel.color != pixel2.color && pixel2.element == "juice"){ + let condition; + if(shiftDown == 0){ + condition = (Math.floor(Math.random() * 2) == 1); + } else { + condition = true; + } + if(condition){ + let newrgb = interpolateRgb(getRGB(pixel.color), getRGB(pixel2.color), 0.5); + pixel.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`; + pixel2.color = `rgb(${parseInt(newrgb.r)},${parseInt(newrgb.g)},${parseInt(newrgb.b)})`; + } + } + } + } +elements.vine.behavior = [["XX", "ST:vine", "XX"],["ST:vine", "XX", "ST:vine"],["XX", "ST:vine AND M1", "XX"]] +elements.apricot = { + behavior: [["XX", "ST:fruit_leaves AND ST:fruit_branch", "XX"],["ST:fruit_leaves AND ST:fruit_branch", "XX", "ST:fruit_leaves AND ST:fruit_branch"],["M2", "ST:fruit_leaves AND ST:fruit_branch AND M1", "M2"]], + color: ["#ffa100", "#FF5D00", "#FF7A00", "#FF9700"], + category: "food", + breakInto: "juice", + breakIntoColor: "#ffa836", + isFood: true, + properties: { + fruit: "apricot", + type: "fruit", + } +} +elements.apricot_seed = { + color: "#291300", + tick: function(pixel) { + if (isEmpty(pixel.x,pixel.y+1)) { + movePixel(pixel,pixel.x,pixel.y+1); + } + else { + if (Math.random() < 0.02 && pixel.age > 50 && pixel.temp < 100) { + if (!outOfBounds(pixel.x,pixel.y+1)) { + var dirtPixel = pixelMap[pixel.x][pixel.y+1]; + if (dirtPixel.element === "dirt" || dirtPixel.element === "mud" || dirtPixel.element === "sand" || dirtPixel.element === "wet_sand" || dirtPixel.element === "clay_soil" || dirtPixel.element === "mycelium") { + changePixel(dirtPixel,"root"); + } + } + if (isEmpty(pixel.x,pixel.y-1)) { + movePixel(pixel,pixel.x,pixel.y-1); + createPixel(Math.random() > 0.5 ? "wood" : "fruit_branch",pixel.x,pixel.y+1); + if (pixelMap[pixel.x][pixel.y+1].element == "fruit_branch" || pixelMap[pixel.x][pixel.y+1].element == "fruit_leaves"){ + pixelMap[pixel.x][pixel.y+1].fruit = "apricot"; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + fruit:"apricot" + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +elements.orange = { + behavior: [["XX", "ST:fruit_leaves AND ST:fruit_branch", "XX"],["ST:fruit_leaves AND ST:fruit_branch", "XX", "ST:fruit_leaves AND ST:fruit_branch"],["M2", "ST:fruit_leaves AND ST:fruit_branch AND M1", "M2"]], + color: "#FFB400", + category: "food", + breakInto: "juice", + breakIntoColor: "#FFDB00", + isFood: true, + properties: { + fruit: "orange", + type: "fruit", + } +} +elements.orange_seed = { + color: "#291300", + tick: function(pixel) { + if (isEmpty(pixel.x,pixel.y+1)) { + movePixel(pixel,pixel.x,pixel.y+1); + } + else { + if (Math.random() < 0.02 && pixel.age > 50 && pixel.temp < 100) { + if (!outOfBounds(pixel.x,pixel.y+1)) { + var dirtPixel = pixelMap[pixel.x][pixel.y+1]; + if (dirtPixel.element === "dirt" || dirtPixel.element === "mud" || dirtPixel.element === "sand" || dirtPixel.element === "wet_sand" || dirtPixel.element === "clay_soil" || dirtPixel.element === "mycelium") { + changePixel(dirtPixel,"root"); + } + } + if (isEmpty(pixel.x,pixel.y-1)) { + movePixel(pixel,pixel.x,pixel.y-1); + createPixel(Math.random() > 0.5 ? "wood" : "fruit_branch",pixel.x,pixel.y+1); + if (pixelMap[pixel.x][pixel.y+1].element == "fruit_branch" || pixelMap[pixel.x][pixel.y+1].element == "fruit_leaves"){ + pixelMap[pixel.x][pixel.y+1].fruit = "orange"; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + fruit:"orange" + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +elements.random_seed = { + color: "#291300", + tick: function(pixel) { + if(pixel.start == pixelTicks){ + pixel.fruit = fruits[Math.floor(Math.random() * fruits.length)]; + } + if (isEmpty(pixel.x,pixel.y+1)) { + movePixel(pixel,pixel.x,pixel.y+1); + } + else { + if (Math.random() < 0.02 && pixel.age > 50 && pixel.temp < 100) { + if (!outOfBounds(pixel.x,pixel.y+1)) { + var dirtPixel = pixelMap[pixel.x][pixel.y+1]; + if (dirtPixel.element === "dirt" || dirtPixel.element === "mud" || dirtPixel.element === "sand" || dirtPixel.element === "wet_sand" || dirtPixel.element === "clay_soil" || dirtPixel.element === "mycelium") { + changePixel(dirtPixel,"root"); + } + } + if (isEmpty(pixel.x,pixel.y-1)) { + movePixel(pixel,pixel.x,pixel.y-1); + createPixel(Math.random() > 0.5 ? "wood" : "fruit_branch",pixel.x,pixel.y+1); + if (pixelMap[pixel.x][pixel.y+1].element == "fruit_branch" || pixelMap[pixel.x][pixel.y+1].element == "fruit_leaves"){ + pixelMap[pixel.x][pixel.y+1].fruit = pixel.fruit; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +elements.multi_seed = { + color: "#291300", + tick: function(pixel) { + pixel.fruit = fruits[Math.floor(Math.random() * fruits.length)] + if (isEmpty(pixel.x,pixel.y+1)) { + movePixel(pixel,pixel.x,pixel.y+1); + } + else { + if (Math.random() < 0.02 && pixel.age > 50 && pixel.temp < 100) { + if (!outOfBounds(pixel.x,pixel.y+1)) { + var dirtPixel = pixelMap[pixel.x][pixel.y+1]; + if (dirtPixel.element === "dirt" || dirtPixel.element === "mud" || dirtPixel.element === "sand" || dirtPixel.element === "wet_sand" || dirtPixel.element === "clay_soil" || dirtPixel.element === "mycelium") { + changePixel(dirtPixel,"root"); + } + } + if (isEmpty(pixel.x,pixel.y-1)) { + movePixel(pixel,pixel.x,pixel.y-1); + createPixel(Math.random() > 0.5 ? "wood" : "fruit_branch",pixel.x,pixel.y+1); + if (pixelMap[pixel.x][pixel.y+1].element == "fruit_branch" || pixelMap[pixel.x][pixel.y+1].element == "fruit_leaves"){ + pixelMap[pixel.x][pixel.y+1].fruit = "random"; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +elements.fruit_vine = { + category: "life", + color: elements.plant.color, + behavior: [["XX", "ST:fruit_vine AND ST:wood", "XX"], ["ST:fruit_vine AND ST:wood", "XX", "ST:fruit_vine AND ST:wood"], ["XX", "ST:fruit_vine AND M1 AND ST:wood", "XX"]], + properties: { + age: 0, + }, + tick: function(pixel){ + if(Math.floor(Math.random() * 100) == 1 && pixel.age > 25 && pixel.age < 500){ + for(var i = 0; i < squareCoords.length; i++){ + let x1 = pixel.x + squareCoords[i][0]; + let y1 = pixel.y + squareCoords[i][1]; + if(!isEmpty(x1,y1) && !outOfBounds(x1,y1) && !vineExclude.includes(pixelMap[x1][y1].element)){ + let randomNum = Math.floor(Math.random() * 4); + let x2 = x1 + squareCoords[randomNum][0]; + let y2 = y1 + squareCoords[randomNum][1]; + if(isEmpty(x2,y2) && !outOfBounds(x2,y2)){ + createPixel("fruit_vine", x2, y2); + pixelMap[x2][y2].fruit = pixel.fruit; + } + } + } + } + pixel.age += 1; + if(pixel.fruit){ + for(var i = 0; i < adjacentCoords.length; i++){ + let x = pixel.x + adjacentCoords[i][0]; + let y = pixel.y + adjacentCoords[i][1]; + if(isEmpty(x,y) && !outOfBounds(x,y) && Math.floor(Math.random() * 1000) == 5){ + createPixel(pixel.fruit, x, y); + } + } + } + if(!pixel.fruit){ + for(var i = 0; i < squareCoords.length; i++){ + let x = pixel.x + squareCoords[i][0]; + let y = pixel.y + squareCoords[i][1]; + if(isEmpty(x,y) || outOfBounds(x,y)){ continue; } + let pixel2 = pixelMap[x][y]; + if(pixel2.fruit){ + pixel.fruit = pixel2.fruit; + } else { continue; } + } + } + } +} +elements.grape.behavior = [["XX", "ST:fruit_vine", "XX"], ["ST:fruit_vine", "XX", "ST:fruit_vine"], ["M2", "ST:fruit_vine AND M1", "M2"]]; +elements.tomato.behavior = elements.grape.behavior; +elements.tomato_seed = { + color: "#FFFAAD", + category: "life", + behavior: behaviors.POWDER, + tick: function(pixel){ + if(pixel.age > 40){ + changePixel(pixel, "fruit_vine"); + pixel.fruit = "tomato"; + } + pixel.age += 1; + }, + properties: { + age: 0, + }, +} +elements.grape_seed = { + color: "#231A00", + category: "life", + behavior: behaviors.POWDER, + tick: function(pixel){ + if(pixel.age > 40){ + changePixel(pixel, "fruit_vine"); + pixel.fruit = "grape"; + } + pixel.age += 1; + }, + properties: { + age: 0, + }, +} +elements.kiwi = { + behavior: elements.grape.behavior, + color: "#403000", + category: "food", + breakInto: "juice", + breakIntoColor: "#21A800", + isFood: true, + properties: { + type: "fruit", + } +} +elements.kiwi_seed = { + color: "#231A00", + category: "life", + behavior: behaviors.POWDER, + tick: function(pixel){ + if(pixel.age > 40){ + changePixel(pixel, "fruit_vine"); + pixel.fruit = "kiwi"; + } + pixel.age += 1; + }, + properties: { + age: 0, + }, +} +elements.bush_base = { + color: elements.wood.color, + behavior: [ + ["CR:bush_cane%25", "XX", "CR:bush_cane%25"], + ["XX", "XX", "XX"], + ["XX", "XX", "XX"] + ], + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -40, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + tick: function(pixel){ + let caneCoords = [[-1,-1],[1,-1]]; + for(var i = 0; i < caneCoords.length; i++){ + let x = pixel.x + caneCoords[i][0]; + let y = pixel.y + caneCoords[i][1]; + if(!isEmpty(x,y) && !outOfBounds(x,y)){ + let pixel2 = pixelMap[x][y]; + if(pixel2.element == "bush_cane" && !pixel2.fruit){ + pixel2.fruit = pixel.fruit; + } + } + } + } +}; +elements.bush_cane = { + color: elements.wood.color, + tick: function(pixel){ + if(pixel.age < 200 && Math.floor(Math.random() * 40) == 1){ + if(!outOfBounds(pixel.x,pixel.y-1)){ + if(isEmpty(pixel.x,pixel.y-1)){ + createPixel("bush_cane",pixel.x,pixel.y-1); + if(pixel.fruit){ + let pixel2 = pixelMap[pixel.x][pixel.y-1]; + pixel2.fruit = pixel.fruit; + pixel2.age = pixel.age; + } + } + } + } + if(pixel.fruit && Math.floor(Math.random() * 400) == 1 && pixel.age > 200){ + for(var i = 0; i < adjacentCoords.length; i++){ + let x = pixel.x + adjacentCoords[i][0]; + let y = pixel.y + adjacentCoords[i][1]; + if(isEmpty(x,y) && !outOfBounds(x,y)){ + createPixel("fruit_leaves", x, y); + pixelMap[x][y].fruit = pixel.fruit; + pixel.blooming = trueFalse(1, 1)[Math.floor(Math.random() * 2)]; + } + } + } + pixel.age += 1; + }, + properties: { + age: 0, + }, + category: "life", + tempLow: -2, + stateLow: "frozen_plant", +} +function trueFalse(numTrue, numFalse){ + let list = []; + for(var i = 0; i < numTrue; i++){ + list.push(true); + } + for(var i = 0; i < numFalse; i++){ + list.push(false); + } + return list; +} +elements.raspberry_seed = { + color: "#ffe099", + behavior: behaviors.STURDYPOWDER, + category: "life", + properties: { + age: 0, + }, + tick: function(pixel){ + if(pixel.age > 40){ + let x1 = pixel.x - 1; + let y = pixel.y; + let x2 = pixel.x + 1; + if(isEmpty(x1,y) && !outOfBounds(x1,y)){ + createPixel("bush_base", x1, y); + pixelMap[x1][y].fruit = "raspberry"; + } + if(isEmpty(x2,y) && !outOfBounds(x2,y)){ + createPixel("bush_base", x2, y); + pixelMap[x2][y].fruit = "raspberry"; + } + if(!isEmpty(x1, y) && !isEmpty(x2, y)){ + deletePixel(pixel.x, pixel.y); + } + } + pixel.age += 1; + } +} +elements.raspberry = { + behavior: [["XX", "ST:bush_cane", "XX"],["ST:bush_cane", "XX", "ST:bush_cane"],["M2", "ST:bush_cane AND M1", "M2"]], + color: ["#b00009", "#bf000a", "#d10812", "#db1822"], + category: "food", + breakInto: "juice", + breakIntoColor: "#ff2b36", + isFood: true, + properties: { + fruit: "raspberry", + type: "fruit", + } +} +elements.blueberry_seed = { + color: "#ffe099", + behavior: behaviors.STURDYPOWDER, + category: "life", + properties: { + age: 0, + }, + tick: function(pixel){ + if(pixel.age > 40){ + let x1 = pixel.x - 1; + let y = pixel.y; + let x2 = pixel.x + 1; + if(isEmpty(x1,y) && !outOfBounds(x1,y)){ + createPixel("bush_base", x1, y); + pixelMap[x1][y].fruit = "blueberry"; + } + if(isEmpty(x2,y) && !outOfBounds(x2,y)){ + createPixel("bush_base", x2, y); + pixelMap[x2][y].fruit = "blueberry"; + } + if(!isEmpty(x1, y) && !isEmpty(x2, y)){ + deletePixel(pixel.x, pixel.y); + } + } + pixel.age += 1; + } +} +elements.blueberry = { + behavior: [["XX", "ST:bush_cane", "XX"],["ST:bush_cane", "XX", "ST:bush_cane"],["M2", "ST:bush_cane AND M1", "M2"]], + color: ["#01082b", "#060e3d", "#111b52", "#1e2866"], + category: "food", + breakInto: "juice", + breakIntoColor: "#726778", + isFood: true, + properties: { + fruit: "blueberry", + type: "fruit", + } +} +elements.blackberry_seed = { + color: "#ffe099", + behavior: behaviors.STURDYPOWDER, + category: "life", + properties: { + age: 0, + }, + tick: function(pixel){ + if(pixel.age > 40){ + let x1 = pixel.x - 1; + let y = pixel.y; + let x2 = pixel.x + 1; + if(isEmpty(x1,y) && !outOfBounds(x1,y)){ + createPixel("bush_base", x1, y); + pixelMap[x1][y].fruit = "blackberry"; + } + if(isEmpty(x2,y) && !outOfBounds(x2,y)){ + createPixel("bush_base", x2, y); + pixelMap[x2][y].fruit = "blackberry"; + } + if(!isEmpty(x1, y) && !isEmpty(x2, y)){ + deletePixel(pixel.x, pixel.y); + } + } + pixel.age += 1; + } +} +elements.blackberry = { + behavior: [["XX", "ST:bush_cane", "XX"],["ST:bush_cane", "XX", "ST:bush_cane"],["M2", "ST:bush_cane AND M1", "M2"]], + color: ["#0c0021", "#070014", "#080017", "#09001a"], + category: "food", + breakInto: "juice", + breakIntoColor: "#2e0000", + isFood: true, + properties: { + fruit: "blackberry", + type: "fruit", + } +} +elements.mango = { + behavior: [["XX", "ST:fruit_leaves AND ST:fruit_branch", "XX"],["ST:fruit_leaves AND ST:fruit_branch", "XX", "ST:fruit_leaves AND ST:fruit_branch"],["M2", "ST:fruit_leaves AND ST:fruit_branch AND M1", "M2"]], + color: ["#d63a45", "#e97341", "#9d9f3e", "#e4791b"], + category: "food", + breakInto: "juice", + breakIntoColor: "#ffa300", + isFood: true, + properties: { + fruit: "mango", + type: "fruit", + } +} +elements.mango_seed = { + color: "#240c00", + tick: function(pixel) { + if (isEmpty(pixel.x,pixel.y+1)) { + movePixel(pixel,pixel.x,pixel.y+1); + } + else { + if (Math.random() < 0.02 && pixel.age > 50 && pixel.temp < 100) { + if (!outOfBounds(pixel.x,pixel.y+1)) { + var dirtPixel = pixelMap[pixel.x][pixel.y+1]; + if (dirtPixel.element === "dirt" || dirtPixel.element === "mud" || dirtPixel.element === "sand" || dirtPixel.element === "wet_sand" || dirtPixel.element === "clay_soil" || dirtPixel.element === "mycelium") { + changePixel(dirtPixel,"root"); + } + } + if (isEmpty(pixel.x,pixel.y-1)) { + movePixel(pixel,pixel.x,pixel.y-1); + createPixel(Math.random() > 0.5 ? "wood" : "fruit_branch",pixel.x,pixel.y+1); + if (pixelMap[pixel.x][pixel.y+1].element == "fruit_branch" || pixelMap[pixel.x][pixel.y+1].element == "fruit_leaves"){ + pixelMap[pixel.x][pixel.y+1].fruit = "mango"; + } + } + } + else if (pixel.age > 1000) { + changePixel(pixel,"wood"); + } + pixel.age++; + } + doDefaults(pixel); + }, + properties: { + "age":0, + fruit:"mango" + }, + tempHigh: 100, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + burn: 65, + burnTime: 15, + category: "life", + state: "solid", + density: 1500, + cooldown: defaultCooldown, + seed: true, +}; +function conditionTrue(condition, pixel){ + let p = pixel; + let string = ""; + condition = condition.split("!OR").join("||").split("&AND").join("&&").split("\"").join("") + + condition = eval(condition); + return condition; +} +let ifCondition = ""; +let currentProp = ""; +let currentPropValue = ""; +elements.propmachine = { + name: "PropMachine", + behavior: behaviors.WALL, + category: "machines", + noMix: true, +onSelect: function(pixel) { + + let item = prompt("enter range for prop changing."); + if(/^\d+$/.test(item)){ + num4 = parseInt(item); + } else { + alert("that is not an integer."); + } + exclude2 = prompt("Enter elements to exclude, seperate them with commas. You can also enter !IF if you wish to enter conditions for it to change the property and add the exclude elements.").replace(/\s/g, ""); + if(exclude2.includes("!IF")){ + exclude2.split("!IF").join(""); + ifCondition = prompt("Enter the condition for the property to change. List of variables you can access can be found at https://5455e34a-cfe9-4576-ac9c-6e64c061433d-00-1psic9s1cgla6.kirk.replit.dev/Mods/morechemistry/conditions%20for%20if.html"); + } else { ifCondition = '1 == 1'; } + exclude2.split(","); + if(exclude2.constructor == [].constructor){ + exclude2.push("propmachine"); + } else { + exclude2 += "propmachine"; + } + var answer1 = prompt("Warning - This tool may break the simulator if used incorrectly.\n\nEnter a pixel attribute to modify:",(currentProp||undefined)); + console.log(answer1) + if (!answer1) { return } + var answer2 = prompt("Now, enter a value for "+answer1+":",(currentPropValue||undefined)); + if (!answer2) { return } + var valueL = answer2.toLowerCase(); + if (valueL === "true") { answer2 = true } + else if (valueL === "false") { answer2 = false } + else if (valueL === "null") { answer2 = null } + else if (valueL === "undefined") { answer2 = undefined } + else if (answer1 === "color" && valueL[0] === "#") { + var rgb = hexToRGB(valueL); + answer2 = "rgb("+rgb.r+","+rgb.g+","+rgb.b+")"; + } + currentProp = answer1; + currentPropValue = answer2; + console.log(answer1); + var num = parseFloat(answer2); + if (!isNaN(num)) { answer2 = num } + currentPropValue = answer2; + logMessage("Prop: "+currentProp); + logMessage("Value: "+currentPropValue); +}, + tick: function(pixel) { + if(pixel.start == pixelTicks) { + pixel.range = num4; + pixel.condition = ifCondition; + pixel.prop = currentProp; + pixel.val = currentPropValue; + } + let range = mouseRange(pixel.x, pixel.y, pixel.range); + prop({ property: pixel.prop, value: pixel.val },range, exclude2, pixel.condition); + } +} +function prop(obj, range, exclude = [], condition = ""){ + let list = []; + for (var i = 0; i < range.length; i++) { + var x = range[i][0]; + var y = range[i][1]; + if (!isEmpty(x,y,true)) { + var pixel = pixelMap[x][y]; + list.push(pixel); + } + } + for (var i = 0; i < list.length; i++) { + if (!isEmpty(list[i].x, list[i].y, true)) { + var pixel = list[i]; + if (!exclude.includes(pixel.element) && conditionTrue(condition, pixel)){ + if(/^\d+$/.test(obj.value)){ + obj.value = parseInt(obj.value); + } + if (!obj.property) { return } + if (pixel[obj.property] !== undefined && typeof pixel[obj.property] !== typeof obj.value) { + logMessage("Error: "+obj.property+" type is "+typeof pixel[obj.property]+", not "+typeof obj.value+"."); + obj.property = null; + obj.value = null; + return; + } + if (obj.property === "element") { + changePixel(pixel, obj.value); + list.splice(list.indexOf(pixel),1); + return; + } + if (obj.property === "burning" && obj.value === "true") { + pixel.burnStart = pixelTicks; + list.splice(list.indexOf(pixel),1); + return; + } + pixel[obj.property] = obj.value; + list.splice(list.indexOf(pixel),1); + } + } + } +} +elements.seed_maker = { + category: "machines", + behavior: behaviors.WALL, + tick: function(pixel){ + for(var i = 0; i < adjacentCoords.length; i++){ + let x = pixel.x + adjacentCoords[i][0]; + let y = pixel.y + adjacentCoords[i][1] + if(!isEmpty(x,y) && !outOfBounds(x,y)){ + let pixel2 = pixelMap[x][y]; + if(allFruits.includes(pixel2.element)){ + changePixel(pixel2, `${pixel2.element}_seed`) + } + } + } + } +} From 7872c7f76cc75e8b93069440507399e2b34115d8 Mon Sep 17 00:00:00 2001 From: Alexthetransfem <124483815+theenchantedsword@users.noreply.github.com> Date: Thu, 15 Feb 2024 16:03:31 -0600 Subject: [PATCH 36/47] Update morechemistry.js --- mods/morechemistry.js | 277 ++++++++++++++++++++++++++++++++---------- 1 file changed, 215 insertions(+), 62 deletions(-) diff --git a/mods/morechemistry.js b/mods/morechemistry.js index c220dfdf..bcbb9122 100644 --- a/mods/morechemistry.js +++ b/mods/morechemistry.js @@ -1,4 +1,4 @@ -//This mod was made by Alex the transfem, https://discord.com/users/778753696804765696 on discord and https://www.tiktok.com/@alextheagenenby?_t=8hoCVI3NRhu&_r=1 on tiktok. +//This mod was made by Adora the transfem, https://discord.com/users/778753696804765696 on discord and https://www.tiktok.com/@alextheagenenby?_t=8hoCVI3NRhu&_r=1 on tiktok. function pixelInRange(pixel, range){ let i = 0; while (i < range.length) { @@ -635,11 +635,6 @@ elements.potassiumhydroxidecrystals = { density: 2040, name: "PotassiumHydroxideCrystals", } -elements.supercooler = { - name: "SuperCooler", - category: "machines" -} -elements.supercooler.behavior = [["XX","CO:10","XX"],["CO:10","XX","CO:10"],["XX","CO:10","XX"]] elements.iron_chloride = { color: ["#010014", "#a2ff94"], reactions: { @@ -695,7 +690,7 @@ elements.kilonova = { temp: 100000000, } elements.supernova.behavior = [ ["XX", "XX", "XX"], [ "XX", "EX:80>plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,molten_iron,molten_uranium,oxygen,molten_sodium,sulfur_gas,neon,chlorine,molten_calcium,molten_nickel,molten_copper,molten_zinc,gallium_gas,hydrogen,hydrogen,hydrogen,hydrogen,helium,helium,helium AND CH:NeutronStar", "XX" ], ["XX", "XX", "XX"] ] -elements.kilonova.behavior = [ ["XX", "XX", "XX"], [ "XX", "EX:200>plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,molten_iron,molten_uranium,molten_lead,oxygen,molten_sodium,molten_gold,molten_tungsten,sulfur_gas,neon,chlorine,molten_calcium,molten_nickel,molten_copper,molten_zinc,gallium_gas,hydrogen,hydrogen,hydrogen,hydrogen,hydrogen,helium,helium,helium,helium AND CH:void", "XX" ], ["XX", "XX", "XX"] ] +elements.kilonova.behavior = [ ["XX", "XX", "XX"], [ "XX", "EX:200>plasma,plasma,plasma,plasma,plasma,plasma,molten_iron,molten_uranium,molten_lead,oxygen,molten_sodium,molten_gold,molten_tungsten,sulfur_gas,neon,chlorine,molten_calcium,molten_nickel,molten_copper,molten_zinc,gallium_gas,hydrogen,hydrogen,hydrogen,hydrogen,hydrogen,helium,helium,helium,helium AND CH:void", "XX" ], ["XX", "XX", "XX"] ] elements.NeutronStar = { behavior: [["XX", "XX", "XX"], ["CR:light", "XX", "CR:light"], ["XX", "XX", "XX"]], name: "NeutronStar", @@ -1057,52 +1052,12 @@ elements.specialmixer = { mix(range, exclude); } } + let num4 = 0; let exclude2 = []; let property1 = ""; let value2 = ""; -elements.propmachine = { - name: "PropMachine", - behavior: behaviors.WALL, - category: "machines", - noMix: true, - onSelect: function(pixel) { - let item = prompt("enter range for prop changing."); - if(/^\d+$/.test(item)){ - num4 = parseInt(item); - } else { - alert("that is not an integer."); - } - exclude2 = prompt("Enter elements to exclude, seperate them with commas.").replace(/\s/g, "").split(","); - exclude2.push("propmachine"); - var answer1 = prompt("Warning - This tool may break the simulator if used incorrectly.\n\nEnter a pixel attribute to modify:",(currentProp||undefined)); - if (!answer1) { return } - var answer2 = prompt("Now, enter a value for "+answer1+":",(currentPropValue||undefined)); - if (!answer2) { return } - var valueL = answer2.toLowerCase(); - if (valueL === "true") { answer2 = true } - else if (valueL === "false") { answer2 = false } - else if (valueL === "null") { answer2 = null } - else if (valueL === "undefined") { answer2 = undefined } - else if (answer1 === "color" && valueL[0] === "#") { - var rgb = hexToRGB(valueL); - answer2 = "rgb("+rgb.r+","+rgb.g+","+rgb.b+")"; - } - currentProp = answer1; - var num = parseFloat(answer2); - if (!isNaN(num)) { answer2 = num } - currentPropValue = answer2; - logMessage("Prop: "+currentProp); - logMessage("Value: "+currentPropValue); - }, - tick: function(pixel) { - if(pixel.start == pixelTicks) { - pixel.range = num4; - } - let range = mouseRange(pixel.x, pixel.y, pixel.range); - prop({ property: property1, value: value2 },range, exclude2); - } - } + let item = ""; elements.improvedsensor = { behavior: behaviors.WALL, @@ -1196,30 +1151,111 @@ elements.incinerator = { color: 'rgb(255, 50, 0)', noMix: true, } -function prop(obj, range, exclude = []){ +function conditionTrue(condition, pixel){ + let p = pixel; + let string = ""; + condition = condition.split("!OR").join("||").split("&AND").join("&&").split("\"").join("") + + condition = eval(condition); + return condition; +} +let ifCondition = ""; +let currentProp = ""; +let currentPropValue = ""; +elements.propmachine = { + name: "PropMachine", + behavior: behaviors.WALL, + category: "machines", + noMix: true, +onSelect: function(pixel) { + + let item = prompt("enter range for prop changing."); + if(/^\d+$/.test(item)){ + num4 = parseInt(item); + } else { + alert("that is not an integer."); + } + exclude2 = prompt("Enter elements to exclude, seperate them with commas. You can also enter !IF if you wish to enter conditions for it to change the property and add the exclude elements.").replace(/\s/g, ""); + if(exclude2.includes("!IF")){ + exclude2.split("!IF").join(""); + ifCondition = prompt("Enter the condition for the property to change. A list of variables can be seen at the bottom of the page. you cannot use \"\" but you can use `` and ''."); + } else { ifCondition = '1 == 1'; } + exclude2.split(","); + if(exclude2.constructor == [].constructor){ + exclude2.push("propmachine"); + } else { + exclude2 += "propmachine"; + } + var answer1 = prompt("Warning - This tool may break the simulator if used incorrectly.\n\nEnter a pixel attribute to modify:",(currentProp||undefined)); + console.log(answer1) + if (!answer1) { return } + var answer2 = prompt("Now, enter a value for "+answer1+":",(currentPropValue||undefined)); + if (!answer2) { return } + var valueL = answer2.toLowerCase(); + if (valueL === "true") { answer2 = true } + else if (valueL === "false") { answer2 = false } + else if (valueL === "null") { answer2 = null } + else if (valueL === "undefined") { answer2 = undefined } + else if (answer1 === "color" && valueL[0] === "#") { + var rgb = hexToRGB(valueL); + answer2 = "rgb("+rgb.r+","+rgb.g+","+rgb.b+")"; + } + currentProp = answer1; + currentPropValue = answer2; + console.log(answer1); + var num = parseFloat(answer2); + if (!isNaN(num)) { answer2 = num } + currentPropValue = answer2; + logMessage("Prop: "+currentProp); + logMessage("Value: "+currentPropValue); +}, + tick: function(pixel) { + if(pixel.start == pixelTicks) { + pixel.range = num4; + pixel.condition = ifCondition; + pixel.prop = currentProp; + pixel.val = currentPropValue; + } + let range = mouseRange(pixel.x, pixel.y, pixel.range); + prop({ property: pixel.prop, value: pixel.val },range, exclude2, pixel.condition); + } +} +function prop(obj, range, exclude = [], condition = ""){ + let list = []; for (var i = 0; i < range.length; i++) { - if (!isEmpty(range[i][0], range[i][1], true)) { - var pixel = pixelMap[range[i][0]][range[i][1]]; - if (!exclude.includes(pixel.element)){ + var x = range[i][0]; + var y = range[i][1]; + if (!isEmpty(x,y,true)) { + var pixel = pixelMap[x][y]; + list.push(pixel); + } + } + for (var i = 0; i < list.length; i++) { + if (!isEmpty(list[i].x, list[i].y, true)) { + var pixel = list[i]; + if (!exclude.includes(pixel.element) && conditionTrue(condition, pixel)){ if(/^\d+$/.test(obj.value)){ obj.value = parseInt(obj.value); } - if (!currentProp) { return } - if (pixel[currentProp] !== undefined && typeof pixel[currentProp] !== typeof currentPropValue) { - logMessage("Error: "+currentProp+" type is "+typeof pixel[currentProp]+", not "+typeof currentPropValue+"."); - currentProp = null; - currentPropValue = null; + if (!obj.property) { return } + if (pixel[obj.property] !== undefined && typeof pixel[obj.property] !== typeof obj.value) { + logMessage("Error: "+obj.property+" type is "+typeof pixel[obj.property]+", not "+typeof obj.value+"."); + obj.property = null; + obj.value = null; return; } - if (currentProp === "element") { - changePixel(pixel, currentPropValue); + if (obj.property === "element") { + changePixel(pixel, obj.value); + list.splice(list.indexOf(pixel),1); return; } - if (currentProp === "burning" && currentPropValue === "true") { + if (obj.property === "burning" && obj.value === "true") { pixel.burnStart = pixelTicks; + list.splice(list.indexOf(pixel),1); return; } - pixel[currentProp] = currentPropValue; + pixel[obj.property] = obj.value; + list.splice(list.indexOf(pixel),1); } } } @@ -1307,3 +1343,120 @@ function pull(range, pixel1, include = []){ } } } + +let prevNum; +elements.etemper = { + name: "E-Temper", + category: "machines", + conduct: 1, + insulate: true, + behavior: behaviors.WALL, + onSelect: function(pixel){ + prevNum = parseInt(prompt("Enter the temperature you want it set to.", (prevNum || undefined))); + }, + tick: function(pixel){ + if(pixel.start === pixelTicks){ + pixel.clone = `Temp: ${prevNum}`; + pixel.Temp = prevNum; + } + for (var i = 0; i < adjacentCoords.length; i++){ + let x = pixel.x + adjacentCoords[i][0]; + let y = pixel.y + adjacentCoords[i][1]; + if(outOfBounds(x,y)){ continue; } + if(isEmpty(x,y)){ continue; } + let pixel2 = pixelMap[x][y]; + + if (pixel2.temp < pixel.Temp && pixel.charge > 0 ){ + pixel2.temp += pixel.Temp / 6; + } + + } + }, +} +let prevString; +elements.sign = { + name: "Sign", + category: "machines", + onSelect: function(){ + prevString = prompt("Enter the text you want it to say.", (prevString || undefined)); + }, + tick: function(pixel){ + if(pixel.start == pixelTicks){ + pixel.clone = prevString; + } + } +} +document.body.innerHTML += ` +these are all properties of the pixel. another way to find pixel properties is using debug on a pixel, it will tell you the property and the value, like x and y, or, in plants.js, fruit. + + +
+` +document.getElementById("extraInfo").innerHTML = ` +Changelog(NEW) • Feedback • Wiki • Reddit • Discord+ + ++ Variable + ++ Definition + ++ ++ p.color + ++ The color of the pixel. it is defined as an RGB value. + ++ ++ p.x and p.y + ++ The x and y positions of the pixel. + ++ ++ p.element + ++ The element of the pixel. + ++ ++ p.clone + ++ Specific to cloners, specifies what the cloner clones. + ++ ++ wc and lc + ++ Specific to saplings, specifies what colour the wood is (wc) and what colour the leaves are (lc). + ++ ++ p.start + ++ The start tick of the pixel. + ++ ++ p.tick + ++ the amount of ticks that have happened so far in the game. + +v1.9.3 • 559 elements, with hidden.
©2021-2024. All Rights Reserved. R74n
+` From 4b19b0bedf0acb8aea7bf7642f9facd557eb19a6 Mon Sep 17 00:00:00 2001 From: Alexthetransfem <124483815+theenchantedsword@users.noreply.github.com> Date: Thu, 15 Feb 2024 16:04:12 -0600 Subject: [PATCH 37/47] Update allliquids.js --- mods/allliquids.js | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/mods/allliquids.js b/mods/allliquids.js index ae92e535..80a6bfd1 100644 --- a/mods/allliquids.js +++ b/mods/allliquids.js @@ -1,21 +1,24 @@ +//This mod was made by Adora the transfem, https://discord.com/users/778753696804765696 on discord and https://www.tiktok.com/@alextheagenenby?_t=8hoCVI3NRhu&_r=1 on tiktok. let liquid = [["XX", "XX", "XX"], ["M1", "XX", "M1"], ["M1", "M2", "M1"]] -for (var element in elements){ - - let a = elements[element].behavior; - console.log(a, elements[element], liquid) - if(a != undefined && typeof a != 'function'){ - let i = 0; - while (i < a.length){ - if(typeof a[i] == "string"){ - a[i] = a[i].split("|"); - i += 1; - } else { - i += 1; +runAfterLoad(function(){ + for (var element in elements){ + elements[element].noMix = false; + let a = elements[element].behavior; + console.log(a, elements[element], liquid) + if(a != undefined && typeof a != 'function'){ + let i = 0; + while (i < a.length){ + if(typeof a[i] == "string"){ + a[i] = a[i].split("|"); + i += 1; + } else { + i += 1; + } } + elements[element].behavior = [[a[0][0], a[0][1], a[0][2]], [`${a[1][0]} AND M1`, a[1][1], `${a[1][2]} AND M1`], [`${a[2][0]} AND M1`, `${a[2][1]} AND M2`, `${a[2][2]} AND M1`]]; + } else { + elements[element].behavior = liquid; } - elements[element].behavior = [[a[0][0], a[0][1], a[0][2]], [`${a[1][0]} AND M1`, a[1][1], `${a[1][2]} AND M1`], [`${a[2][0]} AND M1`, `${a[2][1]} AND M2`, `${a[2][2]} AND M1`]]; - } else { - elements[element].behavior = liquid; + } - -} +}); From aad1b147125998fc4ca1f1f35485c0bd5b18cd78 Mon Sep 17 00:00:00 2001 From: Alexthetransfem <124483815+theenchantedsword@users.noreply.github.com> Date: Thu, 15 Feb 2024 16:14:22 -0600 Subject: [PATCH 38/47] Update mod-list.html --- mod-list.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mod-list.html b/mod-list.html index ec35b37d..fb909973 100644 --- a/mod-list.html +++ b/mod-list.html @@ -117,7 +117,7 @@Tools & Settings - adjustablepixelsize.js Allows you to set the pixelSize with a URL parameter Alice + betaworldgen.js adds a more advanced world generation to the game Alex betaworldgen.js adds a more advanced world generation to the game Adora betterModManager.js Improvements to the Mod Manager ggod betterSettings.js Adds additional settings and functionality ggod @@ -168,7 +168,7 @@ betterStats.js Separate “real” and “set” TPS, meaning you can see what the TPS actually is, instead of only seeing what it’s set to mollthecoder metals.js Adds several metals Alice mixture.js Allows many chemicals to be mixed lllllllllwith10ls - more_gold.js Adds Green Gold pixelegend4 + morechemistry.js Adds many new chemicals and compounds as well as some new machines Alex morechemistry.js Adds many new chemicals and compounds as well as some new machines Adora moreliquids.js Adds various liquids te-agma-at nellfire.js Adds a weird transforming flame and several rock types Alice @@ -235,6 +235,7 @@ Neutronium Mod.js Variety of scientific elements
ExplosionsStellarX20 nocancer2.js Removes cancer from the game altogether. May be incompatible with other mods that spawn cancer mollthecoder nograssgrow.js Prevents Grass from growing mollthecoder + pizzasstuff.js New animals, foods, and plants _ilikepizza_ plants.js Adds a wide variety of new plants and fruits Adora primordial_birthpool.js A cross between Primordial Soup and Birthpool. Requires F&M Alice spring.js Many nature elements, like sakura trees, butterflies, beehives, and more R74n @@ -244,7 +245,7 @@ the_ground_og.js Simplified and more stable version of the_ground.js Alice Fun & Games - all_around_fillers.js Adds directional Filler variants idk73248 + allliquids.js Made all elements liquids Alex allliquids.js Made all elements liquids Adora amogus.js Adds a small amogus structure Alice collab_mod.js Created by multiple people, adds random things mrapple, ilikepizza, stefanblox From 99ef7f15862f35c93c04e26f00a7716b9bdb0b2f Mon Sep 17 00:00:00 2001 From: sb <155691462+stefanblox@users.noreply.github.com> Date: Thu, 15 Feb 2024 19:50:26 -0300 Subject: [PATCH 39/47] sbstuff 2.7 unstain --- mods/sbstuff.js | 62 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 53 insertions(+), 9 deletions(-) diff --git a/mods/sbstuff.js b/mods/sbstuff.js index bf7f4d1e..41ee6af0 100644 --- a/mods/sbstuff.js +++ b/mods/sbstuff.js @@ -3,7 +3,7 @@ elements.cooked_rice = { tempMin: 20, stateMin: "rice", tempHigh: 500, - stateHigh: ["ash", "charcoal"], + stateHigh: "charcoal", density: 699, color: "#c2b6b6", behavior: behaviors.LIQUID, @@ -16,37 +16,39 @@ elements.cooked_rice = { elements.rice = { breakInto: "flour", - viscosity: 10000, isFood: true, density: 696, tempHigh: 232, stateHigh: "cooked_rice", color: "#c8c8c8", - behavior: behaviors.LIQUID, + behavior: behaviors.POWDER, category: "food", state: "liquid", }; elements.moth = { tempHigh: 500, - stateHigh: "ash", + stateHigh: "dead_bug", + breakInto: "dead_bug", color: "#57381a", behavior: behaviors.FLY, category: "life", - state: "solid", + state: "liquid", }; elements.cotton_candy = { isFood: true, - tempHigh: 500, - stateHigh: "ash", + tempHigh: 200, + stateHigh: "sugar", density: 1000, - color: "#b6c7e3", + color: ["#b6c7e3", "#c54b4b", "#e7769c"], + singleColor: true, behavior: behaviors.POWDER, category: "food", state: "liquid", reactions: { - "water": { elem1: "sugar", elem2: null }, + "water": { elem1: "sugar", elem2: "water" }, + "sugar_water": { elem1: "sugar", elem2:"sugar_water", chance: 10 } } }; @@ -358,6 +360,7 @@ elements.cereal = { behavior: behaviors.STURDYPOWDER, category: "food", state: "liquid", + stain: 0.005 }; elements.sushi = { @@ -1692,6 +1695,47 @@ elements.liquid_filler = { state: "liquid" }; +elements.antimony = { + color: ["#4b90b8", "#a3bfd8", "#89a0b6", "#8798a7", "#738092"], + behavior: behaviors.WALL, + category: "solids", + state: "solid", + density: 6697, + tempHigh: 630, + stateHigh: "melted_antimony", + alias: "...sb?!" +}; + +elements.melted_antimony = { + color: ["#8fb2c7", "#7494b1", "#72a1cc", "#a3aaaf", "#a4aab3"], + behavior: behaviors.LIQUID, + category: "liquids", + state: "liquid", + density: 6697, + stain: 0.1, + tempLow: -270, + stateLowName: "antimony_ice" +}; + +elements.unstain = { + color: "#729fff", + behavior: [ + "XX|XX|XX", + "XX|XX|XX", + "XX|XX|XX" + ], + stain: -1, + tool: (pixel) => { + doStaining({ + element: "unstain", + x: pixel.x, + y: pixel.y + }) + }, + category: "tools", + state: "solid", +}; + elements.incinerate.category = "tools", elements.cook.category = "tools", elements.room_temp.category = "tools", From 46f34c6e85c6d27959172722a808c7d78ca60f14 Mon Sep 17 00:00:00 2001 From: Jayd-Rubies <155784127+Jayd-Rubies@users.noreply.github.com> Date: Thu, 15 Feb 2024 17:52:06 -0500 Subject: [PATCH 40/47] jaydstuff.js release --- mods/jaydstuff.js | 286 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 286 insertions(+) create mode 100644 mods/jaydstuff.js diff --git a/mods/jaydstuff.js b/mods/jaydstuff.js new file mode 100644 index 00000000..75c752bb --- /dev/null +++ b/mods/jaydstuff.js @@ -0,0 +1,286 @@ +//jaydstuff +elements.super_raincloud = { + color: "#0000ff", + behavior: [ + "XX|M1%10|XX", + "M1%5|XX|M1%5", + "CR:water%40|CR:water%40|CR:water%40", + ], + category: "gases", + state: "gas", + density: 50, +}, +elements.deuterium = { + color: "#558bcf", + behavior: behaviors.GAS, + reactions: { + "oxygen": { elem1:null, elem2:"heavy_steam", tempMin:500 }, + "tritium": { elem1:"neutron", elem2:"helium", tempMin:100000000, temp1:150000000, temp2:150000000 }, + "fire": { elem1:"explosion", chance:0.005 }, + }, + category: "gases", + burn: 100, + burnTime: 2, + burnInto: ["fire","fire","fire","fire","fire","fire","fire","fire","fire","fire","fire","fire","heavy_steam"], + tempLow: -253, + stateLow: "liquid_deuterium", + state: "gas", + density: 0.180, + conduct: 0.02, + colorOn: "#d6462d" +}, +elements.liquid_deuterium = { + color: "#97afcf", + behavior: behaviors.LIQUID, + reactions: { + "liquid_oxygen": { elem1:"heavy_ice", elem2:null }, + "oxygen": { elem1:"ice", elem2:null } + }, + category: "states", + burn: 100, + burnTime: 2, + temp: -255.879, + tempHigh: -252.879, + stateHigh: "hydrogen", + tempLow: -259.2, + state: "liquid", + density: 163.83, + hidden: true +}, +elements.tritium = { + color: "#558bcf", + behavior: [ + "M2|M1 AND CR:radiation%1|M2", + "M1|XX|M1", + "M2|M1 AND CR:radiation%0.5|M2", + ], + reactions: { + "oxygen": { elem1:null, elem2:"tritiated_steam", tempMin:500 }, + "deuterium": { elem1:"neutron", elem2:"helium", tempMin:100000000, temp1:150000000, temp2:150000000 }, + "fire": { elem1:"explosion", chance:0.005 }, + }, + category: "gases", + burn: 100, + burnTime: 2, + burnInto: ["fire","fire","fire","fire","fire","fire","fire","fire","fire","fire","fire","fire","steam"], + tempLow: -253, + stateLow: "liquid_tritium", + state: "gas", + density: 0.269, + conduct: 0.02, + colorOn: "#d6462d" +}, +elements.liquid_tritium = { + color: "#97afcf", + behavior: [ + "XX|CR:radiation%1|XX", + "M2|XX|M2", + "M1|M1|M1", + ], + reactions: { + "liquid_oxygen": { elem1:"tritiated_ice", elem2:null }, + "oxygen": { elem1:"ice", elem2:null } + }, + category: "states", + burn: 100, + burnTime: 2, + temp: -255.879, + tempHigh: -252.879, + stateHigh: "tritium", + tempLow: -259.2, + state: "liquid", + density: 213, + hidden: true +}, +elements.heavy_water = { + color: "#2167ff", + behavior: behaviors.LIQUID, + tempHigh: 101.4, + stateHigh: "heavy_steam", + tempLow: 0, + stateLow: "heavy_ice", + category: "liquids", + heatCapacity: 4.184, + reactions: { + // electrolysis: + "aluminum": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0025 }, + "zinc": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.015 }, + "steel": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0125 }, + "iron": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0125 }, + "tin": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.01 }, + "brass": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.001 }, + "bronze": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.001 }, + "copper": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0075 }, + "silver": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0075 }, + "gold": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0075 }, + }, + state: "liquid", + density: 1107, + conduct: 0.02, + stain: -0.5, + extinguish: true +}, +elements.heavy_steam = { + color: "#abd6ff", + behavior: behaviors.GAS, + reactions: { + "copper": { elem1:"oxygen", elem2:"oxidized_copper", chance:0.01 }, + "bronze": { elem1:"oxygen", elem2:"oxidized_copper", chance:0.005 }, + "iron": { elem1:"oxygen", elem2:"rust", chance:0.005 }, + "steel": { elem1:"oxygen", elem2:"rust", chance:0.004 }, + }, + temp: 150, + tempLow: 95, + extraTempLow: { + 0: "heavy_rime" + }, + stateLow: "heavy_water", + category: "gases", + state: "gas", + density: 1, + conduct: 0.002, + stain: -0.05, + alias: "heavy water vapor", + extinguish: true +}, +elements.heavy_ice = { + color: "#b2daeb", + behavior: behaviors.WALL, + temp: -5, + tempHigh: 5, + stateHigh: "heavy_water", + category: "solids", + state: "solid", + density: 1014.202, + breakInto: "heavy_snow" +}, +elements.tritiated_water = { + color: "#2167ff", + behavior: [ + "XX|CR:radiation%1|XX", + "M2|XX|M2", + "M1|M1|M1", + ], + tempHigh: 101.4, + stateHigh: "tritiated_steam", + tempLow: 0, + stateLow: "tritiated_ice", + category: "liquids", + heatCapacity: 4.184, + reactions: { + // electrolysis: + "aluminum": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0025 }, + "zinc": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.015 }, + "steel": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0125 }, + "iron": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0125 }, + "tin": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.01 }, + "brass": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.001 }, + "bronze": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.001 }, + "copper": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0075 }, + "silver": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0075 }, + "gold": { elem1:["deuterium","deuterium","oxygen"], charged:true, chance:0.0075 }, + }, + state: "liquid", + density: 1107, + conduct: 0.02, + stain: -0.5, + extinguish: true +}, +elements.tritiated_steam = { + color: "#abd6ff", + behavior: [ + "M2|M1 AND CR:radiation%1|M2", + "M1|XX|M1", + "M2|M1 AND CR:radiation%0.5|M2", + ], + reactions: { + "copper": { elem1:"oxygen", elem2:"oxidized_copper", chance:0.01 }, + "bronze": { elem1:"oxygen", elem2:"oxidized_copper", chance:0.005 }, + "iron": { elem1:"oxygen", elem2:"rust", chance:0.005 }, + "steel": { elem1:"oxygen", elem2:"rust", chance:0.004 }, + }, + temp: 150, + tempLow: 95, + extraTempLow: { + 0: "heavy_rime" + }, + stateLow: "tritiated_water", + category: "gases", + state: "gas", + density: 0.6, + conduct: 0.002, + stain: -0.05, + alias: "tritiated water vapor", + extinguish: true +}, +elements.tritiated_ice = { + color: "#b2daeb", + behavior: [ + "XX|CR:radiation%0.25|XX", + "CR:radiation%0.25|XX|CR:radiation%0.25", + "XX|CR:radiation%0.25|XX", + ], + temp: -5, + tempHigh: 5, + stateHigh: "tritiated_water", + category: "solids", + state: "solid", + density: 1014.202, + breakInto: "tritiated_snow" +}, +elements.fusion = { + color: "#ffffff", + tool: function(pixel) { + pixel.temp = 100000000; + pixelTempCheck(pixel) + }, + category: "tools", +}, +elements.meese = { + color: "#996515", + behavior: [ + "XX|XX|XX", + "XX|FX%0.25|M2%0.5 AND BO", + "XX|M1|XX", + ], + category: "life" +}, +elements.fluoroantimonic_acid = { + color: ["#b5cf91","#a1ff5e","#288f2a"], + behavior: [ + "XX|DB%5|XX", + "DB%5 AND M2|XX|DB%5 AND M2", + "DB%5 AND M2|DB%10 AND M1|DB%5 AND M2", + ], + ignore: ["glass","rad_glass","glass_shard","rad_shard","stained_glass","baked_clay","acid_gas","neutral_acid","copper","gold","porcelain"], + category: "liquids", + state: "liquid", + density: 2885, + hidden: true, + stain: -0.1, +}, +elements.tritium_ice = { + color: "#b5d2ff", + behavior: [ + "XX|CR:radiation%0.25|XX", + "CR:radiation%0.25|XX|CR:radiation%0.25", + "XX|CR:radiation%0.25|XX", + ], + temp: -259, + tempHigh: -256, + stateHigh: "liquid_tritium", + category: "states", + state: "solid", + density: 258, +}, +elements.unstain = { + category: "tools", + stain: -1, + tool: (pixel) => { + doStaining({ + element: "unstain", + x: pixel.x, + y: pixel.y + }) + } +}; \ No newline at end of file From ec6ddaa176156996287050918353b0ca681611aa Mon Sep 17 00:00:00 2001 From: Alexthetransfem <124483815+theenchantedsword@users.noreply.github.com> Date: Thu, 15 Feb 2024 19:00:20 -0600 Subject: [PATCH 41/47] Update plants.js --- mods/plants.js | 109 ------------------------------------------------- 1 file changed, 109 deletions(-) diff --git a/mods/plants.js b/mods/plants.js index dd304907..23a68e1b 100644 --- a/mods/plants.js +++ b/mods/plants.js @@ -1063,115 +1063,6 @@ elements.mango_seed = { cooldown: defaultCooldown, seed: true, }; -function conditionTrue(condition, pixel){ - let p = pixel; - let string = ""; - condition = condition.split("!OR").join("||").split("&AND").join("&&").split("\"").join("") - - condition = eval(condition); - return condition; -} -let ifCondition = ""; -let currentProp = ""; -let currentPropValue = ""; -elements.propmachine = { - name: "PropMachine", - behavior: behaviors.WALL, - category: "machines", - noMix: true, -onSelect: function(pixel) { - - let item = prompt("enter range for prop changing."); - if(/^\d+$/.test(item)){ - num4 = parseInt(item); - } else { - alert("that is not an integer."); - } - exclude2 = prompt("Enter elements to exclude, seperate them with commas. You can also enter !IF if you wish to enter conditions for it to change the property and add the exclude elements.").replace(/\s/g, ""); - if(exclude2.includes("!IF")){ - exclude2.split("!IF").join(""); - ifCondition = prompt("Enter the condition for the property to change. List of variables you can access can be found at https://5455e34a-cfe9-4576-ac9c-6e64c061433d-00-1psic9s1cgla6.kirk.replit.dev/Mods/morechemistry/conditions%20for%20if.html"); - } else { ifCondition = '1 == 1'; } - exclude2.split(","); - if(exclude2.constructor == [].constructor){ - exclude2.push("propmachine"); - } else { - exclude2 += "propmachine"; - } - var answer1 = prompt("Warning - This tool may break the simulator if used incorrectly.\n\nEnter a pixel attribute to modify:",(currentProp||undefined)); - console.log(answer1) - if (!answer1) { return } - var answer2 = prompt("Now, enter a value for "+answer1+":",(currentPropValue||undefined)); - if (!answer2) { return } - var valueL = answer2.toLowerCase(); - if (valueL === "true") { answer2 = true } - else if (valueL === "false") { answer2 = false } - else if (valueL === "null") { answer2 = null } - else if (valueL === "undefined") { answer2 = undefined } - else if (answer1 === "color" && valueL[0] === "#") { - var rgb = hexToRGB(valueL); - answer2 = "rgb("+rgb.r+","+rgb.g+","+rgb.b+")"; - } - currentProp = answer1; - currentPropValue = answer2; - console.log(answer1); - var num = parseFloat(answer2); - if (!isNaN(num)) { answer2 = num } - currentPropValue = answer2; - logMessage("Prop: "+currentProp); - logMessage("Value: "+currentPropValue); -}, - tick: function(pixel) { - if(pixel.start == pixelTicks) { - pixel.range = num4; - pixel.condition = ifCondition; - pixel.prop = currentProp; - pixel.val = currentPropValue; - } - let range = mouseRange(pixel.x, pixel.y, pixel.range); - prop({ property: pixel.prop, value: pixel.val },range, exclude2, pixel.condition); - } -} -function prop(obj, range, exclude = [], condition = ""){ - let list = []; - for (var i = 0; i < range.length; i++) { - var x = range[i][0]; - var y = range[i][1]; - if (!isEmpty(x,y,true)) { - var pixel = pixelMap[x][y]; - list.push(pixel); - } - } - for (var i = 0; i < list.length; i++) { - if (!isEmpty(list[i].x, list[i].y, true)) { - var pixel = list[i]; - if (!exclude.includes(pixel.element) && conditionTrue(condition, pixel)){ - if(/^\d+$/.test(obj.value)){ - obj.value = parseInt(obj.value); - } - if (!obj.property) { return } - if (pixel[obj.property] !== undefined && typeof pixel[obj.property] !== typeof obj.value) { - logMessage("Error: "+obj.property+" type is "+typeof pixel[obj.property]+", not "+typeof obj.value+"."); - obj.property = null; - obj.value = null; - return; - } - if (obj.property === "element") { - changePixel(pixel, obj.value); - list.splice(list.indexOf(pixel),1); - return; - } - if (obj.property === "burning" && obj.value === "true") { - pixel.burnStart = pixelTicks; - list.splice(list.indexOf(pixel),1); - return; - } - pixel[obj.property] = obj.value; - list.splice(list.indexOf(pixel),1); - } - } - } -} elements.seed_maker = { category: "machines", behavior: behaviors.WALL, From 881483a9da755b9cb7e9c28e5fb95b8f31cffb31 Mon Sep 17 00:00:00 2001 From: Alexthetransfem <124483815+theenchantedsword@users.noreply.github.com> Date: Thu, 15 Feb 2024 19:12:08 -0600 Subject: [PATCH 42/47] Update morechemistry.js --- mods/morechemistry.js | 140 +++++++++++++++++++++--------------------- 1 file changed, 71 insertions(+), 69 deletions(-) diff --git a/mods/morechemistry.js b/mods/morechemistry.js index bcbb9122..ef6b8dd9 100644 --- a/mods/morechemistry.js +++ b/mods/morechemistry.js @@ -1386,77 +1386,79 @@ elements.sign = { } } } -document.body.innerHTML += ` -these are all properties of the pixel. another way to find pixel properties is using debug on a pixel, it will tell you the property and the value, like x and y, or, in plants.js, fruit. - elem3.js Adds all elements and combinations from Elemental 3 [Very Large] Sophie - -
+ ` + document.getElementById("extraInfo").innerHTML = ` + Changelog(NEW) • Feedback • Wiki • Reddit • Discord+runAfterLoad(function(){ + document.body.innerHTML += ` + these are all properties of the pixel. another way to find pixel properties is using debug on a pixel, it will tell you the property and the value, like x and y, or, in plants.js, fruit. + + +
-` -document.getElementById("extraInfo").innerHTML = ` -Changelog(NEW) • Feedback • Wiki • Reddit • Discord+ + ++ Variable + ++ Definition + +- - - Variable + p.color - Definition + The color of the pixel. it is defined as an RGB value. - -- p.color - -- The color of the pixel. it is defined as an RGB value. - -- -- p.x and p.y - -- The x and y positions of the pixel. - -- -- p.element - -- The element of the pixel. - -- -- p.clone - -- Specific to cloners, specifies what the cloner clones. - -- -- wc and lc - -- Specific to saplings, specifies what colour the wood is (wc) and what colour the leaves are (lc). - -- -- p.start - -- The start tick of the pixel. - -- -- p.tick - -- the amount of ticks that have happened so far in the game. - -v1.9.3 • 559 elements, with hidden.
©2021-2024. All Rights Reserved. R74n
-` ++ ++ p.x and p.y + ++ The x and y positions of the pixel. + ++ ++ p.element + ++ The element of the pixel. + ++ ++ p.clone + ++ Specific to cloners, specifies what the cloner clones. + ++ ++ wc and lc + ++ Specific to saplings, specifies what colour the wood is (wc) and what colour the leaves are (lc). + ++ ++ p.start + ++ The start tick of the pixel. + ++ ++ p.tick + ++ the amount of ticks that have happened so far in the game. + +v1.9.3 • 559 elements, with hidden.
©2021-2024. All Rights Reserved. R74n
+ ` +} From a55f376ba6523a5cf3b99735480c03756ba941cb Mon Sep 17 00:00:00 2001 From: Alexthetransfem <124483815+theenchantedsword@users.noreply.github.com> Date: Thu, 15 Feb 2024 19:32:49 -0600 Subject: [PATCH 43/47] Update morechemistry.js --- mods/morechemistry.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/morechemistry.js b/mods/morechemistry.js index ef6b8dd9..3549e61b 100644 --- a/mods/morechemistry.js +++ b/mods/morechemistry.js @@ -1461,4 +1461,4 @@ runAfterLoad(function(){ document.getElementById("extraInfo").innerHTML = ` Changelog(NEW) • Feedback • Wiki • Reddit • Discordv1.9.3 • 559 elements, with hidden.
©2021-2024. All Rights Reserved. R74n
` -} +}); From a644a0ce1514ca851e3f9a4ee995a5273f88d1f0 Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Thu, 15 Feb 2024 21:17:25 -0500 Subject: [PATCH 44/47] . --- mods/elem3.js | 4 ++-- mods/funny_liquid.js | 6 ++++++ mods/injector.js | 2 +- mods/life_eater.js | 2 +- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/mods/elem3.js b/mods/elem3.js index 08a385b9..95e6059d 100644 --- a/mods/elem3.js +++ b/mods/elem3.js @@ -170462,7 +170462,7 @@ elements.e15514 = { }; elements.e15515 = { - name: "Niggah", + name: "No", behavior: behaviors.LIQUID, category: "elem3", state: "liquid", @@ -218466,7 +218466,7 @@ elements.e19879 = { }; elements.e19880 = { - name: "Nigga", + name: "No", behavior: behaviors.LIQUID, category: "elem3", state: "liquid", diff --git a/mods/funny_liquid.js b/mods/funny_liquid.js index 2afaed89..821ea0bd 100644 --- a/mods/funny_liquid.js +++ b/mods/funny_liquid.js @@ -1,3 +1,8 @@ +/* +This mod has been moved. +*/ + +/* elements.cum = { name: "cum", color: "#e6e1d5", @@ -610,3 +615,4 @@ runAfterLoad(function() { ] }; }); +*/ \ No newline at end of file diff --git a/mods/injector.js b/mods/injector.js index b1697c3d..4c385004 100644 --- a/mods/injector.js +++ b/mods/injector.js @@ -4,7 +4,7 @@ var structureMod = "mods/structure_test.js"; var rbtMod = "mods/randomness_but_tick.js"; if(enabledMods.includes(libraryMod) && enabledMods.includes(structureMod) && enabledMods.includes(rbtMod)) { - var injectorPoisonCategories = ["life","auto creepers","shit","cum","food","fantastic creatures","fey","auto_fey"]; + var injectorPoisonCategories = ["life","auto creepers","food","fantastic creatures","fey","auto_fey"]; var injectorPoisonBlacklist = ["injector_poison","dead_matter","poisoned_dirt"]; var injectorPoisonWhitelist = ["blood","poop","blood_ice","wood","wood_plank","sawdust","straw","paper","birthpool","dried_poop","gloomfly","meat_monster","rotten_ravager","bone_beast","withery","withery_plant","banana","apple","rotten_apple","apioform_player","apioform_bee","apioform","apiodiagoform","sugar_cactus","sugar_cactus_seed","flowering_sugar_cactus","tree_branch","sap","silk","red_velvet","silk_velvet","ketchup", "enchanted_ketchup", "frozen_ketchup", "poisoned_ketchup", "frozen_poisoned_ketchup", "ketchup_spout", "ketchup_cloud", "poisoned_ketchup_cloud", "ketchup_snow", "ketchup_snow_cloud", "poisoned_ketchup_snow", "poisoned_ketchup_snow_cloud", "ketchup_gas", "poisoned_ketchup_gas", "ketchup_powder", "poisoned_ketchup_powder", "eketchup_spout", "ketchup_metal", "antiketchup", "dirty_ketchup", "ketchup_gold", "molten_ketchup_metal", "ketchup_fairy", "ketchup_metal_scrap", "ketchup_gold_scrap", "molten_ketchup_gold", "mycelium","vaccine","antibody","infection","sap","caramel","molasses","melted_chocolate","soda","mustard","fry_sauce","tomato_sauce","sugary_tomato_sauce","bio_ooze","zombie_blood","feather","tooth","decayed_tooth","plaque","tartar","bacteria","replacer_bacteria","pop_rocks"]; var injectorPoisonSubstitutions = { diff --git a/mods/life_eater.js b/mods/life_eater.js index a7b7b07c..0ca0d1b1 100644 --- a/mods/life_eater.js +++ b/mods/life_eater.js @@ -7,7 +7,7 @@ if(!enabledMods.includes(fireMod)) { alert(`The ${fireMod} mod is required and has been automatically inserted (reload for this to take effect).`); } else { - var lifeEaterCategories = ["life","auto creepers","shit","cum","food","fantastic creatures","fey","auto_fey"]; + var lifeEaterCategories = ["life","auto creepers","food","fantastic creatures","fey","auto_fey"]; var lifeEaterBlacklist = ["life_eater_virus","life_eater_slurry","life_eater_infected_dirt"]; var lifeEaterWhitelist = ["blood","poop","blood_ice","wood","wood_plank","sawdust","straw","paper","birthpool","dried_poop","gloomfly","meat_monster","rotten_ravager","bone_beast","withery","withery_plant","banana","apple","rotten_apple","apioform_player","apioform_bee","apioform","apiodiagoform","sugar_cactus","sugar_cactus_seed","flowering_sugar_cactus","tree_branch","sap","silk","red_velvet","silk_velvet","ketchup", "enchanted_ketchup", "frozen_ketchup", "poisoned_ketchup", "frozen_poisoned_ketchup", "ketchup_spout", "ketchup_cloud", "poisoned_ketchup_cloud", "ketchup_snow", "ketchup_snow_cloud", "poisoned_ketchup_snow", "poisoned_ketchup_snow_cloud", "ketchup_gas", "poisoned_ketchup_gas", "ketchup_powder", "poisoned_ketchup_powder", "eketchup_spout", "ketchup_metal", "antiketchup", "dirty_ketchup", "ketchup_gold", "molten_ketchup_metal", "ketchup_fairy", "ketchup_metal_scrap", "ketchup_gold_scrap", "molten_ketchup_gold", "mycelium","vaccine","antibody","infection","sap","caramel","molasses","melted_chocolate","soda","mustard","fry_sauce","tomato_sauce","sugary_tomato_sauce","bio_ooze","zombie_blood","feather","tooth","decayed_tooth","plaque","tartar","bacteria","replacer_bacteria","pop_rocks"]; var lifeEaterSubstitutions = { From afb4fdb21ea223954369d6c301065ad26c564310 Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Thu, 15 Feb 2024 21:17:28 -0500 Subject: [PATCH 45/47] Update mod-list.html --- mod-list.html | 2 -- 1 file changed, 2 deletions(-) diff --git a/mod-list.html b/mod-list.html index ec35b37d..38b5a83e 100644 --- a/mod-list.html +++ b/mod-list.html @@ -249,8 +249,6 @@collab_mod.js Created by multiple people, adds random things mrapple, ilikepizza, stefanblox elem3.js Adds all elements and combinations from Elemental 3 [Very Large] Sophie - funny elements 2022-11-15.js Adds a few curated randomly-generated elements Alice - funny_liquid_2.js Adds urine Alice funny_liquid_3.js Adds vomit Alice funny_solid.js Adds feces Alice haseulite.js Adds Loona-related materials with various properties Alice From 5d467f1e46d88f646037bbc7c97a0861090e649b Mon Sep 17 00:00:00 2001 From: slweeb <91897291+slweeb@users.noreply.github.com> Date: Fri, 16 Feb 2024 16:18:16 -0500 Subject: [PATCH 46/47] Update index.html --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index c1f843c9..ce880caf 100644 --- a/index.html +++ b/index.html @@ -15851,7 +15851,7 @@ Landmine, Grenade, Smoke Grenade">? If you'd like to support us, consider donating on PayPal or CashApp, or subscribing on Discord. --> iean.js Adds lean and its ingredients Alice Business inquiries? Education stories? Help needed? Email us at contact@R74n.com!
More links: Help • Tips • Mods • Mobile • Offline • Privacy
-Thanks to: Serioustar, WeiChei, Midi_png, ggod, personman, Trent, u2ce
+Thanks to: Serioustar, WeiChei, Midi_png, ggod, personman, fnl4y, Trent, u2ce
Sandboxels is developed by R74n. Check out our other projects!