From 871f80403a3040f8da8b2ab1d0b5c7749b353510 Mon Sep 17 00:00:00 2001 From: feeshmaster <125420779+feeshmaster@users.noreply.github.com> Date: Tue, 21 Nov 2023 14:36:04 -0600 Subject: [PATCH 01/10] Create debugRework.js --- mods/debugRework.js | 169 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 mods/debugRework.js diff --git a/mods/debugRework.js b/mods/debugRework.js new file mode 100644 index 00000000..5350917f --- /dev/null +++ b/mods/debugRework.js @@ -0,0 +1,169 @@ +let cssForDebug = ` +#debugParent { + display: none; +} + +#debugXButton { + position: absolute; + right: 0px; + top: 0px; + font-size: 2em; + background-color: rgb(100, 33, 33); + padding:5px; + text-align:center; + border: 1px solid #ffffff; + z-index: 12; +} +#debugXButton:hover { + background-color: rgb(200, 33, 33); +} + +#debugMenuTitle { + position: absolute; + left: 175px; + font-size: 1.5em; + text-decoration: underline; + color: white; +} +#debugStats { + margin-top: 5px; + line-height: 1.5em; + color: white; +} + +#debugLiveButton { + position: absolute; + left: 0px; + top: 0px; + font-size: 2em; + background-color: rgb(100, 33, 33); + padding:5px; + text-align:center; + border: 1px solid #ffffff; + z-index: 12; +} + + + +#debugLiveButton.live { + background-color: #24fc03; +} + +#debugLiveButton.live:hover { + background-color: #50ff36; +} + +#debugStatList { + position: absolute; + border: 1px solid #ffffff; + left: 50%; + top: 5%; + transform: translate(-50%, 0%); + width: 95%; + height: 50%; + max-width: 700px; + padding: 10px; + background-color: rgb(31, 31, 31); + overflow-x: hidden; + z-index: 10; +} +`, + head = document.head || document.getElementsByTagName('head')[0], + style = document.createElement('style'); + +head.appendChild(style); + +style.type = 'text/css'; +if (style.styleSheet) { + style.styleSheet.cssText = cssForDebug; +} else { + style.appendChild(document.createTextNode(cssForDebug)); +}; +let debugMenu = document.createElement("div"); +debugMenu.innerHTML = ` + ` +document.getElementById("gameDiv").appendChild(debugMenu); +var statChangeInterval; +let live = false; +let openedByClick = true; +let debugToggle = false; +var output; +var targetedPixel; +elements.debug = { + color: ["#b150d4", "#d1b74f"], + tool: function(pixel) { + startDebugUi(pixel); + }, + maxSize: 1, + category: "tools" +} + +function startDebugUi(pixel) { + if (debugToggle) return; + targetedPixel = pixel; + mouseIsDown = false; + shiftDown = false; + output = targetedPixel.element.toUpperCase() + " at x" + targetedPixel.x + ", y" + targetedPixel.y + ", tick: " + pixelTicks + `
`; + for (let i in targetedPixel) { + if (i !== "x" && i !== "y" && i !== "element") { + output += " " + i + ": " + targetedPixel[i] + `
`; + } + } + statChangeInterval = setInterval(statChange, 1000/tps); + document.getElementById("debugParent").style.display = "block"; + document.getElementById("debugStats").innerHTML = output; + debugToggle = true; + + setTimeout(() => { + openedByClick = false; + document.addEventListener('click', clickHandler); + }, 0); +}; + +function closeDebugUi() { + if (!debugToggle) return; + openedByClick = true; + document.getElementById("debugParent").style.display = "none"; + debugToggle = false; + document.removeEventListener('click', clickHandler); + clearInterval(statChangeInterval); +} + +function clickHandler(event) { + const modParent = document.getElementById("debugParent"); + + if (event.target !== modParent && !modParent.contains(event.target)) { + closeDebugUi(); + } +} + +function startDebugLive() { + live = !live; + + document.getElementById("debugLiveButton").classList.toggle("live"); + +} +function statChange() { + if (live == true) { + output = targetedPixel.element.toUpperCase() + " at x" + targetedPixel.x + ", y" + targetedPixel.y + ", tick" + pixelTicks + `
`; + for (let i in targetedPixel) { + if (i !== "x" && i !== "y" && i !== "element") { + output += " " + i + ": " + targetedPixel[i] + `
`; + } + } + document.getElementById("debugStats").innerHTML = output; + } +} + From 507ec784e90691f032b47fc5b99400333901e8b6 Mon Sep 17 00:00:00 2001 From: feeshmaster <125420779+feeshmaster@users.noreply.github.com> Date: Tue, 21 Nov 2023 17:44:01 -0600 Subject: [PATCH 02/10] Update debugRework.js --- mods/debugRework.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/debugRework.js b/mods/debugRework.js index 5350917f..52ea5606 100644 --- a/mods/debugRework.js +++ b/mods/debugRework.js @@ -157,7 +157,7 @@ function startDebugLive() { } function statChange() { if (live == true) { - output = targetedPixel.element.toUpperCase() + " at x" + targetedPixel.x + ", y" + targetedPixel.y + ", tick" + pixelTicks + `
`; + output = targetedPixel.element.toUpperCase() + " at x" + targetedPixel.x + ", y" + targetedPixel.y + ", tick: " + pixelTicks + `
`; for (let i in targetedPixel) { if (i !== "x" && i !== "y" && i !== "element") { output += " " + i + ": " + targetedPixel[i] + `
`; From 1b828c04501d1e4cf9afafad7e2bd4ab80295137 Mon Sep 17 00:00:00 2001 From: feeshmaster <125420779+feeshmaster@users.noreply.github.com> Date: Tue, 21 Nov 2023 21:01:50 -0600 Subject: [PATCH 03/10] Update debugRework.js --- mods/debugRework.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/debugRework.js b/mods/debugRework.js index 52ea5606..ca437ff2 100644 --- a/mods/debugRework.js +++ b/mods/debugRework.js @@ -129,7 +129,7 @@ function startDebugUi(pixel) { setTimeout(() => { openedByClick = false; document.addEventListener('click', clickHandler); - }, 0); + }, 1000); }; function closeDebugUi() { From 7d7356a515e83e552b6e95e5ce060fb7cba82ec5 Mon Sep 17 00:00:00 2001 From: Cerulean <123337485+ceruleanminecraft@users.noreply.github.com> Date: Wed, 22 Nov 2023 14:40:57 -0600 Subject: [PATCH 04/10] Create coffee.js Version 1.0 of the coffee mod - a mod all about coffee! :) --- mods/coffee.js | 228 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 228 insertions(+) create mode 100644 mods/coffee.js diff --git a/mods/coffee.js b/mods/coffee.js new file mode 100644 index 00000000..f097fc49 --- /dev/null +++ b/mods/coffee.js @@ -0,0 +1,228 @@ +// Coffee Mod - Since coffee has been confirmed for a future update, I wanted to see what it might be like :) +// Created by Cerulean - special thanks to ggod :D +// If you have any suggestions for the mod, please leave a dm at @playblooket on discord (me) +// I'm not a pro modder, don't expect much lololol +// Version 1.0 // Last update - Nov 22 + +elements.coffee = { + color: "#22120d", + behavior: behaviors.LIQUID, + temp: 75, + category: "food", + viscosity: 27, + tempHigh: 200, + stateHigh: ["steam", "fragrance"], + tempLow: 4, + stateLow: "iced_coffee", + state: "liquid", + density: 308 +}; + +elements.iced_coffee = { + color: "#271f1c", + behavior: behaviors.LIQUID, + temp: -5, + category: "food", + viscosity: 35, + state: "liquid", + tempHigh: 10, + stateHigh: "coffee", + tempLow: -20, + stateLow: ["ice", "ground_coffee_bean"], + density: 308 +}; + +elements.latte = { + color: "#92817b", + behavior: behaviors.LIQUID, + temp: 75, + category: "food", + viscosity: 20, + tempHigh: 200, + stateHigh: ["steam", "fragrance"], + tempLow: 4, + stateLow: "iced_latte", + state: "liquid", + density: 822 +}; + +elements.iced_latte = { + color: "#271f1c", + behavior: behaviors.LIQUID, + temp: -5, + category: "food", + viscosity: 35, + state: "liquid", + tempHigh: 10, + stateHigh: "latte", + tempLow: -20, + stateLow: ["ice", "ground_coffee_bean", "creamer"], + density: 822 +}; + +elements.creamer = { + color: "#efe8e4", + behavior: behaviors.LIQUID, + category: "food", + viscosity: 5, + state: "liquid", + tempLow: -25, + stateLow: "ice_cream", + tempHigh: 150, + stateHigh: ["steam", "oil", "sugar"], + density: 500 +}; + +elements.coffee_bean = { + color: "#552717", + behavior: behaviors.POWDER, + category: "food", + viscosity: 1, + state: "solid", + tempLow: -20, + stateLow: "frozen_coffee_bean", + tempHigh: 200, + stateHigh: "roasted_coffee_bean", + breakInto: ["coffee_grounds", "ground_coffee_bean"], + density: 500 +}; + +elements.coffee_grounds = { + color: "#34160b", + behavior: behaviors.POWDER, + category: "powders", + viscosity: 1, + state: "solid", + tempHigh: 1200, + stateHigh: "molten_dirt", + tempLow: -50, + stateLow: "permafrost", + density: 550 +}; + +elements.ground_coffee_bean = { + color: "#552717", + behavior: behaviors.POWDER, + category: "food", + viscosity: 1, + state: "solid", + tempHigh: 200, + stateHigh: "roasted_ground_coffee_bean", + tempLow: -20, + stateLow: "frozen_coffee_bean", + density: 450 +}; + +elements.frozen_coffee_bean = { + color: "#5d4037", + behavior: behaviors.POWDER, + temp: -25 + category: "food", + viscosity: 1, + state: "solid", + tempHigh: -10, + stateHigh: "coffee_bean", + density: 550 +}; + +elements.frozen_ground_coffee_bean = { + color: "#533328", + behavior: behaviors.POWDER, + temp: -25 + category: "food", + viscosity: 1, + state: "solid", + tempLow: -10, + stateLow: "ground_coffee_bean", + density: 600 +}; + +elements.roasted_ground_coffee_bean = { + color: "#803e29", + behavior: behaviors.POWDER, + temp: 150 + category: "food", + viscosity: 1, + state: "solid", + tempHigh: 350, + stateHigh: "ash", + tempLow: -20, + stateLow: "frozen_ground_coffee_bean", + density: 350 +}; + +elements.roasted_coffee_bean = { + color: "#9e5842", + behavior: behaviors.POWDER, + category: "food", + viscosity: 1, + state: "solid", + tempLow: -20, + stateLow: "frozen_coffee_bean", + tempHigh: 300, + stateHigh: "ash", + breakInto: ["coffee_grounds", "roasted_ground_coffee_bean"] + density: 400 +}; + +elements.toffee = { + color: "#bf8d5f", + behavior: behaviors.POWDER, + category: "food", + viscosity: 1, + state: "solid", + tempHigh: 186, + stateHigh: "sugar", + breakInto: ["sugar", "h_bomb"] + density: 1000 +}; + +elements.espresso = { + color: "#170701", + behavior: behaviors.LIQUID, + temp: 75, + category: "food", + viscosity: 27, + tempHigh: 200, + stateHigh: ["steam", "fragrance"], + tempLow: 4, + stateLow: "iced_espresso", + state: "liquid", + density: 700 +}; + +elements.iced_espresso = { + color: "#2a1a12", + behavior: behaviors.LIQUID, + temp: -5, + category: "food", + viscosity: 35, + state: "liquid", + tempHigh: 10, + stateHigh: "espresso", + tempLow: -20, + stateLow: ["ice", "roasted_ground_coffee_bean"], + density: 700 +}; + +elements.cacaoffee = { + color: "#33180b", + behavior: behaviors.LIQUID, + temp: 75, + category: "food", + viscosity: 27, + tempHigh: 200, + stateHigh: ["steam", "melted_chocolate"], + tempLow: 4, + stateLow: ["chocolate", "iced_coffee"], + state: "liquid", + density: 308 +}; + +elements.milk.reactions.coffee = { "elem1":"latte"}; +elements.creamer.reactions.coffee = { "elem1":"latte"}; +elements.milk.reactions.ground_coffee_bean = { "elem1":"latte"}; +elements.creamer.reactions.roasted_ground_coffee_bean = { "elem1":"espresso"}; +elements.water.reactions.ground_coffee_bean = { "elem1":"coffee"}; +elements.water.reactions.coffee_grounds = { "elem1":"mud"}; +elements.chocolate.reactions.coffee = { "elem1":"latte"}; From 4bb3b2c9ed12f963ed12ccb27f2b94cb43c0ac05 Mon Sep 17 00:00:00 2001 From: feeshmaster <125420779+feeshmaster@users.noreply.github.com> Date: Sat, 25 Nov 2023 20:32:07 -0600 Subject: [PATCH 05/10] Update pixelResizeTool.js --- mods/pixelResizeTool.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/pixelResizeTool.js b/mods/pixelResizeTool.js index 5f35bb2c..beccf27c 100644 --- a/mods/pixelResizeTool.js +++ b/mods/pixelResizeTool.js @@ -3,7 +3,7 @@ pixelResizeButton.onclick = function(pixel) { let canvas_width = document.getElementById("game").width; let canvas_height = document.getElementById("game").height; let pixelSizeNeeded = prompt("How big should pixels be?"); - if (!pixelSizeNeeded) { return } + if (!pixelSizeNeeded || isNAN(pixelSizeNeeded)) { alert('number is invalid!'); return; } resizeCanvas(canvas_height,canvas_width, parseFloat(pixelSizeNeeded), true); }; pixelResizeButton.textContent = "Resize"; From 4d295cb22adf31c04798d0296b49cf769d36b64d Mon Sep 17 00:00:00 2001 From: JustAGenericUsername <92590792+JustAGenericUsername@users.noreply.github.com> Date: Sun, 26 Nov 2023 15:00:56 -0500 Subject: [PATCH 06/10] Add files via upload --- mods/nouserscaesium.js | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 mods/nouserscaesium.js diff --git a/mods/nouserscaesium.js b/mods/nouserscaesium.js new file mode 100644 index 00000000..74dbcb12 --- /dev/null +++ b/mods/nouserscaesium.js @@ -0,0 +1,47 @@ +elements.caesium = { +color: ["#917921", "#ebcb59", "#a48b2d", "#d6b84c"], +behavior: behaviors.SOLID, +category: "solids", +state: "solid", +tempHigh: 28.44, +stateHigh: "molten_caesium", +density: 1873, +reactions: { + "water": { "elem1":"pop", "elem2":"hydrogen" }, + "sugar_water": { "elem1":"pop", "elem2":"hydrogen" }, + "dirty_water": { "elem1":"pop", "elem2":"hydrogen" }, + "pool_water": { "elem1":"pop", "elem2":"hydrogen" }, + "salt_water": { "elem1":"pop", "elem2":"hydrogen" }, + "seltzer": { "elem1":"pop", "elem2":"hydrogen" }, + } +}; +elements.molten_caesium = { + color: ["#735c0a", "#a68e37", "#7e6715", "#9b832e"], + behavior: behaviors.LIQUID, + category: "states", + state: "liquid", + tempLow: 27.44, + stateLow: "caesium", + tempHigh: 671, + stateHigh: "caesium_vapor", + density: 1843, + temp: 29, + reactions: { + "water": { "elem1":"pop", "elem2":"hydrogen" }, + "sugar_water": { "elem1":"pop", "elem2":"hydrogen" }, + "dirty_water": { "elem1":"pop", "elem2":"hydrogen" }, + "pool_water": { "elem1":"pop", "elem2":"hydrogen" }, + "salt_water": { "elem1":"pop", "elem2":"hydrogen" }, + "seltzer": { "elem1":"pop", "elem2":"hydrogen" }, + } +}; +elements.caesium_vapor = { + color: ["#d89e77", "#cd9064", "#af6f34", "#a26320"], + behavior: behaviors.GAS, + category: "states", + state: "gas", + tempLow: 660, + stateLow: "molten_caesium", + density: 1.7, + temp: 700 +} \ No newline at end of file From 9534ecaeced3fc102ba9c5e346e9ec86939da1a8 Mon Sep 17 00:00:00 2001 From: lllllllllwith10ls <38187754+lllllllllwith10ls@users.noreply.github.com> Date: Sun, 26 Nov 2023 14:42:12 -0600 Subject: [PATCH 07/10] mixture.js and chem.js is free from the dependency hell --- mods/chem.js | 22 +- mods/mixture.js | 716 +++++++++++++++++++++++++++++++++++++++ mods/runAfterAutogen2.js | 6 +- 3 files changed, 727 insertions(+), 17 deletions(-) create mode 100644 mods/mixture.js diff --git a/mods/chem.js b/mods/chem.js index ed95088f..520af9f2 100644 --- a/mods/chem.js +++ b/mods/chem.js @@ -16,10 +16,6 @@ function whenAvailable(names, callback) { } }, interval); } -var runAfterAutogenMod = "mods/runAfterAutogen2.js"; -if(enabledMods.includes(runAfterAutogenMod)){ -whenAvailable(["runAfterAutogen"], function() { - elements.fluorine = { color: "#FFFFBF", @@ -1854,8 +1850,9 @@ elements.molten_potassium = { elements.potassium_gas = { color: "#5e6fdb" }; +elements.molten_salt = {}; +elements.molten_potassium_salt = {}; -runAfterAutogen(function() { elements.molten_salt.reactions = {}; elements.molten_salt.reactions.aluminum = { elem1:["sodium","chlorine"], charged:true, chance:0.0025 }; elements.molten_salt.reactions.zinc = { elem1:["sodium","chlorine"], charged:true, chance:0.015 }; @@ -1883,13 +1880,14 @@ runAfterAutogen(function() { elements.molten_potassium_salt.reactions.silver = { elem1:["potassium","chlorine"], charged:true, chance:0.0075 }; elements.molten_potassium_salt.reactions.gold = { elem1:["potassium","chlorine"], charged:true, chance:0.0075 }; elements.molten_potassium_salt.conduct = 0.7; - delete elements.molten_potassium_salt.burn; - delete elements.molten_potassium.burn; + elements.molten_potassium_salt.burn = 0; + elements.molten_potassium.burn = 0; //Hall–Heroult process + elements.molten_cryolite_solution = {}; elements.molten_cryolite_solution.reactions = {}; elements.molten_cryolite_solution.reactions.charcoal = { elem1:"molten_aluminum", elem2:"carbon_dioxide" }; -}); + elements.niter = { color: "#f0efcc", @@ -2654,10 +2652,4 @@ elements.bless.reactions["liquid_sulfur_dioxide"] = {elem2: "oxygen"}; elements.bless.reactions["sulfur_dioxide_ice"] = {elem2: "oxygen"}; elements.bless.reactions["hydrogen_sulfide"] = {elem2: "hydrogen"}; elements.bless.reactions["liquid_hydrogen_sulfide"] = {elem2: "hydrogen"}; -elements.bless.reactions["rocket_fuel"] = {elem2: null}; -}); -} else { - if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.unshift(runAfterAutogenMod) }; - localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); - alert(`The "${runAfterAutogenMod}" is required and have been automatically inserted (reload for this to take effect).`); -}; \ No newline at end of file +elements.bless.reactions["rocket_fuel"] = {elem2: null}; \ No newline at end of file diff --git a/mods/mixture.js b/mods/mixture.js new file mode 100644 index 00000000..eada089f --- /dev/null +++ b/mods/mixture.js @@ -0,0 +1,716 @@ +/* WARNING: not finished */ + + + +function whenAvailable(names, callback) { + var interval = 10; // ms + window.setTimeout(function() { + let bool = true; + for(let i = 0; i < names.length; i++) + { + if(!window[names[i]]) + { + bool = false; + } + } + if (bool) { + callback(); + } else { + whenAvailable(names, callback); + } + }, interval); +} +var runAfterAutogenMod = "mods/runAfterAutogen2.js"; + +function getName(elementList) +{ + let name = elementList.join(); + if(nameList[name]) + { + name = nameList[name]; + } + else + { + elementList = elementList.filter(function(item, pos, self) { + return self.indexOf(item) == pos; + }); + + let name = elementList.join(); + } + return name; +} + +function makeColors(elementList) +{ + let colors = []; + for(let i = 0; i < predefinedColors.length; i++) + { + if(predefinedColors[i][1].every(val => elementList.includes(val) + && predefinedColors[i][1].filter(el => el === val).length + <= + elementList.filter(el => el === val).length + )) + { + color = predefinedColors[i][0]; + if(color instanceof Array) + { + color = color.map((c) => "rgb("+hexToRGB(c).r+","+hexToRGB(c).g+","+hexToRGB(c).b+")"); + colors.push(color); + } + else + { + colors.push(["rgb("+hexToRGB(color).r+","+hexToRGB(color).g+","+hexToRGB(color).b+")"]); + } + for(let j = 0; j < predefinedColors[i][1].length; j++) + { + let index = elementList.indexOf(predefinedColors[i][1][j]); + if (index > -1) { // only splice array when item is found + elementList.splice(index, 1); // 2nd parameter means remove one item only + } + } + } + } + colors = colors.concat(elementList.map((c) => elements[c].color instanceof Array ? elements[c].color : [elements[c].color])); + return colors; +} + +function mixture(elementList) +{ + elementList.sort(); + + let name = getName(elementList); + + + if(!elements[name]) + { + elements[name] = true; + let minTempHigh = Infinity; + let stateHigh = null; + let indexStateHigh = -1; + + let maxTempLow = -Infinity; + let stateLow = null; + let indexStateLow = -1; + + + for(let i = 0; i < elementList.length; i++) + { + if(elements[elementList[i]]) + { + if(typeof elements[elementList[i]].tempHigh === "number" && elements[elementList[i]].stateHigh) + { + if(elements[elementList[i]].tempHigh < minTempHigh) + { + minTempHigh = elements[elementList[i]].tempHigh; + indexStateHigh = i; + stateHigh = elements[elementList[i]].stateHigh; + } + } + + if(typeof elements[elementList[i]].tempLow === "number" && elements[elementList[i]].stateLow) + { + if(elements[elementList[i]].tempLow > maxTempLow) + { + maxTempLow = elements[elementList[i]].tempLow; + indexStateLow = i; + stateLow = elements[elementList[i]].stateLow; + } + } + } + } + let elementList2 = elementList.slice(); + let elementHigh = null; + let gasesOk = gasOk(elementList); + if(indexStateHigh >= 0 && gasesOk) + { + if(stateHigh instanceof Array) + { + elementHigh = []; + for(let i = 0; i < stateHigh.length; i++) + { + elementList2[indexStateHigh] = stateHigh[i]; + if(isValidMixture(elementList2)) + { + elementHigh.push(mixture(elementList2)); + } + } + } + else + { + elementList2[indexStateHigh] = stateHigh; + if(isValidMixture(elementList2)) + { + elementHigh = mixture(elementList2); + } + else + { + minTempHigh = Infinity; + elementHigh = null; + } + } + } + + let elementList3 = elementList.slice(); + let elementLow = null; + if(indexStateLow >= 0 && gasesOk) + { + if(stateLow instanceof Array) + { + elementLow = []; + for(let i = 0; i < stateLow.length; i++) + { + elementList3[indexStateLow] = stateLow[i]; + if(isValidMixture(elementList3)) + { + elementLow.push(mixture(elementList3)); + } + } + } + else + { + elementList3[indexStateLow] = stateLow; + if(isValidMixture(elementList3)) + { + elementLow = mixture(elementList3); + } + else + { + maxTempLow = -Infinity; + elementLow = null; + } + } + } + + if(elementHigh instanceof Array && elementHigh.length === 0) + { + minTempHigh = Infinity; + elementHigh = null; + } + if(elementLow instanceof Array && elementLow.length === 0) + { + maxTempLow = -Infinity; + elementLow = null; + } + + let colors = makeColors(elementList.slice()); + let colors2 = []; + let maxLength = Math.max(...(colors.map((c) => c.length))); + + for(let i = 0; i < maxLength; i++) + { + let colors3 = []; + for(let j = 0; j < colors.length; j++) + { + colors3.push(toObject(colors[j][i%colors[j].length])); + } + colors2.push(averageRGB(colors3)); + } + let temp = airTemp; + if(maxTempLow < airTemp && minTempHigh > airTemp) + { + + } + else if(maxTempLow > -Infinity && minTempHigh < Infinity) + { + temp = (maxTempLow + minTempHigh)/2; + } + else if(maxTempLow > -Infinity) + { + temp = maxTempLow+20; + } + else if(minTempHigh < Infinity) + { + temp = Math.max(minTempHigh-20,absoluteZero); + } + + let movable = !elementList.some((c) => !elements[c].movable); + + let density = elementList.map((c) => elements[c].density ? elements[c].density : 0).reduce((a,b)=>a+b)/elementList.length; + let stain = elementList.map((c) => elements[c].stain ? elements[c].stain : 0).reduce((a,b)=>a+b)/elementList.length; + + if(elementList.some((c) => c.includes("molten")) || elementList.some((c) => c.includes("magma"))) + { + movable = true; + } + + let states = elementList.map((c) => elements[c].state); + if(!gasesOk) + { + state = "gas"; + density = 0; + } + else if(!movable) + { + state = "solid"; + } + else if(states.includes("liquid")) + { + state = "liquid"; + } + else + { + state = "solid"; + } + + elements[name] = { + color: colors2.length == 1 ? colors2[0] : colors2, + colorObject: colors2.length == 1 ? toObject(colors2[0]) :colors2.map((c) => toObject(c)), + tick: function(pixel) { + checkReactions(pixel, elements[pixel.element].mixture); + mixtureBehavior(pixel, elements[pixel.element].mixture); + doDefaults(pixel); + }, + tempHigh: minTempHigh, + stateHigh: elementHigh, + tempLow: maxTempLow, + stateLow: elementLow, + temp: temp, + category: "mixture", + mixture: elementList, + movable: movable, + density: density, + state: state, + stain: stain, + reactions: {}, + }; + + elementCount++; + elements[name].hidden = true; + hiddenCount++; + elements[name].id = nextid++; + document.getElementById("extraInfo").innerHTML = "

There are " + elementCount + " elements, including " + hiddenCount + " hidden ones.

©2021-" + new Date().getFullYear() + ". All Rights Reserved. R74n

"; //update extra info counts (and the copyright year, due to the method used) + } + else if(!elements[name].mixture) + { + elements[name].mixture = elementList; + let tick = elements[name].tick; + if(!elements[name].reactions) + { + elements[name].reactions = {}; + } + elements[name].tick = function(pixel) { + checkReactions(pixel, elements[pixel.element].mixture); + if(typeof tick === "function") + { + tick(pixel); + } + } + } + return name; +} + +function checkReactions(pixel, elementList) +{ + for (let i = -1; i <= 1; i++) + { + for (let j = -1; j <= 1; j++) + { + if (!(i === 0 && j === 0) && !isEmpty(pixel.x+i,pixel.y+j,true) + && !elements[pixel.element].reactions[pixelMap[pixel.x+i][pixel.y+j].element]) + { + let otherElement = pixelMap[pixel.x+i][pixel.y+j].element; + let otherList = [otherElement]; + if(elements[otherElement].mixture) + { + otherList = elements[otherElement].mixture; + } + let list = elements[pixel.element]; + if(compatableMix(elements[pixel.element].mixture,otherList)) + { + elements[pixel.element].reactions[otherElement] = {elem1: mixture(elements[pixel.element].mixture.concat(otherList)),elem2:null};; + } + else + { + elements[pixel.element].reactions[otherElement] = {}; + } + } + } + } +} + +function mixtureBehavior(pixel, elementList) +{ + let gasesOk = gasOk(elementList); + let gases = elementList.filter((c) => elements[c].state === "gas"); + if(!gasesOk) + { + let neighbors = [ [-1,0], [1,0], [0,-1], [0,1] ] + let randomNeighbor = neighbors[Math.floor(Math.random() * neighbors.length)] + let randomGas = gases[Math.floor(Math.random() * gases.length)] + let rnx = randomNeighbor[0]; + let rny = randomNeighbor[1]; + if(isEmpty(pixel.x+rnx, pixel.y+rny, false)) { + let index = elementList.indexOf(randomGas); + if (index > -1) { + createPixel(randomGas, pixel.x+rnx, pixel.y+rny); + currentPixels[currentPixels.length-1].temp = pixel.temp; + changePixel(pixel, mixture(elementList.slice(0, index).concat(elementList.slice(index+1)))); + return; + } + } + behaviors.GAS(pixel); + return; + } + let states = elementList.map((c) => elements[c].state); + if(elementList.some((c) => c.includes("molten")) || elementList.some((c) => c.includes("magma"))) + { + pixelTick(pixel,behaviors.MOLTEN); + } + else if(!elements[pixel.element].movable) + { + return; + } + else if(states.includes("liquid")) + { + if(elementList.includes("carbon_dioxide")) + { + pixelTick(pixel,elements.soda.behavior); + } + else + { + behaviors.LIQUID(pixel); + } + } + else + { + behaviors.POWDER(pixel); + } +} + +function toObject(color) +{ + color = color.match(/\d+/g); + return { + r: parseInt(color[0]), + g: parseInt(color[1]), + b: parseInt(color[2]) + }; +} + +function averageRGB2(colors) +{ + return toObject(averageRGB(colors.map((d) => (toObject(d))))); +} + +function averageRGB(rgblist) { + var r = 0; + var g = 0; + var b = 0; + for (var i = 0; i < rgblist.length; i++) { + var rgb = rgblist[i]; + r += parseInt(rgb.r); + g += parseInt(rgb.g); + b += parseInt(rgb.b); + } + r = Math.floor(r/rgblist.length); + g = Math.floor(g/rgblist.length); + b = Math.floor(b/rgblist.length); + return "rgb("+r+","+g+","+b+")"; +} + + +function blendColors(colorA, colorB, amount = 0.5) { + const [rA, gA, bA] = colorA.match(/\w\w/g).map((c) => parseInt(c, 16)); + const [rB, gB, bB] = colorB.match(/\w\w/g).map((c) => parseInt(c, 16)); + const r = Math.round(rA + (rB - rA) * amount).toString(16).padStart(2, '0'); + const g = Math.round(gA + (gB - gA) * amount).toString(16).padStart(2, '0'); + const b = Math.round(bA + (bB - bA) * amount).toString(16).padStart(2, '0'); + return '#' + r + g + b; +} + +let mixtureGroups = []; + +function compatableMix(list1,list2) +{ + if(!gasOk(list1.concat(list2))) + { + return false; + } + for(let i = 0; i < mixtureGroups.length; i++) + { + if(list1.concat(list2).every(val => mixtureGroups[i].includes(val) + && list1.concat(list2).filter(el => el === val).length + <= + mixtureGroups[i].filter(el => el === val).length + )) + { + return true; + } + } + return false; +} + +function mixture2(elementList) +{ + mixtureGroups.push(elementList); + for(let i = 0; i < elementList.length; i++) + { + for(let j = i+1; j < elementList.length; j++) + { + if(compatableMix([elementList[i]],[elementList[j]])) + { + if(!elements[elementList[i]].reactions) + { + elements[elementList[i]].reactions = {}; + } + elements[elementList[i]].reactions[elementList[j]] = {elem1: mixture([elementList[i],elementList[j]]),elem2:null}; + } + } + } + mixture3(elementList,[],0); +} + +function mixture3(elementList, list, n) +{ + if(list.length > 0) + { + mixture(list); + } + if(n < elementList.length) + { + mixture3(elementList,list,n+1); + if(compatableMix(list,[elementList[n]])) + { + mixture3(elementList,list.concat([elementList[n]]),n+1); + } + } +} + + +//exceptions to releasing gas +function gasOk(elementList) +{ + let gases = elementList.filter((c) => elements[c].state === "gas"); + if(elementList.includes("water") || elementList.includes("ice")) + { + gases = gases.filter((c) => c !== "carbon_dioxide"); + } + return gases.length <= 0; +} + +//exceptions to mixtures +function isValidMixture(elementList) +{ + if(elementList.includes("dry_ice")) + { + return false; + } + return true; +} + +if(enabledMods.includes(runAfterAutogenMod)){ +whenAvailable(["runAfterAutogen"], function() { + runAfterAutogen(function() { + mixture2(["water","blood"]); + mixture2(["water","cough_drugs","cellulose_gum","carbon_dioxide","sugar","milk"]); + + }); +}); +} + + +predefinedColors = [ + ["#8f19c2",["sugar","carbon_dioxide","cough_drugs","water","cellulose_gum"]], + ["#ab1efc",["sugar","carbon_dioxide","cough_drugs","ice","cellulose_gum"]], + ["#a527db",["sugar","carbon_dioxide","cough_drugs","water"]], + ["#c62eff",["sugar","carbon_dioxide","cough_drugs","ice"]], + ["#422016",["sugar","carbon_dioxide","water"]], + ["#4f261c",["sugar","carbon_dioxide","ice"]], + ["#e9cba3",["sugar","carbon_dioxide","water","milk"]], + ["#fff3d3",["sugar","carbon_dioxide","ice","milk"]], +] + +/* +var c = elements.lean.colorObject; +for (var j = 0; j < autoElements.frozen.rgb.length; j++) { + var newc = autoElements.frozen.rgb[j]; + r = Math.floor(c.r * newc[0]); + g = Math.floor(c.g * newc[1]); + b = Math.floor(c.b * newc[2]); + if (r > 255) {r = 255;} if (g > 255) {g = 255;} if (b > 255) {b = 255;} + alert(RGBToHex({r:r,g:g,b:b})); + }*/ + +nameList = {}; + +nameList[["blood","water"].sort().join()] = "bloody_water"; +nameList[["blood","ice"].sort().join()] = "bloody_slush"; +nameList[["blood_ice","water"].sort().join()] = "slushy_blood"; +nameList[["blood_ice","ice"].sort().join()] = "bloody_ice"; + +nameList[["cough_drugs","water"].sort().join()] = "cough_water"; +nameList[["cough_drugs","ice"].sort().join()] = "cough_ice"; +nameList[["cellulose_gum","water"].sort().join()] = "thick_water"; +nameList[["cellulose_gum","ice"].sort().join()] = "thick_ice"; +nameList[["cough_drugs","cellulose_gum"].sort().join()] = "dried_unsweetened_cough_syrup"; +nameList[["molten_cough_drugs","cellulose_gum"].sort().join()] = "molten_dried_unsweetened_cough_syrup"; +nameList[["cough_drugs","cellulose_gum","water"].sort().join()] = "unsweetened_cough_syrup"; +nameList[["cough_drugs","cellulose_gum","ice"].sort().join()] = "unsweetened_cough_syrup_ice"; + +nameList[["carbon_dioxide","water"].sort().join()] = "seltzer"; +nameList[["carbon_dioxide","ice"].sort().join()] = "seltzer_ice"; + +nameList[["carbon_dioxide","cough_drugs","water"].sort().join()] = "cough_seltzer"; +nameList[["carbon_dioxide","cough_drugs","ice"].sort().join()] = "cough_seltzer_ice"; +nameList[["carbon_dioxide","cellulose_gum","water"].sort().join()] = "thick_seltzer"; +nameList[["carbon_dioxide","cellulose_gum","ice"].sort().join()] = "thick_seltzer_ice"; +nameList[["carbon_dioxide","cough_drugs","cellulose_gum","water"].sort().join()] = "thick_cough_seltzer"; +nameList[["carbon_dioxide","cough_drugs","cellulose_gum","ice"].sort().join()] = "thick_cough_seltzer_ice"; + + + +nameList[["sugar","water"].sort().join()] = "sugar_water"; +nameList[["sugar","ice"].sort().join()] = "sugar_ice"; + +nameList[["sugar","cough_drugs","water"].sort().join()] = "sweetened_cough_water"; +nameList[["sugar","cough_drugs","ice"].sort().join()] = "sweetened_cough_ice"; +nameList[["sugar","cellulose_gum","water"].sort().join()] = "thick_sugar_water"; +nameList[["sugar","cellulose_gum","ice"].sort().join()] = "thick_sugar_ice"; +nameList[["sugar","cough_drugs","cellulose_gum"].sort().join()] = "dried_cough_syrup"; +nameList[["sugar","molten_cough_drugs","cellulose_gum"].sort().join()] = "molten_dried_cough_syrup"; +nameList[["sugar","cough_drugs","cellulose_gum","water"].sort().join()] = "cough_syrup"; +nameList[["sugar","cough_drugs","cellulose_gum","ice"].sort().join()] = "cough_syrup_ice"; + +nameList[["sugar","carbon_dioxide","water"].sort().join()] = "soda"; +nameList[["sugar","carbon_dioxide","ice"].sort().join()] = "soda_ice"; + +nameList[["sugar","carbon_dioxide","cough_drugs","water"].sort().join()] = "runny_lean"; +nameList[["sugar","carbon_dioxide","cough_drugs","ice"].sort().join()] = "runny_lean_ice"; +nameList[["sugar","carbon_dioxide","cellulose_gum","water"].sort().join()] = "thick_soda"; +nameList[["sugar","carbon_dioxide","cellulose_gum","ice"].sort().join()] = "thick_soda_ice"; +nameList[["sugar","carbon_dioxide","cough_drugs","cellulose_gum","water"].sort().join()] = "lean"; +nameList[["sugar","carbon_dioxide","cough_drugs","cellulose_gum","ice"].sort().join()] = "lean_ice"; + +nameList[["sugar","cough_drugs"].sort().join()] = "cough_sugar"; +nameList[["sugar","molten_cough_drugs"].sort().join()] = "molten_cough_sugar"; +nameList[["caramel","molten_cough_drugs"].sort().join()] = "molten_cough_caramel"; +nameList[["caramel","cough_drugs"].sort().join()] = "cough_caramel"; +nameList[["candy","cough_drugs"].sort().join()] = "cough_candy"; +nameList[["candy","molten_cough_drugs"].sort().join()] = "molten_cough_candy"; + +nameList[["sugar","cellulose_gum"].sort().join()] = "sweet_cellulose_gum"; +nameList[["caramel","cellulose_gum"].sort().join()] = "caramel_cellulose_gum"; +nameList[["candy","cellulose_gum"].sort().join()] = "cellulose_gum_candy"; + + +nameList[["cellulose_gum","caramel","molten_cough_drugs"].sort().join()] = "molten_caramelized_cough_syrup"; +nameList[["cellulose_gum","caramel","cough_drugs"].sort().join()] = "caramelized_cough_syrup"; +nameList[["cellulose_gum","candy","cough_drugs"].sort().join()] = "cough_drop"; +nameList[["cellulose_gum","candy","molten_cough_drugs"].sort().join()] = "molten_cough_drop"; + +function milkNames(elements,name) +{ + nameList[elements.concat("milk").sort().join()] = name + "_milk"; + nameList[elements.concat("yogurt").sort().join()] = name + "_yogurt"; + nameList[elements.concat("frozen_yogurt").sort().join()] = name + "_frozen_yogurt"; + nameList[elements.concat("cream").sort().join()] = name + "_cream"; + nameList[elements.concat("ice_cream").sort().join()] = name + "_ice_cream"; +} + +nameList[["calcium","cough_drugs"].sort().join()] = "calcified_cough_syrup"; +nameList[["calcium","molten_cough_drugs"].sort().join()] = "calcified_molten_cough_syrup"; +nameList[["molten_calcium","molten_cough_drugs"].sort().join()] = "molten_calcified_cough_syrup"; + + +milkNames2([ +["water","ice","cellulose_gum","sugar","carbon_dioxide","caramel","candy","cough_drugs","molten_cough_drugs"], +["watery","icy","thick","sweetened","carbonated","caramelized","candied","cough","cough"]],[[],""],0); + +function milkNames2(elementList, list, n) +{ + if(list[0].length > 0) + { + if(list[0].includes("molten_cough_drugs")) + { + milkNames(list[0], "molten" + list[1]); + } + else + { + milkNames(list[0], list[1].substring(1)); + } + } + if(n < elementList[0].length && n < elementList[1].length) + { + milkNames2(elementList,list,n+1); + list2 = [list[0].concat([elementList[0][n]]),list[1] + "_" + elementList[1][n]]; + if(list2[0]) + { + milkNames2(elementList,list2,n+1); + } + } +} + +for(let i in nameList) +{ + if(nameList[i].includes("sweetened_carbonated_")) + { + nameList[i] = nameList[i].replace("sweetened_carbonated_",""); + nameList[i] += "_soda"; + } +} + +nameList[["sugar","carbon_dioxide","water","milk"].sort().join()] = "pilk"; +nameList[["sugar","carbon_dioxide","ice","milk"].sort().join()] = "icy_pilk"; +nameList[["sugar","carbon_dioxide","water","yogurt"].sort().join()] = "pogurt"; +nameList[["sugar","carbon_dioxide","ice","yogurt"].sort().join()] = "icy_pogurt"; +nameList[["sugar","carbon_dioxide","water","frozen_yogurt"].sort().join()] = "frozen_pogurt"; +nameList[["sugar","carbon_dioxide","ice","frozen_yogurt"].sort().join()] = "icy_frozen_pogurt"; +nameList[["sugar","carbon_dioxide","water","cream"].sort().join()] = "pilk_cream"; +nameList[["sugar","carbon_dioxide","ice","cream"].sort().join()] = "icy_pilk_cream"; +nameList[["sugar","carbon_dioxide","water","ice_cream"].sort().join()] = "pice_cream"; +nameList[["sugar","carbon_dioxide","ice","ice_cream"].sort().join()] = "icy_pice_cream"; + + +nameList[["cellulose_gum","sugar","carbon_dioxide","water","milk"].sort().join()] = "thick_pilk"; +nameList[["cellulose_gum","sugar","carbon_dioxide","ice","milk"].sort().join()] = "icy_thick_pilk"; +nameList[["cellulose_gum","sugar","carbon_dioxide","water","yogurt"].sort().join()] = "thick_pogurt"; +nameList[["cellulose_gum","sugar","carbon_dioxide","ice","yogurt"].sort().join()] = "icy_thick_pogurt"; +nameList[["cellulose_gum","sugar","carbon_dioxide","water","frozen_yogurt"].sort().join()] = "frozen_thick_pogurt"; +nameList[["cellulose_gum","sugar","carbon_dioxide","ice","frozen_yogurt"].sort().join()] = "icy_frozen_thick_pogurt"; +nameList[["cellulose_gum","sugar","carbon_dioxide","water","cream"].sort().join()] = "thick_pilk_cream"; +nameList[["cellulose_gum","sugar","carbon_dioxide","ice","cream"].sort().join()] = "icy_thick_pilk_cream"; +nameList[["cellulose_gum","sugar","carbon_dioxide","water","ice_cream"].sort().join()] = "thick_pice_cream"; +nameList[["cellulose_gum","sugar","carbon_dioxide","ice","ice_cream"].sort().join()] = "icy_thick_pice_cream"; + + +nameList[["cough_drugs","cellulose_gum","sugar","carbon_dioxide","water","milk"].sort().join()] = "lilk"; +nameList[["cough_drugs","cellulose_gum","sugar","carbon_dioxide","ice","milk"].sort().join()] = "icy_lilk"; +nameList[["cough_drugs","cellulose_gum","sugar","carbon_dioxide","water","yogurt"].sort().join()] = "logurt"; +nameList[["cough_drugs","cellulose_gum","sugar","carbon_dioxide","ice","yogurt"].sort().join()] = "icy_logurt"; +nameList[["cough_drugs","cellulose_gum","sugar","carbon_dioxide","water","frozen_yogurt"].sort().join()] = "frozen_logurt"; +nameList[["cough_drugs","cellulose_gum","sugar","carbon_dioxide","ice","frozen_yogurt"].sort().join()] = "icy_frozen_logurt"; +nameList[["cough_drugs","cellulose_gum","sugar","carbon_dioxide","water","cream"].sort().join()] = "lilk_cream"; +nameList[["cough_drugs","cellulose_gum","sugar","carbon_dioxide","ice","cream"].sort().join()] = "icy_lilk_cream"; +nameList[["cough_drugs","cellulose_gum","sugar","carbon_dioxide","water","ice_cream"].sort().join()] = "leanice_cream"; +nameList[["cough_drugs","cellulose_gum","sugar","carbon_dioxide","ice","ice_cream"].sort().join()] = "icy_leanice_cream"; + +nameList[["cough_drugs","sugar","carbon_dioxide","water","milk"].sort().join()] = "runny_lilk"; +nameList[["cough_drugs","sugar","carbon_dioxide","ice","milk"].sort().join()] = "icy_runny_lilk"; +nameList[["cough_drugs","sugar","carbon_dioxide","water","yogurt"].sort().join()] = "runny_logurt"; +nameList[["cough_drugs","sugar","carbon_dioxide","ice","yogurt"].sort().join()] = "icy_runny_logurt"; +nameList[["cough_drugs","sugar","carbon_dioxide","water","frozen_yogurt"].sort().join()] = "frozen_runny_logurt"; +nameList[["cough_drugs","sugar","carbon_dioxide","ice","frozen_yogurt"].sort().join()] = "icy_frozen_runny_logurt"; +nameList[["cough_drugs","sugar","carbon_dioxide","water","cream"].sort().join()] = "runny_lilk_cream"; +nameList[["cough_drugs","sugar","carbon_dioxide","ice","cream"].sort().join()] = "icy_runny_lilk_cream"; +nameList[["cough_drugs","sugar","carbon_dioxide","water","ice_cream"].sort().join()] = "runny_leanice_cream"; +nameList[["cough_drugs","sugar","carbon_dioxide","ice","ice_cream"].sort().join()] = "icy_runny_leanice_cream"; + +elements.cough_drugs = { + density: 1230, //using the 6.25/10 ratio from a CP/PH cough syrup from Morton Grove Pharmaceuticals, Inc. because it was in hot on r/lean (of course there’s a subreddit for that) | this is 6.25 mg pr.hy. and 10 mg co.ph. per 5mL dose, but ratios and reactions aren’t possible and implementing them to this accuracy would also require an accurate cough syrup density + tempHigh: 157.5, + color: "#e0e4e0", + behavior: behaviors.POWDER, + category: "powders", + state: "solid" +} + + +elements.cellulose_gum = { + density: 1600, + tempHigh: 270, + stateHigh: "fire", + color: "#f7e7b7", + behavior: behaviors.POWDER, + category: "powders", + state: "solid" +} \ No newline at end of file diff --git a/mods/runAfterAutogen2.js b/mods/runAfterAutogen2.js index d7b1f692..8ea63f87 100644 --- a/mods/runAfterAutogen2.js +++ b/mods/runAfterAutogen2.js @@ -11,8 +11,10 @@ function runAfterAutogen(callback) { }, interval); } function createButtonsAndCountElements() { - document.getElementById("categoryControls").innerHTML = ""; + window.setTimeout(function() { + document.getElementById("categoryControls").innerHTML = ""; document.getElementById("elementControls").innerHTML = ""; + document.getElementById("category-tools").innerHTML = ""; document.getElementById("extraInfo").innerHTML = ""; elementCount = 0; hiddenCount = 0; @@ -46,7 +48,7 @@ function createButtonsAndCountElements() { document.getElementById("categoryControls").children[0].click() document.getElementById("extraInfo").insertAdjacentHTML("beforeend", "

v" + currentversion + " • " + elementCount + " elements, including " + hiddenCount + " hidden ones.

©2021-" + new Date().getFullYear() + ". All Rights Reserved. R74n

"); selectElement(currentElement); - + }, 10); }; runAfterAutogen(createButtonsAndCountElements); \ No newline at end of file From 948821e4541572ffff50e975e191b99a6e4a7bb2 Mon Sep 17 00:00:00 2001 From: lllllllllwith10ls <38187754+lllllllllwith10ls@users.noreply.github.com> Date: Sun, 26 Nov 2023 14:56:22 -0600 Subject: [PATCH 08/10] changed chem.js mod interaction --- mods/chem.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/chem.js b/mods/chem.js index 520af9f2..6f6c0666 100644 --- a/mods/chem.js +++ b/mods/chem.js @@ -416,7 +416,7 @@ trueAcidGases = ["acid_gas", "hydrofluoric_acid_gas"]; if (enabledMods.includes("mods/generative_mods.js")) { -whenAvailable(["generateCloud"], function() { +runAfterLoad(function() { generateCloud("hydrofluoric_acid"); elements["hydrofluoric_acid_gas"].reactions["hydrofluoric_acid_gas"]= { "elem1": null, "elem2": "hydrofluoric_acid_cloud", "chance":0.3, "y":[0,12], "setting":"clouds" }; elements["hydrofluoric_acid_gas"].reactions["rain_cloud"]= { "elem1": null, "elem2": "hydrofluoric_acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }; @@ -476,7 +476,7 @@ function createAcid(name,reactions, gasReactions, color, category, categoryGas, elements.bless.reactions[name] = { elem2: "hydrogen" }; elements.bless.reactions[name+"_gas"] = { elem2: "hydrogen" }; if (enabledMods.includes("mods/generative_mods.js")) { - whenAvailable(["generateCloud"], function() { + runAfterLoad(function() { generateCloud(name); elements[name+"_gas"].reactions[name+"_gas"]= { "elem1": null, "elem2": name + "_cloud", "chance":0.3, "y":[0,12], "setting":"clouds" }; elements[name+"_gas"].reactions["rain_cloud"]= { "elem1": null, "elem2": name + "_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }; From 657244d2fd757fb2a75a826bca49714a6a51c54c Mon Sep 17 00:00:00 2001 From: JustAGenericUsername <92590792+JustAGenericUsername@users.noreply.github.com> Date: Sun, 26 Nov 2023 18:41:09 -0500 Subject: [PATCH 09/10] Update nouserscaesium.js --- mods/nouserscaesium.js | 58 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 3 deletions(-) diff --git a/mods/nouserscaesium.js b/mods/nouserscaesium.js index 74dbcb12..c4511bd4 100644 --- a/mods/nouserscaesium.js +++ b/mods/nouserscaesium.js @@ -14,7 +14,7 @@ reactions: { "salt_water": { "elem1":"pop", "elem2":"hydrogen" }, "seltzer": { "elem1":"pop", "elem2":"hydrogen" }, } -}; +}, elements.molten_caesium = { color: ["#735c0a", "#a68e37", "#7e6715", "#9b832e"], behavior: behaviors.LIQUID, @@ -34,7 +34,7 @@ elements.molten_caesium = { "salt_water": { "elem1":"pop", "elem2":"hydrogen" }, "seltzer": { "elem1":"pop", "elem2":"hydrogen" }, } -}; +}, elements.caesium_vapor = { color: ["#d89e77", "#cd9064", "#af6f34", "#a26320"], behavior: behaviors.GAS, @@ -44,4 +44,56 @@ elements.caesium_vapor = { stateLow: "molten_caesium", density: 1.7, temp: 700 -} \ No newline at end of file +}, +elements.subzero_grass_seed = { + color: ["#022c14", "#032911", "#032205", "#021f00"], + behavior: [ + "XX|M2%0.1|XX", + "XX|L2:subzero_grass AND C2:subzero_grass%15|XX", + "XX|M1|XX", + ], + category: "life", + state: "solid", + tempHigh: 10, + temp: 0, + stateHigh: "dead_plant", + density: 1400 +}, +elements.subzero_grass = { + color: ["#003220", "#022a1a", "#032314", "#001c0d"], + behavior: behaviors.STURDYPOWDER, + category: "life", + state: "solid", + tempHigh: 13, + temp: 0, + stateHigh: "dead_plant", + density:1400 +}, +elements.technetium = { + color: ["#e7d9bb", "#bab195", "#8f8a70", "#66654e"], + behavior: [ + "XX|XX|XX", + "XX|CH:neutron%0.07|XX", + "XX|XX|XX", + ], + category: "solids", + state: "solid", + tempHigh: 2157, + stateHigh: "molten_technetium", + density: 11500 +}, + elements.molten_technetium = { + color: ["#d16b42", "#da904c", "#dfb360", "#e2d57f"], + behavior: behaviors.LIQUID, + tick: function(pixel) { + if (Math.random() < 0.0007) { + changePixel(pixel, "neutron", false); + } + }, + category: "states", + state: "liquid", + tempLow: 2140, + temp: 2200, + stateLow: "technetium", + density: 11400 +} From 5fce4a014ddecc180c49fc1fd09a701b575a9a30 Mon Sep 17 00:00:00 2001 From: JustAGenericUsername <92590792+JustAGenericUsername@users.noreply.github.com> Date: Sun, 26 Nov 2023 18:42:35 -0500 Subject: [PATCH 10/10] Rename nouserscaesium.js to nousersthings.js --- mods/{nouserscaesium.js => nousersthings.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename mods/{nouserscaesium.js => nousersthings.js} (100%) diff --git a/mods/nouserscaesium.js b/mods/nousersthings.js similarity index 100% rename from mods/nouserscaesium.js rename to mods/nousersthings.js