From 923e2de477f990a48cb19cfb41ce4f05427c0f3a Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 23 Apr 2023 13:59:50 -0400 Subject: [PATCH 01/41] emergency name fix --- mods/fire_mod.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/fire_mod.js b/mods/fire_mod.js index d6e2096d..bb87986f 100644 --- a/mods/fire_mod.js +++ b/mods/fire_mod.js @@ -1,4 +1,4 @@ -var modName = "mods/random_rocks.js"; +var modName = "mods/fire_mpd.js"; var libraryMod = "mods/code_library.js"; if(enabledMods.includes(libraryMod)) { From fdbe2846e71bf947076c1e008632dc183a582098 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 23 Apr 2023 14:00:33 -0400 Subject: [PATCH 02/41] fix typo i'm going to fucking kashoot myself /j --- mods/fire_mod.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/fire_mod.js b/mods/fire_mod.js index bb87986f..5aa4a25c 100644 --- a/mods/fire_mod.js +++ b/mods/fire_mod.js @@ -1,4 +1,4 @@ -var modName = "mods/fire_mpd.js"; +var modName = "mods/fire_mod.js"; var libraryMod = "mods/code_library.js"; if(enabledMods.includes(libraryMod)) { From 714fdb410b1584c461d32b7ce461f337dec8af5e Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 23 Apr 2023 14:34:27 -0400 Subject: [PATCH 03/41] ionized carbon and oxygen, cl dep --- mods/boiling_things.js | 1053 +++++++++++++++++++++++----------------- 1 file changed, 616 insertions(+), 437 deletions(-) diff --git a/mods/boiling_things.js b/mods/boiling_things.js index 4522881c..21c8b095 100644 --- a/mods/boiling_things.js +++ b/mods/boiling_things.js @@ -1,485 +1,664 @@ -//glass { +var modName = "mods/boiling_things.js"; +var libraryMod = "mods/code_library.js"; - elements.molten_glass = { - tempHigh: 2200, - stateHigh: "vaporized_glass", - } - - elements.vaporized_glass = { - color: ["#D6B049","#E8D957","#E8AE57"], - behavior: [ - "M2|M1|M2", - "M1|XX|M1", - "M2|M1|M2", - ], - reactions: { - "vaporized_glass": { "elem1": null, "elem2": "hot_glass_cloud", "chance":0.3, "y":[0,15] }, - "hot_glass_cloud": { "elem1": "hot_glass_cloud", "chance":0.4, "y":[0,15] }, - }, - density: 2, //very rough approximation based on https://nvlpubs.nist.gov/nistpubs/jres/46/jresv46n3p176_A1b.pdf - temp: 2300, //https://www.sciencealert.com/did-this-piece-of-glass-really-break-a-law-of-thermodynamics - tempLow: 2200, - stateLow: "molten_glass", - category: "gases", - state: "gas", - hidden: true, - }, +if(enabledMods.includes(libraryMod)) { - elements.hot_glass_cloud = { - color: ["#B69089","#C8B997","#C88E77"], - behavior: [ - "XX|XX|XX", - "M1%7|CH:molten_glass%0.05|M1%7", - "XX|XX|XX", - ], - density: 2, - temp: 2300, - tempLow: 2200, - stateLow: "cold_glass_cloud", - category: "gases", - state: "gas", - }, - - elements.cold_glass_cloud = { - color: ["#967089","#A89997","#A86E77"], - behavior: [ - "XX|XX|XX", - "M1%7|CH:glass_shard%0.05|M1%7", - "XX|XX|XX", - ], - density: 2, - temp: 2000, - tempHigh: 2200, - stateHigh: "hot_glass_cloud", - category: "gases", - state: "gas", - }, + //glass { -//} - -// ash { - - elements.ash.tempHigh = 1200 //https://www.quora.com/Can-you-melt-ashes - elements.ash.stateHigh = "molten_ash" //https://www.sciencedirect.com/science/article/pii/S1877705817326772 - - elements.molten_ash = { - color: ["#df6f30","#df8c30","#df4d30"], - behavior: behaviors.MOLTEN, - temp: 1300, - tempLow: 1200, - stateLow: "ash", - tempHigh: 1700, //https://authors.library.caltech.edu/58447/1/018-Senior.pdf - //https://pubs.acs.org/doi/10.1021/ef049693l - stateHigh: "vaporized_ash", - viscosity: 10000, - category: "liquids", - state: "liquid", - density: 2725, - }, - - elements.vaporized_ash = { - color: ["#df9f50","#dfbc50","#df7d50"], - behavior: [ - "M2|M1|M2", - "M1|XX|M1", - "M2|M1|M2", - ], - reactions: { - "vaporized_ash": { "elem1": null, "elem2": "hot_ash_cloud", "chance":0.3, "y":[0,15] }, - "hot_ash_cloud": { "elem1": "hot_ash_cloud", "chance":0.4, "y":[0,15] }, - }, - temp: 1800, - tempLow: 1700, - stateLow: "molten_ash", - category: "gases", - state: "gas", - hidden: true, - density: 3, - }, - - elements.hot_ash_cloud = { - color: ["#bf8f50","#bfac50","#bf7d50"], - behavior: [ - "XX|XX|XX", - "M1%7|CH:molten_ash%0.05|M1%7", - "XX|XX|XX", - ], - density: 0.7, - temp: 1800, - tempLow: 1700, - stateLow: "cold_ash_cloud", - category: "gases", - state: "gas", - }, - - elements.cold_ash_cloud = { - color: ["#af8f50","#ab9c50","#af6d50"], - behavior: [ - "XX|XX|XX", - "M1%7|CH:ash%0.05|M1%7", - "XX|XX|XX", - ], - density: 0.7, - temp: 1600, - tempHigh: 1700, - stateHigh: "hot_ash_cloud", - category: "gases", - state: "gas", - }, - -//} - -// charcoal { - - elements.charcoal.tempHigh = 800 - elements.charcoal.stateHigh = "carbon_dioxide" - -//} - -// baking soda { - - elements.baking_soda.tempHigh = 150, - elements.baking_soda.stateHigh = ["water","carbon_dioxide","calcined_soda"] - - // decomposition result { - - elements.calcined_soda = { //TODO: decomposition? - color: "#ededed", - behavior: behaviors.POWDER, - reactions: { - "water": { "elem1": "washing_soda", "elem2": null } //should be 10x water - //"carbon_dioxide": not possible: Na_{2}CO_{3} + CO_{2} + H_{2}O → 2NaHCO_{3} - }, - category: "powders", - state: "solid", - density: 2540, - tempHigh: 851, + elements.molten_glass = { + tempHigh: 2200, + stateHigh: "vaporized_glass", } - - if(!elements.molten_calcined_soda) { - elements.molten_calcined_soda = {} - } - - elements.molten_calcined_soda.temp = 1700 - elements.molten_calcined_soda.tempHigh = 1600 - elements.molten_calcined_soda.stateHigh = "vaporized_calcined_soda" - elements.molten_calcined_soda.density = 1920 - elements.vaporized_calcined_soda = { - color: ["#ffbf60","#ffdc60","#ff9d60"], + elements.vaporized_glass = { + color: ["#D6B049","#E8D957","#E8AE57"], behavior: [ "M2|M1|M2", "M1|XX|M1", "M2|M1|M2", ], reactions: { - "vaporized_calcined_soda": { "elem1": null, "elem2": "hot_calcined_soda_cloud", "chance":0.3, "y":[0,15] }, - "hot_calcined_soda_cloud": { "elem1": "hot_calcined_soda_cloud", "chance":0.4, "y":[0,15] }, + "vaporized_glass": { "elem1": null, "elem2": "hot_glass_cloud", "chance":0.3, "y":[0,15] }, + "hot_glass_cloud": { "elem1": "hot_glass_cloud", "chance":0.4, "y":[0,15] }, }, - temp: 1700, - tempLow: 1600, - stateLow: "molten_calcined_soda", + density: 2, //very rough approximation based on https://nvlpubs.nist.gov/nistpubs/jres/46/jresv46n3p176_A1b.pdf + temp: 2300, //https://www.sciencealert.com/did-this-piece-of-glass-really-break-a-law-of-thermodynamics + tempLow: 2200, + stateLow: "molten_glass", category: "gases", state: "gas", hidden: true, - density: 1.5, //bs }, - - elements.hot_calcined_soda_cloud = { - color: ["#cfbf70","#cfcc70","#cf9d70"], + + elements.hot_glass_cloud = { + color: ["#B69089","#C8B997","#C88E77"], behavior: [ "XX|XX|XX", - "M1%7|CH:molten_calcined_soda%0.05|M1%7", + "M1%7|CH:molten_glass%0.05|M1%7", "XX|XX|XX", ], - density: 0.7, - temp: 1700, - tempLow: 1600, - stateLow: "cold_calcined_soda_cloud", + density: 2, + temp: 2300, + tempLow: 2200, + stateLow: "cold_glass_cloud", category: "gases", state: "gas", }, - elements.cold_calcined_soda_cloud = { - color: ["#afaf70","#afac70","#af8d70"], + elements.cold_glass_cloud = { + color: ["#967089","#A89997","#A86E77"], behavior: [ "XX|XX|XX", - "M1%7|CH:calcined_soda%0.05|M1%7", + "M1%7|CH:glass_shard%0.05|M1%7", "XX|XX|XX", ], - density: 0.7, - temp: 1500, - tempHigh: 1600, - stateHigh: "hot_calcined_soda_cloud", + density: 2, + temp: 2000, + tempHigh: 2200, + stateHigh: "hot_glass_cloud", category: "gases", state: "gas", }, //} - - // decomp hydrate { - elements.washing_soda = { - color: "#ededed", - behavior: behaviors.POWDER, - //no reactions because it always requires ******* water - category: "powders", - state: "solid", - density: 1460, - tempHigh: 400, - stateHigh: ["water","calcined_soda"], + // ash { + + elements.ash.tempHigh = 1200 //https://www.quora.com/Can-you-melt-ashes + elements.ash.stateHigh = "molten_ash" //https://www.sciencedirect.com/science/article/pii/S1877705817326772 + + elements.molten_ash = { + color: ["#df6f30","#df8c30","#df4d30"], + behavior: behaviors.MOLTEN, + temp: 1300, + tempLow: 1200, + stateLow: "ash", + tempHigh: 1700, //https://authors.library.caltech.edu/58447/1/018-Senior.pdf + //https://pubs.acs.org/doi/10.1021/ef049693l + stateHigh: "vaporized_ash", + viscosity: 10000, + category: "liquids", + state: "liquid", + density: 2725, + }, + + elements.vaporized_ash = { + color: ["#df9f50","#dfbc50","#df7d50"], + behavior: [ + "M2|M1|M2", + "M1|XX|M1", + "M2|M1|M2", + ], + reactions: { + "vaporized_ash": { "elem1": null, "elem2": "hot_ash_cloud", "chance":0.3, "y":[0,15] }, + "hot_ash_cloud": { "elem1": "hot_ash_cloud", "chance":0.4, "y":[0,15] }, + }, + temp: 1800, + tempLow: 1700, + stateLow: "molten_ash", + category: "gases", + state: "gas", + hidden: true, + density: 3, + }, + + elements.hot_ash_cloud = { + color: ["#bf8f50","#bfac50","#bf7d50"], + behavior: [ + "XX|XX|XX", + "M1%7|CH:molten_ash%0.05|M1%7", + "XX|XX|XX", + ], + density: 0.7, + temp: 1800, + tempLow: 1700, + stateLow: "cold_ash_cloud", + category: "gases", + state: "gas", + }, + + elements.cold_ash_cloud = { + color: ["#af8f50","#ab9c50","#af6d50"], + behavior: [ + "XX|XX|XX", + "M1%7|CH:ash%0.05|M1%7", + "XX|XX|XX", + ], + density: 0.7, + temp: 1600, + tempHigh: 1700, + stateHigh: "hot_ash_cloud", + category: "gases", + state: "gas", + }, + + //} + + // charcoal { + + elements.charcoal.tempHigh = 800 + elements.charcoal.stateHigh = "carbon_dioxide" + + //} + + //carbon dioxide { + + /*fuck this, i can't work out the offset-infested math + function carbonDioxideDecompRatio(temp) { + // + // K is the ratio of O_2 to CO_2 + // If K = 100, there is 100 times more O_2 + // If K = 1, there is a 1:1 ratio + // + return Math.E**(((1110190+(13.083*(temp-298)))-(temp*(149.498+(13.083*(Math.log(temp/298))))))/(-8.31446*temp)) + } + + function carbonDioxideDecompChance(temp) { + //Expected 0.5 at 6275.6434478747902 + if(typeof(temp) === "undefined") { + throw new Error("Temp must be specified~"); + }; + if(typeof(temp) == "string") { + temp = parseFloat(temp); + }; + if(isNaN(temp)) { + throw new TypeError(typeof(temp) == "number" ? "Temp cannot be NaN~" : "Temp must be a number~"); + }; + if(temp == Infinity) { + return 1; + }; + if(temp <= 0) { + return 0; + }; + var K = carbonDioxideDecompRatio(temp); + return 1-(1/(K+1)); + }; + */ + + var hasNM = enabledMods.includes("mods/Neutronium Mod.js"); + + //Mass given is the molar mass of O_2 molecule (31.999 g) + //O_2 bond energy is 495 kJ/mol + //Heat capacity is 0.918 J/(g*K) + //in case the link goes down: c = Q/(m * delta-T); c = capacity, m = mass, delta-T = temp change, energy = Q + //https://www.calctool.org/thermodynamics/specific-heat + elements.oxygen.tempHigh = 16851; + elements.oxygen.stateHigh = "monatomic_oxygen"; + + elements.monatomic_oxygen = { + temp: 18000, + tempLow: 16851, + stateLow: "oxygen", + behavior: behaviors.GAS, + tempHigh: 158051.204, + stateHigh: "ionized_oxygen", + color: "#d2adff", + category: "gases", + state: "gas", + density: 1 + }; + + elements.ionized_oxygen = { + color: "#ff1900", + category: "energy", + state: "gas", + behavior: behaviors.GAS, + //First ionization energy of oxygen (13.61806 eV) * eV-to-K conversion factor (11606 K/eV) = 158051 K + //https://byjus.com/question-answer/what-is-oxygen-ionization-energy/ + //https://astro.swarthmore.edu/~cohen/projects/prismspect/notes.html + temp: 160000, + tempLow: 157778.054, + stateLow: "monatomic_oxygen", + density: 1, //made up + }; + + tupleAdverbs = ['Nullly', 'Singly', 'Doubly', 'Triply', 'Quadruply', 'Quintuply', 'Sextuply', 'Septuply', 'Octuply', 'Nonuply', 'Decuply', 'Undecuply', 'Duodecuply', 'Tredecuply', 'Quattuordecuply', 'Quindecuply', 'Sexdecuply', 'Septendecuply', 'Octodecuply', 'Novemdecuply', 'Vigintuply', 'Unvigintuply', 'Duovigintuply', 'Trevigintuply', 'Quattuorvigintuply', 'Quinvigintuply', 'Sexvigintuply', 'Septenvigintuply', 'Octovigintuply', 'Novemvigintuply', 'Trigintuply'].map(x => x.toLowerCase()); + + var oxygenIonizationTemperatures = [-273.15,13.61806,35.11730,54.9355,77.41353,113.8990,138.1197,739.29,871.4101].map(x => (x * 11606) - 273.15); + for(var highUpGirlsCindy = 2; highUpGirlsCindy <= 8; highUpGirlsCindy++) { + var newName = `${tupleAdverbs[highUpGirlsCindy]}_ionized_oxygen`; + + elements[newName] = { + color: convertColorFormats({r: 255, g: 25, b: (highUpGirlsCindy - 1) * 24},"hex"), + category: "energy", + state: "gas", + behavior: behaviors.GAS, + temp: Math.ceil(oxygenIonizationTemperatures[highUpGirlsCindy]/10000)*10000, + tempLow: oxygenIonizationTemperatures[highUpGirlsCindy], + stateLow: `${tupleAdverbs[highUpGirlsCindy - 1]}_ionized_oxygen`.replace("singly_",""), + density: 1, //made up + }; + + if(highUpGirlsCindy < 8) { + elements[newName].tempHigh = oxygenIonizationTemperatures[highUpGirlsCindy + 1]; + elements[newName].stateHigh = `${tupleAdverbs[highUpGirlsCindy + 1]}_ionized_oxygen`; + }; + }; + elements.ionized_oxygen.tempHigh = 407571.3838; + elements.ionized_oxygen.stateHigh = "doubly_ionized_oxygen"; + + elements.carbon_gas = { + color: ["#ffce9f", "#ffda80", "#ffbc8f"], + behavior: behaviors.GAS, + state: "gas", + category: "gases", + tempLow: 3642, + tempHigh: 130687.0418, + stateHigh: "ionized_carbon", + stateLow: hasNM ? "molten_carbon" : "carbon", + density: 2 //made-up due to lack of academic literature + }; + + elements.ionized_carbon = { + color: "#7f7f8f", + category: "energy", + state: "gas", + behavior: behaviors.GAS, + temp: 140000, + tempLow: 130687.0418, + stateLow: "carbon_gas", + density: 1, //made up + }; + + var carbonIonizationTemperatures = [-273.15,11.26030,24.38332,47.8878,64.4939,392.087,489.99334].map(x => (x * 11606) - 273.15); + for(var highUpGirlsCindy = 2; highUpGirlsCindy <= 6; highUpGirlsCindy++) { + var newName = `${tupleAdverbs[highUpGirlsCindy]}_ionized_carbon`; + + console.log(highUpGirlsCindy,newName,carbonIonizationTemperatures[highUpGirlsCindy]); + elements[newName] = { + color: convertColorFormats({r: 127 + ((highUpGirlsCindy - 1) * 8), g: 127, b: 127 + (highUpGirlsCindy - 1) * 16},"hex"), + category: "energy", + state: "gas", + behavior: behaviors.GAS, + temp: Math.ceil(carbonIonizationTemperatures[highUpGirlsCindy]/10000)*10000, + tempLow: carbonIonizationTemperatures[highUpGirlsCindy], + stateLow: `${tupleAdverbs[highUpGirlsCindy - 1]}_ionized_carbon`.replace("singly_",""), + density: 1, //made up + }; + + if(highUpGirlsCindy < 6) { + elements[newName].tempHigh = carbonIonizationTemperatures[highUpGirlsCindy + 1]; + elements[newName].stateHigh = `${tupleAdverbs[highUpGirlsCindy + 1]}_ionized_carbon`; + }; + }; + elements.ionized_carbon.tempHigh = 282992.81192; + elements.ionized_carbon.stateHigh = "doubly_ionized_carbon"; + + if(hasNM) { + runAfterLoad(function() { + elements.carbon.density = 3500; + elements.molten_carbon.density = 1200; + + elements.carbon.tick = behaviors.POWDER; + + elements.molten_carbon.tempHigh = 3642; + elements.molten_carbon.stateHigh = "carbon_gas"; + }); + } else { + elements.carbon = { + color: "#171717", + behavior: behaviors.POWDER, + density: 3500, + tempHigh: 3642, + stateHigh: "carbon_gas", + state: "solid", + category: POWDERS, + }; + }; + + elements.carbon_dioxide.tempHigh = 6275.6434478747902; //50% point + elements.carbon_dioxide.stateHigh = ["carbon","oxygen","carbon_dioxide","carbon_dioxide"]; + //} + + // baking soda { + + elements.baking_soda.tempHigh = 150, + elements.baking_soda.stateHigh = ["water","carbon_dioxide","calcined_soda"] + + // decomposition result { + + elements.calcined_soda = { //TODO: decomposition? + color: "#ededed", + behavior: behaviors.POWDER, + reactions: { + "water": { "elem1": "washing_soda", "elem2": null } //should be 10x water + //"carbon_dioxide": not possible: Na_{2}CO_{3} + CO_{2} + H_{2}O → 2NaHCO_{3} + }, + category: "powders", + state: "solid", + density: 2540, + tempHigh: 851, + } + + if(!elements.molten_calcined_soda) { + elements.molten_calcined_soda = {} + } + + elements.molten_calcined_soda.temp = 1700 + elements.molten_calcined_soda.tempHigh = 1600 + elements.molten_calcined_soda.stateHigh = "vaporized_calcined_soda" + elements.molten_calcined_soda.density = 1920 + + elements.vaporized_calcined_soda = { + color: ["#ffbf60","#ffdc60","#ff9d60"], + behavior: [ + "M2|M1|M2", + "M1|XX|M1", + "M2|M1|M2", + ], + reactions: { + "vaporized_calcined_soda": { "elem1": null, "elem2": "hot_calcined_soda_cloud", "chance":0.3, "y":[0,15] }, + "hot_calcined_soda_cloud": { "elem1": "hot_calcined_soda_cloud", "chance":0.4, "y":[0,15] }, + }, + temp: 1700, + tempLow: 1600, + stateLow: "molten_calcined_soda", + category: "gases", + state: "gas", + hidden: true, + density: 1.5, //bs + }, + + elements.hot_calcined_soda_cloud = { + color: ["#cfbf70","#cfcc70","#cf9d70"], + behavior: [ + "XX|XX|XX", + "M1%7|CH:molten_calcined_soda%0.05|M1%7", + "XX|XX|XX", + ], + density: 0.7, + temp: 1700, + tempLow: 1600, + stateLow: "cold_calcined_soda_cloud", + category: "gases", + state: "gas", + }, + + elements.cold_calcined_soda_cloud = { + color: ["#afaf70","#afac70","#af8d70"], + behavior: [ + "XX|XX|XX", + "M1%7|CH:calcined_soda%0.05|M1%7", + "XX|XX|XX", + ], + density: 0.7, + temp: 1500, + tempHigh: 1600, + stateHigh: "hot_calcined_soda_cloud", + category: "gases", + state: "gas", + }, + + //} + + // decomp hydrate { + + elements.washing_soda = { + color: "#ededed", + behavior: behaviors.POWDER, + //no reactions because it always requires ******* water + category: "powders", + state: "solid", + density: 1460, + tempHigh: 400, + stateHigh: ["water","calcined_soda"], + } + + //} + + //alkalinities { + + elements.acid.reactions.baking_soda = { "elem1":"neutral_acid", "elem2":null } + elements.acid.reactions.calcined_soda = { "elem1":"neutral_acid", "elem2":null } + elements.acid.reactions.washing_soda = { "elem1":"neutral_acid", "elem2":null } + + //} + + //} + + // calcium { + + elements.molten_calcium = { + tempHigh: 2200, + stateHigh: "vaporized_calcium", } - //} - - //alkalinities { - - elements.acid.reactions.baking_soda = { "elem1":"neutral_acid", "elem2":null } - elements.acid.reactions.calcined_soda = { "elem1":"neutral_acid", "elem2":null } - elements.acid.reactions.washing_soda = { "elem1":"neutral_acid", "elem2":null } + elements.vaporized_calcium = { + color: ["#ffc94a", "#fcd34c", "#ffae36", "#ff9c40","#ffcd90","#cf8d50"], + behavior: [ + "M2|M1|M2", + "M1|XX|M1", + "M2|M1|M2", + ], + reactions: { + "vaporized_calcium": { "elem1": null, "elem2": "hot_calcium_cloud", "chance":0.3, "y":[0,15] }, + "hot_calcium_cloud": { "elem1": "hot_calcium_cloud", "chance":0.4, "y":[0,15] }, + }, + density: 1.5, //most of these density values are complete bullshit due to a lack of research + temp: 1550, + tempLow: 1484, + stateLow: "molten_calcium", + category: "gases", + state: "gas", + hidden: true, + }, + elements.hot_calcium_cloud = { + color: ["#dfa98a", "#dcb38c", "#df8e76", "#ef8c60","#efbdb0","#af8d70"], + behavior: [ + "XX|XX|XX", + "M1%7|CH:molten_calcium%0.05|M1%7", + "XX|XX|XX", + ], + density: 1.5, + temp: 1550, + tempLow: 842, + stateLow: "cold_calcium_cloud", + category: "gases", + state: "gas", + }, + + elements.cold_calcium_cloud = { + color: ["#bf998a", "#bca38c", "#bf8e76", "#cf8c60","#cfadb0","#9f8d70"], + behavior: [ + "XX|XX|XX", + "M1%7|CH:calcium%0.05|M1%7", + "XX|XX|XX", + ], + density: 2, + temp: 800, + tempHigh: 842, + stateHigh: "hot_calcium_cloud", + category: "gases", + state: "gas", + } + //} -//} + // clay { -// calcium { + if(!elements.baked_clay) { + elements.baked_clay = {} + } - elements.molten_calcium = { - tempHigh: 2200, - stateHigh: "vaporized_calcium", - } - - elements.vaporized_calcium = { - color: ["#ffc94a", "#fcd34c", "#ffae36", "#ff9c40","#ffcd90","#cf8d50"], - behavior: [ - "M2|M1|M2", - "M1|XX|M1", - "M2|M1|M2", - ], - reactions: { - "vaporized_calcium": { "elem1": null, "elem2": "hot_calcium_cloud", "chance":0.3, "y":[0,15] }, - "hot_calcium_cloud": { "elem1": "hot_calcium_cloud", "chance":0.4, "y":[0,15] }, + elements.baked_clay.tempHigh = 1600 //the range of melting points online is so fucking wide + elements.baked_clay.stateHigh = "molten_clay" + + elements.molten_clay = { + color: ["#ff6d23","#ff5723","#ff4100"], + behavior: [ + "XX|CR:fire%2.5|XX", + "M2|XX|M2", + "M1|M1|M1", + ], + temp: 1700, + tempLow: 1600, + stateLow: "baked_clay", + viscosity: 10000, + hidden: true, + state: "liquid", + density: 1800, + tempHigh: 2980, + stateHigh: "vaporized_clay", + category: "liquids", + } + + elements.vaporized_clay = { + color: ["#ff8d43","#ff7743","#ff6120"], + behavior: [ + "M2|M1|M2", + "M1|XX|M1", + "M2|M1|M2", + ], + reactions: { + "vaporized_clay": { "elem1": null, "elem2": "hot_clay_cloud", "chance":0.3, "y":[0,15] }, + "hot_clay_cloud": { "elem1": "hot_clay_cloud", "chance":0.4, "y":[0,15] }, + }, + density: 1.6, + temp: 1700, + tempLow: 1600, + stateLow: "molten_clay", + category: "gases", + state: "gas", + hidden: true, }, - density: 1.5, //most of these density values are complete bullshit due to a lack of research - temp: 1550, - tempLow: 1484, - stateLow: "molten_calcium", - category: "gases", - state: "gas", - hidden: true, - }, - - elements.hot_calcium_cloud = { - color: ["#dfa98a", "#dcb38c", "#df8e76", "#ef8c60","#efbdb0","#af8d70"], - behavior: [ - "XX|XX|XX", - "M1%7|CH:molten_calcium%0.05|M1%7", - "XX|XX|XX", - ], - density: 1.5, - temp: 1550, - tempLow: 842, - stateLow: "cold_calcium_cloud", - category: "gases", - state: "gas", - }, - - elements.cold_calcium_cloud = { - color: ["#bf998a", "#bca38c", "#bf8e76", "#cf8c60","#cfadb0","#9f8d70"], - behavior: [ - "XX|XX|XX", - "M1%7|CH:calcium%0.05|M1%7", - "XX|XX|XX", - ], - density: 2, - temp: 800, - tempHigh: 842, - stateHigh: "hot_calcium_cloud", - category: "gases", - state: "gas", - } - -//} -/* -// clay { - - if(!elements.baked_clay) { - elements.baked_clay = {} - } - - elements.baked_clay.tempHigh = 1600 //the range of melting points online is so fucking wide - elements.baked_clay.stateHigh = "molten_clay" - - elements.molten_clay = { - color: ["#ff6d23","#ff5723","#ff4100"], - behavior: [ - "XX|CR:fire%2.5|XX", - "M2|XX|M2", - "M1|M1|M1", - ], - temp: 1700, - tempLow: 1600, - stateLow: "baked_clay", - viscosity: 10000, - hidden: true, - state: "liquid", - density: 1800, - tempHigh: 2980, - stateHigh: "vaporized_clay", - category: "liquids", - } - - elements.vaporized_clay = { - color: ["#ff8d43","#ff7743","#ff6120"], - behavior: [ - "M2|M1|M2", - "M1|XX|M1", - "M2|M1|M2", - ], - reactions: { - "vaporized_clay": { "elem1": null, "elem2": "hot_clay_cloud", "chance":0.3, "y":[0,15] }, - "hot_clay_cloud": { "elem1": "hot_clay_cloud", "chance":0.4, "y":[0,15] }, + + elements.hot_clay_cloud = { + color: ["#ff9945", "#fca347", "#ff7e31"], + behavior: [ + "XX|XX|XX", + "M1%7|CH:molten_clay%0.05|M1%7", + "XX|XX|XX", + ], + density: 1.5, + temp: 1550, + tempLow: 842, + stateLow: "cold_clay_cloud", + category: "gases", + state: "gas", }, - density: 1.6, - temp: 1700, - tempLow: 1600, - stateLow: "molten_clay", - category: "gases", - state: "gas", - hidden: true, - }, - - elements.hot_clay_cloud = { - color: ["#ff9945", "#fca347", "#ff7e31"], - behavior: [ - "XX|XX|XX", - "M1%7|CH:molten_clay%0.05|M1%7", - "XX|XX|XX", - ], - density: 1.5, - temp: 1550, - tempLow: 842, - stateLow: "cold_clay_cloud", - category: "gases", - state: "gas", - }, - - elements.cold_clay_cloud = { - color: ["#ef7945", "#ec8347", "#ef5e31"], - behavior: [ - "XX|XX|XX", - "M1%7|CH:baked_clay%0.05|M1%7", - "XX|XX|XX", - ], - density: 2, - temp: 800, - tempHigh: 842, - stateHigh: "hot_clay_cloud", - category: "gases", - state: "gas", - }, - -//} -*/ -// salt { - - elements.molten_salt = { - tempHigh: 1465, - stateHigh: "vaporized_salt", - } - - elements.vaporized_salt = { - color: ["#ff9f60","#ffbc60","#ff7d60"], - behavior: [ - "M2|M1|M2", - "M1|XX|M1", - "M2|M1|M2", - ], - reactions: { - "vaporized_salt": { "elem1": null, "elem2": "hot_salt_cloud", "chance":0.3, "y":[0,15] }, - "hot_salt_cloud": { "elem1": "hot_salt_cloud", "chance":0.4, "y":[0,15] }, + + elements.cold_clay_cloud = { + color: ["#ef7945", "#ec8347", "#ef5e31"], + behavior: [ + "XX|XX|XX", + "M1%7|CH:baked_clay%0.05|M1%7", + "XX|XX|XX", + ], + density: 2, + temp: 800, + tempHigh: 842, + stateHigh: "hot_clay_cloud", + category: "gases", + state: "gas", }, - density: 1946, - temp: 1550, - tempLow: 1465, - stateLow: "molten_salt", - category: "gases", - state: "gas", - hidden: true, - }, - - elements.hot_salt_cloud = { - color: ["#ef8f30","#efac60","#ef6d60"], - behavior: [ - "XX|XX|XX", - "M1%7|CH:molten_salt%0.05|M1%7", - "XX|XX|XX", - ], - density: 2.2, - temp: 1550, - tempLow: 801, - stateLow: "cold_salt_cloud", - category: "gases", - state: "gas", - }, - - elements.cold_salt_cloud = { - color: ["#cf7f60","#cf9c60","#cf7d60"], - behavior: [ - "XX|XX|XX", - "M1%7|CH:salt%0.05|M1%7", - "XX|XX|XX", - ], - density: 2.2, - temp: 700, - tempHigh: 801, - stateHigh: "hot_salt_cloud", - category: "gases", - state: "gas", - } -//} + //} -runAfterLoad(function() { - if(elements.acid_gas.tempHigh) { - delete elements.acid_gas.tempHigh - } - if(elements.acid_gas.stateHigh) { - delete elements.acid_gas.stateHigh - } - elements.acid.stateHigh = "acid_gas" - elements.acid_gas.tempLow = 400 - elements.acid_gas.stateLow = "acid" - elements.yogurt.tempHigh = 400 - elements.yogurt.stateHigh = "ash" - elements.dust.tempHigh = 400 - elements.dust.stateHigh = "fire" + // salt { - if(enabledMods.includes("mods/fey_and_more.js")) { - //mistake - elements.concoction.reactions.vaporized_glass = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.hot_glass_cloud = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.cold_glass_cloud = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.molten_ash = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.vaporized_ash = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.hot_ash_cloud = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.cold_ash_cloud = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.calcined_soda = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.molten_calcined_soda = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.vaporized_calcined_soda = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.hot_calcined_soda_cloud = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.cold_calcined_soda_cloud = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.washing_soda = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.vaporized_calcium = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.hot_calcium_cloud = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.cold_calcium_cloud = { "elem1": "mistake", "elem2": null } - /*elements.concoction.reactions.molten_clay = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.vaporized_clay = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.hot_clay_cloud = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.cold_clay_cloud = { "elem1": "mistake", "elem2": null }*/ - elements.concoction.reactions.vaporized_salt = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.hot_salt_cloud = { "elem1": "mistake", "elem2": null } - elements.concoction.reactions.cold_salt_cloud = { "elem1": "mistake", "elem2": null } - }; + elements.molten_salt = { + tempHigh: 1465, + stateHigh: "vaporized_salt", + } + + elements.vaporized_salt = { + color: ["#ff9f60","#ffbc60","#ff7d60"], + behavior: [ + "M2|M1|M2", + "M1|XX|M1", + "M2|M1|M2", + ], + reactions: { + "vaporized_salt": { "elem1": null, "elem2": "hot_salt_cloud", "chance":0.3, "y":[0,15] }, + "hot_salt_cloud": { "elem1": "hot_salt_cloud", "chance":0.4, "y":[0,15] }, + }, + density: 1946, + temp: 1550, + tempLow: 1465, + stateLow: "molten_salt", + category: "gases", + state: "gas", + hidden: true, + }, + + elements.hot_salt_cloud = { + color: ["#ef8f30","#efac60","#ef6d60"], + behavior: [ + "XX|XX|XX", + "M1%7|CH:molten_salt%0.05|M1%7", + "XX|XX|XX", + ], + density: 2.2, + temp: 1550, + tempLow: 801, + stateLow: "cold_salt_cloud", + category: "gases", + state: "gas", + }, + + elements.cold_salt_cloud = { + color: ["#cf7f60","#cf9c60","#cf7d60"], + behavior: [ + "XX|XX|XX", + "M1%7|CH:salt%0.05|M1%7", + "XX|XX|XX", + ], + density: 2.2, + temp: 700, + tempHigh: 801, + stateHigh: "hot_salt_cloud", + category: "gases", + state: "gas", + } -}); + //} + + runAfterLoad(function() { + if(elements.acid_gas.tempHigh) { + delete elements.acid_gas.tempHigh + } + if(elements.acid_gas.stateHigh) { + delete elements.acid_gas.stateHigh + } + elements.acid.stateHigh = "acid_gas" + elements.acid_gas.tempLow = 400 + elements.acid_gas.stateLow = "acid" + elements.yogurt.tempHigh = 400 + elements.yogurt.stateHigh = "ash" + elements.dust.tempHigh = 400 + elements.dust.stateHigh = "fire" + + if(enabledMods.includes("mods/fey_and_more.js")) { + //mistake + elements.concoction.reactions.vaporized_glass = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.hot_glass_cloud = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.cold_glass_cloud = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.molten_ash = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.vaporized_ash = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.hot_ash_cloud = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.cold_ash_cloud = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.calcined_soda = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.molten_calcined_soda = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.vaporized_calcined_soda = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.hot_calcined_soda_cloud = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.cold_calcined_soda_cloud = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.washing_soda = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.vaporized_calcium = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.hot_calcium_cloud = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.cold_calcium_cloud = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.molten_clay = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.vaporized_clay = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.hot_clay_cloud = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.cold_clay_cloud = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.vaporized_salt = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.hot_salt_cloud = { "elem1": "mistake", "elem2": null } + elements.concoction.reactions.cold_salt_cloud = { "elem1": "mistake", "elem2": null } + }; + + }); +} else { + alert(`The ${libraryMod} mod is required and has been automatically inserted (reload for this to take effect).`) + enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) + localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); +}; From a1f7c8f6ea27a2013c67f2877efaddcf996c7f94 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 23 Apr 2023 18:41:36 -0400 Subject: [PATCH 04/41] test of element mod system --- mods/test_2.js | 155 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 mods/test_2.js diff --git a/mods/test_2.js b/mods/test_2.js new file mode 100644 index 00000000..1040b4bd --- /dev/null +++ b/mods/test_2.js @@ -0,0 +1,155 @@ +alert("this requires code library and i am out of time to add a dependency if-block"); + +function defaultIonizationColorFormula(state) { + return convertColorFormats({r: 255, g: 221 - ((state + 1) * 32), b: 255 - ((state + 1) * 8)},"hex"); +}; + +function secondTestDefaultIonizationColorFormula(state) { + return convertColorFormats({r: 221 - ((state + 1) * 32), g: 255, b: 255 - ((state + 1) * 8)},"hex"); +}; + +function thirdTestDefaultIonizationColorFormula(state) { + var lum = 17 + (state * 10); + return convertColorFormats({r: lum, g: lum, b: lum},"hex"); +}; + +scientificElements = { + defaultium: { sublimates: false, solidColor: "#EEEEEE", solidDensity: 1000, meltingPoint: 1200, solidHardness: 0.8, + liquidColor: "#FFFFFF", liquidDensity: 850, liquidViscosity: 4000, boilingPoint: 2500, + gasColor: "#FFDDFF", gasDensity: 3.5, + ionizationEnergies_eV: [15,30,45,60,100], ionizationColorFormula: defaultIonizationColorFormula, + defaultState: "solid" + }, + + sublimatestium: { sublimates: true, solidColor: "#FFFFCC", solidDensity: 813, meltingPoint: 1033, solidHardness: 0.5, + liquidColor: "#EEEEAA", liquidDensity: 420, liquidViscosity: 420, boilingPoint: 42069, + gasColor: "#FFFF96", gasDensity: 3.2, + ionizationEnergies_eV: [12,41,99], ionizationColorFormula: secondTestDefaultIonizationColorFormula, + defaultState: "solid" + }, + + pneumagvnigium: { sublimates: false, solidColor: "#100810", solidDensity: 814, meltingPoint: -191, solidHardness: 0.7, + liquidColor: "#131011", liquidDensity: 1013, liquidViscosity: 131, boilingPoint: -83, + gasColor: "#202020", gasDensity: 14.6, + ionizationEnergies_eV: [11,22,33,44,55,66,77,88,99,110,121,1337], + ionizationColorFormula: thirdTestDefaultIonizationColorFormula, + defaultState: "gas" + } +}; + +behaviors.HOT_GAS = [ + "CR:fire%0.25 AND M2|M1|CR:fire%0.25 AND M2", + "M1|XX|M1", + "CR:fire%0.25 AND M2|M1|CR:fire%0.25 AND M2" +], + +behaviors.SUPERHOT_GAS = [ + "CR:plasma%0.1 AND M2|M1|CR:plasma%0.1 AND M2", + "M1|XX|M1", + "CR:plasma%0.1 AND M2|M1|CR:plasma%0.1 AND M2" +], + +tupleAdverbs = ['Singly', 'Doubly', 'Triply', 'Quadruply', 'Quintuply', 'Sextuply', 'Septuply', 'Octuply', 'Nonuply', 'Decuply', 'Undecuply', 'Duodecuply', 'Tredecuply', 'Quattuordecuply', 'Quindecuply', 'Sexdecuply', 'Septendecuply', 'Octodecuply', 'Novemdecuply', 'Vigintuply', 'Unvigintuply', 'Duovigintuply', 'Trevigintuply', 'Quattuorvigintuply', 'Quinvigintuply', 'Sexvigintuply', 'Septenvigintuply', 'Octovigintuply', 'Novemvigintuply', 'Trigintuply'].map(x => x.toLowerCase()); + +for(element in scientificElements) { + var elemInfo = scientificElements[element]; + + if(!elemInfo.liquidColor) { + elemInfo.liquidColor = makeMoltenColor(elemInfo.solidColor); + }; + + if(!elemInfo.gasColor) { + elemInfo.gasColor = makeGasColor(elemInfo.solidColor); + }; + + var names = { + solid: elemInfo.meltingPoint <= 0 ? element + "_ice" : "solid_" + element, + liquid: (elemInfo.meltingPoint > 200 ? "molten_" : "liquid_") + element, + gas: element + "_gas" + }; + names[elemInfo.defaultState] = element; //"hydrogen" is not "hydrogen_gas", iron is not "solid_iron", etc. + + if(elemInfo.defaultState == "liquid" && elemInfo.sublimates) { + throw new Error("A sublimating element can't have a liquid default state, idiot!"); + }; + + var ionizationTemperatures = elemInfo.ionizationEnergies_eV.map(x => (x * 16021766340) / 1380649); + var liquidIsHot = (elemInfo.meltingPoint > 600); + var gasIsHot = (elemInfo.boilingPoint > 600); + var solidIsCold = (elemInfo.meltingPoint < 0); + + //"nullish"-piecewise definition to preserve reactions + elements[names.solid] ??= {}; + elements[names.solid].color = elemInfo.solidColor; + elements[names.solid].density = elemInfo.solidDensity; + elements[names.solid].hardness = elemInfo.solidHardness; + elements[names.solid].temp = Math.min(20, elemInfo.meltingPoint * 1.1); + elements[names.solid].tempHigh = elemInfo.meltingPoint; + elements[names.solid].stateHigh = elemInfo.sublimates ? names.gas : names.liquid; + elements[names.solid].behavior = behaviors.POWDER; + elements[names.solid].category = "powders"; + elements[names.solid].state = "solid"; + elements[names.solid].hidden = true; + + if(elemInfo.sublimates != true) { + elements[names.liquid] ??= {}; + elements[names.liquid].color = elemInfo.liquidColor; + elements[names.liquid].density = elemInfo.liquidDensity; + elements[names.liquid].temp = (elemInfo.meltingPoint + elemInfo.boilingPoint) / 2; + elements[names.liquid].tempHigh = elemInfo.boilingPoint; + elements[names.liquid].stateHigh = names.gas; + elements[names.liquid].tempLow = elemInfo.meltingPoint; + elements[names.liquid].stateLow = names.solid; + elements[names.liquid].viscosity = elemInfo.liquidViscosity; + elements[names.liquid].behavior = liquidIsHot ? behaviors.MOLTEN : behaviors.LIQUID; + elements[names.liquid].category = "liquids"; + elements[names.liquid].state = "liquid"; + elements[names.liquid].hidden = true; + }; + + elements[names.gas] ??= {} + elements[names.gas].color = elemInfo.gasColor; + elements[names.gas].density = elemInfo.gasDensity; + elements[names.gas].temp = (elemInfo.sublimates ? elemInfo.meltingPoint : elemInfo.boilingPoint) * 1.1; + elements[names.gas].tempLow = (elemInfo.sublimates ? elemInfo.meltingPoint : elemInfo.boilingPoint); + elements[names.gas].stateLow = elemInfo.sublimates ? names.solid : names.liquid; + elements[names.gas].behavior = gasIsHot ? behaviors.HOT_GAS : behaviors.GAS; + elements[names.gas].category = "gases"; + elements[names.gas].state = "gas"; + elements[names.gas].hidden = true; + + if(elemInfo.ionizationEnergies_eV && elemInfo.ionizationEnergies_eV.length > 0 && elemInfo.ionizationColorFormula) { + elements[names.gas].tempHigh = ionizationTemperatures[0]; + elements[names.gas].stateHigh = "ionized_" + element; + + var lastTempsIndex = ionizationTemperatures.length - 1; + + for(j in ionizationTemperatures) { + j = parseInt(j); // for some reason JS is suddenly deciding to use strings for array iterators + var plasmaName = (tupleAdverbs[j] + "_ionized_" + element).replace("singly_",""); + var lastPlasmaName = (tupleAdverbs[j - 1] + "_ionized_" + element).replace("singly_",""); + var nextPlasmaName = (tupleAdverbs[j + 1] + "_ionized_" + element).replace("singly_",""); + var plasmaTemp = ionizationTemperatures[j]; + + elements[plasmaName] = { + color: elemInfo.ionizationColorFormula(j), + density: elemInfo.gasDensity * (0.99 ** (j + 1)), + temp: (Math.ceil(plasmaTemp/10000)*10000) + 1000, + tempLow: ionizationTemperatures[j], + stateLow: j == 0 ? names.gas : lastPlasmaName, + behavior: behaviors.SUPERHOT_GAS, + category: "energy", + state: "gas", + hidden: true, + }; + + if(j < lastTempsIndex) { + elements[plasmaName].tempHigh = ionizationTemperatures[j + 1]; + //console.log(j,tupleAdverbs[j],nextPlasmaName); + elements[plasmaName].stateHigh = nextPlasmaName; + }; + }; + }; + + elements[names[elemInfo.defaultState]].hidden = false; +}; \ No newline at end of file From e7b7e7c72250cd2953429576cb4d65470512b3d6 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Tue, 25 Apr 2023 11:23:07 -0400 Subject: [PATCH 05/41] dep --- mods/test_2.js | 388 +++++++++++++++++++++++++++++++------------------ 1 file changed, 249 insertions(+), 139 deletions(-) diff --git a/mods/test_2.js b/mods/test_2.js index 1040b4bd..e77783df 100644 --- a/mods/test_2.js +++ b/mods/test_2.js @@ -1,155 +1,265 @@ -alert("this requires code library and i am out of time to add a dependency if-block"); +var modName = "mods/test_2.js"; +var libraryMod = "mods/code_library.js"; -function defaultIonizationColorFormula(state) { - return convertColorFormats({r: 255, g: 221 - ((state + 1) * 32), b: 255 - ((state + 1) * 8)},"hex"); -}; +if(enabledMods.includes(libraryMod)) { + alert("this requires code library and i am out of time to add a dependency if-block"); -function secondTestDefaultIonizationColorFormula(state) { - return convertColorFormats({r: 221 - ((state + 1) * 32), g: 255, b: 255 - ((state + 1) * 8)},"hex"); -}; - -function thirdTestDefaultIonizationColorFormula(state) { - var lum = 17 + (state * 10); - return convertColorFormats({r: lum, g: lum, b: lum},"hex"); -}; - -scientificElements = { - defaultium: { sublimates: false, solidColor: "#EEEEEE", solidDensity: 1000, meltingPoint: 1200, solidHardness: 0.8, - liquidColor: "#FFFFFF", liquidDensity: 850, liquidViscosity: 4000, boilingPoint: 2500, - gasColor: "#FFDDFF", gasDensity: 3.5, - ionizationEnergies_eV: [15,30,45,60,100], ionizationColorFormula: defaultIonizationColorFormula, - defaultState: "solid" - }, - - sublimatestium: { sublimates: true, solidColor: "#FFFFCC", solidDensity: 813, meltingPoint: 1033, solidHardness: 0.5, - liquidColor: "#EEEEAA", liquidDensity: 420, liquidViscosity: 420, boilingPoint: 42069, - gasColor: "#FFFF96", gasDensity: 3.2, - ionizationEnergies_eV: [12,41,99], ionizationColorFormula: secondTestDefaultIonizationColorFormula, - defaultState: "solid" - }, - - pneumagvnigium: { sublimates: false, solidColor: "#100810", solidDensity: 814, meltingPoint: -191, solidHardness: 0.7, - liquidColor: "#131011", liquidDensity: 1013, liquidViscosity: 131, boilingPoint: -83, - gasColor: "#202020", gasDensity: 14.6, - ionizationEnergies_eV: [11,22,33,44,55,66,77,88,99,110,121,1337], - ionizationColorFormula: thirdTestDefaultIonizationColorFormula, - defaultState: "gas" - } -}; - -behaviors.HOT_GAS = [ - "CR:fire%0.25 AND M2|M1|CR:fire%0.25 AND M2", - "M1|XX|M1", - "CR:fire%0.25 AND M2|M1|CR:fire%0.25 AND M2" -], - -behaviors.SUPERHOT_GAS = [ - "CR:plasma%0.1 AND M2|M1|CR:plasma%0.1 AND M2", - "M1|XX|M1", - "CR:plasma%0.1 AND M2|M1|CR:plasma%0.1 AND M2" -], - -tupleAdverbs = ['Singly', 'Doubly', 'Triply', 'Quadruply', 'Quintuply', 'Sextuply', 'Septuply', 'Octuply', 'Nonuply', 'Decuply', 'Undecuply', 'Duodecuply', 'Tredecuply', 'Quattuordecuply', 'Quindecuply', 'Sexdecuply', 'Septendecuply', 'Octodecuply', 'Novemdecuply', 'Vigintuply', 'Unvigintuply', 'Duovigintuply', 'Trevigintuply', 'Quattuorvigintuply', 'Quinvigintuply', 'Sexvigintuply', 'Septenvigintuply', 'Octovigintuply', 'Novemvigintuply', 'Trigintuply'].map(x => x.toLowerCase()); - -for(element in scientificElements) { - var elemInfo = scientificElements[element]; - - if(!elemInfo.liquidColor) { - elemInfo.liquidColor = makeMoltenColor(elemInfo.solidColor); + function defaultIonizationColorFormula(state) { + return convertColorFormats({r: 255, g: 221 - ((state + 1) * 32), b: 255 - ((state + 1) * 8)},"hex"); }; - if(!elemInfo.gasColor) { - elemInfo.gasColor = makeGasColor(elemInfo.solidColor); + function secondTestDefaultIonizationColorFormula(state) { + return convertColorFormats({r: 221 - ((state + 1) * 32), g: 255, b: 255 - ((state + 1) * 8)},"hex"); }; - var names = { - solid: elemInfo.meltingPoint <= 0 ? element + "_ice" : "solid_" + element, - liquid: (elemInfo.meltingPoint > 200 ? "molten_" : "liquid_") + element, - gas: element + "_gas" - }; - names[elemInfo.defaultState] = element; //"hydrogen" is not "hydrogen_gas", iron is not "solid_iron", etc. - - if(elemInfo.defaultState == "liquid" && elemInfo.sublimates) { - throw new Error("A sublimating element can't have a liquid default state, idiot!"); - }; - - var ionizationTemperatures = elemInfo.ionizationEnergies_eV.map(x => (x * 16021766340) / 1380649); - var liquidIsHot = (elemInfo.meltingPoint > 600); - var gasIsHot = (elemInfo.boilingPoint > 600); - var solidIsCold = (elemInfo.meltingPoint < 0); - - //"nullish"-piecewise definition to preserve reactions - elements[names.solid] ??= {}; - elements[names.solid].color = elemInfo.solidColor; - elements[names.solid].density = elemInfo.solidDensity; - elements[names.solid].hardness = elemInfo.solidHardness; - elements[names.solid].temp = Math.min(20, elemInfo.meltingPoint * 1.1); - elements[names.solid].tempHigh = elemInfo.meltingPoint; - elements[names.solid].stateHigh = elemInfo.sublimates ? names.gas : names.liquid; - elements[names.solid].behavior = behaviors.POWDER; - elements[names.solid].category = "powders"; - elements[names.solid].state = "solid"; - elements[names.solid].hidden = true; - - if(elemInfo.sublimates != true) { - elements[names.liquid] ??= {}; - elements[names.liquid].color = elemInfo.liquidColor; - elements[names.liquid].density = elemInfo.liquidDensity; - elements[names.liquid].temp = (elemInfo.meltingPoint + elemInfo.boilingPoint) / 2; - elements[names.liquid].tempHigh = elemInfo.boilingPoint; - elements[names.liquid].stateHigh = names.gas; - elements[names.liquid].tempLow = elemInfo.meltingPoint; - elements[names.liquid].stateLow = names.solid; - elements[names.liquid].viscosity = elemInfo.liquidViscosity; - elements[names.liquid].behavior = liquidIsHot ? behaviors.MOLTEN : behaviors.LIQUID; - elements[names.liquid].category = "liquids"; - elements[names.liquid].state = "liquid"; - elements[names.liquid].hidden = true; + function thirdTestDefaultIonizationColorFormula(state) { + var lum = 17 + (state * 10); + return convertColorFormats({r: lum, g: lum, b: lum},"hex"); }; - elements[names.gas] ??= {} - elements[names.gas].color = elemInfo.gasColor; - elements[names.gas].density = elemInfo.gasDensity; - elements[names.gas].temp = (elemInfo.sublimates ? elemInfo.meltingPoint : elemInfo.boilingPoint) * 1.1; - elements[names.gas].tempLow = (elemInfo.sublimates ? elemInfo.meltingPoint : elemInfo.boilingPoint); - elements[names.gas].stateLow = elemInfo.sublimates ? names.solid : names.liquid; - elements[names.gas].behavior = gasIsHot ? behaviors.HOT_GAS : behaviors.GAS; - elements[names.gas].category = "gases"; - elements[names.gas].state = "gas"; - elements[names.gas].hidden = true; + function fourthTestDefaultIonizationColorFormula(state) { + return convertColorFormats({r: 0x9f + (state * 4), g: 0xff - state, b: 0x7f - (state * 3)},"hex"); + }; - if(elemInfo.ionizationEnergies_eV && elemInfo.ionizationEnergies_eV.length > 0 && elemInfo.ionizationColorFormula) { - elements[names.gas].tempHigh = ionizationTemperatures[0]; - elements[names.gas].stateHigh = "ionized_" + element; - - var lastTempsIndex = ionizationTemperatures.length - 1; + scientificElementoids = { + defaultium: { sublimates: false, solidColor: "#EEEEEE", solidDensity: 1000, meltingPoint: 1200, solidHardness: 0.8, + liquidColor: "#FFFFFF", liquidDensity: 850, liquidViscosity: 4000, boilingPoint: 2500, + gasColor: "#FFDDFF", gasDensity: 3.5, + ionizationEnergies_eV: [15,30,45,60,100], ionizationColorFormula: defaultIonizationColorFormula, + defaultState: "solid" + }, - for(j in ionizationTemperatures) { - j = parseInt(j); // for some reason JS is suddenly deciding to use strings for array iterators - var plasmaName = (tupleAdverbs[j] + "_ionized_" + element).replace("singly_",""); - var lastPlasmaName = (tupleAdverbs[j - 1] + "_ionized_" + element).replace("singly_",""); - var nextPlasmaName = (tupleAdverbs[j + 1] + "_ionized_" + element).replace("singly_",""); - var plasmaTemp = ionizationTemperatures[j]; + sublimatestium: { sublimates: true, solidColor: "#FFFFCC", solidDensity: 813, meltingPoint: 1033, solidHardness: 0.5, + liquidColor: "#EEEEAA", liquidDensity: 420, liquidViscosity: 420, boilingPoint: 42069, + gasColor: "#FFFF96", gasDensity: 3.2, + ionizationEnergies_eV: [12,41,99], ionizationColorFormula: secondTestDefaultIonizationColorFormula, + defaultState: "solid" + }, - elements[plasmaName] = { - color: elemInfo.ionizationColorFormula(j), - density: elemInfo.gasDensity * (0.99 ** (j + 1)), - temp: (Math.ceil(plasmaTemp/10000)*10000) + 1000, - tempLow: ionizationTemperatures[j], - stateLow: j == 0 ? names.gas : lastPlasmaName, - behavior: behaviors.SUPERHOT_GAS, - category: "energy", - state: "gas", - hidden: true, + pneumagvnigium: { sublimates: false, solidColor: "#100810", solidDensity: 814, meltingPoint: -191, solidHardness: 0.7, + liquidColor: "#131011", liquidDensity: 1013, liquidViscosity: 131, boilingPoint: -83, + gasColor: "#202020", gasDensity: 14.6, + ionizationEnergies_eV: [11,22,33,44,55,66,77,88,99,110,121,1337], + ionizationColorFormula: thirdTestDefaultIonizationColorFormula, + defaultState: "gas" + }, + + trollolium: { sublimates: false, solidColor: "#559933", solidDensity: 6969, meltingPoint: 1337, solidHardness: 0.69, + liquidColor: "#55aa33", liquidDensity: 4201, liquidViscosity: 12345, boilingPoint: 4444, + gasColor: "#9fff7f", gasDensity: 2.2, + ionizationEnergies_eV: [], + ionizationColorFormula: fourthTestDefaultIonizationColorFormula, + defaultState: "solid" + } + }; + + for(var q = 1; q < 30; q++) { + scientificElementoids.trollolium.ionizationEnergies_eV.push(q); + }; + scientificElementoids.trollolium.ionizationEnergies_eV.push(747.5802880508742); + + behaviors.HOT_GAS = [ + "CR:fire%0.25 AND M2|M1|CR:fire%0.25 AND M2", + "M1|XX|M1", + "CR:fire%0.25 AND M2|M1|CR:fire%0.25 AND M2" + ], + + behaviors.SUPERHOT_GAS = [ + "CR:plasma%0.1 AND M2|M1|CR:plasma%0.1 AND M2", + "M1|XX|M1", + "CR:plasma%0.1 AND M2|M1|CR:plasma%0.1 AND M2" + ], + + first9 = [ "singly", "doubly", "triply", "quadruply", "quintuply", "sextuply", "septuply", "octuply", "nonuply", "ERROR" ]; + + ones = ["", "un", "duo", "tre", "quattuor", "quin", "sex", "septen", "octo", "novem", "ERROR"]; + + tens = ["", "dec", "vigint", "trigint", "quadragint", "quinquagint", "sexagint", "septuagint", "octogint", "nonagint", "ERROR"]; + + hundreds = ["", "cent", "ducent", "trecent", "quadringent", "quingent", "sescent", "septingent", "octingent", "nongent", "ERROR"]; + + thousands = ["", "mill", "dumill", "trimill", "quadrimill", "quinmill", "sexmill", "septimill", "octimill", "nonimill", "ERROR"]; + + function getTupleAdverb(number) { //this code is horrendous + if(number == "0") { return "nullly" }; + number--; + if(number <= 8) { + return first9[number]; + } else { + number++; + + var onesPlace = Math.floor(number % 10); + var tensPlace = Math.floor((number / 10) % 10); + var hundredsPlace = Math.floor((number / 100) % 10); + var thousandsPlace = Math.floor((number / 1000) % 10); + + var tupleOnes = ones[onesPlace]; + var tupleTens = tens[tensPlace]; + var tupleHundreds = hundreds[hundredsPlace]; + var tupleThousands = thousands[thousandsPlace]; + + if(tupleOnes.endsWith("tre")) { + if(!tupleTens.startsWith("d") && !tupleTens.startsWith("s")) { //tre is not tres before d, and not as many people double the S + tupleOnes = "tres"; + //this entire code block is basically so we can use trescentuple for 103-uple and trecentuple for 300-uple + }; }; - if(j < lastTempsIndex) { - elements[plasmaName].tempHigh = ionizationTemperatures[j + 1]; - //console.log(j,tupleAdverbs[j],nextPlasmaName); - elements[plasmaName].stateHigh = nextPlasmaName; + if(number > 100 && tupleTens !== "") { //tens before something have an number after them + tupleTens += "number"; }; + + if(number > 1000 && tupleHundreds !== "") { //hundreds before something have an number after them + tupleHundreds += "number"; + }; + + tuple = tupleOnes + tupleTens + tupleHundreds + tupleThousands + "uply"; + + return tuple; }; }; - - elements[names[elemInfo.defaultState]].hidden = false; -}; \ No newline at end of file + + function makeScrapColor(colorIn) { + var colorInput = colorIn; //side effects? + + //make sure in is array + if(!(colorInput instanceof Array)) { + colorInput = [colorInput]; + }; + + colorInput = colorInput.map(color => convertColorFormats(color,"hex")); + + //prepare final color + var finalColor = []; + + var lumOffsets = [1.2,1,0.8]; + for(var i in colorInput) { + for(var j in lumOffsets) { + finalColor.push(changeLuminance(colorInput[i],lumOffsets[j],"multiply","hex")); + }; + }; + + return finalColor; + }; + + for(element in scientificElementoids) { + var elemInfo = scientificElementoids[element]; + + if(!elemInfo.liquidColor) { + elemInfo.liquidColor = makeMoltenColor(elemInfo.solidColor); + }; + + if(!elemInfo.gasColor) { + elemInfo.gasColor = makeGasColor(elemInfo.solidColor); + }; + + var names = { + solid: elemInfo.meltingPoint <= 0 ? element + "_ice" : "solid_" + element, + powder: elemInfo.meltingPoint <= 0 ? element + "_snow" : "powdered_" + element, + liquid: (elemInfo.meltingPoint > 200 ? "molten_" : "liquid_") + element, + gas: element + "_gas" + }; + names[elemInfo.defaultState] = element; //"hydrogen" is not "hydrogen_gas", iron is not "solid_iron", etc. + + if(elemInfo.defaultState == "liquid" && elemInfo.sublimates) { + throw new Error("A sublimating element can't have a liquid default state, idiot!"); + }; + + var ionizationTemperatures = elemInfo.ionizationEnergies_eV.map(x => (x * 16021766340) / 1380649); + var liquidIsHot = (elemInfo.meltingPoint > 600); + var gasIsHot = (elemInfo.boilingPoint > 600); + var solidIsCold = (elemInfo.meltingPoint < 0); + + //"nullish"-piecewise definition to preserve reactions + elements[names.solid] ??= {}; + elements[names.solid].color = elemInfo.solidColor; + elements[names.solid].density = elemInfo.solidDensity; + elements[names.solid].hardness = elemInfo.solidHardness; + elements[names.solid].breakInto = names.powder; + elements[names.solid].temp = Math.min(20, elemInfo.meltingPoint * 1.1); + elements[names.solid].tempHigh = elemInfo.meltingPoint; + elements[names.solid].stateHigh = elemInfo.sublimates ? names.gas : names.liquid; + elements[names.solid].behavior = behaviors.WALL; + elements[names.solid].category = "powders"; + elements[names.solid].state = "solid"; + elements[names.solid].hidden = true; + + elements[names.powder] ??= {}; + elements[names.powder].color = makeScrapColor(elemInfo.solidColor); + elements[names.powder].density = elemInfo.solidDensity * 0.7; + elements[names.powder].hardness = elemInfo.solidHardness * 0.7; + elements[names.powder].temp = Math.min(20, elemInfo.meltingPoint * 1.1); + elements[names.powder].tempHigh = elemInfo.meltingPoint; + elements[names.powder].stateHigh = elemInfo.sublimates ? names.gas : names.liquid; + elements[names.powder].behavior = behaviors.POWDER; + elements[names.powder].category = "powders"; + elements[names.powder].state = "powder"; + elements[names.powder].hidden = true; + + if(elemInfo.sublimates != true) { + elements[names.liquid] ??= {}; + elements[names.liquid].color = elemInfo.liquidColor; + elements[names.liquid].density = elemInfo.liquidDensity; + elements[names.liquid].temp = (elemInfo.meltingPoint + elemInfo.boilingPoint) / 2; + elements[names.liquid].tempHigh = elemInfo.boilingPoint; + elements[names.liquid].stateHigh = names.gas; + elements[names.liquid].tempLow = elemInfo.meltingPoint; + elements[names.liquid].stateLow = names.solid; + elements[names.liquid].viscosity = elemInfo.liquidViscosity; + elements[names.liquid].behavior = liquidIsHot ? behaviors.MOLTEN : behaviors.LIQUID; + elements[names.liquid].category = "liquids"; + elements[names.liquid].state = "liquid"; + elements[names.liquid].hidden = true; + }; + + elements[names.gas] ??= {} + elements[names.gas].color = elemInfo.gasColor; + elements[names.gas].density = elemInfo.gasDensity; + elements[names.gas].temp = (elemInfo.sublimates ? elemInfo.meltingPoint : elemInfo.boilingPoint) * 1.1; + elements[names.gas].tempLow = (elemInfo.sublimates ? elemInfo.meltingPoint : elemInfo.boilingPoint); + elements[names.gas].stateLow = elemInfo.sublimates ? names.solid : names.liquid; + elements[names.gas].behavior = gasIsHot ? behaviors.HOT_GAS : behaviors.GAS; + elements[names.gas].category = "gases"; + elements[names.gas].state = "gas"; + elements[names.gas].hidden = true; + + if(elemInfo.ionizationEnergies_eV && elemInfo.ionizationEnergies_eV.length > 0 && elemInfo.ionizationColorFormula) { + elements[names.gas].tempHigh = ionizationTemperatures[0]; + elements[names.gas].stateHigh = "ionized_" + element; + + var lastTempsIndex = ionizationTemperatures.length - 1; + + for(j in ionizationTemperatures) { + j = parseInt(j); // for some reason JS is suddenly deciding to use strings for array iterators + var plasmaName = (getTupleAdverb(j + 1) + "_ionized_" + element).replace("singly_",""); + var lastPlasmaName = (getTupleAdverb(j) + "_ionized_" + element).replace("singly_",""); + var nextPlasmaName = (getTupleAdverb(j + 2) + "_ionized_" + element).replace("singly_",""); + var plasmaTemp = ionizationTemperatures[j]; + + elements[plasmaName] = { + color: elemInfo.ionizationColorFormula(j), + density: elemInfo.gasDensity * (0.99 ** (j + 1)), + temp: (Math.ceil(plasmaTemp/10000)*10000) + 1000, + tempLow: ionizationTemperatures[j], + stateLow: j == 0 ? names.gas : lastPlasmaName, + behavior: behaviors.SUPERHOT_GAS, + category: "energy", + state: "gas", + hidden: true, + }; + + if(j < lastTempsIndex) { + elements[plasmaName].tempHigh = ionizationTemperatures[j + 1]; + //console.log(j,getTupleAdverb(j),nextPlasmaName); + elements[plasmaName].stateHigh = nextPlasmaName; + }; + }; + }; + + elements[names[elemInfo.defaultState]].hidden = false; + }; +} else { + alert(`The ${libraryMod} mod is required and has been automatically inserted (reload for this to take effect).`) + enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) + localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); +}; From fe746390ada7438a6b71db16b63908924e02de02 Mon Sep 17 00:00:00 2001 From: HamNcheese95 <132232207+HamNcheese95@users.noreply.github.com> Date: Sun, 30 Apr 2023 14:45:09 -0700 Subject: [PATCH 06/41] funni_water.js Water and Armageddon makes a snow --- mods/funni_water.js | 62 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 mods/funni_water.js diff --git a/mods/funni_water.js b/mods/funni_water.js new file mode 100644 index 00000000..e9bca816 --- /dev/null +++ b/mods/funni_water.js @@ -0,0 +1,62 @@ +"water": { + color: "#2167ff", + behavior: behaviors.LIQUID, + tempHigh: 100, + stateHigh: "steam", + tempLow: 0, + stateLow: "ice", + category: "liquids", + heatCapacity: 4.184, + reactions: { + "dirt": { // React with (water reacts with dirt to make mud) + elem1: null, // First element transforms into; in this case, water deletes itself + elem2: "mud", // Second element transforms into; in this case, dirt turns to mud + }, + "sand": { elem1: null, elem2: "wet_sand" }, + "clay_soil": { elem1: null, elem2: "clay" }, + "salt": { elem1: "salt_water", elem2: null }, + "sugar": { elem1: "sugar_water", elem2: null }, + "dust": { elem1: "dirty_water", elem2: null }, + "ash": { elem1: "dirty_water", elem2: null }, + "cyanide": { elem1: "dirty_water", elem2: null }, + "cyanide_gas": { elem1: "dirty_water", elem2: null }, + "carbon_dioxide": { elem1: "seltzer", elem2: null, "oneway":true }, + "sulfur": { elem1: "dirty_water", elem2: null }, + "rat": { elem1: "dirty_water", chance:0.005 }, + "plague": { elem1: "dirty_water", elem2: null }, + "rust": { elem1: "dirty_water", chance:0.005 }, + "fallout": { elem1: "dirty_water", chance:0.25 }, + "radiation": { elem1: "dirty_water", chance:0.25 }, + "uranium": { elem1: "dirty_water", chance:0.25 }, + "rotten_meat": { elem1: "dirty_water", chance:0.25 }, + "rotten_cheese": { elem1: "dirty_water", chance:0.25 }, + "cancer": { elem1: "dirty_water", chance:0.25 }, + "quicklime": { elem1: null, elem2: "slaked_lime" }, + "rock": { elem2: "wet_sand", chance: 0.00035 }, + "ruins": { elem2: "rock", chance: 0.00035 }, + "mudstone": { elem2: "mud", chance: 0.00035 }, + "methane": { elem1:"primordial_soup", elem2:"primordial_soup", tempMin:60, charged:true }, + "ammonia": { elem1:"primordial_soup", elem2:"primordial_soup", tempMin:60, charged:true }, + "fly": { elem2:"dead_bug", chance:0.1, "oneway":true }, + "firefly": { elem2:"dead_bug", chance:0.1, "oneway":true }, + "bee": { elem2:"dead_bug", chance:0.05, "oneway":true }, + "stink_bug": { elem2:"dead_bug", chance:0.1, "oneway":true }, + // electrolysis: + "aluminum": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.0025 }, + "zinc": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.015 }, + "steel": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.0125 }, + "iron": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.0125 }, + "tin": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.01 }, + "lead": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.01 }, + "brass": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.001 }, + “snow": { elem1: "armageddon", elem2: null, "oneway":false }, + "bronze": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.001 }, + "copper": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.0075 }, + "silver": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.0075 }, + "gold": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.0075 }, + }, + state: "liquid", + density: 997, + conduct: 0.02, + stain: -0.5 +}, From c77fa02518ba012bd91b79df9128d80c8f1156d1 Mon Sep 17 00:00:00 2001 From: HamNcheese95 <132232207+HamNcheese95@users.noreply.github.com> Date: Sun, 30 Apr 2023 14:54:47 -0700 Subject: [PATCH 07/41] fixing quotation marks think it might work now --- mods/funni_water.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/funni_water.js b/mods/funni_water.js index e9bca816..a08a45b0 100644 --- a/mods/funni_water.js +++ b/mods/funni_water.js @@ -49,7 +49,7 @@ "tin": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.01 }, "lead": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.01 }, "brass": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.001 }, - “snow": { elem1: "armageddon", elem2: null, "oneway":false }, + "snow": { elem1: "armageddon", elem2: null, "oneway":false }, "bronze": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.001 }, "copper": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.0075 }, "silver": { elem1:["hydrogen","hydrogen","oxygen"], charged:true, chance:0.0075 }, From 6b98cfe8988d2bf1d0014a2abba620570119d979 Mon Sep 17 00:00:00 2001 From: lllllllllwith10ls <38187754+lllllllllwith10ls@users.noreply.github.com> Date: Thu, 4 May 2023 10:13:59 -0500 Subject: [PATCH 08/41] Added hydroxide and potassium Also added bless compatibility, fixed nitric acid stuff, and made degenerate materials less explodey. --- mods/chem.js | 237 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 219 insertions(+), 18 deletions(-) diff --git a/mods/chem.js b/mods/chem.js index 2710bcfb..950681c9 100644 --- a/mods/chem.js +++ b/mods/chem.js @@ -1,3 +1,7 @@ +var runAfterAutogenMod = "mods/runAfterAutogen and onload restructure.js"; +if(enabledMods.includes(runAfterAutogenMod)){ + + elements.fluorine = { color: "#FFFFBF", behavior: behaviors.GAS, @@ -449,6 +453,8 @@ function createAcid(name,reactions, gasReactions, color, colorGas, category, cat state: "gas", density: densityGas, } + elements.bless.reactions[name] = { elem2: "hydrogen" }; + elements.bless.reactions[name+"_gas"] = { elem2: "hydrogen" }; if (enabledMods.includes("mods/generative_mods.js")) { runAfterLoad(function() { generateCloud(name); @@ -498,7 +504,7 @@ if (!enabledMods.includes("mods/generative_mods.js")) { ]; } -createAcid("nitric_acid",defaultAcidReactions,defaultAcidGasReactions,["#5ee9c7","#7ac2b1","#7c9f96"],["#78edd2","#8eccbe","#8aa8a1"],"liquids","gases",83,70,-42,400,1500,1.5) +createAcid("nitric_acid",defaultAcidReactions,defaultAcidGasReactions,["#91993c","#6b7041","#5f614b"],["#c9d457","#94996e","#abb07f"],"liquids","gases",83,70,-42,400,1500,1.5) elements.nitric_acid.reactions["ammonia"] = { "elem1": "fertilizer", "elem2": null}; elements.nitric_acid_gas.reactions["ammonia"] = { "elem1": "fertilizer", "elem2": null}; @@ -523,14 +529,14 @@ elements.liquid_nitric_oxide = { tempLow: -164, hidden: true, }; - elements.nitrogen_dioxide = { color: "#964B00", behavior: behaviors.GAS, reactions: { "steam": { "elem1": "smog", "elem2": null, "chance":0.01 }, "blood": { "elem1":null, "elem2":"infection", "chance":0.01 }, - "water": { "elem1":null, "elem2":"acid", "chance":0.01 }, + "water": { "elem1":null, "elem2":"nitric_acid", "chance":0.01 }, + "dirty_water": { "elem1":null, "elem2":"nitric_acid", "chance":0.01 }, "plant": { "elem1":null, "elem2":"dead_plant", "chance":0.01 }, "grass": { "elem1":null, "elem2":"dead_plant", "chance":0.01 }, "algae": { "elem1":null, "elem2":null, "chance":0.01 }, @@ -554,14 +560,7 @@ elements.nitrogen_dioxide = { "pistil": { "elem1":null, "elem2":"dead_plant", "chance":0.01 }, "petal": { "elem1":null, "elem2":"dead_plant", "chance":0.01 }, "grass_seed": { "elem1":null, "elem2":"dead_plant", "chance":0.01 }, - "meat": { "elem1":null, "elem2":"rotten_meat", "chance":0.01 }, - //clouds - "rain_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, - "cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, - "snow_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, - "hail_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, - "pyrocumulus": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, - "fire_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, + "meat": { "elem1":null, "elem2":"rotten_meat", "chance":0.01 } }, temp: 30, tempLow: 21.15, @@ -576,6 +575,26 @@ elements.liquid_nitrogen_dioxide = { reactions: structuredClone(elements.nitrogen_dioxide.reactions), }; +if (enabledMods.includes("mods/generative_mods.js")) { + elements["nitrogen_dioxide"].reactions["rain_cloud"]= { "elem1": null, "elem2": "nitric_acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }; + elements["nitrogen_dioxide"].reactions["cloud"]= { "elem1": null, "elem2": "nitric_acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }; + elements["nitrogen_dioxide"].reactions["snow_cloud"]= { "elem1": null, "elem2": "nitric_acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }; + elements["nitrogen_dioxide"].reactions["hail_cloud"]= { "elem1": null, "elem2": "nitric_acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }; + elements["nitrogen_dioxide"].reactions["pyrocumulus"]= { "elem1": null, "elem2": "nitric_acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }; + elements["nitrogen_dioxide"].reactions["fire_cloud"]= { "elem1": null, "elem2": "nitric_acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }; + elements["nitrogen_dioxide"].reactions["thunder_cloud"]= { "elem1": null, "elem2": "nitric_acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }; +} +else +{ + elements["nitrogen_dioxide"].reactions["rain_cloud"]= { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }; + elements["nitrogen_dioxide"].reactions["cloud"]= { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }; + elements["nitrogen_dioxide"].reactions["snow_cloud"]= { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }; + elements["nitrogen_dioxide"].reactions["hail_cloud"]= { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }; + elements["nitrogen_dioxide"].reactions["pyrocumulus"]= { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }; + elements["nitrogen_dioxide"].reactions["fire_cloud"]= { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }; + elements["nitrogen_dioxide"].reactions["thunder_cloud"]= { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }; +} + acidIgnore(["nitric_oxide","liquid_nitric_oxide","nitric_oxide_ice","nitrogen_dioxide","liquid_nitrogen_dioxide","nitrogen_dioxide_ice"]); elements.fertilizer = { @@ -610,7 +629,7 @@ elements.ammonia.reactions["oxygen"] = { "elem1": "steam", "elem2": "nitric_oxid elements.supernova.behavior = [ "XX|XX|XX", - "XX|EX:80>plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,molten_iron,molten_uranium,molten_lead AND CH:neutronium,neutronium,neutronium,liquid_neutronium,quark_matter,void|XX", + "XX|EX:80>plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,molten_iron,molten_uranium,molten_lead AND CH:neutronium,neutronium,quark_matter,void|XX", "XX|XX|XX", ]; @@ -645,10 +664,11 @@ elements.neutronium = { stateHigh: "liquid_neutronium", tempLow: 1e5, stateLow: ["molten_uranium","molten_gold","molten_tungsten","molten_lead"], - breakInto: "gamma_ray_burst", + breakInto: ["gamma_ray_burst","supernova","supernova"], category: "special", state: "solid", density: 4e17, + hardness: 0.999, excludeRandom: true, }; @@ -697,10 +717,11 @@ elements.liquid_neutronium = { temp: 2e7, tempLow: 1e7, stateLow: "neutronium", - breakInto: "gamma_ray_burst", + breakInto: ["gamma_ray_burst","supernova","supernova"], category: "special", state: "liquid", density: 2e17, + hardness: 0.999, excludeRandom: true, }; @@ -763,13 +784,12 @@ elements.quark_matter = { tick: function(pixel) { pixel.color = pixelColorPick(pixel); }, - tempHigh: 1e8, temp: 2e7, - stateHigh: "gamma_ray_burst", breakInto: "gamma_ray_burst", category: "special", state: "liquid", density: 4e18, + hardness: 0.999, excludeRandom: true, }; @@ -889,7 +909,7 @@ elements.iron_chloride = { density: 2900, } -createAcid("sulfuric_acid",defaultAcidReactions,defaultAcidGasReactions,["#e9e05e","#c2bd7a","#9e9c7b"],["#ede579","#ccc88f","#a8a68a"],"liquids","gases",337,337,10,500,1830,1.26) +createAcid("sulfuric_acid",structuredClone(defaultAcidReactions),structuredClone(defaultAcidGasReactions),["#e9e05e","#c2bd7a","#9e9c7b"],["#ede579","#ccc88f","#a8a68a"],"liquids","gases",337,337,10,500,1830,1.26) elements.sulfuric_acid.ignore.push("charcoal"); elements.sulfuric_acid_gas.ignore.push("charcoal"); @@ -1603,6 +1623,138 @@ elements.big_pop = { hidden: true, }; +elements.potassium_salt_water = { + color: "#416ed1", + behavior: behaviors.LIQUID, + tempHigh: 102, + stateHigh: ["steam","potassium_salt"], + tempLow: -2, + stateLowName: "potassium_salt_ice", + category: "liquids", + reactions: { + "dirt": { elem1: null, elem2: "mud" }, + "sand": { elem1: null, elem2: "wet_sand" }, + "clay_soil": { elem1: null, elem2: "clay" }, + "dust": { elem1: "dirty_water", elem2: null }, + "ash": { elem1: "dirty_water", elem2: null }, + "carbon_dioxide": { elem1: "dirty_water", elem2: null }, + "sulfur": { elem1: "dirty_water", elem2: null }, + "charcoal": { elem1: "dirty_water", chance:0.005 }, + "rat": { elem1: "dirty_water", chance:0.005 }, + "plague": { elem1: "dirty_water", elem2: null }, + "fallout": { elem1: "dirty_water", chance:0.25 }, + "radiation": { elem1: "dirty_water", chance:0.25 }, + "rust": { elem1: "dirty_water", chance:0.005 }, + "quicklime": { elem1: null, elem2: "slaked_lime" }, + "rock": { elem2: "wet_sand", chance: 0.0005 }, + "fly": { elem2:"dead_bug", chance:0.1, "oneway":true }, + "firefly": { elem2:"dead_bug", chance:0.1, "oneway":true }, + "bee": { elem2:"dead_bug", chance:0.05, "oneway":true }, + "stink_bug": { elem2:"dead_bug", chance:0.1, "oneway":true }, + "cancer": { elem1: "dirty_water", chance:0.25 }, + // electrolysis: + "aluminum": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.0025 }, + "zinc": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.015 }, + "steel": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.0125 }, + "iron": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.0125 }, + "tin": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.01 }, + "lead": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.01 }, + "brass": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.001 }, + "bronze": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.001 }, + "copper": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.0075 }, + "silver": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.0075 }, + "gold": { elem1:["hydrogen","hydrogen","oxygen","potassium_salt"], charged:true, chance:0.0075 }, + }, + state: "liquid", + density: 1026, + conduct: 0.1, + stain: -0.66 +}; + + +elements.potassium = { + color: ["#8e8ba3","#8797a8","#7d6a75","#879dad"], + tick: function(pixel) { + for (var i = 0; i < adjacentCoords.length; i++) { + var x = pixel.x+adjacentCoords[i][0]; + var y = pixel.y+adjacentCoords[i][1]; + if (isEmpty(x,y)) { + if (Math.random() < 0.005) { deletePixel(pixel.x,pixel.y) } + break + } } }, + reactions: { + "chlorine": { elem1:"potassium_salt", elem2:"big_pop" }, + "water": { elem1:"big_pop" }, + "salt_water": { elem1:"big_pop" }, + "sugar_water": { elem1:"big_pop" }, + "dirty_water": { elem1:"big_pop" }, + "seltzer": { elem1:"big_pop" }, + "acid": { elem1:"explosion" } + }, + tempHigh: 63.5, + category: "solids", + state: "solid", + density: 890, + conduct: 0.85, + hardness: 0.04, + burn:40, + burnTime: 200, + fireColor: ["#ff00ee","#ff6bf5"] +}; +elements.molten_potassium = { + tempLow: 63.5, + tempHigh: 757.6, + burn:40, + burnTime: 200, + fireColor: ["#ff00ee","#ff6bf5"], + reactions: { + "chlorine": { elem1:"potassium_salt", elem2:"big_pop" }, + "water": { elem1:"big_pop" }, + "salt_water": { elem1:"big_pop" }, + "sugar_water": { elem1:"big_pop" }, + "dirty_water": { elem1:"big_pop" }, + "seltzer": { elem1:"big_pop" }, + "acid": { elem1:"explosion" } + } +}; +elements.potassium_gas = { + color: "#5e6fdb" +}; + +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 }; + elements.molten_salt.reactions.steel = { elem1:["sodium","chlorine"], charged:true, chance:0.0125 }; + elements.molten_salt.reactions.iron = { elem1:["sodium","chlorine"], charged:true, chance:0.0125 }; + elements.molten_salt.reactions.tin = { elem1:["sodium","chlorine"], charged:true, chance:0.01 }; + elements.molten_salt.reactions.lead = { elem1:["sodium","chlorine"], charged:true, chance:0.01 }; + elements.molten_salt.reactions.brass = { elem1:["sodium","chlorine"], charged:true, chance:0.001 }; + elements.molten_salt.reactions.bronze = { elem1:["sodium","chlorine"], charged:true, chance:0.001 }; + elements.molten_salt.reactions.copper = { elem1:["sodium","chlorine"], charged:true, chance:0.0075 }; + elements.molten_salt.reactions.silver = { elem1:["sodium","chlorine"], charged:true, chance:0.0075 }; + elements.molten_salt.reactions.gold = { elem1:["sodium","chlorine"], charged:true, chance:0.0075 }; + elements.molten_salt.conduct = 0.7; + + elements.molten_potassium_salt.reactions = {}; + elements.molten_potassium_salt.reactions.aluminum = { elem1:["potassium","chlorine"], charged:true, chance:0.0025 }; + elements.molten_potassium_salt.reactions.zinc = { elem1:["potassium","chlorine"], charged:true, chance:0.015 }; + elements.molten_potassium_salt.reactions.steel = { elem1:["potassium","chlorine"], charged:true, chance:0.0125 }; + elements.molten_potassium_salt.reactions.iron = { elem1:["potassium","chlorine"], charged:true, chance:0.0125 }; + elements.molten_potassium_salt.reactions.tin = { elem1:["potassium","chlorine"], charged:true, chance:0.01 }; + elements.molten_potassium_salt.reactions.lead = { elem1:["potassium","chlorine"], charged:true, chance:0.01 }; + elements.molten_potassium_salt.reactions.brass = { elem1:["potassium","chlorine"], charged:true, chance:0.001 }; + elements.molten_potassium_salt.reactions.bronze = { elem1:["potassium","chlorine"], charged:true, chance:0.001 }; + elements.molten_potassium_salt.reactions.copper = { elem1:["potassium","chlorine"], charged:true, chance:0.0075 }; + 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.potassium_salt.hidden = false; + let defaultBaseReactions = { "grape": { "elem2":"juice", "color1":"#291824" }, @@ -1635,4 +1787,53 @@ elements.francium_hydroxide_gas.breakInto = "francium_hydroxide_gas"; delete elements.francium_hydroxide.burn; delete elements.francium_hydroxide_gas.burn; acidNeutralize("francium_hydroxide"); -acidNeutralize("francium_hydroxide_gas"); \ No newline at end of file +acidNeutralize("francium_hydroxide_gas"); + +createAcid("sodium_hydroxide",structuredClone(defaultBaseReactions),structuredClone(defaultBaseGasReactions),["#fc3bff","#c000ca","#9b7b9e"],["#f36cff","#be40d7","#b69cb6"],"liquids","hidden",100,100,0,1000,1010,1); +acidNeutralize("sodium_hydroxide"); +acidNeutralize("sodium_hydroxide_gas"); + +createAcid("potassium_hydroxide",structuredClone(defaultBaseReactions),structuredClone(defaultBaseGasReactions),["#3bc4ff","#0062ca","#7b949e"],["#6eecff","#40c5d7","#9cb1b6"],"liquids","hidden",100,100,0,1000,1020,1); +acidNeutralize("potassium_hydroxide"); +acidNeutralize("potassium_hydroxide_gas"); + +elements.salt_water.reactions["mercury"] = { elem1:["sodium_hydroxide","chlorine","hydrogen"], charged:true, chance:0.02 }; +elements.sodium_hydroxide.ignore.push("mercury"); +elements.potassium_hydroxide.ignore.push("salt_water"); +elements.potassium_salt_water.reactions["mercury"] = { elem1:["potassium_hydroxide","chlorine","hydrogen"], charged:true, chance:0.02 }; +elements.potassium_hydroxide.ignore.push("mercury"); +elements.potassium_hydroxide.ignore.push("potassium_salt_water"); + + +elements.bless.reactions["FOOF"] = {elem2: "oxygen"}; +elements.bless.reactions["solid_FOOF"] = {elem2: "oxygen"}; +elements.bless.reactions["fluorine"] = {elem2: null}; +elements.bless.reactions["liquid_fluorine"] = {elem2: null}; +elements.bless.reactions["fluorine_ice"] = {elem2: null}; +elements.bless.reactions["hydrogen_fluoride"] = {elem2: "hydrogen"}; +elements.bless.reactions["liquid_hydrogen_fluoride"] = {elem2: "hydrogen"}; +elements.bless.reactions["hydrogen_fluoride_ice"] = {elem2: "hydrogen"}; +elements.bless.reactions["hydrofluoric_acid"] = {elem2: "hydrogen"}; +elements.bless.reactions["liquid_hydrofluoric_acid"] = {elem2: "hydrogen"}; +elements.bless.reactions["hydrofluoric_acid_ice"] = {elem2: "hydrogen"}; +elements.bless.reactions["francium"] = {elem2: null}; +elements.bless.reactions["molten_francium"] = {elem2: null}; +elements.bless.reactions["radon"] = {elem2: null}; +elements.bless.reactions["polonium"] = {elem2: null}; +elements.bless.reactions["molten_polonium"] = {elem2: null}; +elements.bless.reactions["neutronium"] = {elem2: "neutron"}; +elements.bless.reactions["liquid_neutronium"] = {elem2: "neutron"}; +elements.bless.reactions["quark_matter"] = {elem2: ["neutron","proton"]}; +elements.bless.reactions["gamma_ray_burst"] = {elem2: null}; +elements.bless.reactions["nitrogen_dioxide"] = {elem2: "oxygen"}; +elements.bless.reactions["liquid_nitrogen_dioxide"] = {elem2: "oxygen"}; +elements.bless.reactions["sulfur_dioxide"] = {elem2: "oxygen"}; +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"}; +} else { + if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,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 From 9d634835d72ac013f04148ef9865bb4e78bacb61 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sat, 6 May 2023 18:03:49 -0400 Subject: [PATCH 09/41] temporarily remove rad clt --- mods/glenn_gases.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mods/glenn_gases.js b/mods/glenn_gases.js index da1dd6d9..6008d68a 100644 --- a/mods/glenn_gases.js +++ b/mods/glenn_gases.js @@ -384,7 +384,7 @@ runAfterLoad(function() { if(enabledMods.includes("mods/Neutronium Mod.js")) { elements.coal.breakInto = "coal_dust" } - if(enabledMods.includes("mods/the_ground.js")) { + /*if(enabledMods.includes("mods/the_ground.js")) { elements.radioactive_rock_dust = { color: "#839e78", behavior: behaviors.RAD_GAS, @@ -399,13 +399,13 @@ runAfterLoad(function() { } elements.radioactive_rock.breakInto.push("radioactive_rock_dust") - } + }*/ if(enabledMods.includes("mods/boiling_rock.js")) { elements.rock_dust.tempHigh = 3000 elements.rock_dust.stateHigh = "vaporized_rock" - if(enabledMods.includes("mods/the_ground.js")) { + /*if(enabledMods.includes("mods/the_ground.js")) { elements.radioactive_rock_dust.tempHigh = 3000 elements.radioactive_rock_dust.stateHigh = "vaporized_rock" - } + }*/ } }); From da8b31dcee85a24e91abea8e14c432cfd7c59130 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sat, 6 May 2023 18:04:38 -0400 Subject: [PATCH 10/41] sloppily merged hot_rocks in, made code edits, removed rad cult --- mods/the_ground.js | 503 ++++++++++++++++++++++++++++++++------------- 1 file changed, 358 insertions(+), 145 deletions(-) diff --git a/mods/the_ground.js b/mods/the_ground.js index 59d4b7aa..b660d04d 100644 --- a/mods/the_ground.js +++ b/mods/the_ground.js @@ -29,6 +29,108 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { //Functions + //Basically the entire hot_rocks.js code + + function hotRockFunction() { + var hotNameOverrides = { + dry_dirt: "hot_dirt", + }; + + var igneousRocksAndSands = Object.keys(elements).filter( + function(elemName) { + //console.log(elemName,elements[elemName]._data?.[2]); + return ["igneous_rock","solid_igneous_rock","igneous_gravel","sedimentary_rock","particulate"].includes(elements[elemName]._data?.[2]) && !("clay","limestone","black_limestone","shale".includes(elemName)) + } + ); + + function hotData2Switch(data2) { + switch(data2) { + case "igneous_rock": + return "hot_igneous_rock"; + case "solid_igneous_rock": + return "hot_solid_igneous_rock"; + case "particulate": + return "hot_particulate"; + case "sedimentary_rock": + return "hot_sedimentary_rock"; + case "igneous_gravel": + return "hot_igneous_gravel"; + default: + return "hot_" + data2; + }; + }; + + igneousRocksAndSands = igneousRocksAndSands.concat("dry_dirt"); + + hotRockBehavior = [ + "XX|CR:fire%0.5|XX", + "XX|XX|XX", + "M2|M1|M2" + ]; + + solidHotRockBehavior = [ + "XX|CR:fire%0.1|XX", + "CR:fire%0.1|XX|CR:fire%0.1", + "XX|CR:fire%0.1|XX" + ]; + + console.log(igneousRocksAndSands) + for(j = 0; j < igneousRocksAndSands.length; j++) { + var rockName = igneousRocksAndSands[j]; + var rockInfo = elements[rockName]; + if(!rockInfo) { + console.error(rockName); + continue; + }; + var rockData = rockInfo._data ?? ["error","error","hot_unknown"]; + var newName = hotNameOverrides[rockName] ?? "hot_" + rockName; + console.log(newName,igneousRocksAndSands.indexOf(rockName)); + //console.log(rockInfo.stateHigh); + elements[newName] = { + color: redHotColorgen(rockInfo.color,"hex"), + behavior: hotData2Switch(rockData[2]).includes("solid") ? solidHotRockBehavior : hotRockBehavior, + category: "land", + state: "solid", + temp: Math.min(rockInfo.tempHigh - 50,850), + tempHigh: rockInfo.tempHigh, + tempLow: Math.min(rockInfo.tempHigh - 100,800), + stateLow: rockName, + stateHigh: rockInfo.stateHigh, + density: rockData.density * 0.9, + hardness: rockData.density * 0.85, + //breakInto: newName + "_gravel", + _data: [rockData[0], rockData[1], hotData2Switch(rockData[2])], + }; + + if(rockName == "basalt") { + elements[newName].behavior = [ + "XX|CR:fire%0.5|XX", + "XX|XX|XX", + "XX|M1|XX" + ] + }; + + //console.log(j); + + if(rockInfo.nellfireImmune) { + elements[newName].nellfireImmune = true; + }; + + elements[rockName].tempHigh = Math.min(rockInfo.tempHigh - 100,800); + elements[rockName].stateHigh = newName; + if(rockInfo._data[2] == "igneous_rock" && elements[newName + "_gravel"]) { + elements[newName].stateHigh = newName + "_gravel"; + }; + }; + + elements.dirt.tempHigh = 100; + elements.dirt.stateHigh = "dry_dirt"; + elements.hot_dirt.tempHigh = 1200; + elements.hot_dirt.stateHigh = "molten_dirt"; + elements.hot_dirt.tempLow = 800; + elements.hot_dirt.stateLow = "dry_dirt"; + }; + //Star world matter function var stellarPlasmaSpreadWhitelist = ["stellar_plasma","liquid_stellar_plasma","liquid_degenerate_neutronium","gaseous_degenerate_neutronium","neutron_star"]; @@ -271,16 +373,27 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { return; }; //console.log(pixel.x,pixel.y,overallTemperatureChangeRate) + var stateLow; if(overallTemperatureChangeRate < vitriteThreshold) { //numbers made up //console.log("f99fd90"); - changePixel(pixel,vitriteName,false); + stateLow = vitriteName; } else if(overallTemperatureChangeRate < aphaniteThreshold) { //console.log("aaaaaaaaaa"); - changePixel(pixel,aphaniteName,false); + stateLow = aphaniteName; } else { //console.log("03"); - changePixel(pixel,phaneriteName,false); + stateLow = phaneriteName; }; + var stateLowInfo = elements[stateLow]; + var slHasHotRock = (stateLowInfo.stateLow == "hot_" + stateLow); + var changeToRockIsHot = false; + if(slHasHotRock) { + var hotRockPoint = stateLowInfo.tempHigh; + if(pixel.temp >= hotRockPoint) { + changeToRockIsHot = true; + }; + }; + changePixel(pixel,changeToRockIsHot ? "hot_" + stateLow : stateLow,false); }; }; @@ -660,6 +773,36 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { //Generate an entire composition family at once + function redHotColorgen(colorIn,outputFormat="rgb") { + var color = colorIn; + //console.log(color); + if(!Array.isArray(color)) { + color = [color]; + }; + //console.log(color); + color = color.map(x => convertColorFormats(x,"json")); + //console.log(color); + for(i = 0; i < color.length; i++) { + var subcolor = color[i]; + //console.log(i); + subcolor.r += 48; + subcolor.r *= 1.7; + subcolor.g += 24; + subcolor.g *= 1.2; + subcolor.g -= 16; + subcolor.b -= 10; + subcolor.b *= 0.75; + for(colorlet in subcolor) { + subcolor[colorlet] = Math.round(rgbColorBound(subcolor[colorlet])); + }; + //console.log(color); + }; + //console.log(color); + color = color.map(x => convertColorFormats(x,outputFormat)); + if(color.length == 1) { color = color[0] }; + return color; + }; + var sands = ["sand"]; var wetSands = ["wet_sand"]; var sandSuspensions = []; @@ -667,6 +810,22 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { var sandstones = ["radioactive_sandstone","shale"]; var vaporizedMagmas = []; var magmaClouds = []; + var rockClouds = []; + + function nicffunc_getReactions(elemName) { + if(!(elements[elemName])) { + return null; + }; + if(!(elements[elemName].reactions)) { + return null; + }; + var reactions = elements[elemName].reactions; + if(structuredClone) { + return !!reactions ? structuredClone(reactions) : null; + } else { + return !!reactions ? JSON.parse(JSON.stringify(reactions)) : null; + }; + }; function newIgneousCompositionFamily( compositionFamilyName, @@ -701,18 +860,31 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { ) { //console.log(compositionFamilyName,vesiculiteMeltingPoint,vitriteMeltingPoint); + //gabbro_sand instead of rock_sand for rock's unique sand var phaneriteSandName = compositionFamilyName == "mafic" ? "gabbro_sand" : phaneriteName + "_sand"; - var aphaniteSandName = aphaniteName + "_sand"; var vesiculiteSandName = vesiculiteName + "_sand"; var vitriteSandName = vitriteName + "_sand"; - var phaneriteDustName = compositionFamilyName == "mafic" ? "gabbro_dust" : phaneriteName + "_dust"; + //keep rock_wall to replace vanilla rock wall + var phaneriteWallName = phaneriteName + "_wall"; + var aphaniteWallName = aphaniteName + "_wall"; + var vesiculiteWallName = vesiculiteName + "_wall"; + var vitriteWallName = vitriteName + "_wall"; + //gravel instead of rock_gravel for normal gravel (as rock's unique gravel) + var phaneriteGravelName = compositionFamilyName == "mafic" ? "gravel" : phaneriteName + "_gravel"; + var aphaniteGravelName = aphaniteName + "_gravel"; + var vesiculiteGravelName = vesiculiteName + "_gravel"; + var vitriteGravelName = vitriteName + "_shard"; + + //gabbro_dust instead of rock_dust for rock's unique dust + var phaneriteDustName = compositionFamilyName == "mafic" ? "gabbro_dust" : phaneriteName + "_dust"; var aphaniteDustName = aphaniteName + "_dust"; var vesiculiteDustName = vesiculiteName + "_dust"; var vitriteDustName = vitriteName + "_dust"; + //push future sand names and wet sand names to sand list for sandstone system generation sands.push(phaneriteSandName); sands.push(aphaniteSandName); sands.push(vesiculiteSandName); @@ -722,56 +894,50 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { wetSands.push("wet_" + vesiculiteSandName); wetSands.push("wet_" + vitriteSandName); - var magmaName = compositionFamilyName + "_magma"; - if(compositionFamilyName !== "mafic") { //skip phanerite, phangravel, and aphanite for mafic rocks (rock, gravel, basalt) - elements[phaneriteName] = { - color: phaneriteColor, - behavior: behaviors.POWDER, - category: "land", - state: "solid", - tempHigh: phaneriteMeltingPoint, - stateHigh: magmaName, - density: phaneriteDensity, - hardness: 0.75, - breakInto: phaneriteName + "_gravel", - _data: [compositionFamilyName,"phanerite","igneous_rock"], - }; - - elements.water.reactions[phaneriteName] = { "elem2": phaneriteName + "_gravel", "chance": 0.00035 } + //generate magma name for whole igneous family + var magmaName = compositionFamilyName == "mafic" ? "magma" : compositionFamilyName + "_magma"; + var magmaCloudName = magmaName + "_cloud" + var rockCloudName = compositionFamilyName + "_rock_cloud" - elements[phaneriteName + "_gravel"] = { - color: gravelizeToHex(phaneriteColor), - behavior: behaviors.POWDER, - category: "land", - state: "solid", - tempHigh: phaneriteMeltingPoint, - stateHigh: magmaName, - breakInto: phaneriteDustName, - density: phaneriteDensity * 0.55, - _data: [compositionFamilyName,"phanerite","igneous_gravel"], - }; - - elements.water.reactions[phaneriteName + "_gravel"] = { "elem2": twoPartRepeatedArray(phaneriteSandName,sandFormationReactionSpecificSandCount,"sand",sandFormationReactionRegularSandCount), "chance": 0.0005 }; - - elements[aphaniteName] = { - color: aphaniteColor, - behavior: behaviors.POWDER, - category: "land", - state: "solid", - tempHigh: aphaniteMeltingPoint, - stateHigh: magmaName, - density: aphaniteDensity, - hardness: 0.75, - breakInto: aphaniteName + "_gravel", - _data: [compositionFamilyName,"aphanite","igneous_rock"], - }; - } else { - phaneriteName = "rock"; - aphaniteName = "basalt"; - magmaName = "magma"; + //create phanerite and transplant existing reactions if they exist + var phaneriteOldReactions = nicffunc_getReactions(phaneriteName); + elements[phaneriteName] = { + color: phaneriteColor, + behavior: behaviors.POWDER, + category: "land", + state: "solid", + tempHigh: phaneriteMeltingPoint, + stateHigh: magmaName, + density: phaneriteDensity, + hardness: 0.75, + breakInto: phaneriteGravelName, + _data: [compositionFamilyName,"phanerite","igneous_rock"], + }; + if(phaneriteOldReactions) { + elements[phaneriteName].reactions = phaneriteOldReactions; }; - elements["solid_" + phaneriteName] = { + //replace water rock-erosion reaction + elements.water.reactions[phaneriteName] = { "elem2": phaneriteGravelName, "chance": 0.00035 } + + //create unique gravel + elements[phaneriteGravelName] = { + color: gravelizeToHex(phaneriteColor), + behavior: behaviors.POWDER, + category: "land", + state: "solid", + tempHigh: phaneriteMeltingPoint, + stateHigh: magmaName, + breakInto: phaneriteDustName, + density: phaneriteDensity * 0.55, + _data: [compositionFamilyName,"phanerite","igneous_gravel"], + }; + + //generate water gravel-erosion reaction using rock family's sand ratio + elements.water.reactions[phaneriteGravelName] = { "elem2": twoPartRepeatedArray(phaneriteSandName,sandFormationReactionSpecificSandCount,"sand",sandFormationReactionRegularSandCount), "chance": 0.0005 }; + + //generate unique solid version + elements[phaneriteWallName] = { color: phaneriteColor, behavior: behaviors.WALL, category: "land", @@ -784,7 +950,24 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { _data: [compositionFamilyName,"phanerite","solid_igneous_rock"], }; - elements["solid_" + aphaniteName] = { + var aphaniteOldReactions = nicffunc_getReactions(aphaniteName); + elements[aphaniteName] = { + color: aphaniteColor, + behavior: behaviors.POWDER, + category: "land", + state: "solid", + tempHigh: aphaniteMeltingPoint, + stateHigh: magmaName, + density: aphaniteDensity, + hardness: 0.75, + breakInto: aphaniteGravelName, + _data: [compositionFamilyName,"aphanite","igneous_rock"], + }; + if(aphaniteOldReactions) { + elements[aphaniteName].reactions = aphaniteOldReactions; + }; + + elements[aphaniteWallName] = { color: aphaniteColor, behavior: behaviors.WALL, category: "land", @@ -797,12 +980,12 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { _data: [compositionFamilyName,"aphanite","solid_igneous_rock"], }; - elements.water.reactions["solid_" + phaneriteName] = { "elem2": phaneriteName, "chance": 0.00035 } - elements.water.reactions["solid_" + aphaniteName] = { "elem2": aphaniteName, "chance": 0.00035 } - elements.water.reactions["solid_" + vesiculiteName] = { "elem2": vesiculiteName, "chance": 0.00035 } - elements.water.reactions["solid_" + vitriteName] = { "elem2": vitriteName, "chance": 0.00035 } + elements.water.reactions[phaneriteWallName] = { "elem2": phaneriteName, "chance": 0.00035 } + elements.water.reactions[aphaniteWallName] = { "elem2": aphaniteName, "chance": 0.00035 } + elements.water.reactions[vesiculiteWallName] = { "elem2": vesiculiteName, "chance": 0.00035 } + elements.water.reactions[vitriteWallName] = { "elem2": vitriteName, "chance": 0.00035 } - elements.water.reactions[aphaniteName] = { "elem2": aphaniteName + "_gravel", "chance": 0.00035 } + elements.water.reactions[aphaniteName] = { "elem2": aphaniteGravelName, "chance": 0.00035 } elements[phaneriteSandName] = { color: sandizeToHex(phaneriteName,"normal"), @@ -863,7 +1046,7 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { "elem1": null, "elem2": "wet_" + phaneriteSandName, }; - elements[aphaniteName + "_gravel"] = { + elements[aphaniteGravelName] = { color: gravelizeToHex(aphaniteColor), behavior: behaviors.POWDER, category: "land", @@ -875,7 +1058,7 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { _data: [compositionFamilyName,"aphanite","igneous_gravel"], }; - elements.water.reactions[aphaniteName + "_gravel"] = { "elem2": twoPartRepeatedArray(aphaniteSandName,sandFormationReactionSpecificSandCount,"sand",sandFormationReactionRegularSandCount), "chance": 0.0005 }; + elements.water.reactions[aphaniteGravelName] = { "elem2": twoPartRepeatedArray(aphaniteSandName,sandFormationReactionSpecificSandCount,"sand",sandFormationReactionRegularSandCount), "chance": 0.0005 }; elements[aphaniteSandName] = { color: sandizeToHex(aphaniteName,"normal"), @@ -943,11 +1126,11 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { stateHigh: magmaName, density: vesiculiteDensity, hardness: 0.75, - breakInto: vesiculiteName + "_gravel", + breakInto: vesiculiteGravelName, _data: [compositionFamilyName,"vesiculite","igneous_rock"], }; - elements["solid_" + vesiculiteName] = { + elements[vesiculiteWallName] = { color: vesiculiteColor, behavior: behaviors.WALL, category: "land", @@ -960,9 +1143,9 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { _data: [compositionFamilyName,"vesiculite","solid_igneous_rock"], }; - elements.water.reactions[vesiculiteName] = { "elem2": vesiculiteName + "_gravel", "chance": 0.00035 } + elements.water.reactions[vesiculiteName] = { "elem2": vesiculiteGravelName, "chance": 0.00035 } - elements[vesiculiteName + "_gravel"] = { + elements[vesiculiteGravelName] = { color: gravelizeToHex(vesiculiteColor), behavior: behaviors.POWDER, category: "land", @@ -974,7 +1157,7 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { _data: [compositionFamilyName,"vesiculite","igneous_gravel"], }; - elements.water.reactions[vesiculiteName + "_gravel"] = { "elem2": twoPartRepeatedArray(vesiculiteSandName,sandFormationReactionSpecificSandCount,"sand",sandFormationReactionRegularSandCount), "chance": 0.0005 }; + elements.water.reactions[vesiculiteGravelName] = { "elem2": twoPartRepeatedArray(vesiculiteSandName,sandFormationReactionSpecificSandCount,"sand",sandFormationReactionRegularSandCount), "chance": 0.0005 }; elements[vesiculiteSandName] = { color: sandizeToHex(vesiculiteName,"normal"), @@ -1042,11 +1225,11 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { stateHigh: magmaName, density: vitriteDensity, hardness: 0.75, - breakInto: vitriteName + "_shard", + breakInto: vitriteGravelName, _data: [compositionFamilyName,"vitrite","igneous_rock"], }; - elements["solid_" + vitriteName] = { + elements[vitriteWallName] = { color: vitriteColor, behavior: behaviors.SOLID, category: "land", @@ -1059,9 +1242,9 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { _data: [compositionFamilyName,"vitrite","solid_igneous_rock"], }; - elements.water.reactions[vitriteName] = { "elem2": vitriteName + "_shard", "chance": 0.00035 } + elements.water.reactions[vitriteName] = { "elem2": vitriteGravelName, "chance": 0.00035 } - elements[vitriteName + "_shard"] = { + elements[vitriteGravelName] = { color: gravelizeToHex(vitriteColor), behavior: behaviors.POWDER, category: "land", @@ -1073,7 +1256,7 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { _data: [compositionFamilyName,"vitrite","glass_shard"], }; - elements.water.reactions[vitriteName + "_shard"] = { "elem2": twoPartRepeatedArray(vitriteSandName,sandFormationReactionSpecificSandCount,"sand",sandFormationReactionRegularSandCount), "chance": 0.0005 }; + elements.water.reactions[vitriteGravelName] = { "elem2": twoPartRepeatedArray(vitriteSandName,sandFormationReactionSpecificSandCount,"sand",sandFormationReactionRegularSandCount), "chance": 0.0005 }; elements[vitriteSandName] = { color: sandizeToHex(vitriteName,"normal"), @@ -1132,63 +1315,69 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { "elem1": null, "elem2": "wet_" + vitriteSandName, }; - if(compositionFamilyName !== "mafic") { - elements[magmaName] = { - "reactions": { - "ash": { "elem1": null, "elem2": "molten_slag" }, - "dust": { "elem1": null, "elem2": "molten_slag" }, - "foam": { "elem1": vesiculiteName, "elem2": vesiculiteName }, + var magmaOldReactions = nicffunc_getReactions(magmaName); + var magmaOldColor = elements.magma.color; + elements[magmaName] = { + reactions: { + "ash": { "elem1": null, "elem2": "molten_slag" }, + "dust": { "elem1": null, "elem2": "molten_slag" }, + }, + _magmaCoolingPassToElement: { + vitreous: [vitriteCoolingRateThreshold,vitriteName], + aphanitic: [aphaniteCoolingRateThreshold,aphaniteName], + phaneritic: [Infinity,phaneriteName], + meltingPoints: { + vitreous: vitriteMeltingPoint, + vesicular: vesiculiteMeltingPoint, + aphanitic: aphaniteMeltingPoint, + phaneritic: phaneriteMeltingPoint, }, - _magmaCoolingPassToElement: { - vitreous: [vitriteCoolingRateThreshold,vitriteName], - aphanitic: [aphaniteCoolingRateThreshold,aphaniteName], - phaneritic: [Infinity,phaneriteName], - meltingPoints: { - vitreous: vitriteMeltingPoint, - vesicular: vesiculiteMeltingPoint, - aphanitic: aphaniteMeltingPoint, - phaneritic: phaneriteMeltingPoint, - }, - }, - tick: function(pixel) { - var coolingInfo = elements[pixel.element]._magmaCoolingPassToElement; - magmaRateBasedCooling( - pixel, - Math.min( - coolingInfo.meltingPoints.vitreous, - coolingInfo.meltingPoints.vesicular, - coolingInfo.meltingPoints.aphanitic, - coolingInfo.meltingPoints.phaneritic - ) - 20, - coolingInfo.vitreous[1], - coolingInfo.vitreous[0], - coolingInfo.aphanitic[1], - coolingInfo.aphanitic[0], - coolingInfo.phaneritic[1] - ); - }, - "color": makeMoltenColor(phaneriteColor), - "behavior": behaviors.MOLTEN, - "temp": Math.max(phaneriteMeltingPoint,aphaniteMeltingPoint,vesiculiteMeltingPoint,vitriteMeltingPoint) + 100, - "tempLow": -Infinity, //cosmetic info - "stateLow": [aphaniteName,phaneriteName,vitriteName], - "tempHigh": magmaBoilingPoint, - "stateHigh": "vaporized_" + magmaName, - "viscosity": magmaViscosity, - "hidden": true, - "state": "liquid", - "category": "magma", - "density": magmaDensity, - "_data": [compositionFamilyName,"magma","liquid"], - }; - } else { - elements[magmaName].tempHigh = magmaBoilingPoint; - elements[magmaName].stateHigh = ["vaporized_" + magmaName]; + }, + tick: function(pixel) { + var coolingInfo = elements[pixel.element]._magmaCoolingPassToElement; + magmaRateBasedCooling( + pixel, + Math.min( + coolingInfo.meltingPoints.vitreous, + coolingInfo.meltingPoints.vesicular, + coolingInfo.meltingPoints.aphanitic, + coolingInfo.meltingPoints.phaneritic + ) - 20, + coolingInfo.vitreous[1], + coolingInfo.vitreous[0], + coolingInfo.aphanitic[1], + coolingInfo.aphanitic[0], + coolingInfo.phaneritic[1] + ); + }, + "color": makeMoltenColor(phaneriteColor), + "behavior": behaviors.MOLTEN, + "temp": Math.max(phaneriteMeltingPoint,aphaniteMeltingPoint,vesiculiteMeltingPoint,vitriteMeltingPoint) + 100, + "tempLow": -Infinity, //cosmetic info + "stateLow": [aphaniteName,phaneriteName,vitriteName], + "tempHigh": magmaBoilingPoint, + "stateHigh": "vaporized_" + magmaName, + "viscosity": magmaViscosity, + "hidden": true, + "state": "liquid", + "category": "magma", + "density": magmaDensity, + "_data": [compositionFamilyName,"magma","liquid"], }; + if(magmaOldReactions) { + elements[magmaName].reactions = magmaOldReactions; + }; + if(magmaName == "magma") { + elements.magma.color = magmaOldColor; + }; + elements[magmaName].reactions.foam = { "elem1": vesiculiteName, "elem2": vesiculiteName }; elements["vaporized_" + magmaName] = { color: magmavaporizeToHex(elements[magmaName].color), behavior: behaviors.GAS, + reactions: { + ["vaporized_" + magmaName]: { elem1: null, elem2: magmaCloudName, chance:0.3, "y":[0,15], "setting":"clouds" } + }, density: magmaDensity * 0.0028, temp: magmaBoilingPoint + 100, tempLow: magmaBoilingPoint, @@ -1201,7 +1390,7 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { vaporizedMagmas.push("vaporized_" + magmaName); - elements[magmaName + "_cloud"] = { + elements[magmaCloudName] = { color: magmacloudizeToHex(elements[magmaName].color), behavior: [ "XX|XX|XX", @@ -1211,7 +1400,7 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { density: magmaDensity * 0.0021, temp: magmaBoilingPoint + 100, tempLow: Math.min(phaneriteMeltingPoint,aphaniteMeltingPoint,vesiculiteMeltingPoint,vitriteMeltingPoint) - 50, - stateLow: aphaniteSandName, + stateLow: rockCloudName, category: "gases", state: "gas", _data: [compositionFamilyName,"magma","cloud"], @@ -1219,6 +1408,24 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { magmaClouds.push(magmaName + "_cloud"); + elements[rockCloudName] = { + color: magmacloudizeToHex(elements[magmaName].color), + behavior: [ + "XX|XX|XX", + "M1%7|CH:" + [aphaniteName,aphaniteGravelName,aphaniteDustName].join(",") + "%0.05|M1%7", + "XX|XX|XX", + ], + density: magmaDensity * 0.0024, + temp: magmaBoilingPoint + 100, + tempHigh: Math.min(phaneriteMeltingPoint,aphaniteMeltingPoint,vesiculiteMeltingPoint,vitriteMeltingPoint) - 50, + stateHigh: magmaCloudName, + category: "gases", + state: "gas", + _data: [compositionFamilyName,"magma","cloud"], + }; + + rockClouds.push(rockCloudName); + }; function standaloneBrokenFormMaker(elementName,suffixWithoutUnderscore,addBreakIntoToSourceElement=false,category=null,density=null,tempHigh=null,stateHigh=null,breakInto=null) { @@ -2671,7 +2878,7 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { newConcreteTick(pixel); }; }; - + /* //Rocks //Igneous @@ -2932,15 +3139,18 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { "XX|XX|XX", "M2|M1|M2", ], - tempHigh:1200, - stateHigh: "molten_dirt", + tempHigh: 800, + stateHigh: "hot_dirt", tempLow: -50, stateLow: "dry_permafrost", category:"land", state: "solid", density: 1100, + _data: ["mixed","mixed","particulate"] }, + elements.dirt._data = ["mixed","mixed","particulate"]; + elements.molten_dirt = { //added manually because the change to dirt will prevent molten_dirt from being auto-generated "behavior": behaviors.MOLTEN, "hidden": true, @@ -2974,22 +3184,13 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { elements.dirt.tempHigh = 110; elements.dirt.stateHigh = "dry_dirt"; - elements.water.reactions.dry_dirt = { elem1: null, elem2: "dirt", chance: 0.1 } - elements.water.reactions.radioactive_dry_dirt = { elem1: null, elem2: "radioactive_dirt", chance: 0.1 } - - if(!elements.mud.reactions) { - elements.mud.reactions = {}; - }; - elements.mud.reactions.dry_dirt = { elem1: "dirt", elem2: "dirt", chance: 0.06 } - elements.mud.reactions.radioactive_dry_dirt = { elem1: "radioactive_dirt", elem2: "radioactive_dirt", chance: 0.06 } - //Land Element Cults /* "Cult" is used similarly to its EoD sense; here, it signifies a set of elements that systematically replicates another set of elements except for a given modification. In this case, they replicate some land elements; a "yellow" cult, for example, would have yellow_dirt, yellow_mud, yellow_mudstone, yellow_permafrost, yellow_sand... */ - //Radioactive land + /*//Radioactive land //Radioactive behavior cult (see above) @@ -3280,11 +3481,11 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { "quicklime": { "elem1": [null,null,"wet_sand"], "elem2": "slaked_lime", }, "rock": { "elem2": "wet_sand", "chance": 0.00035 }, "ruins": { "elem2": "rock", "chance": 0.00035 },*/ - "mudstone": { "elem2": "radioactive_mud", "chance": 0.00035 }, - "radioactive_mudstone": { "elem2": "radioactive_mud", "chance": 0.00035 }, + /*"mudstone": { "elem2": "radioactive_mud", "chance": 0.00035 }, + "radioactive_mudstone": { "elem2": "radioactive_mud", "chance": 0.00035 },*/ //"methane": { "elem1":"primordial_soup", "elem2":"primordial_soup", tempMin:60, charged:true }, //"ammonia": { "elem1":"primordial_soup", "elem2":"primordial_soup", tempMin:60, charged:true }, - "fly": { "elem2":"dead_bug", "chance":0.1, "oneway":true }, + /*"fly": { "elem2":"dead_bug", "chance":0.1, "oneway":true }, "firefly": { "elem2":"dead_bug", "chance":0.1, "oneway":true }, "bee": { "elem2":"dead_bug", "chance":0.05, "oneway":true }, "stink_bug": { "elem2":"dead_bug", "chance":0.1, "oneway":true }, @@ -3590,16 +3791,16 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { category:"machines", insulate: true, state: "solid", - }; + };*/ elements.liquid_irradium = { color: "#5499FF", behavior: behaviors.RAD_LIQUID, - tick: function(pixel) { + /*tick: function(pixel) { for(i = 0; i < adjacentCoords.length; i++) { transformAdjacent(pixel,radioactiveObject) } - }, + },*/ //Becomes rainbow sand by water or poison, as well as by protocite, or bio-ooze //Becomes sulfuric acid on contact with it //Becomes corrupt slime by elder fluid @@ -3614,10 +3815,20 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { //https://omniblog-of-starbound.tumblr.com/post/188424072728/starbound-element-headcannon-modded-metals viscosity: 80.1, //probably misinterpreting tickDelta, and w/o the game assets, I can't compare against water, so this is in relation to H2SO4 scaled to its density in cP and under the assumption that water visc = 1 }; - + + + elements.water.reactions.dry_dirt = { elem1: null, elem2: "dirt", chance: 0.1 } + //elements.water.reactions.radioactive_dry_dirt = { elem1: null, elem2: "radioactive_dirt", chance: 0.1 } + + if(!elements.mud.reactions) { + elements.mud.reactions = {}; + }; + elements.mud.reactions.dry_dirt = { elem1: "dirt", elem2: "dirt", chance: 0.06 } + //elements.mud.reactions.radioactive_dry_dirt = { elem1: "radioactive_dirt", elem2: "radioactive_dirt", chance: 0.06 } + //Inter-mod compatibility - if(enabledMods.includes("mods/some_tf_liquids.js")) { + /*if(enabledMods.includes("mods/some_tf_liquids.js")) { elements.radioactive_basalt_gravel = { color: ["#394d37", "#3b452f", "#3f452a", "#2d3d2c"], behavior: behaviors.RAD_POWDER, @@ -3629,7 +3840,7 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { hardness: 0.26, } elements.radioactive_basalt.breakInto = "radioactive_basalt_gravel"; - }; + };*/ //Worldgen preset for testing @@ -3661,6 +3872,8 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { elements.water.reactions[filteredWaterIrradiationArray[i]] = { "elem1":"radioactive_water", chance: 0.01 } };*/ + hotRockFunction(); //needs to happen after dry dirt is defined + //Generation //TNT world From a817ca217dd90670034c0a223c2dccb634812837 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sat, 6 May 2023 18:11:20 -0400 Subject: [PATCH 11/41] merged --- mods/hot_rocks.js | 146 ---------------------------------------------- 1 file changed, 146 deletions(-) delete mode 100644 mods/hot_rocks.js diff --git a/mods/hot_rocks.js b/mods/hot_rocks.js deleted file mode 100644 index d11a71f0..00000000 --- a/mods/hot_rocks.js +++ /dev/null @@ -1,146 +0,0 @@ -var modName = "mods/hot_rocks.js"; -var groundMod = "mods/the_ground.js"; -var libraryMod = "mods/code_library.js"; - -if(enabledMods.includes(groundMod) && enabledMods.includes(libraryMod)) { - function redHotColorgen(colorIn,outputFormat="rgb") { - var color = colorIn; - //console.log(color); - if(!Array.isArray(color)) { - color = [color]; - }; - //console.log(color); - color = color.map(x => convertColorFormats(x,"json")); - //console.log(color); - for(i = 0; i < color.length; i++) { - var subcolor = color[i]; - //console.log(i); - subcolor.r += 48; - subcolor.r *= 1.7; - subcolor.g += 24; - subcolor.g *= 1.2; - subcolor.g -= 16; - subcolor.b -= 10; - subcolor.b *= 0.75; - for(colorlet in subcolor) { - subcolor[colorlet] = Math.round(rgbColorBound(subcolor[colorlet])); - }; - //console.log(color); - }; - //console.log(color); - color = color.map(x => convertColorFormats(x,outputFormat)); - if(color.length == 1) { color = color[0] }; - return color; - }; - - var hotNameOverrides = { - dry_dirt: "hot_dirt", - }; - - elements.dirt._data = ["mixed","mixed","particulate"]; - elements.dry_dirt._data = ["mixed","mixed","particulate"]; - //console.log(elements.dry_dirt.stateHigh); - - runAfterLoad(function() { - var igneousRocksAndSands = Object.keys(elements).filter( - function(elemName) { - //console.log(elemName,elements[elemName]._data?.[2]); - return ["igneous_rock","solid_igneous_rock","igneous_gravel","sedimentary_rock","particulate"].includes(elements[elemName]._data?.[2]) && !("clay","limestone","black_limestone","shale".includes(elemName)) - } - ); - - //console.log(igneousRocksAndSands); - - function hotData2Switch(data2) { - switch(data2) { - case "igneous_rock": - return "hot_igneous_rock"; - case "solid_igneous_rock": - return "hot_solid_igneous_rock"; - case "particulate": - return "hot_particulate"; - case "sedimentary_rock": - return "hot_sedimentary_rock"; - case "igneous_gravel": - return "hot_igneous_gravel"; - default: - return "hot_" + data2; - }; - }; - - igneousRocksAndSands = igneousRocksAndSands.concat("dry_dirt"); - - hotRockBehavior = [ - "XX|CR:fire%0.5|XX", - "XX|XX|XX", - "M2|M1|M2" - ]; - - solidHotRockBehavior = [ - "XX|CR:fire%0.1|XX", - "CR:fire%0.1|XX|CR:fire%0.1", - "XX|CR:fire%0.1|XX" - ]; - - for(j = 0; j < igneousRocksAndSands.length; j++) { - var rockName = igneousRocksAndSands[j]; - var rockInfo = elements[rockName]; - if(!rockInfo) { - console.error(rockName); - continue; - }; - var rockData = rockInfo._data ?? ["error","error","hot_unknown"]; - var newName = hotNameOverrides[rockName] ?? "hot_" + rockName; - //console.log(rockInfo.stateHigh); - elements[newName] = { - color: redHotColorgen(rockInfo.color,"hex"), - behavior: hotData2Switch(rockData[2]).includes("solid") ? solidHotRockBehavior : hotRockBehavior, - category: "land", - state: "solid", - temp: Math.min(rockInfo.tempHigh - 50,850), - tempHigh: rockInfo.tempHigh, - tempLow: Math.min(rockInfo.tempHigh - 100,800), - stateLow: rockName, - stateHigh: rockInfo.stateHigh, - density: rockData.density * 0.9, - hardness: rockData.density * 0.85, - //breakInto: newName + "_gravel", - _data: [rockData[0], rockData[1], hotData2Switch(rockData[2])], - }; - - if(rockName == "basalt") { - elements[newName].behavior = [ - "XX|CR:fire%0.5|XX", - "XX|XX|XX", - "XX|M1|XX" - ] - }; - - //console.log(j); - - if(rockInfo.nellfireImmune) { - elements[newName].nellfireImmune = true; - }; - - elements[rockName].tempHigh = Math.min(rockInfo.tempHigh - 100,800); - elements[rockName].stateHigh = newName; - if(rockInfo._data[2] == "igneous_rock" && elements[newName + "_gravel"]) { - elements[newName].stateHigh = newName + "_gravel"; - }; - }; - - elements.dirt.tempHigh = 100; - elements.dirt.stateHigh = "dry_dirt"; - elements.dry_dirt.tempHigh = 800; - elements.dry_dirt.stateHigh = "hot_dirt"; - elements.hot_dirt.tempHigh = 1200; - elements.hot_dirt.stateHigh = "molten_dirt"; - elements.hot_dirt.tempLow = 800; - elements.hot_dirt.stateLow = "dry_dirt"; - }); -} else { - enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod); - enabledMods.splice(enabledMods.indexOf(modName),0,groundMod); - localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); - alert(`The ${groundMod} and ${libraryMod} mods are required and have been automatically inserted (reload for this to take effect).`); -}; From cc4221efa18838eeaa38752e93c4273eb94d9a9b Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sat, 6 May 2023 18:11:52 -0400 Subject: [PATCH 12/41] comment out a log line --- mods/the_ground.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/the_ground.js b/mods/the_ground.js index b660d04d..5f822e70 100644 --- a/mods/the_ground.js +++ b/mods/the_ground.js @@ -84,7 +84,7 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { }; var rockData = rockInfo._data ?? ["error","error","hot_unknown"]; var newName = hotNameOverrides[rockName] ?? "hot_" + rockName; - console.log(newName,igneousRocksAndSands.indexOf(rockName)); + //console.log(newName,igneousRocksAndSands.indexOf(rockName)); //console.log(rockInfo.stateHigh); elements[newName] = { color: redHotColorgen(rockInfo.color,"hex"), From 26e0ee09f3a6f029d279c2d7fb7fb4190a89b1fc Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sat, 6 May 2023 20:29:17 -0400 Subject: [PATCH 13/41] fix move bug, add mood, tweak panic, added kep1er --- mods/human_edit.js | 212 ++++++++++++++++++++++++++++++++------------- 1 file changed, 150 insertions(+), 62 deletions(-) diff --git a/mods/human_edit.js b/mods/human_edit.js index bc0f0b1c..b72f78e8 100644 --- a/mods/human_edit.js +++ b/mods/human_edit.js @@ -1,5 +1,23 @@ var modName = "mods/human_edit.js"; var onTryMoveIntoMod = "mods/onTryMoveInto.js"; +if(typeof(breakPixel) == "undefined") { + function breakPixel(pixel,changetemp=false,defaultBreakIntoDust=false) { + var info = elements[pixel.element]; + if(typeof(info.breakInto) === "undefined") { + if(defaultBreakIntoDust) { + if(Math.random() < defaultBreakIntoDust) { changePixel(pixel,"dust",changetemp) }; + }; + return defaultBreakIntoDust; + }; + var breakIntoElement = info.breakInto; + if(Array.isArray(breakIntoElement)) { + breakIntoElement = breakIntoElement[Math.floor(Math.random() * breakIntoElement.length)] + }; + changePixel(pixel,breakIntoElement,changetemp) + return true + } +}; + function hasPixel(x,y,elementInput) { if(isEmpty(x,y,true)) { //if empty, it can't have a pixel return false; @@ -15,22 +33,6 @@ function hasPixel(x,y,elementInput) { }; }; -function breakPixel(pixel,changetemp=false,defaultBreakIntoDust=false) { - var info = elements[pixel.element]; - if(typeof(info.breakInto) === "undefined") { - if(defaultBreakIntoDust) { - if(Math.random() < defaultBreakIntoDust) { changePixel(pixel,"dust",changetemp) }; - }; - return defaultBreakIntoDust; - }; - var breakIntoElement = info.breakInto; - if(Array.isArray(breakIntoElement)) { - breakIntoElement = breakIntoElement[Math.floor(Math.random() * breakIntoElement.length)] - }; - changePixel(pixel,breakIntoElement,changetemp) - return true; -}; - if(enabledMods.includes(onTryMoveIntoMod)) { elements.brain = { color: ["#fce3e3","#deb6c5","#f5ced5","#e87b8f"], @@ -98,31 +100,39 @@ if(enabledMods.includes(onTryMoveIntoMod)) { //console.log(`Bounding code running from value of ${pixel.panic}`); pixel.panic = Math.max(0,Math.min(1,pixel.panic)); //console.log(`Validation result: Panic set to ${pixel.panic}`); + + if(Number.isNaN(pixel.mood)) { + //console.log("NaN case: panic set to 0"); + pixel.mood = 0; + }; + //console.log(`Bounding code running from value of ${pixel.panic}`); + pixel.mood = Math.max(-3,Math.min(3,pixel.mood)); + //console.log(`Validation result: Panic set to ${pixel.panic}`); }; goodPixels = { - silver: { panicIncrease: 0.01, panicIncreaseChance: 0.1 }, - gold: { panicIncrease: 0.02, panicIncreaseChance: 0.15 }, - diamond: { panicIncrease: 0.03, panicIncreaseChance: 0.2 }, + silver: { panicChange: 0.01, panicChangeChance: 0.1, moodChange: 0.004 }, + gold: { panicChange: 0.02, panicChangeChance: 0.15, moodChange: 0.01 }, + diamond: { panicChange: 0.03, panicChangeChance: 0.2, moodChange: 0.02 }, }; //effectively, the difference is that good pixels don't make the human flip direction (run away); badPixels = { - rotten_meat: { panicIncrease: 0.02, panicIncreaseChance: 0.15 }, - blood: { panicIncrease: 0.06, panicIncreaseChance: 0.2 }, - brain: { panicIncrease: 0.1, panicIncreaseChance: 0.3 }, - fire: { panicIncrease: 0.1, panicIncreaseChance: 0.1 }, - poison: { panicIncrease: 0.2, panicIncreaseChance: 0.05 }, - grenade: { panicIncrease: 0.2, panicIncreaseChance: 0.4 }, - bomb: { panicIncrease: 0.2, panicIncreaseChance: 0.4 }, - tnt: { panicIncrease: 0.2, panicIncreaseChance: 0.4 }, - dynamite: { panicIncrease: 0.2, panicIncreaseChance: 0.4 }, - anti_bomb: { panicIncrease: 0.2, panicIncreaseChance: 0.4 }, - cluster_bomb: { panicIncrease: 0.2, panicIncreaseChance: 0.4 }, - landmine: { panicIncrease: 0.25, panicIncreaseChance: 0.1 }, - fireball: { panicIncrease: 0.25, panicIncreaseChance: 0.45 }, - magma: { panicIncrease: 0.3, panicIncreaseChance: 0.2 }, - plasma: { panicIncrease: 0.3, panicIncreaseChance: 0.2 }, - nuke: { panicIncrease: 1, panicIncreaseChance: 1 }, //insta-panic - cluster_nuke: { panicIncrease: 1, panicIncreaseChance: 1 }, //insta-panic + rotten_meat: { panicChange: 0.02, panicChangeChance: 0.15, moodChange: -0.015 }, + blood: { panicChange: 0.06, panicChangeChance: 0.2, moodChange: -0.006 }, + brain: { panicChange: 0.1, panicChangeChance: 0.3, moodChange: -0.005 }, + fire: { panicChange: 0.1, panicChangeChance: 0.1, moodChange: 0 }, + poison: { panicChange: 0.2, panicChangeChance: 0.05, moodChange: -0.01 }, + grenade: { panicChange: 0.2, panicChangeChance: 0.4, moodChange: -0.3 }, + bomb: { panicChange: 0.2, panicChangeChance: 0.4, moodChange: -0.3 }, + tnt: { panicChange: 0.2, panicChangeChance: 0.4, moodChange: 0 }, + dynamite: { panicChange: 0.2, panicChangeChance: 0.4, moodChange: -0.3 }, + anti_bomb: { panicChange: 0.2, panicChangeChance: 0.4, moodChange: -0.3 }, + cluster_bomb: { panicChange: 0.2, panicChangeChance: 0.4, moodChange: -0.4 }, + landmine: { panicChange: 0.25, panicChangeChance: 0.1, moodChange: -0.3 }, + fireball: { panicChange: 0.25, panicChangeChance: 0.45, moodChange: -0.35 }, + magma: { panicChange: 0.3, panicChangeChance: 0.2, moodChange: 0 }, + plasma: { panicChange: 0.3, panicChangeChance: 0.2, moodChange: 0 }, + nuke: { panicChange: 1, panicChangeChance: 1, moodChange: -1 }, //insta-panic + cluster_nuke: { panicChange: 1, panicChangeChance: 1, moodChange: -1 }, //insta-panic }; //testing otherPixels = ["head","body"]; //do custom code here @@ -137,8 +147,13 @@ if(enabledMods.includes(onTryMoveIntoMod)) { elements.body.properties = { dead: false, dir: 1, + extremePanicStart: null, }; elements.body.tick = function(pixel) { + if(typeof(pixel.extremePanicStart) == "undefined") { + //console.log("oops"); + pixel.extremePanicStart = null + }; if (tryMove(pixel, pixel.x, pixel.y+1)) { // Fall if (!isEmpty(pixel.x, pixel.y-2, true)) { // Drag head down var headpixel = pixelMap[pixel.x][pixel.y-2]; @@ -192,9 +207,20 @@ if(enabledMods.includes(onTryMoveIntoMod)) { // While movesToTry is not empty, tryMove(pixel, x, y) with a random move, then remove it. if tryMove returns true, break. while (movesToTry.length > 0) { var move = movesToTry.splice(Math.floor(Math.random() * movesToTry.length), 1)[0]; - if (isEmpty(pixel.x+move[0], pixel.y+move[1]-1)) { + /* + console.log(move); + console.log("Body X:", pixel.x, "to", pixel.x+move[0]); + console.log("Body Y:", pixel.y, "to", pixel.y+move[1]); + console.log("Head X:",head.x, "to", head.x+move[0]); + console.log("Head Y:", head.y, "to", head.y+move[1]); + */ + //If head coords are empty + if (isEmpty(pixel.x+move[0], pixel.y+move[1]) && isEmpty(head.x+move[0], head.y+move[1])) { + //console.log("Head target coords are empty"); if (tryMove(pixel, pixel.x+move[0], pixel.y+move[1])) { movePixel(head, head.x+move[0], head.y+move[1]); + //console.log(`Moved body to (${pixel.x},${pixel.y}) and head to (${head.x},${head.y})`); + //console.log(`Head-body offset (should always be [0,-1]): [${head.x-pixel.x},${head.y-pixel.y}]`) break; } } @@ -206,11 +232,32 @@ if(enabledMods.includes(onTryMoveIntoMod)) { //console.log("*turns around cutely to face ${pixel.dir < 0 ? 'left' : 'right'}*"); }; }; + }; + + //if not flagged for extreme panic + //extreme panic will not be flagged in good moods, just to be nice + if(pixel.extremePanicStart == null && head.panic > 0.8 && head.mood <= 0) { + //flag extreme panic + pixel.extremePanicStart = pixelTicks; + } + //if flagged for extreme panic and panic is still extreme + else if(pixel.extremePanicStart != null && (head.panic > 0.8 && head.mood <= 0)) { + //if extreme panic lasts too long + if(pixelTicks - pixel.extremePanicStart > 350) { + //random chance to die from exhaustion/a heart attack/whatever + if(Math.random() < 0.01) { + pixel.dead = true; + }; + }; + } + //if flagged for extreme panic and extreme panic is no longer extreme + else if(pixel.extremePanicStart != null && (head.panic <= 0.8 || head.mood > 0)) { + //unflag + pixel.extremePanicStart = null; }; - var pX = pixel.x; - var pY = pixel.y; }; + elements.body.onTryMoveInto = function(pixel,otherPixel) { var pX = pixel.x; var pY = pixel.y; @@ -260,12 +307,8 @@ if(enabledMods.includes(onTryMoveIntoMod)) { dirLocked: false, panic: 0, }; + elements.head.tick = function(pixel) { - //debugging: display panic through color and temp - /*pixel.temp = (pixel.panic * 100); - var spookyColor = Math.min(pixel.panic,1) * 255; - var spookyColor2 = 255 - Math.max(pixel.panic-1, 0); - pixel.color = `rgb(${spookyColor},${spookyColor2},0)`;*/ doHeat(pixel); doBurning(pixel); doElectricity(pixel); @@ -297,6 +340,8 @@ if(enabledMods.includes(onTryMoveIntoMod)) { } } } + + pixel.mood ??= 0; if((pixelTicks-pixel.start) % 5 === 0) { //Vision loop @@ -323,14 +368,16 @@ if(enabledMods.includes(onTryMoveIntoMod)) { var newElement = newPixel.element; if(Object.keys(goodPixels).includes(newElement)) { //no dir flip - if(Math.random() > goodPixels[newElement].panicIncreaseChance) { - pixel.panic += goodPixels[newElement].panicIncrease; + if(Math.random() > goodPixels[newElement].panicChangeChance) { + pixel.panic += goodPixels[newElement].panicChange; + pixel.mood += goodPixels[newElement].moodChange; //like if there was a pretty painting item, it would make you feel better but you wouldn't necessarily feel the need to run towards it }; pixel.dirLocked = true; } else if(Object.keys(badPixels).includes(newElement)) { body.dir = 1; //flip dir - if(Math.random() > badPixels[newElement].panicIncreaseChance) { - pixel.panic += badPixels[newElement].panicIncrease; + if(Math.random() > badPixels[newElement].panicChangeChance) { + pixel.panic += badPixels[newElement].panicChange; + pixel.mood += badPixels[newElement].moodChange; }; pixel.dirLocked = true; }; //good and bad should be mutually exclusive; good will be evaulated first because one inevitably has to be considered first @@ -359,6 +406,12 @@ if(enabledMods.includes(onTryMoveIntoMod)) { } else { pixel.panic += 0.003; }; + + //the vision loop is in the head, and this is in the "seeing head" case, then this will happen when the head sees another head, and heads store panic; this is in the "other head" is panicking case so this will ultimately be the code that runs when its human sees another human panicking + if(Math.random() < 0.5) { + //run in same direction as panicking person + pixel.dir = newPixel.dir + }; }; }; } else { //severed head @@ -429,8 +482,9 @@ if(enabledMods.includes(onTryMoveIntoMod)) { var newElement = newPixel.element; if(Object.keys(goodPixels).includes(newElement)) { //no dir flip - if(Math.random() > goodPixels[newElement].panicIncreaseChance) { - pixel.panic += goodPixels[newElement].panicIncrease; + if(Math.random() > goodPixels[newElement].panicChangeChance) { + pixel.panic += goodPixels[newElement].panicChange; + pixel.mood += goodPixels[newElement].moodChange; }; pixel.dirLocked = true; } else if(Object.keys(badPixels).includes(newElement)) { @@ -438,8 +492,9 @@ if(enabledMods.includes(onTryMoveIntoMod)) { var body = pixelMap[pX][pY+1]; body.dir = -1; //run away }; - if(Math.random() > badPixels[newElement].panicIncreaseChance) { - pixel.panic += badPixels[newElement].panicIncrease; + if(Math.random() > badPixels[newElement].panicChangeChance) { + pixel.panic += badPixels[newElement].panicChange; + pixel.mood += badPixels[newElement].moodChange; }; pixel.dirLocked = true; }; //good and bad should be mutually exclusive; good will be evaulated first because one inevitably has to be considered first @@ -526,12 +581,14 @@ if(enabledMods.includes(onTryMoveIntoMod)) { //console.log("Meh."); }; - if(Math.random() < 0.02) { //2% chance each tick to decrease panic + if(Math.random() < ((pixel.panic) > 0.8 ? 0.04 : 0.02)) { //2% chance each tick to decrease panic (4% if the panic is extreme) //console.log("Decreasing panic"); pixel.panic < 0.05 ? pixel.panic = 0 : pixel.panic -= 0.05; }; + }; elements.head.breakInto = ["bone","brain","brain","cerebrospinal_fluid","blood","blood","meat"]; + elements.head.onTryMoveInto = function(pixel,otherPixel) { var pX = pixel.x; var pY = pixel.y; @@ -546,40 +603,40 @@ if(enabledMods.includes(onTryMoveIntoMod)) { var otherBody = pixelMap[oX][oY+1]; if(otherPixel.dead || otherBody.dead) { //if either part of that human is dead pixel.panic += 0.08; //being hit by a dead ******* body is terrifying - //console.log("head.onTryMoveInto: panic increase, case: head hit by dead whole body (head's code branch)"); + console.log("head.onTryMoveInto: panic increase, case: head hit by dead whole body (head's code branch)"); } else { if(otherPixel.panic > 0.04) { pixel.panic += 0.04; console.log("head.onTryMoveInto: panic increase, case: head hit by panicked whole body (head's code branch)"); }; //living, normal, headed bodies scare only if that incoming human is already scared }; } else { //if it's a severed head if(otherPixel.dead) { //if the head is dead pixel.panic += 0.08; //being hit by a /severed ******* head/ is terrifying - //console.log("head.onTryMoveInto: panic increase, case: head hit by dead severed head"); + console.log("head.onTryMoveInto: panic increase, case: head hit by dead severed head"); } else { pixel.panic += 0.1; //being hit by a //******* severed head that's still alive// is even worse - //console.log("head.onTryMoveInto: panic increase, case: head hit by living severed head"); + console.log("head.onTryMoveInto: panic increase, case: head hit by living severed head"); }; }; } else if(otherElement === "body") { //if the pixel hitting this head is a body if(hasPixel(oX,oY-1,"head")) { //if the body hitting this pixel has a head on it var otherHead = pixelMap[oX][oY-1]; if(otherPixel.dead || otherHead.dead) { //if either part of that human is dead - pixel.panic += 0.06; //dead whole body case + pixel.panic += 0.03; //dead whole body case //console.log("head.onTryMoveInto: panic increase, case: head hit by dead whole body (body's code branch)"); } else { if(otherHead.panic > 0.04) { - pixel.panic += 0.06; + pixel.panic += 0.03; //console.log("head.onTryMoveInto: panic increase, case: head crushed by panicked whole body (body's code branch)"); } else { - pixel.panic += 0.04; + pixel.panic += 0.02; //console.log("head.onTryMoveInto: panic increase, case: head crushed by whole body (body's code branch)"); }; }; } else { //severed body case if(otherPixel.dead) { //if the body is dead - pixel.panic += 0.08; //imagine being hit by a severed human without the head + pixel.panic += 0.04; //imagine being hit by a severed human without the head //console.log("head.onTryMoveInto: panic increase, case: head hit by dead severed body"); } else { - pixel.panic += 0.1; //imagine the above but the heart is still beating + pixel.panic += 0.05; //imagine the above but the heart is still beating //console.log("head.onTryMoveInto: panic increase, case: head hit by living severed body"); }; }; @@ -614,8 +671,39 @@ if(enabledMods.includes(onTryMoveIntoMod)) { [0, "dirt"] ] }; + + kep1er = [ + ["first_impact", ["#664482","#cf4ba3","#c15ca9","#f0a669"]], + ["doublast", ["#2b98fd","#d0e26d","#e6f049","#dce4b3"]], + ["fly-up", ["#f2f2f2","#15a667","#de0180"]], + ["troubleshooter", ["#291923","#ed3fb6","#fee6f8","#64c5e0","#d6cdca","#330d25"]], + ["fly-by", ["#e7e6dd","#fcf0ef","#efa1ba","#8d7cb6","#5e74ba","#2b5db5","#e292b7"]], + ["lovestruck", ["#bfd9f0","#bfd9f0","#fef792","#c36475","#edd1d6"]], + ]; + + for(index in kep1er) { + index = parseInt(index); + var newName = kep1er[index][0]; + var newColor = kep1er[index][1]; + var newDisplayName = newName.replaceAll("_"," ").replaceAll("-"," - ").split(" ").map(x => x.substring(0,1).toUpperCase() + x.substring(1)).join(" ").replace(" - ","-"); + elements[newName] = { + name: newDisplayName, + color: newColor, + tempHigh: 200, + stateHigh: ["ash","molten_plastic"], + density: 332, //based off of First Impact: https://www.amazon.com/Kep1er-IMPACT-Contents-Tracking-Connect/dp/B09MQMNZ62 + behavior: behaviors.POWDER, + burn: 40, + burnTime: 150, + burnInto: ["ash","molten_plastic","carbon_dioxide","smoke"], + category: "other" + }; + + goodPixels[newName] = { panicChange: 0.01, panicChangeChance: 0.2, moodChange: 0.035 }; + }; + } else { - alert(`The ${onTryMoveIntoMod} mod is required and has been automatically inserted (reload for this to take effect).`) enabledMods.splice(enabledMods.indexOf(modName),0,onTryMoveIntoMod) localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); + alert(`The ${onTryMoveIntoMod} mod is required and has been automatically inserted (reload for this to take effect).`) }; From ea1d1ece29a838bc8395a9e8e3c3b793086c288f Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sat, 6 May 2023 20:49:39 -0400 Subject: [PATCH 14/41] change kep1er behavior --- mods/human_edit.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/mods/human_edit.js b/mods/human_edit.js index b72f78e8..6fc2e10a 100644 --- a/mods/human_edit.js +++ b/mods/human_edit.js @@ -692,7 +692,23 @@ if(enabledMods.includes(onTryMoveIntoMod)) { tempHigh: 200, stateHigh: ["ash","molten_plastic"], density: 332, //based off of First Impact: https://www.amazon.com/Kep1er-IMPACT-Contents-Tracking-Connect/dp/B09MQMNZ62 - behavior: behaviors.POWDER, + tick: function(pixel) { + if(!(tryMove(pixel,pixel.x,pixel.y+1))) { + var directions = []; + if(isEmpty(pixel.x-1,pixel.y+2)) { + directions.push(-1) + }; + if(isEmpty(pixel.x+1,pixel.y+2)) { + directions.push(1) + }; + if(directions.length > 0) { + tryMove(pixel,pixel.x+directions[Math.floor(Math.random() * directions.length)],pixel.y) + }; + } + }, + reactions: { + water: { elem1: ["plastic","cellulose","cellulose"], elem2: ["water","water","cellulose",null,null], chance: 0.8 } + }, burn: 40, burnTime: 150, burnInto: ["ash","molten_plastic","carbon_dioxide","smoke"], From d32e2d1226912077639eea689ae168dc7428a17d Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sat, 6 May 2023 20:51:39 -0400 Subject: [PATCH 15/41] fear changes f --- mods/human_edit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/human_edit.js b/mods/human_edit.js index 6fc2e10a..445d142a 100644 --- a/mods/human_edit.js +++ b/mods/human_edit.js @@ -273,7 +273,7 @@ if(enabledMods.includes(onTryMoveIntoMod)) { if(otherPixel.dead || otherBody.dead) { //if either part of that human is dead head.panic += 0.08; //being hit by a dead ******* body is terrifying } else { - if(otherPixel.panic > 0.04) { head.panic += 0.04 }; //living, normal, bodied heads scare only if that incoming human is already scared + if(otherPixel.panic > 0.04 && otherPixel.mood <= 0) { head.panic += 0.04 }; //living, normal, bodied heads scare only if that incoming human is already scared }; } else { //if it's a severed head if(otherPixel.dead) { //if the head is dead From 1869e7b3510e1017eaa157eb651ae2f3d0b1fdff Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sat, 6 May 2023 21:39:34 -0400 Subject: [PATCH 16/41] more inherited info --- mods/neutronium_compressor.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mods/neutronium_compressor.js b/mods/neutronium_compressor.js index cefcbcf2..fc59d905 100644 --- a/mods/neutronium_compressor.js +++ b/mods/neutronium_compressor.js @@ -175,6 +175,8 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) //console.log(elementOfSingularity); + var returns = []; + if(!elementExists(singularityName)) { elements[singularityName] = { color: newColorArray, @@ -184,9 +186,14 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) temp: firstTemp, hardness: 0.995, singularityNumber: null, + originalElementDisplay: elements[elementOfSingularity.replaceAll(",","_")]?.originalElementKey ?? elementOfSingularity.split(","), + originalElementKey: elements[elementOfSingularity.replaceAll(",","_")]?.originalElementKey ?? elementOfSingularity.split(","), state: "solid", density: finalDensity, }; + var newInfo = elements[singularityName]; + elements[singularityName].originalElementDisplay = newInfo.originalElementKey.map(x => elements[x].name ?? x); + if(elements[singularityName].originalElementDisplay.length == 1) { elements[singularityName].originalElementDisplay = elements[singularityName].originalElementDisplay[0] }; if(singularityElements[0] instanceof Array) { elements[singularityName].singularityNumber = 1; } else { @@ -196,6 +203,11 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) elements[singularityName].singularityNumber = elements[singularityElements[0]].singularityNumber + 1; }; }; + var num = newInfo.singularityNumber ?? NaN; + var descTypeString = (num == 1 ? "singularity" : `${num.toString()}-singularity`); + var descNumberString = (num < 4 ? (10 ** (num * 4)).toLocaleString("en-US") : `10${num * 4}`); + var descElementString = tryJoin((newInfo.originalElementDisplay ?? "[Original element could not be determined]"),", "); + elements[singularityName].desc = `A ${descTypeString} normally made of ${descNumberString} pixels of ${descElementString}.`.replaceAll("NaN","[Quantity could not be determined]"); if(singularityName.includes("haseulite") && !singularityName.includes("haseulite_vent")) { elements[singularityName].tick = function(pixel) { haseulitoidSingularityTick(pixel) }; haseuliteSpreadWhitelist.push(singularityName); @@ -236,8 +248,9 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) }; }; count++; + returns.push(singularityName); }; - return count; + return returns; }; elements.neutronium_compressor = { From a58d61e3efd0c974341e5eb1969366072a91e498 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 7 May 2023 11:24:37 -0400 Subject: [PATCH 17/41] partial update --- mods/the_ground.js | 223 ++++++++++++++++++++++++--------------------- 1 file changed, 118 insertions(+), 105 deletions(-) diff --git a/mods/the_ground.js b/mods/the_ground.js index 5f822e70..b70993df 100644 --- a/mods/the_ground.js +++ b/mods/the_ground.js @@ -32,11 +32,7 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { //Basically the entire hot_rocks.js code function hotRockFunction() { - var hotNameOverrides = { - dry_dirt: "hot_dirt", - }; - - var igneousRocksAndSands = Object.keys(elements).filter( + var rocksSandsAndSoils = Object.keys(elements).filter( function(elemName) { //console.log(elemName,elements[elemName]._data?.[2]); return ["igneous_rock","solid_igneous_rock","igneous_gravel","sedimentary_rock","particulate"].includes(elements[elemName]._data?.[2]) && !("clay","limestone","black_limestone","shale".includes(elemName)) @@ -60,8 +56,6 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { }; }; - igneousRocksAndSands = igneousRocksAndSands.concat("dry_dirt"); - hotRockBehavior = [ "XX|CR:fire%0.5|XX", "XX|XX|XX", @@ -74,33 +68,35 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { "XX|CR:fire%0.1|XX" ]; - console.log(igneousRocksAndSands) - for(j = 0; j < igneousRocksAndSands.length; j++) { - var rockName = igneousRocksAndSands[j]; + //console.log(rocksSandsAndSoils) + for(j = 0; j < rocksSandsAndSoils.length; j++) { + var rockName = rocksSandsAndSoils[j]; var rockInfo = elements[rockName]; if(!rockInfo) { - console.error(rockName); + console.error(`${rockName}`); continue; }; var rockData = rockInfo._data ?? ["error","error","hot_unknown"]; - var newName = hotNameOverrides[rockName] ?? "hot_" + rockName; - //console.log(newName,igneousRocksAndSands.indexOf(rockName)); + var newName = rockName.startsWith("dry_") ? rockName.replace("dry_","hot_") : "hot_" + rockName; //console.log(rockInfo.stateHigh); elements[newName] = { color: redHotColorgen(rockInfo.color,"hex"), behavior: hotData2Switch(rockData[2]).includes("solid") ? solidHotRockBehavior : hotRockBehavior, category: "land", state: "solid", + stateHigh: rockInfo.stateHigh, temp: Math.min(rockInfo.tempHigh - 50,850), tempHigh: rockInfo.tempHigh, tempLow: Math.min(rockInfo.tempHigh - 100,800), stateLow: rockName, - stateHigh: rockInfo.stateHigh, - density: rockData.density * 0.9, - hardness: rockData.density * 0.85, + density: rockInfo.density * 0.9, + hardness: rockInfo.density * 0.85, //breakInto: newName + "_gravel", _data: [rockData[0], rockData[1], hotData2Switch(rockData[2])], }; + + //console.log([elements[rockName].tempHigh,elements[rockName].stateHigh]); + //console.log([elements[newName].tempLow,elements[newName].stateLow]) if(rockName == "basalt") { elements[newName].behavior = [ @@ -125,10 +121,6 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { elements.dirt.tempHigh = 100; elements.dirt.stateHigh = "dry_dirt"; - elements.hot_dirt.tempHigh = 1200; - elements.hot_dirt.stateHigh = "molten_dirt"; - elements.hot_dirt.tempLow = 800; - elements.hot_dirt.stateLow = "dry_dirt"; }; //Star world matter function @@ -602,17 +594,17 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { //Sands - function sandizeToHex(rockName,type="normal",sBringTo=31,sBringFactor=0.4,lBringTo=70,lBringFactor=0.6) { - //console.log(rockName); + function sandizeToHex(rockColor,type="normal",sBringTo=31,sBringFactor=0.4,lBringTo=70,lBringFactor=0.6) { + if(elements[rockColor]) { + //Assuming an element was given, for compatibility + rockColor = elements[rockColor].color + }; if(!["normal","n","wet","w","packed","p"].includes(type.toLowerCase())) { throw new Error("Type must be 'normal', 'wet', or 'packed'"); }; - var rockInfo = elements[rockName]; - if(!rockInfo) { throw new Error("No such element '" + rockName + "'") }; var sandColor = []; //var sandColorObject = []; - var rockColor = rockInfo.color; - if(!rockColor instanceof Array) { + if(!(rockColor instanceof Array)) { rockColor = [rockColor]; }; for(i = 0; i < rockColor.length; i++) { @@ -643,14 +635,15 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { return sandColor; }; - function dustizeToHex(rockName,sBringTo=25,sBringFactor=0.4,lBringTo=55,lBringFactor=0.6) { + function dustizeToHex(rockColor,sBringTo=25,sBringFactor=0.4,lBringTo=55,lBringFactor=0.6) { + if(elements[rockColor]) { + //Assuming an element was given, for compatibility + rockColor = elements[rockColor].color + }; //console.log(rockName); - var rockInfo = elements[rockName]; - if(!rockInfo) { throw new Error("No such element '" + rockName + "'") }; var dustColor = []; //var dustColorObject = []; - var rockColor = rockInfo.color; - if(!rockColor instanceof Array) { + if(!(rockColor instanceof Array)) { rockColor = [rockColor]; }; for(i = 0; i < rockColor.length; i++) { @@ -771,6 +764,26 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { return color; }; + function rockcloudizeToHex(colorIn) { + var color = colorIn; + + if(!(color instanceof Array)) { + color = [color]; + }; + + color = color.map(x => normalizeColorToHslObject(x)); + + for(i = 0; i < color.length; i++) { + color[i].h -= 12; + color[i].s *= 0.12; + color[i].l -= 6; + }; + + color = color.map(x => convertHslObjects(x,"hex")); + + return color; + }; + //Generate an entire composition family at once function redHotColorgen(colorIn,outputFormat="rgb") { @@ -1401,7 +1414,7 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { temp: magmaBoilingPoint + 100, tempLow: Math.min(phaneriteMeltingPoint,aphaniteMeltingPoint,vesiculiteMeltingPoint,vitriteMeltingPoint) - 50, stateLow: rockCloudName, - category: "gases", + category: "magma", state: "gas", _data: [compositionFamilyName,"magma","cloud"], }; @@ -1409,17 +1422,17 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { magmaClouds.push(magmaName + "_cloud"); elements[rockCloudName] = { - color: magmacloudizeToHex(elements[magmaName].color), + color: rockcloudizeToHex(elements[magmaName].color), behavior: [ "XX|XX|XX", "M1%7|CH:" + [aphaniteName,aphaniteGravelName,aphaniteDustName].join(",") + "%0.05|M1%7", "XX|XX|XX", ], density: magmaDensity * 0.0024, - temp: magmaBoilingPoint + 100, + temp: Math.min(phaneriteMeltingPoint,aphaniteMeltingPoint,vesiculiteMeltingPoint,vitriteMeltingPoint) - 300, tempHigh: Math.min(phaneriteMeltingPoint,aphaniteMeltingPoint,vesiculiteMeltingPoint,vitriteMeltingPoint) - 50, stateHigh: magmaCloudName, - category: "gases", + category: "magma", state: "gas", _data: [compositionFamilyName,"magma","cloud"], }; @@ -1975,77 +1988,76 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { elements.molten_dirt.tempHigh = 3313; var rockStateHigh = JSON.parse(JSON.stringify(vaporizedMagmas)); + //no nellish or rainbow magma in dirt if(rockStateHigh.includes("vaporized_nellish_magma")) { rockStateHigh.splice(rockStateHigh.indexOf("vaporized_nellish_magma")); }; + if(rockStateHigh.includes("vaporized_rainbow_magma")) { + rockStateHigh.splice(rockStateHigh.indexOf("vaporized_rainbow_magma")); + }; elements.molten_dirt.stateHigh = rockStateHigh; //assuming mixture + + for(var sandIndex in sands) { + sandIndex = parseInt(sandIndex); + var sandName = sands[sandIndex]; + var usedSandColor = elements[sandName].color; + if(!(usedSandColor instanceof Array)) { + usedSandColor = [usedSandColor]; + }; + + var newSandyClayColor = usedSandColor.map(subcolor => lerpColors(subcolor,elements.clay.color,"hex",weight1=0.5)); + + var newSandyLoamColor = []; + for(var dirtSubcolorIndex in elements.dirt.color) { + dirtSubcolorIndex = parseInt(dirtSubcolorIndex); + dirtSubcolor = elements.dirt.color[dirtSubcolorIndex]; + //for each dirt subcolor, to the final new color concatenate the result of mapping each of the sand color's subcolors to one of dirt's subcolors + newSandyLoamColor = newSandyLoamColor.concat(usedSandColor.map(subcolor => lerpColors(subcolor,dirtSubcolor,"hex",weight1=0.6))); + }; + + var newLoamySandColor = []; + for(var dirtSubcolorIndex in elements.dirt.color) { + dirtSubcolorIndex = parseInt(dirtSubcolorIndex); + dirtSubcolor = elements.dirt.color[dirtSubcolorIndex]; + //for each dirt subcolor, to the final new color concatenate the result of mapping each of the sand color's subcolors to one of dirt's subcolors + newLoamySandColor = newLoamySandColor.concat(usedSandColor.map(subcolor => lerpColors(subcolor,dirtSubcolor,"hex",weight1=0.4))); + }; + + var newSandyClayLoamColor = newSandyLoamColor.map(subcolor => lerpColors(subcolor,elements.clay.color,"hex",weight1=2/3)); + + + var newSandyLoamColor = elements.dirt.color.map(subcolor => lerpColors(subcolor,elements.clay.color,"hex",weight1=0.5)); + } + + var newClayLoamColor = elements.dirt.color.map(subcolor => changeHue(lerpColors(subcolor,elements.clay.color,"hex",weight1=0.5),0.9,"multiply","hex")); + var newDryClayLoamColor = newClayLoamColor.map(x => changeSaturation(changeLuminance(x,15,"add","hsljson"),0.9,"multiply","hex")); + newPowder("clay_loam",newClayLoamColor,1500,100,"dry_clay_loam",["dirt","clay_soil"]); + + elements.clay_loam._data = ["clay_loam","soil","particulate"]; + + //manual addition due to autogen fuckery and i don't feel like calling in runAfterAutogen + elements.molten_clay_loam = { + "behavior": behaviors.MOLTEN, + "hidden": true, + "state": "liquid", + "category": "states", + "color": [ "rgb(255,217,75)", "rgb(255,174,75)", "rgb(255,130,0)", "rgb(255,205,70)", "rgb(255,164,70)", "rgb(255,123,0)", "rgb(255,202,68)", "rgb(255,162,68)", "rgb(255,121,0)", "rgb(255,210,72)", "rgb(255,168,72)", "rgb(255,126,0)" ].map(x => convertColorFormats(x,"hex")), + "tempLow": 1250, + "stateLow": "dry_clay_loam", + "density": 1350, + "viscosity": 10000 + }; + + newPowder("dry_clay_loam",newDryClayLoamColor,1500,1250,"molten_clay_loam",["dry_dirt","clay_soil"]); + + elements.dry_clay_loam.data = ["clay_loam","dry_soil","particulate"]; + + //newPowder(name,color,density=null,tempHigh=null,stateHigh=null,breakInto=null) }); //Terrain //Soils - - //Dry - //Warning: Crippling lack of online information on the properties of the various soils by texture - - //Clay - - //Clay exists - - //Silty clay - - //TODO - - //Silty Clay Loam - - //TODO - - //Silty Loam - - //TODO - - //Silt - - //TODO - - //Clay Loam - - //TODO - //elements.clay_soil.name = "Clay Loam" - - //Medium Loam - - //TODO - //elements.dirt.name = "Medium Loam"; - - //Sandy Clay - - /*elements.sandy_clay = { - color: "#DDCD8A", - behavior: behaviors.POWDER, - tempHigh: 1710, - tempLow: -50, - stateLow: "sandy_clay_permafrost", - category:"land", - state: "solid", - density: 1220, - };*/ - - //Sandy Clay Loam - - //TODO - - //Sandy Loam - - //TODO - - //Loamy Sand - - //TODO - - //Sand - - //Sand exists //Wet @@ -3132,6 +3144,8 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { //Dry dirt + elements.dirt.forceAutoGen = true; + elements.dry_dirt = { color: ["#a88e5e","#8f7950","#8a7045","#9e804c"], behavior: [ @@ -3139,20 +3153,21 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { "XX|XX|XX", "M2|M1|M2", ], - tempHigh: 800, - stateHigh: "hot_dirt", + tempHigh: 1200, + stateHigh: "molten_dirt", tempLow: -50, stateLow: "dry_permafrost", category:"land", state: "solid", density: 1100, - _data: ["mixed","mixed","particulate"] + _data: ["loam","dry_soil","particulate"] }, - elements.dirt._data = ["mixed","mixed","particulate"]; + elements.dirt._data = ["loam","soil","particulate"]; elements.molten_dirt = { //added manually because the change to dirt will prevent molten_dirt from being auto-generated "behavior": behaviors.MOLTEN, + "name": "molten_loam", "hidden": true, "state": "liquid", "category": "states", @@ -3164,10 +3179,8 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { "viscosity": 10000 } - if(enabledMods.includes("mods/boiling_rock.js")) { - elements.molten_dirt.tempHigh = 3000; - elements.molten_dirt.stateHigh = "vaporized_rock"; - }; + elements.molten_dirt.tempHigh = 3000; + elements.molten_dirt.stateHigh = "vaporized_rock"; elements.dry_permafrost = { color: ["#5B7870","#535D51","#52746A","#5A7A6F"], From 89c7bbf7dcb65b585cc6402d1875024ee5c3386a Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 7 May 2023 11:32:40 -0400 Subject: [PATCH 18/41] comment out logs --- mods/human_edit.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mods/human_edit.js b/mods/human_edit.js index 445d142a..1cdf42b1 100644 --- a/mods/human_edit.js +++ b/mods/human_edit.js @@ -603,17 +603,17 @@ if(enabledMods.includes(onTryMoveIntoMod)) { var otherBody = pixelMap[oX][oY+1]; if(otherPixel.dead || otherBody.dead) { //if either part of that human is dead pixel.panic += 0.08; //being hit by a dead ******* body is terrifying - console.log("head.onTryMoveInto: panic increase, case: head hit by dead whole body (head's code branch)"); + //console.log("head.onTryMoveInto: panic increase, case: head hit by dead whole body (head's code branch)"); } else { - if(otherPixel.panic > 0.04) { pixel.panic += 0.04; console.log("head.onTryMoveInto: panic increase, case: head hit by panicked whole body (head's code branch)"); }; //living, normal, headed bodies scare only if that incoming human is already scared + //if(otherPixel.panic > 0.04) { pixel.panic += 0.04; console.log("head.onTryMoveInto: panic increase, case: head hit by panicked whole body (head's code branch)"); }; //living, normal, headed bodies scare only if that incoming human is already scared }; } else { //if it's a severed head if(otherPixel.dead) { //if the head is dead pixel.panic += 0.08; //being hit by a /severed ******* head/ is terrifying - console.log("head.onTryMoveInto: panic increase, case: head hit by dead severed head"); + //console.log("head.onTryMoveInto: panic increase, case: head hit by dead severed head"); } else { pixel.panic += 0.1; //being hit by a //******* severed head that's still alive// is even worse - console.log("head.onTryMoveInto: panic increase, case: head hit by living severed head"); + //console.log("head.onTryMoveInto: panic increase, case: head hit by living severed head"); }; }; } else if(otherElement === "body") { //if the pixel hitting this head is a body @@ -695,10 +695,10 @@ if(enabledMods.includes(onTryMoveIntoMod)) { tick: function(pixel) { if(!(tryMove(pixel,pixel.x,pixel.y+1))) { var directions = []; - if(isEmpty(pixel.x-1,pixel.y+2)) { + if(isEmpty(pixel.x-1,pixel.y+1) && isEmpty(pixel.x-1,pixel.y+2)) { directions.push(-1) }; - if(isEmpty(pixel.x+1,pixel.y+2)) { + if(isEmpty(pixel.x+1,pixel.y+1) && isEmpty(pixel.x+1,pixel.y+2)) { directions.push(1) }; if(directions.length > 0) { From 40b0bf5caa50d36b183b300d3d03e9c13b0bce29 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 7 May 2023 11:36:02 -0400 Subject: [PATCH 19/41] amonus (bugfixes) --- mods/generative_mods.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/generative_mods.js b/mods/generative_mods.js index ba0c3de2..52b62d6f 100644 --- a/mods/generative_mods.js +++ b/mods/generative_mods.js @@ -114,12 +114,12 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu //Bombs amalgamatedBombFire = "plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,smoke,plasma,plasma,fire,smoke,fire,smoke,plasma,metal_scrap,metal_scrap,metal_scrap,metal_scrap,metal_scrap,acid,acid,oil,oil,oil,oil,oil,oil,oil,plasma,plasma,plasma,plasma,plasma,smoke,plasma,plasma,fire,smoke,plasma,metal_scrap,metal_scrap,metal_scrap,metal_scrap,metal_scrap,metal_scrap,flash,flash,flash,flash,flash,acid_gas,acid_gas,acid_gas,acid,oil,oil,oil,oil,oil,oil,oil,oil,oil,oil,plasma,plasma,plasma,plasma,metal_scrap,metal_scrap,metal_scrap,metal_scrap,metal_scrap,acid,acid,oil,oil,oil,oil,oil,oil,oil,plasma,plasma,plasma,plasma,plasma,smoke,plasma,plasma,fire,smoke,plasma,metal_scrap,metal_scrap,metal_scrap,metal_scrap,metal_scrap,metal_scrap,electric_cluster_bomb,electric_cluster_bomb,flash,flash,flash,flash,flash,acid_gas,acid_gas,acid_gas,acid,oil,oil,oil,oil,oil,oil,oil,oil,oil,oil,plasma,plasma,plasma,plasma,plague,plague,plague,plague,plague,plague,radiation,radiation,radiation,radiation,radiation,radiation,radiation,radiation,uranium,uranium,uranium,uranium,uranium,uranium,greek_fire,greek_fire,greek_fire,greek_fire,greek_fire,antimatter,antimatter,antimatter,antimatter,antimatter,smoke_grenade,antimatter,smoke_grenade,fireball,flash,acid_gas,acid_gas,acid_gas,plague,plague,plague,plague,plague,plague,radiation,radiation,radiation,radiation,radiation,radiation,radiation,radiation,uranium,uranium,uranium,uranium,uranium,uranium,greek_fire,greek_fire,greek_fire,greek_fire,greek_fire,antimatter,antimatter,antimatter,antimatter,antimatter,smoke_grenade,antimatter,flash,acid_gas,acid_gas,acid_gas,radiation,radiation,radiation,radiation,plague,acid_gas,acid_gas,acid_gas,chlorine,chlorine,chlorine" - eLists.BOMB = ["bomb", "tnt", "c4", "grenade", "dynamite", "gunpowder", "firework", "nuke", "h_bomb", "dirty_bomb", "emp_bomb", "sticky_bomb", "cold_bomb", "hot_bomb", "electro_bomb", "water_bomb", "antimatter_bomb", "flashbang", "smoke_grenade", "fireball", "landmine", "cluster_bomb", "cluster_nuke", "op_hottester_bomb", "anti-bomb", "electric_bomblet", "electric_cluster_bomb", "radioactive_popper", "acid_bomb", "amalgamated_bomb"]; + eLists.BOMB = ["bomb", "tnt", "c4", "grenade", "dynamite", "gunpowder", "firework", "nuke", "h_bomb", "dirty_bomb", "emp_bomb", "sticky_bomb", "cold_bomb", "hot_bomb", "electro_bomb", "water_bomb", "antimatter_bomb", "flashbang", "smoke_grenade", "fireball", "landmine", "cluster_bomb", "cluster_nuke", "op_hottester_bomb", "anti-bomb", "electric_bomblet", "electric_cluster_bomb", "radioactive_popper", "acid_bomb", "amalgamated_bomb"]; bombChoices = eLists.BOMB; var excludedBombElements = ["water", "antimatter", "acid"]; //Clouds - eLists.CLOUD = ["cloud", "rain_cloud", "snow_cloud", "fire_cloud", "hail_cloud", "acid_cloud", "pyrocumulus"]; + eLists.CLOUD = ["cloud", "rain_cloud", "snow_cloud", "fire_cloud", "hail_cloud", "acid_cloud", "pyrocumulus"]; cloudChoices = eLists.CLOUD; var includedClouds = ["cloud", "rain_cloud", "snow_cloud", "fire_cloud", "hail_cloud", "acid_cloud", "pyrocumulus"]; var excludedCloudElements = ["snow", "fire", "hail", "acid"]; if(typeof(behaviorGenerators) === "undefined") { behaviorGenerators = {} }; @@ -137,7 +137,7 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu var backupElementWhitelist = ["mercury", "chalcopyrite_ore", "chalcopyrite_dust", "copper_concentrate", "fluxed_copper_concentrate", "unignited_pyrestone", "ignited_pyrestone", "everfire_dust", "extinguished_everfire_dust", "mistake", "polusium_oxide", "vaporized_polusium_oxide", "glowstone_dust", "redstone_dust", "soul_mud", "wet_soul_sand", "nitrogen_snow", "fusion_catalyst", "coal", "coal_coke", "blast_furnace_fuel", "molten_mythril"]; //Spouts - eLists.SPOUT = ["spout", "udder", "torch"]; + eLists.SPOUT = ["spout", "udder", "torch"]; spoutChoices = eLists.SPOUT; var excludedSpoutElements = ["ketchup", "liquid_cloner", "fire_cloner"] var includedSpouts = ["ketchup_spout", "spout", "udder", "torch"] var backupCategoryWhitelist = ["land","powders","weapons","food","life","corruption","states","fey","Fantastic Creatures","dyes","energy liquids","random liquids","random gases","random rocks"]; From c868a06f773dda8b213cfaa080f82f4e9f1fc8fc Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 7 May 2023 12:00:02 -0400 Subject: [PATCH 20/41] test --- mods/rays.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mods/rays.js b/mods/rays.js index 43c7a8cd..0a7e8ee0 100644 --- a/mods/rays.js +++ b/mods/rays.js @@ -244,13 +244,13 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) else { var otherPixel = pixelMap[x][y] var otherInfo = elements[otherPixel.element]; - otherPixel.temp += 400; + otherPixel.temp += (400 * (shiftDown + 1)); if(otherPixel.del) { continue }; if (!(grbBreakIntos.includes(otherPixel.element))) { if (otherInfo.isGas) { - if(Math.random() > ((otherInfo.hardness ?? 0) ** 4)) { breakPixel(otherPixel,false,false) }; + if(Math.random() > ((otherInfo.hardness ?? 0) ** (4 + shiftDown))) { breakPixel(otherPixel,false,false) }; if(hasVelocity && otherPixel && !(lightlikes.includes(otherPixel.element))) { - var vels = [randomIntegerBetweenTwoValues(-7,7),randomIntegerBetweenTwoValues(-7,7)]; + var vels = [randomIntegerBetweenTwoValues(-7 - (shiftDown * 2),7 + (shiftDown * 2)),randomIntegerBetweenTwoValues(-7 - (shiftDown * 2),7 + (shiftDown * 2))]; otherPixel.vx = vels[0]; otherPixel.vy = vels[1]; }; @@ -258,13 +258,13 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) }; if (otherInfo.id === elements[pixel.element].id) { break } - if(Math.random() > ((otherInfo.hardness ?? 0) ** 2)) { breakPixel(otherPixel,false,false) }; + if(Math.random() > ((otherInfo.hardness ?? 0) ** (2 + shiftDown))) { breakPixel(otherPixel,false,false) }; if(hasVelocity && otherPixel) { - var vels = [randomIntegerBetweenTwoValues(-9,9),randomIntegerBetweenTwoValues(-7,0)]; + var vels = [randomIntegerBetweenTwoValues(-9 - (shiftDown * 2),9 + (shiftDown * 2)),randomIntegerBetweenTwoValues(-7 - (shiftDown * 2),0 + (shiftDown * 2))]; otherPixel.vx = vels[0]; otherPixel.vy = vels[1]; }; - if(Math.random() < Math.max(0.9,0.4 + ((1 - (otherInfo.hardness ?? 0)) / 2))) { //thanks, I hate random continue + if(Math.random() < ((shiftDown / 20) + (Math.max(0.9,0.4 + ((1 - (otherInfo.hardness ?? 0)) / 2))))) { //thanks, I hate random continue continue; }; break; From 7d2f1b274ce8c0747ad7bd97341a6a650948a8f3 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 7 May 2023 14:12:06 -0400 Subject: [PATCH 21/41] replace rayIgnoreSelf to more useful rayIgnore array system --- mods/ray_cloner.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/ray_cloner.js b/mods/ray_cloner.js index 6d6abd8f..254e5f1a 100644 --- a/mods/ray_cloner.js +++ b/mods/ray_cloner.js @@ -3,7 +3,7 @@ var libraryMod = "mods/code_library.js"; var propMod = "mods/prop.js"; var variablesMod = "mods/prop and prompt variables.js"; if(enabledMods.includes(libraryMod) && enabledMods.includes(propMod) && enabledMods.includes(variablesMod)) { - function placeRegularlySpacedPixels(element,startX,startY,xSpacing,ySpacing,overwrite=false,stopAt=null,rayIgnore=null,spawnTemp=null,limit=1000) { + function placeRegularlySpacedPixels(element,startX,startY,xSpacing,ySpacing,overwrite=false,stopAt=null,rayIgnore=[],spawnTemp=null,limit=1000) { if(element.includes(",")) { element = element.split(",") }; var newElement = element; if(isNaN(xSpacing) || isNaN(ySpacing)) { @@ -94,7 +94,7 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(propMod) && enabledM ySpacing: 0, overwrite: false, stopAt: null, - rayIgnoreSelf: true, + rayIgnore: [], spawnAtPixelTemp: false, maxPixels: 1000, /*clone: "plasma", @@ -118,7 +118,7 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(propMod) && enabledM pixel.ySpacing, pixel.overwrite, pixel.stopAt, - pixel.rayIgnoreSelf ? pixel.clone : null, + pixel.rayIgnore, pixel.spawnAtPixelTemp ? pixel.temp : null, pixel.maxPixels ); From 9d02183a60afd554554f7cb53f1d3ada7d4cbb59 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 7 May 2023 15:09:47 -0400 Subject: [PATCH 22/41] wifi --- mods/wifi.js | 162 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 mods/wifi.js diff --git a/mods/wifi.js b/mods/wifi.js new file mode 100644 index 00000000..cf87ddd9 --- /dev/null +++ b/mods/wifi.js @@ -0,0 +1,162 @@ +var modName = "mods/wifi.js"; +var libraryMod = "mods/code_library.js"; + +if(enabledMods.includes(libraryMod)) { + //https://stackoverflow.com/a/60922255 + if(!enabledMods.includes("mods/mobs.js")) { + headBodyObject = { + "head": "body", + }; + }; + + elements.wifi = { + color: "#bfff7f", + properties: { + _channel: 0, + _correspondingWifi: null, + }, + conduct: 1, + insulate: true, + tick: function(pixel) { + pixel._channel = Math.floor(pixel.temp / 100); + + var colorBase = (pixel._channel + 3); + if(colorBase < 0 || colorBase > 63) { + pixel.color == "rgb(212,185,222)"; + } else { + colorBase = colorBase.toString(4).padStart(3,"0").split("").map(x => parseInt(x) * 64); + pixel.color = `rgb(${colorBase.join(",")})` + }; + + pixel._correspondingWifi = currentPixels.filter(function(pixelToCheck) { + return ( + pixelToCheck !== pixel && //should work if this pixel is the same as the other one by reference + ["wifi","receiver"].includes(pixelToCheck.element) && + pixelToCheck._channel == pixelChannel + ); + },pixelChannel=pixel._channel).map(pixel => [pixel.x,pixel.y]); + + if(pixel.charge) { + for(var i in pixel._correspondingWifi) { + i = parseInt(i); + var wifiCoords = pixel._correspondingWifi[i]; + var newPixel = pixelMap[wifiCoords[0]]?.[wifiCoords[1]]; + if(newPixel) { + if(!newPixel.chargeCD) { + for(var j in adjacentCoords) { + j = parseInt(j); + var pixelAdjacentToWifi = pixelMap[newPixel.x+adjacentCoords[j][0]]?.[newPixel.y+adjacentCoords[j][1]]; + if(pixelAdjacentToWifi) { pixelAdjacentToWifi.charge = 1 }; + }; + } + } + }; + if(pixel._correspondingWifi.length > 0) { + delete pixel.charge; + pixel.chargeCD = 5 + } + } + + if(typeof(pixel.chargeCD) !== "undefined") { + pixel.chargeCD--; + if(pixel.chargeCD <= 0) { delete pixel.chargeCD }; + }; + }, + category: "machines", + state: "solid", + }; + + elements.transmitter = { + color: "#00ff7f", + properties: { + _channel: 0, + _correspondingWifi: null, + }, + conduct: 1, + insulate: true, + tick: function(pixel) { + pixel._channel = Math.floor(pixel.temp / 100); + + var colorBase = (pixel._channel + 3); + if(colorBase < 0 || colorBase > 63) { + pixel.color == "rgb(212,185,222)"; + } else { + colorBase = colorBase.toString(4).padStart(3,"0").split("").map(x => parseInt(x) * 64); + pixel.color = `rgb(${colorBase.join(",")})` + }; + + pixel._correspondingWifi = currentPixels.filter(function(pixelToCheck) { + return ( + pixelToCheck !== pixel && //should work if this pixel is the same as the other one by reference + ["wifi","receiver"].includes(pixelToCheck.element) && + pixelToCheck._channel == pixelChannel + ); + },pixelChannel=pixel._channel).map(pixel => [pixel.x,pixel.y]); + + if(pixel.charge) { + for(var i in pixel._correspondingWifi) { + i = parseInt(i); + var wifiCoords = pixel._correspondingWifi[i]; + var newPixel = pixelMap[wifiCoords[0]]?.[wifiCoords[1]]; + if(newPixel) { + if(!newPixel.chargeCD) { + for(var j in adjacentCoords) { + j = parseInt(j); + var pixelAdjacentToWifi = pixelMap[newPixel.x+adjacentCoords[j][0]]?.[newPixel.y+adjacentCoords[j][1]]; + if(pixelAdjacentToWifi && elements[pixelAdjacentToWifi.element].conduct) { pixelAdjacentToWifi.charge = 1 }; + }; + } + } + }; + if(pixel._correspondingWifi.length > 0) { + delete pixel.charge; + pixel.chargeCD = 5 + } + } + + if(typeof(pixel.chargeCD) !== "undefined") { + pixel.chargeCD--; + if(pixel.chargeCD <= 0) { delete pixel.chargeCD }; + }; + }, + category: "machines", + state: "solid", + } + + elements.receiver = { + color: "#bfff00", + properties: { + _channel: 0, + }, + conduct: 1, + insulate: true, + tick: function(pixel) { + pixel._channel = Math.floor(pixel.temp / 100); + + var colorBase = (pixel._channel + 3); + if(colorBase < 0 || colorBase > 63) { + pixel.color == "rgb(212,185,222)"; + } else { + colorBase = colorBase.toString(4).padStart(3,"0").split("").map(x => parseInt(x) * 64); + pixel.color = `rgb(${colorBase.join(",")})` + }; + + if(typeof(pixel.chargeCD) !== "undefined") { + pixel.chargeCD = Math.min(pixel.chargeCD,5); + pixel.chargeCD--; + if(pixel.chargeCD <= 0) { delete pixel.chargeCD }; + }; + if(pixel.charge) { + pixel.charge -= 0.25; + if(pixel.charge <= 0) { delete pixel.charge }; + }; + }, + category: "machines", + state: "solid", + } + +} else { + if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) }; + localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); + alert(`The "${libraryMod}" mods is required; and has been automatically inserted (reload for this to take effect).`) +}; From 4811e97dfca1076e9b732a0a011cdc517aad4fe9 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 7 May 2023 15:45:02 -0400 Subject: [PATCH 23/41] incompat merge noConduct --- mods/doElectricity changes.js | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/doElectricity changes.js b/mods/doElectricity changes.js index 9d7fc59b..e505fa5e 100644 --- a/mods/doElectricity changes.js +++ b/mods/doElectricity changes.js @@ -13,6 +13,7 @@ function doElectricity(pixel) { var newPixel = pixelMap[x][y]; var con = elements[newPixel.element].conduct; if (con == undefined) {continue} + if (info.noConduct?.length && info.noConduct.includes(newPixel.element)) {continue}; if (Math.random() < con) { // If random number is less than conductivity if (!newPixel.charge && !newPixel.chargeCD) { newPixel.charge = isNaN(pixel.charge) ? 0 : pixel.charge; //Actually set it to the same charge From dc2700d9293da5bdfbd2f1f3ce17da75e6db9ef5 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 7 May 2023 15:45:24 -0400 Subject: [PATCH 24/41] merge delete noConduct.js incompatible with doElectricity changes.js --- mods/noConduct.js | 43 ------------------------------------------- 1 file changed, 43 deletions(-) delete mode 100644 mods/noConduct.js diff --git a/mods/noConduct.js b/mods/noConduct.js deleted file mode 100644 index 5c6535bb..00000000 --- a/mods/noConduct.js +++ /dev/null @@ -1,43 +0,0 @@ -function doElectricity(pixel) { - var info = elements[pixel.element]; - if (pixel.charge) { - // Check each adjacent pixel, if that pixel's charge is false, set it to the same charge - for (var i = 0; i < adjacentCoords.length; i++) { - var x = pixel.x+adjacentCoords[i][0]; - var y = pixel.y+adjacentCoords[i][1]; - if (!isEmpty(x,y,true)) { - var newPixel = pixelMap[x][y]; - var con = elements[newPixel.element].conduct; - if (con == undefined) {continue} - if (info.noConduct?.length && info.noConduct.includes(newPixel.element)) {continue}; - if (Math.random() < con) { // If random number is less than conductivity - if (!newPixel.charge && !newPixel.chargeCD) { - newPixel.charge = 1; - if (elements[newPixel.element].colorOn) { - newPixel.color = pixelColorPick(newPixel); - } - } - } - else if (elements[newPixel.element].insulate != true) { // Otherwise heat the pixel (Resistance simulation) - newPixel.temp += pixel.charge/4; - pixelTempCheck(newPixel); - } - } - } - pixel.charge -= 0.25; - if (pixel.charge <= 0) { - delete pixel.charge; - pixel.chargeCD = 4; - } - } - // Lower charge cooldown - else if (pixel.chargeCD) { - pixel.chargeCD -= 1; - if (pixel.chargeCD <= 0) { - delete pixel.chargeCD; - if (info.colorOn) { - pixel.color = pixelColorPick(pixel); - } - } - } -} From bb97d4317088a0aa8caf887d95bb34e36d456c0b Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 7 May 2023 15:46:07 -0400 Subject: [PATCH 25/41] gyhjko --- mods/doElectricity changes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/doElectricity changes.js b/mods/doElectricity changes.js index e505fa5e..8c45be29 100644 --- a/mods/doElectricity changes.js +++ b/mods/doElectricity changes.js @@ -13,7 +13,7 @@ function doElectricity(pixel) { var newPixel = pixelMap[x][y]; var con = elements[newPixel.element].conduct; if (con == undefined) {continue} - if (info.noConduct?.length && info.noConduct.includes(newPixel.element)) {continue}; + if (info?.noConduct?.length && info.noConduct.includes(newPixel.element)) {continue}; if (Math.random() < con) { // If random number is less than conductivity if (!newPixel.charge && !newPixel.chargeCD) { newPixel.charge = isNaN(pixel.charge) ? 0 : pixel.charge; //Actually set it to the same charge From 0558726c46e51faac7fa669342b9810324a413d3 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 7 May 2023 15:47:30 -0400 Subject: [PATCH 26/41] hyeju --- mods/doElectricity changes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/doElectricity changes.js b/mods/doElectricity changes.js index 8c45be29..5316ffb9 100644 --- a/mods/doElectricity changes.js +++ b/mods/doElectricity changes.js @@ -13,7 +13,7 @@ function doElectricity(pixel) { var newPixel = pixelMap[x][y]; var con = elements[newPixel.element].conduct; if (con == undefined) {continue} - if (info?.noConduct?.length && info.noConduct.includes(newPixel.element)) {continue}; + if (elements[newPixel.element].noConduct?.length && elements[newPixel.element].noConduct.includes(newPixel.element)) {continue}; if (Math.random() < con) { // If random number is less than conductivity if (!newPixel.charge && !newPixel.chargeCD) { newPixel.charge = isNaN(pixel.charge) ? 0 : pixel.charge; //Actually set it to the same charge From 067836312a5c4b19597750c7dd3d64d303ec16b6 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 7 May 2023 15:48:21 -0400 Subject: [PATCH 27/41] heck --- mods/switches.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mods/switches.js b/mods/switches.js index e4e2e2d0..392aa7f3 100644 --- a/mods/switches.js +++ b/mods/switches.js @@ -1,7 +1,7 @@ var modName = "mods/switches.js"; -var noConductMod = "mods/noConduct.js"; +var formerlyNoConductMod = "mods/doElectricity changes.js"; -if(enabledMods.includes(noConductMod)) { +if(enabledMods.includes(formerlyNoConductMod)) { elements.switch_off = { name: "switch (off)", color: "#7F3333", @@ -45,7 +45,7 @@ if(enabledMods.includes(noConductMod)) { category: "machines", }; } else { - enabledMods.splice(enabledMods.indexOf(modName),0,noConductMod) - alert(`The ${noConductMod} mod is required and has been automatically inserted (reload for this to take effect).`) + enabledMods.splice(enabledMods.indexOf(modName),0,formerlyNoConductMod) + alert(`The ${formerlyNoConductMod} mod is required and has been automatically inserted (reload for this to take effect).`) localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); }; From 14886f32e08580b6603549daa50676bd137b6794 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 7 May 2023 15:52:52 -0400 Subject: [PATCH 28/41] sex with hyeju --- mods/switches.js | 102 ++++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 49 deletions(-) diff --git a/mods/switches.js b/mods/switches.js index 392aa7f3..9e98834e 100644 --- a/mods/switches.js +++ b/mods/switches.js @@ -1,51 +1,55 @@ -var modName = "mods/switches.js"; -var formerlyNoConductMod = "mods/doElectricity changes.js"; +console.log("doElectricity should be changed"); -if(enabledMods.includes(formerlyNoConductMod)) { - elements.switch_off = { - name: "switch (off)", - color: "#7F3333", - behavior: behaviors.WALL, - noConduct: ["switch_on_control","switch_off_control"], - category: "machines", +function doElectricity(pixel) { + if(isNaN(pixel.charge)) { + pixel.charge = 0; }; - - elements.switch_on = { - name: "switch (on)", - color: "#33CC33", - behavior: behaviors.WALL, - conduct: 1, - noConduct: ["switch_on_control","switch_off_control"], - category: "machines", - }; - - elements.switch_off_control = { - color: "#FF3333", - behavior: behaviors.WALL, - behaviorOn: [ - "XX|CH:switch_on>switch_off|XX", - "CH:switch_on>switch_off|XX|CH:switch_on>switch_off", - "XX|CH:switch_on>switch_off|XX" - ], - conduct: 1, - noConduct: ["switch_on","switch_off"], - category: "machines", - }; - - elements.switch_on_control = { - color: "#33FF33", - behavior: behaviors.WALL, - behaviorOn: [ - "XX|CH:switch_off>switch_on|XX", - "CH:switch_off>switch_on|XX|CH:switch_off>switch_on", - "XX|CH:switch_off>switch_on|XX" - ], - conduct: 1, - noConduct: ["switch_on","switch_off"], - category: "machines", - }; -} else { - enabledMods.splice(enabledMods.indexOf(modName),0,formerlyNoConductMod) - alert(`The ${formerlyNoConductMod} mod is required and has been automatically inserted (reload for this to take effect).`) - localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); -}; + if (pixel.charge) { + // Check each adjacent pixel, if that pixel's charge is false, set it to the same charge + for (var i = 0; i < adjacentCoords.length; i++) { + var x = pixel.x+adjacentCoords[i][0]; + var y = pixel.y+adjacentCoords[i][1]; + if (!isEmpty(x,y,true)) { + var newPixel = pixelMap[x][y]; + var con = elements[newPixel.element].conduct; + if (con == undefined) {continue} + var info = elements[pixel.element]; + if (info.noConduct && info.noConduct.includes(newPixel.element)) {continue}; + if (Math.random() < con) { // If random number is less than conductivity + if (!newPixel.charge && !newPixel.chargeCD) { + newPixel.charge = isNaN(pixel.charge) ? 0 : pixel.charge; //Actually set it to the same charge + if (elements[newPixel.element].colorOn) { + newPixel.color = pixelColorPick(newPixel); + } + if(elements[newPixel.element].onCharge) { + pixel.charge ??= 0; + if(isNaN(pixel.charge)) { pixel.charge = 0 }; + elements[newPixel.element].onCharge(pixel); + }; + } + } + else if (elements[newPixel.element].insulate != true && !elements[newPixel.element].noResistance) { // Otherwise heat the pixel (Resistance simulation) + newPixel.temp += isNaN(pixel.charge) ? 0.25 : pixel.charge/4; + pixelTempCheck(newPixel); + } + } + } + pixel.charge -= 0.25; + if (pixel.charge <= 0) { + delete pixel.charge; + //console.log(elements[pixel.element].chargeCD); + var chargeCd = elements[pixel.element].chargeCD ?? 4; + pixel.chargeCD = chargeCd; //Customizable chargeCD + } + } + // Lower charge cooldown + else if (pixel.chargeCD) { + pixel.chargeCD -= 1; + if (pixel.chargeCD <= 0) { + delete pixel.chargeCD; + if (elements[pixel.element].colorOn) { + pixel.color = pixelColorPick(pixel); + } + } + } +} From c32a3e58bc48bab385d021bbb3c1d726e5f89213 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 7 May 2023 15:54:15 -0400 Subject: [PATCH 29/41] sex with heejin --- mods/doElectricity changes.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mods/doElectricity changes.js b/mods/doElectricity changes.js index 5316ffb9..df3d3d0a 100644 --- a/mods/doElectricity changes.js +++ b/mods/doElectricity changes.js @@ -13,7 +13,8 @@ function doElectricity(pixel) { var newPixel = pixelMap[x][y]; var con = elements[newPixel.element].conduct; if (con == undefined) {continue} - if (elements[newPixel.element].noConduct?.length && elements[newPixel.element].noConduct.includes(newPixel.element)) {continue}; + var info = elements[pixel.element]; + if (info.noConduct && info.noConduct.includes(newPixel.element)) {continue}; if (Math.random() < con) { // If random number is less than conductivity if (!newPixel.charge && !newPixel.chargeCD) { newPixel.charge = isNaN(pixel.charge) ? 0 : pixel.charge; //Actually set it to the same charge From 66234c8484d5020090bd97292c58df7be467bda7 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 7 May 2023 15:55:17 -0400 Subject: [PATCH 30/41] sex with github --- mods/switches.js | 102 +++++++++++++++++++++++------------------------ 1 file changed, 49 insertions(+), 53 deletions(-) diff --git a/mods/switches.js b/mods/switches.js index 9e98834e..392aa7f3 100644 --- a/mods/switches.js +++ b/mods/switches.js @@ -1,55 +1,51 @@ -console.log("doElectricity should be changed"); +var modName = "mods/switches.js"; +var formerlyNoConductMod = "mods/doElectricity changes.js"; -function doElectricity(pixel) { - if(isNaN(pixel.charge)) { - pixel.charge = 0; +if(enabledMods.includes(formerlyNoConductMod)) { + elements.switch_off = { + name: "switch (off)", + color: "#7F3333", + behavior: behaviors.WALL, + noConduct: ["switch_on_control","switch_off_control"], + category: "machines", }; - if (pixel.charge) { - // Check each adjacent pixel, if that pixel's charge is false, set it to the same charge - for (var i = 0; i < adjacentCoords.length; i++) { - var x = pixel.x+adjacentCoords[i][0]; - var y = pixel.y+adjacentCoords[i][1]; - if (!isEmpty(x,y,true)) { - var newPixel = pixelMap[x][y]; - var con = elements[newPixel.element].conduct; - if (con == undefined) {continue} - var info = elements[pixel.element]; - if (info.noConduct && info.noConduct.includes(newPixel.element)) {continue}; - if (Math.random() < con) { // If random number is less than conductivity - if (!newPixel.charge && !newPixel.chargeCD) { - newPixel.charge = isNaN(pixel.charge) ? 0 : pixel.charge; //Actually set it to the same charge - if (elements[newPixel.element].colorOn) { - newPixel.color = pixelColorPick(newPixel); - } - if(elements[newPixel.element].onCharge) { - pixel.charge ??= 0; - if(isNaN(pixel.charge)) { pixel.charge = 0 }; - elements[newPixel.element].onCharge(pixel); - }; - } - } - else if (elements[newPixel.element].insulate != true && !elements[newPixel.element].noResistance) { // Otherwise heat the pixel (Resistance simulation) - newPixel.temp += isNaN(pixel.charge) ? 0.25 : pixel.charge/4; - pixelTempCheck(newPixel); - } - } - } - pixel.charge -= 0.25; - if (pixel.charge <= 0) { - delete pixel.charge; - //console.log(elements[pixel.element].chargeCD); - var chargeCd = elements[pixel.element].chargeCD ?? 4; - pixel.chargeCD = chargeCd; //Customizable chargeCD - } - } - // Lower charge cooldown - else if (pixel.chargeCD) { - pixel.chargeCD -= 1; - if (pixel.chargeCD <= 0) { - delete pixel.chargeCD; - if (elements[pixel.element].colorOn) { - pixel.color = pixelColorPick(pixel); - } - } - } -} + + elements.switch_on = { + name: "switch (on)", + color: "#33CC33", + behavior: behaviors.WALL, + conduct: 1, + noConduct: ["switch_on_control","switch_off_control"], + category: "machines", + }; + + elements.switch_off_control = { + color: "#FF3333", + behavior: behaviors.WALL, + behaviorOn: [ + "XX|CH:switch_on>switch_off|XX", + "CH:switch_on>switch_off|XX|CH:switch_on>switch_off", + "XX|CH:switch_on>switch_off|XX" + ], + conduct: 1, + noConduct: ["switch_on","switch_off"], + category: "machines", + }; + + elements.switch_on_control = { + color: "#33FF33", + behavior: behaviors.WALL, + behaviorOn: [ + "XX|CH:switch_off>switch_on|XX", + "CH:switch_off>switch_on|XX|CH:switch_off>switch_on", + "XX|CH:switch_off>switch_on|XX" + ], + conduct: 1, + noConduct: ["switch_on","switch_off"], + category: "machines", + }; +} else { + enabledMods.splice(enabledMods.indexOf(modName),0,formerlyNoConductMod) + alert(`The ${formerlyNoConductMod} mod is required and has been automatically inserted (reload for this to take effect).`) + localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); +}; From b4a0c4a20ac2d07c3ec1a530978a4bba358eff3d Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 7 May 2023 16:03:29 -0400 Subject: [PATCH 31/41] stayc girls --- mods/wifi.js | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/mods/wifi.js b/mods/wifi.js index cf87ddd9..aaaa086d 100644 --- a/mods/wifi.js +++ b/mods/wifi.js @@ -3,12 +3,6 @@ var libraryMod = "mods/code_library.js"; if(enabledMods.includes(libraryMod)) { //https://stackoverflow.com/a/60922255 - if(!enabledMods.includes("mods/mobs.js")) { - headBodyObject = { - "head": "body", - }; - }; - elements.wifi = { color: "#bfff7f", properties: { @@ -21,10 +15,10 @@ if(enabledMods.includes(libraryMod)) { pixel._channel = Math.floor(pixel.temp / 100); var colorBase = (pixel._channel + 3); - if(colorBase < 0 || colorBase > 63) { + if(colorBase < 0 || colorBase > 124) { pixel.color == "rgb(212,185,222)"; } else { - colorBase = colorBase.toString(4).padStart(3,"0").split("").map(x => parseInt(x) * 64); + colorBase = colorBase.toString(5).padStart(3,"0").split("").map(x => parseInt(x) * 64); pixel.color = `rgb(${colorBase.join(",")})` }; @@ -78,10 +72,10 @@ if(enabledMods.includes(libraryMod)) { pixel._channel = Math.floor(pixel.temp / 100); var colorBase = (pixel._channel + 3); - if(colorBase < 0 || colorBase > 63) { + if(colorBase < 0 || colorBase > 124) { pixel.color == "rgb(212,185,222)"; } else { - colorBase = colorBase.toString(4).padStart(3,"0").split("").map(x => parseInt(x) * 64); + colorBase = colorBase.toString(5).padStart(3,"0").split("").map(x => parseInt(x) * 64); pixel.color = `rgb(${colorBase.join(",")})` }; @@ -134,10 +128,10 @@ if(enabledMods.includes(libraryMod)) { pixel._channel = Math.floor(pixel.temp / 100); var colorBase = (pixel._channel + 3); - if(colorBase < 0 || colorBase > 63) { - pixel.color == "rgb(212,185,222)"; + if(colorBase < 0 || colorBase > 124) { + pixel.color = "rgb(212,185,222)"; } else { - colorBase = colorBase.toString(4).padStart(3,"0").split("").map(x => parseInt(x) * 64); + colorBase = colorBase.toString(5).padStart(3,"0").split("").map(x => parseInt(x) * 64); pixel.color = `rgb(${colorBase.join(",")})` }; From 6274c6781f01e388d65bc74e19725c047541ed67 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 7 May 2023 16:08:02 -0400 Subject: [PATCH 32/41] nerf wifi --- mods/wifi.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mods/wifi.js b/mods/wifi.js index aaaa086d..bdc94a21 100644 --- a/mods/wifi.js +++ b/mods/wifi.js @@ -9,6 +9,8 @@ if(enabledMods.includes(libraryMod)) { _channel: 0, _correspondingWifi: null, }, + hardness: 0.8, + breakInto: ["plastic","steel","copper"], conduct: 1, insulate: true, tick: function(pixel) { @@ -66,6 +68,8 @@ if(enabledMods.includes(libraryMod)) { _channel: 0, _correspondingWifi: null, }, + hardness: 0.8, + breakInto: ["plastic","steel","copper"], conduct: 1, insulate: true, tick: function(pixel) { @@ -122,6 +126,8 @@ if(enabledMods.includes(libraryMod)) { properties: { _channel: 0, }, + hardness: 0.8, + breakInto: ["plastic","steel","copper"], conduct: 1, insulate: true, tick: function(pixel) { From 67353e74a41dcdcecf2470cc3aff3775d4af4760 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Sun, 7 May 2023 18:15:24 -0400 Subject: [PATCH 33/41] added kep1er --- mods/date_test.js | 122 ++++++++++++++++++++++++++-------------------- 1 file changed, 68 insertions(+), 54 deletions(-) diff --git a/mods/date_test.js b/mods/date_test.js index 88d804b0..7590e6d8 100644 --- a/mods/date_test.js +++ b/mods/date_test.js @@ -5,70 +5,83 @@ if(enabledMods.includes(haseuliteMod)) { fakeDate = urlParams.get('fakeDate'); shortenedTest = (urlParams.get('shortenedTest') !== null); - loonaObject = { + idolData = { "08-01": [ - {member: "Seo Dahyun",color: "rgb(251,160,227)",group: "tripleS"}, - {member: "Kwak Yeonji",color: "rgb(89,116,255)",group: "tripleS"},//Fod gucking damn it + {member: "Seo Dahyun", color: "rgb(251,160,227)", group: "tripleS"}, + {member: "Kwak Yeonji", color: "rgb(89,116,255)", group: "tripleS"}, ], - "23-01": {member: "Isa",color: "rgb(0,0,0)",group: "STAYC"}, - "01-02": {member: "Jihyo",color: "rgb(250,200,87)",group: "Twice"}, + "23-01": {member: "Isa", color: "rgb(0,0,0)", group: "STAYC"}, + "01-02": {member: "Jihyo", color: "rgb(250,200,87)", group: "Twice"}, "03-02": [ - {member: "Rei",color: "rgba(105,195,45)",group: "IVE"}, - {member: "Gong Yubin",color: "rgb(255,227,226)",group: "tripleS"}, + {member: "Rei", color: "rgba(105,195,45)", group: "IVE"}, + {member: "Gong Yubin", color: "rgb(255,227,226)", group: "tripleS"}, ], - "09-02": {member: "Kim Yooyeon",color: "rgb(205,102,171)",group: "tripleS"}, - "21-02": {member: "Leeseo",color: "rgb(255,240,1)",group: "IVE"}, - "10-02": {member: "Kim Lip",color: "rgb(234,2,1)",group: "Loona"}, - "10-03": {member: "Kotone",color: "rgb(255,246,84)",group: "tripleS"}, - "13-03": {member: "Sumin",color: "rgb(255,192,203)",group: "STAYC"}, - "24-03": {member: "Mina",color: "rgb(111,197,194)",group: "Twice"}, - "12-04": {member: "Jeong Hyerin",color: "rgb(142,108,255)",group: "tripleS"}, - "14-04": {member: "Yoon",color: "rgb(50,205,50)",group: "STAYC"},//so pretty soijejdsjiodiopziajreldkxf - "23-04": {member: "Chaeyoung",color: "rgb(255,23,68)",group: "Twice"}, - "24-05": {member: "Yves",color: "rgb(125,0,30)",group: "Loona"}, - "28-05": {member: "Dahyun",color: "rgb(255,255,255)",group: "Twice"}, - "04-06": {member: "Choerry",color: "rgb(92,44,146)",group: "Loona"}, - "13-06": {member: "JinSoul",color: "rgb(20,36,176)",group: "Loona"}, + "09-02": {member: "Kim Yooyeon", color: "rgb(205,102,171)", group: "tripleS"}, + "21-02": {member: "Leeseo", color: "rgb(255,240,1)", group: "IVE"}, + "10-02": {member: "Kim Lip", color: "rgb(234,2,1)", group: "Loona"}, + "02-03": {member: "Dayeon", color: "rgb", group: "Kep1er"}, + "10-03": {member: "Kotone", color: "rgb(255,246,84)", group: "tripleS"}, + "12-03": {member: "Hikaru", color:"rgb", group: "Kep1er"}, + "13-03": {member: "Sumin", color: "rgb(255,192,203)", group: "STAYC"}, + "24-03": {member: "Mina", color: "rgb(111,197,194)", group: "Twice"}, + "12-04": {member: "Jeong Hyerin", color: "rgb(142,108,255)", group: "tripleS"}, + "14-04": {member: "Yoon", color: "rgb(50,205,50)", group: "STAYC"}, + "23-04": {member: "Chaeyoung", color: "rgb(255,23,68)", group: "Twice"}, + "26-04": {member: "Chaehyun", color:"rgb", group: "Kep1er"}, + "24-05": {member: "Yves", color: "rgb(125,0,30)", group: "Loona"}, + "28-05": {member: "Dahyun", color: "rgb(255,255,255)", group: "Twice"}, + "02-06": {member: "Nien", color: "rgb(255,149,64)", group: "tripleS"}, + "04-06": {member: "Choerry", color: "rgb(92,44,146)", group: "Loona"}, + "13-06": {member: "JinSoul", color: "rgb(20,36,176)", group: "Loona"}, "14-06": [ - {member: "Seeun",color: "rgb(135,206,235)",group: "STAYC"}, - {member: "Tzuyu",color: "rgb(2,119,189)",group: "Twice"} + {member: "Seeun", color: "rgb(135,206,235)", group: "STAYC"}, + {member: "Tzuyu", color: "rgb(2,119,189)", group: "Twice"} ], - "01-08": {member: "Sieun",color: "rgb(255,255,255)",group: "STAYC"}, - "06-08": {member: "Yoon Seoyeon",color: "rgb(34,174,255)",group: "tripleS"}, - "18-08": {member: "HaSeul",color: "rgb(0,166,81)",group: "Loona"}, - "31-08": {member: "Wonyoung",color: "rgb(255,0,30)",group: "IVE"},//stay mad - "01-09": {member: "Yujin",color: "rgb(255,57,154)",group: "IVE"}, - "22-09": {member: "Nayeon",color: "rgb(129,212,250)",group: "Twice"}, - "24-09": {member: "Gaeul",color: "rgb(0,85,168)",group: "IVE"}, - "03-10": {member: "Kim Soomin",color: "rgb(236,138,165)",group: "tripleS"}, - "13-10": {member: "Kim Nakyoung",color: "rgb(101,153,164)",group: "tripleS"}, - "19-10": {member: "HeeJin",color: "rgb(255,0,146)",group: "Loona"}, - "20-10": {member: "Chuu",color: "rgb(246,144,126)",group: "Loona"}, - "24-10": {member: "Lee Jiwoo",color: "rgb(255,249,36)",group: "tripleS"}, - "01-11": {member: "Jeongyeon",color: "rgb(188,215,118)",group: "Twice"}, - "09-11": {member: "Momo",color: "rgb(248,207,215)",group: "Twice"}, - "11-11": {member: "YeoJin",color: "rgb(244,111,31)",group: "Loona"}, - "13-11": {member: "Olivia Hye",color: "rgb(143,143,143)",group: "Loona"}, - "15-11": {member: "HyunJin",color: "rgb(255,204,0)",group: "Loona"}, - "19-11": {member: "Go Won",color: "rgb(48,195,156)",group: "Loona"}, - "21-11": {member: "Liz",color: "rgb(0,195,245)",group: "IVE"}, - "04-12": {member: "Kim Chaeyeon",color: "rgb(141,191,65)",group: "tripleS"}, + "27-07": {member: "Huening Bahiyyih", color:"rgb", group: "Kep1er"}, + "01-08": {member: "Sieun", color: "rgb(255,255,255)", group: "STAYC"}, + "06-08": {member: "Yoon Seoyeon", color: "rgb(34,174,255)", group: "tripleS"}, + "12-08": {member: "Choi Yujin", color:"rgb", group: "Kep1er"}, + "18-08": {member: "HaSeul", color: "rgb(0,166,81)", group: "Loona"}, + "22-08": {member: "Yeseo", color:"rgb", group: "Kep1er"}, + "31-08": {member: "Wonyoung", color: "rgb(255,0,30)", group: "IVE"},//stay mad + "01-09": {member: "Yujin", color: "rgb(255,57,154)", group: "IVE"}, + "22-09": {member: "Nayeon", color: "rgb(129,212,250)", group: "Twice"}, + "24-09": {member: "Gaeul", color: "rgb(0,85,168)", group: "IVE"}, + "03-10": {member: "Kim Soomin", color: "rgb(236,138,165)", group: "tripleS"}, + "13-10": [ + {member: "Kim Nakyoung", color: "rgb(101,153,164)", group: "tripleS"}, + {member: "Park Sohyun", color: "rgb(19,34,182)", group: "tripleS"}, + ], + "19-10": {member: "HeeJin", color: "rgb(255,0,146)", group: "Loona"}, + "20-10": {member: "Chuu", color: "rgb(246,144,126)", group: "Loona"}, + "24-10": {member: "Lee Jiwoo", color: "rgb(255,249,36)", group: "tripleS"}, + "01-11": {member: "Jeongyeon", color: "rgb(188,215,118)", group: "Twice"}, + "09-11": {member: "Momo", color: "rgb(248,207,215)", group: "Twice"}, + "11-11": {member: "YeoJin", color: "rgb(244,111,31)", group: "Loona"}, + "12-11": {member: "Xiaoting", color:"rgb", group: "Kep1er"}, + "13-11": {member: "Olivia Hye", color: "rgb(143,143,143)", group: "Loona"}, + "15-11": {member: "HyunJin", color: "rgb(255,204,0)", group: "Loona"}, + "19-11": {member: "Go Won", color: "rgb(48,195,156)", group: "Loona"}, + "21-11": {member: "Liz", color: "rgb(0,195,245)", group: "IVE"}, + "04-12": {member: "Kim Chaeyeon", color: "rgb(141,191,65)", group: "tripleS"}, "09-12": [ - {member: "ViVi",color: "rgb(255,152,180)",group: "Loona"}, - {member: "J",color: "rgb(255,0,0)",group: "STAYC"} + {member: "ViVi", color: "rgb(255,152,180)", group: "Loona"}, + {member: "J", color: "rgb(255,0,0)", group: "STAYC"} ], - "20-12": {member: "Kaede",color: "rgb(255,201,53)",group: "tripleS"}, - "29-12": {member: "Sana",color: "rgb(159,168,218)",group: "Twice"} + "16-12": {member: "Mashiro", color:"rgb", group: "Kep1er"}, + "20-12": {member: "Kaede", color: "rgb(255,201,53)", group: "tripleS"}, + "27-12": {member: "Youngeun", color:"rgb", group: "Kep1er"}, + "29-12": {member: "Sana", color: "rgb(159,168,218)", group: "Twice"} }; var chaos = []; - for(date in loonaObject) { + for(date in idolData) { if(date == "chaos") { continue }; - if(!(loonaObject[date] instanceof Array)) { loonaObject[date] = [loonaObject[date]] }; //array wrap + if(!(idolData[date] instanceof Array)) { idolData[date] = [idolData[date]] }; //array wrap - chaos = chaos.concat(loonaObject[date]); + chaos = chaos.concat(idolData[date]); }; - loonaObject.chaos = chaos; + idolData.chaos = chaos; var february10Override = false; @@ -83,7 +96,7 @@ if(enabledMods.includes(haseuliteMod)) { } function registerElemClick(elementName,memberDataIndex) { - var dateData = loonaObject[getDayMonth()]; + var dateData = idolData[getDayMonth()]; if(!dateData) { alert("No birthday data here"); return false; @@ -155,8 +168,8 @@ if(enabledMods.includes(haseuliteMod)) { var randomElementSets = {}; - if(loonaObject[dayMonth]) { - var data = loonaObject[dayMonth]; + if(idolData[dayMonth]) { + var data = idolData[dayMonth]; for(var memberIndex = 0; memberIndex < data.length; memberIndex++) { var member = data[memberIndex].member; @@ -203,7 +216,7 @@ if(enabledMods.includes(haseuliteMod)) { }; runAfterButtons(function() { - var data = loonaObject[getDayMonth()]; + var data = idolData[getDayMonth()]; //console.log(data); for(var memberIndex = 0; memberIndex < data.length; memberIndex++) { var member = data[memberIndex].member; @@ -230,6 +243,7 @@ if(enabledMods.includes(haseuliteMod)) { for(element in funnyElements) { var elemName = funnyElements[element]; var info = elements[elemName]; + if(!info) { console.log(element) }; var memberData = data[memberIndex]; if(typeof(info.desc) === "undefined") { info.desc = "" From 26980c584aafafddee23e7f0e1fb21bb4ba57c67 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Mon, 8 May 2023 11:30:05 -0400 Subject: [PATCH 34/41] the switch fix keeps reverting itself and it's so fucking annoying --- mods/doElectricity changes.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mods/doElectricity changes.js b/mods/doElectricity changes.js index df3d3d0a..5bb17b70 100644 --- a/mods/doElectricity changes.js +++ b/mods/doElectricity changes.js @@ -13,8 +13,7 @@ function doElectricity(pixel) { var newPixel = pixelMap[x][y]; var con = elements[newPixel.element].conduct; if (con == undefined) {continue} - var info = elements[pixel.element]; - if (info.noConduct && info.noConduct.includes(newPixel.element)) {continue}; + if (elements[pixel.element].noConduct?.length && elements[pixel.element].noConduct.includes(newPixel.element)) {continue}; if (Math.random() < con) { // If random number is less than conductivity if (!newPixel.charge && !newPixel.chargeCD) { newPixel.charge = isNaN(pixel.charge) ? 0 : pixel.charge; //Actually set it to the same charge From c184a14857ef4c9cc6afe63602d02643a8b69b32 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Mon, 8 May 2023 12:04:07 -0400 Subject: [PATCH 35/41] Update generative_mods.js fix fatal bug --- mods/generative_mods.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/mods/generative_mods.js b/mods/generative_mods.js index 52b62d6f..1805df2d 100644 --- a/mods/generative_mods.js +++ b/mods/generative_mods.js @@ -1352,17 +1352,21 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu var returns = []; for(aaf = 0; aaf < bombElements.length; aaf++) { var elementOfBomb = bombElements[aaf]; - if(!(elements[elementOfBomb]?.color)) { continue }; + //console.log("1",elementOfBomb); + var allElementsHaveColors = ((elementOfBomb instanceof Array ? elementOfBomb : [elementOfBomb]).map(function(name) { return !!(elements[name]?.color)}).reduce(function(a,b) { return a*b }) == 1) + if(!allElementsHaveColors) { continue }; var startColor; var randomExcl = 0; //console.log(elementOfBomb); var bombName; + //console.log("2-1"); if(typeof(elementOfBomb === "string")) { //comma separated string check if(elementOfBomb.includes(",")) { //if it is elementOfBomb = elementOfBomb.split(","); //to array elementOfBomb = elementOfBomb.filter(function(e) { //strip nonexistent elements + //console.log("3 a"); return typeof(elements[e]) === "object"; }); }; @@ -1395,6 +1399,7 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu }; }; }; + //console.log("e",bombName); //Color gen if(Array.isArray(startColor)) { //Average arrays, make colors rgb() @@ -1505,7 +1510,8 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu var returns = []; for(aaf = 0; aaf < cloudElements.length; aaf++) { var elementOfCloud = cloudElements[aaf]; - if(!(elements[elementOfCloud]?.color)) { continue }; + var allElementsHaveColors = ((elementOfCloud instanceof Array ? elementOfCloud : [elementOfCloud]).map(function(name) { return !!(elements[name]?.color)}).reduce(function(a,b) { return a*b }) == 1) + if(!allElementsHaveColors) { continue }; var startColor; var randomExcl = 0; //console.log("randomExcl set") @@ -1712,7 +1718,8 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu var returns = []; for(aaf = 0; aaf < creeperElements.length; aaf++) { var elementOfCreeper = creeperElements[aaf]; - if(!(elements[elementOfCreeper]?.color)) { continue }; + var allElementsHaveColors = ((elementOfCreeper instanceof Array ? elementOfCreeper : [elementOfCreeper]).map(function(name) { return !!(elements[name]?.color)}).reduce(function(a,b) { return a*b }) == 1) + if(!allElementsHaveColors) { continue }; var startColor; var randomExcl = 0; //console.log("randomExcl set") @@ -1941,7 +1948,8 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu var returns = []; for(aaf = 0; aaf < fairyElements.length; aaf++) { var elementOfFairy = fairyElements[aaf]; - if(!(elements[elementOfFairy]?.color)) { continue }; + var allElementsHaveColors = ((elementOfFairy instanceof Array ? elementOfFairy : [elementOfFairy]).map(function(name) { return !!(elements[name]?.color)}).reduce(function(a,b) { return a*b }) == 1) + if(!allElementsHaveColors) { continue }; var startColor; var randomExcl = 0; var isNocheer = 0; @@ -2129,7 +2137,8 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu var returns = []; for(aaf = 0; aaf < spoutElements.length; aaf++) { var elementOfSpout = spoutElements[aaf]; - if(!(elements[elementOfSpout]?.color)) { continue }; + var allElementsHaveColors = ((elementOfSpout instanceof Array ? elementOfSpout : [elementOfSpout]).map(function(name) { return !!(elements[name]?.color)}).reduce(function(a,b) { return a*b }) == 1) + if(!allElementsHaveColors) { continue }; var startColor; var randomExcl = 0; var isNocheer = 0; From 894856b6258b249d56f1a73eacafe9089064f862 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Mon, 8 May 2023 12:56:13 -0400 Subject: [PATCH 36/41] Update and rename invisible_dye.js to invisible_things.js merge invisible dye and wall --- mods/invisible_dye.js | 43 --------------------- mods/invisible_things.js | 83 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+), 43 deletions(-) delete mode 100644 mods/invisible_dye.js create mode 100644 mods/invisible_things.js diff --git a/mods/invisible_dye.js b/mods/invisible_dye.js deleted file mode 100644 index e9f09a23..00000000 --- a/mods/invisible_dye.js +++ /dev/null @@ -1,43 +0,0 @@ -if(!settings) { - settings = {} -} - -if(!settings.bg) { - settings.bg = "#000000" -} - -elements.invisible_dye = { - color: settings.bg, - behavior: behaviors.LIQUID, - tick: function(pixel) { - var backgroundColor = hexToRGB(settings.bg); - var rgbValue = "rgb("+backgroundColor.r+","+backgroundColor.g+","+backgroundColor.b+")"; - pixel.color = rgbValue; - }, - hardness: 0.8, - breakInto: "invisible_dye_gas", - tempHigh: 110, - stateHigh: "invisible_dye_gas", - category: "special", - state: "liquid", - density: 1, - stain: elements.dye.stain, -}; - -elements.invisible_dye_gas = { - color: settings.bg, - behavior: behaviors.GAS, - tick: function(pixel) { - var backgroundColor = hexToRGB(settings.bg); - var rgbValue = "rgb("+backgroundColor.r+","+backgroundColor.g+","+backgroundColor.b+")"; - pixel.color = rgbValue; - }, - hardness: 0.5, - breakInto: "invisible_dye_gas", - tempLow: 109, - stateLow: "invisible_dye", - category: "special", - state: "liquid", - density: 1, - stain: elements.spray_paint.stain, -}; diff --git a/mods/invisible_things.js b/mods/invisible_things.js new file mode 100644 index 00000000..c80c17d8 --- /dev/null +++ b/mods/invisible_things.js @@ -0,0 +1,83 @@ +var modName = "mods/invisible_things.js"; +var libraryMod = "mods/code_library.js"; + +if(enabledMods.includes(libraryMod)) { + if(!settings) { + settings = {} + } + + if(!(settings.bg)) { + settings.bg = "#000000" + } + + function getBackgroundColorOrAverageAsJSON() { + if(!(settings?.bg)) { + return {r: 0, g: 0, b: 0}; + } else if(!(settings.bg instanceof Array)) { + return convertColorFormats(settings.bg,"json") + } else { + return convertColorFormats(averageRgbPrefixedColorArray(settings.bg.map(color => convertColorFormats(color,"rgb"))),"json"); + }; + }; + + function makePixelInvisible(pixel) { + var backgroundColor = getBackgroundColorOrAverageAsJSON(); + pixel.color = `rgba(${backgroundColor.r},${backgroundColor.g},${backgroundColor.b},0)`; + }; + + elements.invisible_wall = { + color: settings.bg, + behavior: behaviors.WALL, + tick: function(pixel) { makePixelInvisible(pixel) }, + insulate: true, + hardness: 1, + category: "special", + state: "solid", + }; + + elements.invisible_dye = { + color: settings.bg, + behavior: behaviors.LIQUID, + tick: function(pixel) { makePixelInvisible(pixel) }, + hardness: 0.8, + breakInto: "invisible_dye_gas", + tempHigh: 110, + stateHigh: "invisible_dye_gas", + category: "special", + state: "liquid", + density: 1, + stain: elements.dye.stain, + }; + + elements.invisible_dye_gas = { + color: settings.bg, + behavior: behaviors.GAS, + tick: function(pixel) { makePixelInvisible(pixel) }, + hardness: 0.5, + breakInto: "invisible_dye_gas", + tempLow: 109, + stateLow: "invisible_dye", + category: "special", + state: "liquid", + density: 1, + stain: elements.spray_paint.stain, + }; + + var temp = { + invisible_wall: "asdfg", + invisible_dye: 2, + invisible_dye_gas: false + }; + + if(enabledMods.includes("mods/gradient_background_support.js")) { + for(var elemName in temp) { + elements[elemName].desc = "Invisible dyes do not work and are not supported with gradient backgrouds"; + elements[elemName].hidden = true; + elements[elemName].excludeRandom = true; + }; + }; +} else { + enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) + localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); + alert(`The ${libraryMod} mod is required and has been automatically inserted (reload for this to take effect).`) +}; From fb0579a8ddba742eea0f5a1c90957278d07c03e0 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Mon, 8 May 2023 12:56:54 -0400 Subject: [PATCH 37/41] merged with inv_dyes --- mods/invisible_wall.js | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 mods/invisible_wall.js diff --git a/mods/invisible_wall.js b/mods/invisible_wall.js deleted file mode 100644 index 3aeb3549..00000000 --- a/mods/invisible_wall.js +++ /dev/null @@ -1,21 +0,0 @@ -if(!settings) { - settings = {} -} - -if(!settings.bg) { - settings.bg = "#000000" -} - -elements.invisible_wall = { - color: settings.bg, - behavior: behaviors.WALL, - tick: function(pixel) { - var backgroundColor = hexToRGB(settings.bg); - var rgbValue = "rgb("+backgroundColor.r+","+backgroundColor.g+","+backgroundColor.b+")"; - pixel.color = rgbValue; - }, - insulate: true, - hardness: 1, - category: "special", - state: "solid", -}; From 0084b8f7020b01e6ac4a9ba3c302ccaa8774c3f8 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Tue, 9 May 2023 11:23:54 -0400 Subject: [PATCH 38/41] add optional property-based radiation system --- mods/the_ground.js | 775 ++++++--------------------------------------- 1 file changed, 98 insertions(+), 677 deletions(-) diff --git a/mods/the_ground.js b/mods/the_ground.js index b70993df..503a9f3c 100644 --- a/mods/the_ground.js +++ b/mods/the_ground.js @@ -11,11 +11,24 @@ Proper classification of limestone within these code comments var modName = "mods/the_ground.js"; var libraryMod = "mods/code_library.js"; var colorOffsetMod = "mods/maxColorOffset.js"; +var libHookTickMod = "mods/libhooktick.js"; +var propertyLibrary = "mods/special_property_library.js"; -if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { +//someone retroactively turned off ??= assignment on undeclared variables /hj +if(!urlParams) { urlParams = new URLSearchParams(window.location.search) }; + +modRequirementsPartOne = (enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)); +if(urlParams.get("radiationSystemEnabled") === null) { + modRequirementsPartTwo = true +} else { + modRequirementsPartTwo = (enabledMods.includes(libHookTickMod) && enabledMods.includes(propertyLibrary)) +}; + + +if(modRequirementsPartOne && modRequirementsPartTwo) { //Variables - //var vitreousInterfelsicName = "obsidian"; + //var vitreousFelsicName = "obsidian"; var vitreousInterfelsicName = "dacidian"; var vitreousIntermediateName = "andesidian"; var vitreousMaficName = "basalidian"; @@ -302,8 +315,8 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { if (!isEmpty(pixel.x+j,pixel.y+i) && !outOfBounds(pixel.x+j,pixel.y+i)) { var destPixel = pixelMap[pixel.x+j][pixel.y+i]; var elementToCheck = destPixel.element; - if(getKeyByValue(radioactiveObject,elementToCheck)) { - changePixel(destPixel,getKeyByValue(radioactiveObject,elementToCheck)); + if(getKeyByValue(substitutionObject,elementToCheck)) { + changePixel(destPixel,getKeyByValue(substitutionObject,elementToCheck)); }; }; } else { @@ -329,8 +342,8 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { if (!isEmpty(pixel.x+j,pixel.y+i) && !outOfBounds(pixel.x+j,pixel.y+i)) { var destPixel = pixelMap[pixel.x+j][pixel.y+i]; var elementToCheck = destPixel.element; - if(getKeyByValue(radioactiveObject,elementToCheck)) { - changePixel(destPixel,getKeyByValue(radioactiveObject,elementToCheck)); + if(getKeyByValue(substitutionObject,elementToCheck)) { + changePixel(destPixel,getKeyByValue(substitutionObject,elementToCheck)); }; }; } else { @@ -3203,617 +3216,80 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { In this case, they replicate some land elements; a "yellow" cult, for example, would have yellow_dirt, yellow_mud, yellow_mudstone, yellow_permafrost, yellow_sand... */ - /*//Radioactive land + //Radiation - //Radioactive behavior cult (see above) + //System with new special_property_library.js to replace the old mass manual recreation - behaviors.RAD_POWDER = [ - "XX|CR:radiation%2|XX", - "CR:radiation%2|HT%1.5|CR:radiation%2", - "M2|M1 AND CR:radiation%2|M2", - ], - behaviors.RAD_STURDYPOWDER = [ - "XX|CR:radiation%2|XX", - "CR:radiation%2|HT%1.5|CR:radiation%2", - "XX|M1 AND CR:radiation%2|XX", - ], - behaviors.RAD_SUPPORT = [ - "CR:radiation%1|CR:radiation%2|CR:radiation%1", - "SP AND CR:radiation%2|HT%1.5|SP AND CR:radiation%2", - "XX|M1 AND CR:radiation%2|XX", - ], - behaviors.RAD_SUPPORTPOWDER = [ - "CR:radiation%1|CR:radiation%2|CR:radiation%1", - "SP AND CR:radiation%2|HT%1.5|SP AND CR:radiation%2", - "M2|M1 AND CR:radiation%2|M2", - ], - behaviors.RAD_LIQUID = [ - "XX|CR:radiation%2|XX", - "M2 AND CR:radiation%2|HT%1.5|M2 AND CR:radiation%2", - "M1|M1 AND CR:radiation%2|M1", - ], - behaviors.RAD_WALL = [ - "CR:radiation%0.7|CR:radiation%1.4|CR:radiation%0.7", - "CR:radiation%1.4|HT%1.50000000000|CR:radiation%1.4", - "CR:radiation%0.7|CR:radiation%1.4|CR:radiation%0.7", - ], - behaviors.RAD_GAS = [ - "M2 AND CR:radiation%1.0|M1 AND CR:radiation%2|M2 AND CR:radiation%1", - "M1 AND CR:radiation%2|HT%1 AND CR:radiation%2|M1 AND CR:radiation%2", - "M2 AND CR:radiation%1.0|M1 AND CR:radiation%2|M2 AND CR:radiation%1", - ], - behaviors.RAD_MOLTEN = [ - "XX|CR:radiation%2.5 AND CR:fire%2.5|XX", - "M2 AND CR:radiation%1|HT%2|M2 AND CR:radiation%1", - "M1|M1 AND CR:radiation%1|M1", - ] - - //console.log(behaviors.RAD_POWDER) //forcing it to acknowledge the behaviors i just added instead of giving me "undefined" - - //Setting reactions (we'll define the elements later) - - var namelessArray = ["dirt","sand","mud","wet_sand"]; - for(i = 0; i < namelessArray.length; i++) { - var elementt = namelessArray[i]; - if(!elements[elementt].reactions) { - elements[elementt].reactions = {}; - }; + if(urlParams.get("radiationSystemEnabled") !== null) { + radioactiveTransforms = { + steam: "rad_steam", + glass: "rad_glass", + molten_glass: "molten_rad_glass" }; - - elements.water.reactions.radiation = { elem1: "radioactive_water", elem2: null, chance:0.25 }, - elements.radiation.reactions.water = { elem2: "radioactive_water", elem1: null, chance:0.25 }, - elements.dirt.reactions.radiation = { elem1: "radioactive_dirt", elem2: null, chance:0.25 }, - elements.radiation.reactions.dirt = { elem2: "radioactive_dirt", elem1: null, chance:0.25 }, - elements.sand.reactions.radiation = { elem1: "radioactive_sand", elem2: null, chance:0.25 }, - elements.radiation.reactions.sand = { elem2: "radioactive_sand", elem1: null, chance:0.25 }, - elements.mud.reactions.radiation = { elem1: "radioactive_mud", elem2: null, chance:0.25 }, - elements.radiation.reactions.mud = { elem2: "radioactive_mud", elem1: null, chance:0.25 }, - elements.wet_sand.reactions.radiation = { elem1: "radioactive_wet_sand", elem2: null, chance:0.25 }, - elements.radiation.reactions.wet_sand = { elem2: "radioactive_wet_sand", elem1: null, chance:0.25 }, - //Substitution table - - radioactiveObject = { - dirt: "radioactive_dirt", - dry_dirt: "radioactive_dry_dirt", - molten_dirt: "molten_radioactive_dirt", - glass: "radioactive_glass", - molten_glass: "molten_radioactive_glass", - glass_shard: "radioactive_glass_shard", - sand: "radioactive_sand", - mud: "radioactive_mud", - wet_sand: "radioactive_wet_sand", - water: "radioactive_water", - permafrost: "radioactive_permafrost", - dry_permafrost: "radioactive_dry_permafrost", - mudstone: "radioactive_mudstone", - packed_sand: "radioactive_packed_sand", - ice: "radioactive_ice", - snow: "radioactive_snow", - packed_snow: "radioactive_packed_snow", - rain_cloud: "rad_cloud", - snow_cloud: "rad_snow_cloud", - snow_cloud_floater: "rad_snow_cloud_floater", - rock: "radioactive_rock", - gravel: "radioactive_gravel", - basalt: "radioactive_basalt", - magma: "radioactive_magma", - sandstone: "radioactive_sandstone", - sand_sediment: "radioactive_sand_sediment" - }; - - if(enabledMods.includes("mods/glenn_gases.js")) { - radioactiveObject.rock_dust = "radioactive_rock_dust"; - }; - if(enabledMods.includes("mods/fire_mod.js")) { - radioactiveObject.fire = "rad_fire"; - radioactiveObject.torch = "rad_torch"; - }; - - if(enabledMods.includes("mods/structure_test.js")) { - radioactiveObject.glass = "rad_glass"; - radioactiveObject.glass_pane = "rad_glass_pane"; - radioactiveObject.glass_shard = "rad_glass_shard"; - }; - - //Reverse lookup function - - function getKeyByValue(object, value) { - return Object.keys(object).find(key => object[key] === value); + radioactiveTransforms.fire = "rad_fire" + radioactiveTransforms.torch = "rad_torch" } - //getKeyByValue code by UncleLaz on StackOverflow: https://stackoverflow.com/questions/9907419/how-to-get-a-key-in-a-javascript-object-by-its-value" - + + specialProperties.radioactive = { + specialColorFunction: function(pixel,oldColor) { + var colorJSON = convertColorFormats(oldColor,"json"); + colorJSON.r *= 0.85; + colorJSON.r += 8; + colorJSON.g *= 1.4; + colorJSON.g += 16; + colorJSON.b *= 0.4; + return convertColorFormats(colorJSON,"rgb"); + }, + specialFunction: function(pixel) { + if(radioactiveTransforms[pixel.element]) { + var result = radioactiveTransforms[pixel.element]; + while(result instanceof Array) { + result = result[Math.floor(Math.random() * result.length)] + }; + changePixel(pixel,result,false); + return + }; + for(var i in adjacentCoords) { + if(Math.random() < 0.005) { + var newCoords = [ + pixel.x+adjacentCoords[i][0], + pixel.y+adjacentCoords[i][1] + ]; + if(isEmpty(newCoords[0],newCoords[1],false)) { + createPixel("radiation",newCoords[0],newCoords[1]) + } + }; + }; + if(Math.random() < 0.05) { + pixel.temp+=1.5; + if(Math.random() < 0.005) { + delete pixel.radioactive + } + } + } + } + console.log("Radioactive property defined"); + //Main elements - elements.radioactive_dirt = { - color: ["#70762b","#4c5c21","#50571a","#4c6b1e"], - behavior: behaviors.RAD_POWDER, - tempHigh:110, - stateHigh: "radioactive_dry_dirt", - reactions: { - "dirt": { "elem1":"dirt", "elem2":"radioactive_dirt", "chance":0.0005, "oneway":true }, - "dry_dirt": { "elem1":"radioactive_dry_dirt", "elem2":"radioactive_dirt", "chance":0.0005, "oneway":true }, - "radioactive_dry_dirt": { "elem1":"radioactive_dry_dirt", "elem2":"radioactive_dirt", "chance":0.0005, "oneway":true }, - }, - tempLow: -50, - stateLow: "radioactive_permafrost", - category: "Radioactive", - state: "solid", - density: 1220, - }; - - elements.radioactive_dry_dirt = { - color: ["#8aa85e","#999c5d","#7f8a45","#b5ad59"], - behavior: [ - "XX|SW:radioactive_dirt%3 AND SW:radioactive_mud%6 AND CR:radiation%2|XX", - "AND CR:radiation%2|HT%1.5|CR:radiation%2", - "M2|M1 AND CR:radiation%2|M2", - ], - tempHigh:1200, - stateHigh: "molten_radioactive_dirt", - tempLow: -50, - stateLow: "radioactive_dry_permafrost", - category:"land", - state: "solid", - density: 1100, - }, - - elements.molten_radioactive_dirt = { - "behavior": behaviors.RAD_MOLTEN, - "hidden": true, - "state": "liquid", - "category": "Radioactive", - "color": ["#e09315", "#e07615", "#e05800", "#987310", "#985c10", "#984500", "#a06c0d", "#a0570d", "#a04100", "#98850f", "#986b0f", "#985000"], - "temp": 1250, - "tempLow": 1100, - "stateLow": "radioactive_dirt", - "density": 1098, - "viscosity": 10000 - } - - elements.radioactive_glass = { - color: ["#597a58","#719171"], - colorOn: ["#6dab67","#88b567"], - behavior: behaviors.RAD_WALL, - tempHigh: 1500, - category: "solids", - state: "solid", - density: 2500, - breakInto: "radioactive_glass_shard", - conduct: 0.01, - }; - - elements.molten_radioactive_glass = { - behavior: behaviors.RAD_MOLTEN, - category: "Radioactive", - }; - - elements.radioactive_glass_shard = { - color: ["#597a58","#719171", "#628263"], - colorOn: ["#6dab67","#88b567", "#7bad6f"], - behavior: behaviors.RAD_POWDER, - tempHigh: 1500, - stateHigh: "molten_radioactive_glass", - category: "powders", - state: "solid", - density: 2500, - conduct: 0.01, - }; - - elements.radioactive_sand = { - color: "#cbdb7b", - behavior: behaviors.RAD_POWDER, - tempHigh: 1700, - stateHigh: "molten_radioactive_glass", - category: "Radioactive", - state: "solid", - density: 1602 - }; - - elements.radioactive_mud = { - color: "#3c401c", - behavior: behaviors.RAD_STURDYPOWDER, - reactions: { - "dry_dirt": { "elem1": "radioactive_dirt", "elem2": "radioactive_dirt", chance: 0.06 }, - "radioactive_dirt": { "elem1":"radioactive_dirt", "elem2":"radioactive_mud", "chance":0.0005, "oneway":true }, - "radioactive_sand": { "elem1":"radioactive_dirt", "elem2":"radioactive_wet_sand", "chance":0.0005, "oneway":true }, - "sand": { "elem1":"radioactive_dirt", "elem2":"radioactive_wet_sand", "chance":0.0005, "oneway":true }, - "dirt": { "elem1":"radioactive_dirt", "elem2":"radioactive_mud", "chance":0.0005, "oneway":true }, - }, - tempHigh: 100, - stateHigh: "radioactive_mudstone", - tempLow: -50, - stateLow: "radioactive_permafrost", - category: "Radioactive", - state: "solid", - density: 1730, - stain: 0.02, - }; - - elements.radioactive_wet_sand = { - color: ["#848c3a","#969e4c"], - behavior: behaviors.RAD_STURDYPOWDER, - reactions: { - "radioactive_sand": { "elem1":"radioactive_sand", "elem2":"radioactive_wet_sand", "chance":0.0005, "oneway":true }, - "radioactive_dirt": { "elem1":"radioactive_sand", "elem2":"radioactive_mud", "chance":0.0005, "oneway":true }, - "sand": { "elem1":"radioactive_sand", "elem2":"radioactive_wet_sand", "chance":0.0005, "oneway":true }, - "dirt": { "elem1":"radioactive_sand", "elem2":"radioactive_mud", "chance":0.0005, "oneway":true }, - "wet_sand": { "elem1":"radioactive_sand", "elem2":"radioactive_sand_sediment", "chance":0.0005, "oneway":true }, - "sand_sediment": { "elem1":"radioactive_sand", "elem2":"radioactive_sand_sediment", "chance":0.0005, "oneway":true }, - "radioactive_wet_sand": { "elem1":"radioactive_sand", "elem2":"radioactive_sand_sediment", "chance":0.0005, "oneway":true }, - "radioactive_sand_sediment": { "elem1":"radioactive_sand", "elem2":"radioactive_sand_sediment", "chance":0.0005, "oneway":true }, - }, - tempHigh: 100, - stateHigh: "radioactive_packed_sand", - category: "Radioactive", - state: "solid", - density: 1905, - }; - - elements.radioactive_sandy_water = { - color: ["#84A244", "#90AE50"], - behavior: behaviors.RAD_LIQUID, - tempHigh: 100, - stateHigh: ["rad_steam","rad_steam","radioactive_sand"], - //tempLow: 0, - //stateLow: "radioactive_sandy_ice", - category: "Radioactive", - heatCapacity: 4.184, //unimplemented - reactions: { - "dirt": { // React with (water reacts with dirt to make mud) - "elem1": [null,null,"radioactive_wet_sand"], // First element transforms into; in this case, water deletes itself - "elem2": "radioactive_mud", // Second element transforms into; in this case, dirt turns to mud - }, - "radioactive_dirt": { // React with (water reacts with dirt to make mud) - "elem1": [null,null,"radioactive_wet_sand"], // First element transforms into; in this case, water deletes itself - "elem2": "radioactive_mud", // Second element transforms into; in this case, dirt turns to mud - }, - "water": { "elem1":"radioactive_water", "elem2":"radioactive_sandy_water", "chance":0.025 }, - "radioactive_water": { "elem1":"radioactive_water", "elem2":"radioactive_sandy_water", "chance":0.025 }, - "sand": { "elem1": [null,null,"radioactive_wet_sand"], "elem2": "radioactive_wet_sand", }, - "radioactive_sand": { "elem1": [null,null,"radioactive_wet_sand"], "elem2": "radioactive_wet_sand", }, - "sandy_water": { "elem1":"radioactive_wet_sand", "elem2":"radioactive_sand_sediment", "chance": 0.001 }, - "radioactive_sandy_water": { "elem1":"radioactive_wet_sand", "elem2":"radioactive_sand_sediment", "chance": 0.001 }, - "wet_sand": { "elem1": "radioactive_water", "elem2":"radioactive_sand_sediment", "chance": 0.0005 }, - "radioactive_wet_sand": { "elem1": "radioactive_water", "elem2":"radioactive_sand_sediment", "chance": 0.0005 }, - /*"salt": { "elem1": "salt_water", "elem2": null }, - "sugar": { "elem1": "sugar_water", "elem2": null, }, - "dust": { "elem1": "dirty_water", "elem2": null, }, - "ash": { "elem1": "dirty_water", "elem2": null, }, - "cyanide": { "elem1": "dirty_water", "elem2": null, }, - "carbon_dioxide": { "elem1": "seltzer", "elem2": null, "oneway":true }, - "sulfur": { "elem1": "dirty_water", "elem2": null, }, - "rat": { "elem1": "dirty_water", chance:0.005 }, - "plague": { "elem1": "dirty_water", "elem2": null, }, - "rust": { "elem1": "dirty_water", chance:0.005 }, - "fallout": { "elem1": "dirty_water", chance:0.25 }, - "radiation": { "elem1": "dirty_water", chance:0.25 }, - "uranium": { "elem1": "dirty_water", chance:0.25 }, - "rotten_meat": { "elem1": "dirty_water", chance:0.25 }, - "quicklime": { "elem1": [null,null,"wet_sand"], "elem2": "slaked_lime", }, - "rock": { "elem2": "wet_sand", "chance": 0.00035 }, - "ruins": { "elem2": "rock", "chance": 0.00035 },*/ - /*"mudstone": { "elem2": "radioactive_mud", "chance": 0.00035 }, - "radioactive_mudstone": { "elem2": "radioactive_mud", "chance": 0.00035 },*/ - //"methane": { "elem1":"primordial_soup", "elem2":"primordial_soup", tempMin:60, charged:true }, - //"ammonia": { "elem1":"primordial_soup", "elem2":"primordial_soup", tempMin:60, charged:true }, - /*"fly": { "elem2":"dead_bug", "chance":0.1, "oneway":true }, - "firefly": { "elem2":"dead_bug", "chance":0.1, "oneway":true }, - "bee": { "elem2":"dead_bug", "chance":0.05, "oneway":true }, - "stink_bug": { "elem2":"dead_bug", "chance":0.1, "oneway":true }, - }, - state: "liquid", - density: 1097, - conduct: 0.02, - stain: 0.01, - } - - elements.radioactive_sand_sediment = { - hidden: true, - color: "#afd182", - hardness: 0.2, - behavior: [ - "XX|XX|XX", - "XX|XX|XX", - "SW:wet_sand,radioactive_wet_sand%1.5 AND M2|SW:wet_sand,radioactive_wet_sand%2.5 AND M1|SW:wet_sand,radioactive_wet_sand%1.5 AND M2" - ], - reactions: { - "water": { "elem1":"radioactive_sandy_water", "elem2":"radioactive_sandy_water", "chance":0.025 }, - "radioactive_water": { "elem1":"radioactive_sandy_water", "elem2":"radioactive_sandy_water", "chance":0.025 }, - "sand": { "elem1": [null,null,"radioactive_wet_sand"], "elem2": "radioactive_wet_sand", }, - "radioactive_sand": { "elem1": [null,null,"radioactive_wet_sand"], "elem2": "radioactive_wet_sand", }, - "sandy_water": { "elem1":["radioactive_water","radioactive_water","radioactive_sand_sediment"], "chance":0.001 }, - "radioactive_sandy_water": { "elem1":["radioactive_water","radioactive_water","radioactive_sand_sediment"], "chance":0.001 }, - "wet_sand": { "elem2": "radioactive_sand_sediment", "chance": 0.0005 }, - "radioactive_wet_sand": { "elem2": "radioactive_sand_sediment", "chance": 0.0005 }, - }, - tempHigh: 1700, - stateHigh: "molten_radioactive_glass", - category: "Radioactive", - state: "solid", - density: 1602, - breakInto: "radioactive_sand", - tick: function(pixel) { - sedimentation(pixel,"radioactive_sandstone") - }, - } - - elements.radioactive_sandstone = { - color: ["#85b357", "#b5d177", "#9cd184", "#7bc25f"], - behavior: behaviors.RAD_WALL, - tempHigh: 1500, - stateHigh: "molten_radioactive_glass", - category: "Radioactive", - state: "solid", - density: 2323, //wide range - hardness: 0.5, - breakInto: "radioactive_sand", - } - - elements.radioactive_water = { - color: "#85cf57", - behavior: behaviors.RAD_LIQUID, - tempHigh: 100, - stateHigh: ["rad_steam","rad_steam","fallout"], - tempLow: -5, - stateLow: "radioactive_ice", - category: "Radioactive", - heatCapacity: 4.184, - reactions: { - "water": { elem1: "water", elem2: "radioactive_water", chance:0.05 }, //swap - "dirt": { // React with (water reacts with dirt to make mud) - "elem1": null, // First element transforms into; in this case, water deletes itself - "elem2": "radioactive_dirt", // Second element transforms into; in this case, dirt turns to mud - }, - "dry_dirt": { "elem1": null, "elem2": "radioactive_dirt", }, - "radioactive_dirt": { "elem1": null, "elem2": "radioactive_dirt", }, - "sand": { "elem1": null, "elem2": "radioactive_wet_sand", }, - "wet_sand": { "elem1": "radioactive_sandy_water", "elem2": ["radioactive_wet_sand","radioactive_wet_sand","radioactive_wet_sand","radioactive_wet_sand","radioactive_wet_sand",null], chance: 0.01 }, - "radioactive_wet_sand": { "elem1": "radioactive_sandy_water", "elem2": ["radioactive_wet_sand","radioactive_wet_sand","radioactive_wet_sand","radioactive_wet_sand","radioactive_wet_sand",null], chance: 0.01 }, - "rat": { "elem2": "rotten_meat", chance:0.005 }, - "plague": { "elem2": null, chance: 0.3, }, - //"quicklime": { "elem1": null, "elem2": "slaked_lime", }, - "rock": { "elem2": "radioactive_wet_sand", "chance": 0.00035 }, - //"ruins": { "elem2": "rock", "chance": 0.00035 }, - "mudstone": { "elem2": "radioactive_mud", "chance": 0.00035 }, - "radioactive_mudstone": { "elem2": "radioactive_mud", "chance": 0.00035 }, - "packed_sand": { "elem2": "radioactive_wet_sand", "chance": 0.00035 }, - "radioactive_packed_sand": { "elem2": "radioactive_wet_sand", "chance": 0.00035 }, - "fly": { "elem2":"dead_bug", "chance":0.1, "oneway":true }, - "firefly": { "elem2":"dead_bug", "chance":0.1, "oneway":true }, - "bee": { "elem2":"dead_bug", "chance":0.05, "oneway":true }, - "stink_bug": { "elem2":"dead_bug", "chance":0.1, "oneway":true }, - }, - state: "liquid", - density: 997, - conduct: 0.03, - stain: 0.02, - } - - elements.rad_steam.behavior = behaviors.RAD_GAS; - elements.rad_steam.stateLow = "radioactive_water"; - elements.rad_cloud.behavior = [ - "XX|XX|XX", - "XX|CH:fallout,radiation,radioactive_water%0.025|M1%2.5 AND BO", - "CR:radiation%0.05|CR:radiation%0.05|CR:radiation%0.05", - ]; - elements.rad_cloud.tempLow = 0; - elements.rad_cloud.stateLow = "rad_snow_cloud"; - elements.fallout.behavior = behaviors.RAD_POWDER; - - elements.radioactive_permafrost = { - color: ["#51613d","#495234","#3b4a30","#4a4f35"], - behavior: behaviors.RAD_SUPPORT, - temp: -50, - tempHigh: 10, - stateHigh: "radioactive_mudstone", - category: "Radioactive", - state: "solid", - density: 700, - }; - - elements.radioactive_dry_permafrost = { - color: ["#6e9970","#64756a","#4e7864", "#5f8a78"], - behavior: behaviors.POWDER, //not enough water for cementing - temp: -50, - tempHigh: 10, - stateHigh: "radioactive_dry_dirt", - category: "land", - state: "solid", - state: "solid", - density: 1200, - } - - elements.radioactive_mudstone = { - color: "#4f5e25", - behavior: behaviors.RAD_SUPPORT, - tempHigh:1200, - stateHigh: "molten_radioactive_dirt", - tempLow: -50, - stateLow: "radioactive_permafrost", - category: "Radioactive", - state: "solid", - density: 1250, - breakInto: "radioactive_dirt", - }; - - elements.radioactive_packed_sand = { - color: "#79945c", - behavior: behaviors.RAD_SUPPORT, - tempHigh: 1700, - stateHigh: "molten_radioactive_glass", - category: "Radioactive", - state: "solid", - density: 1682, - breakInto: "radioactive_sand", - }; - - elements.radioactive_ice = { - color: "#b7e0b4", - behavior: behaviors.RAD_WALL, - temp: 0, - tempHigh: 5, - stateHigh: "radioactive_water", - category: "solids", - state: "solid", - density: 917, - breakInto: "radioactive_snow", - }; - - elements.radioactive_snow = { - color: "#d5f2d3", - behavior: behaviors.RAD_POWDER, - temp: 0, - tempHigh: 5, - tempLow: -100, - stateLow: "radioactive_packed_snow", - stateHigh: "radioactive_water", - category: "Radioactive", - state: "solid", - density: 100, - }; - - elements.radioactive_packed_snow = { - color: "#a7d4a3", - behavior: behaviors.RAD_SUPPORTPOWDER, - temp: 0, - tempHigh: 20, - tempLow: -200, - stateLow: "radioactive_ice", - stateHigh: "radioactive_water", - category: "Radioactive", - state: "solid", - density: 400, - hidden: true, - }; - - elements.rad_snow_cloud = { - color: ["#2d6e31","#416e21"], - behavior: [ - "XX|XX|XX", - "XX|CH:fallout,radiation,radioactive_snow%0.025|M1%2.5 AND BO", - "CR:radiation%0.05|CR:radiation%0.05|CR:radiation%0.05", - ], - category:"Radioactive", - hidden: true, - state: "gas", - density: 0.5, - ignoreAir: true, - temp: -20, - tempHigh: 0, - stateHigh: "rad_cloud", - }; - - elements.rad_snow_cloud_floater = { - color: ["#2d6e31","#416e21"], - behavior: [ - "M2|M1|M2", - "M1%80|CH:rad_snow_cloud_%0.2|M1%80", - "M%60|XX|M2%60", - ], - reactions: { - "rad_snow_cloud_floater": { elem1: "rad_snow_cloud", elem2: "rad_snow_cloud", chance: 0.003 }, - "rad_snow_cloud": { elem1: "rad_snow_cloud", elem2: "rad_snow_cloud", chance: 0.01 } - }, - category:"Radioactive", - hidden: true, - state: "gas", - density: 0.5, - temp: -20, - tempHigh: 0, - stateHigh: "rad_cloud", - }; - - elements.radioactive_rock = { - color: ["#768063","#444f3f","#7a9476"], - behavior: behaviors.RAD_POWDER, - tempHigh: 950, - stateHigh: "radioactive_magma", - category: "Radioactive", - state: "solid", - density: 2550, - hardness: 0.5, - breakInto: ["radioactive_sand","radioactive_gravel"], - }; - - elements.radioactive_gravel = { - color: ["#d1e3c8","#a6b090","#657360","#4d523f"], - behavior: behaviors.RAD_POWDER, - category: "Radioactive", - tempHigh: 950, - stateHigh: "radioactive_magma", - state: "solid", - density: 1680, - hardness: 0.2, - breakInto: "radioactive_sand", - }; - - elements.radioactive_basalt = { - color: ["#262e20","#23331f","#3f4235"], - behavior: behaviors.RAD_STURDYPOWDER, - tempHigh: 1262.5, - stateHigh: "radioactive_magma", - category: "Radioactive", - state: "solid", - density: 3000, - hardness: 0.65, - breakInto: "radioactive_gravel", - }; - - elements.radioactive_magma = { - color: ["#ff9100","#ffae00","#ff8400"], - behavior: behaviors.RAD_MOLTEN, - reactions: { - "ice": { "elem1": "radioactive_basalt" }, - "radioactive_ice": { "elem1": "radioactive_basalt" }, - "magma": { "elem1":"magma", "elem2":"radioactive_magma", "chance":0.0005, "oneway":true }, - }, - temp: 1500, - tempLow: 850, - stateLow: ["radioactive_basalt","radioactive_basalt","radioactive_basalt","radioactive_rock"], - viscosity: 5000, - category: "Radioactive", - state: "liquid", - density: 2725, - }; - - //(Just for fun) - - elements.super_irradiator = { - color: "#66ee33", - tick: function(pixel) { - var twentiethOfTemp = pixel.temp / 20; - var roundOf20th = Math.round(twentiethOfTemp); - var boundedR20 = Math.max(1,Math.min(roundOf20th,11)); - transformAround(pixel,boundedR20,radioactiveObject) - }, - category:"machines", - insulate: true, - state: "solid", - }; - - elements.super_deirradiator = { - color: "#dd33ee", - tick: function(pixel) { - var twentiethOfTemp = pixel.temp / 20; - var roundOf20th = Math.round(twentiethOfTemp); - var boundedR20 = Math.max(1,Math.min(roundOf20th,11)); - transformAround(pixel,boundedR20,radioactiveObject,reverse=true) - }, - category:"machines", - insulate: true, - state: "solid", - };*/ - elements.liquid_irradium = { color: "#5499FF", - behavior: behaviors.RAD_LIQUID, - /*tick: function(pixel) { - for(i = 0; i < adjacentCoords.length; i++) { - transformAdjacent(pixel,radioactiveObject) + behavior: behaviors.LIQUID, + tick: function(pixel) { + for(var i = 0; i < adjacentCoords.length; i++) { + //transformAdjacent(pixel,radioactiveTransforms) + var newCoords = [ + pixel.x+adjacentCoords[i][0], + pixel.y+adjacentCoords[i][1] + ]; + var newPixel = pixelMap[newCoords[0]]?.[newCoords[1]]; + if(newPixel && newPixel.element !== pixel.element) { + newPixel.radioactive = true + } } - },*/ + }, //Becomes rainbow sand by water or poison, as well as by protocite, or bio-ooze //Becomes sulfuric acid on contact with it //Becomes corrupt slime by elder fluid @@ -3827,65 +3303,11 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { density: 18180, //Cherry-picked from a Tumblr headcanon //https://omniblog-of-starbound.tumblr.com/post/188424072728/starbound-element-headcannon-modded-metals viscosity: 80.1, //probably misinterpreting tickDelta, and w/o the game assets, I can't compare against water, so this is in relation to H2SO4 scaled to its density in cP and under the assumption that water visc = 1 - }; - - - elements.water.reactions.dry_dirt = { elem1: null, elem2: "dirt", chance: 0.1 } - //elements.water.reactions.radioactive_dry_dirt = { elem1: null, elem2: "radioactive_dirt", chance: 0.1 } - - if(!elements.mud.reactions) { - elements.mud.reactions = {}; + } + }; - elements.mud.reactions.dry_dirt = { elem1: "dirt", elem2: "dirt", chance: 0.06 } - //elements.mud.reactions.radioactive_dry_dirt = { elem1: "radioactive_dirt", elem2: "radioactive_dirt", chance: 0.06 } - //Inter-mod compatibility - - /*if(enabledMods.includes("mods/some_tf_liquids.js")) { - elements.radioactive_basalt_gravel = { - color: ["#394d37", "#3b452f", "#3f452a", "#2d3d2c"], - behavior: behaviors.RAD_POWDER, - tempHigh: 1262.5, - stateHigh: "radioactive_magma", - category: "Radioactive", - state: "solid", - density: 1975, - hardness: 0.26, - } - elements.radioactive_basalt.breakInto = "radioactive_basalt_gravel"; - };*/ - - //Worldgen preset for testing - - worldgentypes.radioactive_sandstone_test_ocean = { - layers: [ - [0.9, "radioactive_wet_sand", 0.2], - [0.9, "radioactive_sand", 0.2], - [0.8, "radioactive_sandy_water", 0.7], - [0.25, "radioactive_water"], - [0.1, "radioactive_sand", 0.1], - [0.1, "clay", 0.1], - [0.1, "radioactive_gravel", 0.2], - [0.1, "radioactive_wet_sand"], - [0.03, "radioactive_gravel", 0.5], - [0.03, "radioactive_rock"], - [0, "radioactive_basalt"], - ] - }; - - /*/Water irradiation reactions (must be done last) - - waterIrradiationExclusionArray = ["radioactive_water", "radioactive_wet_sand"] - - filteredWaterIrradiationArray = Object.keys(elements).filter(function(e) { - return elements[e].category === "Radioactive" && (!waterIrradiationExclusionArray.includes(e)); - }); - - for(i = 0; i < filteredWaterIrradiationArray.length; i++) { - elements.water.reactions[filteredWaterIrradiationArray[i]] = { "elem1":"radioactive_water", chance: 0.01 } - };*/ - - hotRockFunction(); //needs to happen after dry dirt is defined + hotRockFunction(); //needs to happen after dry dirt is defined //Generation @@ -4000,13 +3422,7 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { temperature: -20 }; - //Nuclear wasteland - - //Elements defined above - - //Main preset - - worldgentypes.nuclear_wasteland = { + /*worldgentypes.nuclear_wasteland = { layers: [ [0.9, "smoke", 0.5], [0.9, "rad_snow_cloud_floater", 0.75], @@ -4023,7 +3439,7 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { [0, "basalt"], ], temperature: -5 //nuclear winter - }; + };*/ //Dark world @@ -4215,7 +3631,7 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { //Main preset - worldgentypes.nuclear_wasteland_desert = { + /*worldgentypes.nuclear_wasteland_desert = { layers: [ [0.97, "fallout", 0.4], [0.95, "radioactive_gravel", 0.6], @@ -4230,13 +3646,18 @@ if(enabledMods.includes(libraryMod) && enabledMods.includes(colorOffsetMod)) { [-0.78, "radioactive_basalt"] ], temperature: -13 - }; - - - + };*/ } else { if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) }; if(!enabledMods.includes(colorOffsetMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,colorOffsetMod) }; + if(urlParams.get("radiationSystemEnabled") !== null) { + if(!enabledMods.includes(libHookTickMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libHookTickMod) }; + if(!enabledMods.includes(propertyLibrary)) { enabledMods.splice(enabledMods.indexOf(modName),0,propertyLibrary) } + }; localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); - alert(`The "${libraryMod}" and "${colorOffsetMod}" mods are required and have been automatically inserted (reload for this to take effect).`) + if(urlParams.get("radiationSystemEnabled") !== null) { + alert(`The "${libraryMod}", "${colorOffsetMod}", "${libHookTickMod}", and "${propertyLibrary}" mods are all required and any missing mods have been automatically inserted (reload for this to take effect).`) + } else { + alert(`The "${libraryMod}" and "${colorOffsetMod}" mods are required and have been automatically inserted (reload for this to take effect).`) + }; }; From 73d74eae69eb35e0ce11ddc5312cfdfd593c78d1 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Tue, 9 May 2023 11:24:34 -0400 Subject: [PATCH 39/41] library for special properties --- mods/special_property_library.js | 138 +++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 mods/special_property_library.js diff --git a/mods/special_property_library.js b/mods/special_property_library.js new file mode 100644 index 00000000..26ce7684 --- /dev/null +++ b/mods/special_property_library.js @@ -0,0 +1,138 @@ +var modName = "mods/special_property_library.js"; +var libraryMod = "mods/code_library.js"; +var libHookTickMod = "mods/libhooktick.js"; + +if(enabledMods.includes(libraryMod) && enabledMods.includes(libHookTickMod)) { + specialProperties = { + /*red: { + specialFunction: function(pixel) { pixel.color = "rgb(255,0,0)" } + },*/ + }; + + //I hate overwriting drawPixels + function drawPixels(forceTick=false) { + // newCurrentPixels = shuffled currentPixels + var newCurrentPixels = currentPixels.slice(); + var pixelsFirst = []; + var pixelsLast = []; + if (!paused || forceTick) { + shuffleArray(newCurrentPixels); + } + /*{newCurrentPixels.sort(function(p) { // shuffle the pixels but keep elements[p.element].isGas last + return 0.5 - Math.random(); + })} // shuffle the pixels if not paused*/ + for (var i = 0; i < newCurrentPixels.length; i++) { + pixel = newCurrentPixels[i]; + //if (pixelMap[pixel.x][pixel.y] == undefined || currentPixels.indexOf(pixel) == -1) {continue} + if (pixel.del) {continue} + if (!paused || forceTick) { + if (elements[pixel.element].tick) { // Run tick function if it exists + elements[pixel.element].tick(pixel); + } + if (pixel.del) {continue} + if (elements[pixel.element].behavior) { // Parse behavior if it exists + pixelTick(pixel); + } + }; + if (elements[pixel.element].isGas) { + pixelsLast.push(pixel); + } + else { + pixelsFirst.push(pixel); + } + } + // Draw the current pixels + var canvas = document.getElementById("game"); + var ctx = canvas.getContext("2d"); + 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 (view===null || view===3) { + var colorOut = pixel.color; + for(var imsorryaboutthelagthiswillcause in specialProperties) { + if(pixel[imsorryaboutthelagthiswillcause] !== undefined && specialProperties[imsorryaboutthelagthiswillcause].specialColorFunction) { + colorOut = specialProperties[imsorryaboutthelagthiswillcause].specialColorFunction(pixel,oldColor=colorOut) + } + } + ctx.fillStyle = colorOut; + } + else if (view === 2) { // thermal view + // set the color to pixel.temp, from hottest at 0 hue to coldest 225 hue, with the minimum being -273, max being 6000 + var temp = pixel.temp; + if (temp < -273) {temp = -273} + if (temp > 6000) {temp = 6000} + var hue = 225 - (temp/6000)*225; + if (hue < 0) {hue = 0} + if (hue > 225) {hue = 225} + ctx.fillStyle = "hsl("+hue+",100%,50%)"; + } + else if (view === 4) { // smooth view, average of surrounding pixels + // E/N: i'm too scared to do smooth view + var colorlist = []; + // check adjacent coords on the pixelMap, add the color to the list if the pixel is not empty and the color indexOf "rgb" is not -1 + for (var j = 0; j < biCoords.length; j++) { + var x = pixel.x + biCoords[j][0]; + var y = pixel.y + biCoords[j][1]; + if (isEmpty(x,y,true) || elements[pixelMap[x][y].element].state !== elements[pixel.element].state) {continue} + var color = pixelMap[x][y].color; + if (color.indexOf("rgb") !== -1) { + colorlist.push(color.match(/\d+/g)); + } + } + if (colorlist.length === 0) { + ctx.fillStyle = pixel.color; + } + else { + ctx.fillStyle = averageRGB(colorlist); + } + } + if (ctx.globalAlpha < 1 && !elements[pixel.element].isGas) { + ctx.globalAlpha = 1; + } + if ((view === null || view === 4) && elements[pixel.element].isGas) { + if (ctx.globalAlpha!==0.5) { ctx.globalAlpha = 0.5; } + ctx.fillRect((pixel.x-1)*pixelSize, (pixel.y)*pixelSize, pixelSize*3, pixelSize); + ctx.fillRect((pixel.x)*pixelSize, (pixel.y-1)*pixelSize, pixelSize, pixelSize*3); + } + else { // draw the pixel (default) + 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 (ctx.globalAlpha < 1) { + ctx.globalAlpha = 1; + } + if ((!paused) || forceTick) {pixelTicks++}; + } + //I hate overwriting drawPixels + + runAfterLoad(function() { + console.log(everyTick(function() { + if(paused) { return }; + for(var propName in specialProperties) { + //thanks, I hate not being able to pass arguments to filter functions + var _filterFunction = function(pixel) { + return pixel.hasOwnProperty(propName) + }; + var pixelsWithProp = currentPixels.filter(_filterFunction); + //console.log(pixelsWithProp.map(p => [p.x,p.y,propName,p[propName]].join(",")).join("\n")); + for(var i in pixelsWithProp) { + var propPixel = pixelsWithProp[i]; + if(!propPixel || propPixel.del) { continue }; + specialProperties[propName]?.specialFunction?.(propPixel); + }; + } + }),"Property handler tick callback set") + }); +} else { + enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod); + enabledMods.splice(enabledMods.indexOf(modName),0,libHookTickMod); + localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); + alert(`The ${libraryMod} and ${libHookTickMod} mods are required and have been automatically inserted (reload for this to take effect).`); +}; From 02a47190590e3f0397a98006bf88dda2158ad084 Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Wed, 10 May 2023 14:14:43 -0400 Subject: [PATCH 40/41] more gases, water stuff --- mods/test_2.js | 166 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 150 insertions(+), 16 deletions(-) diff --git a/mods/test_2.js b/mods/test_2.js index e77783df..3fe600c7 100644 --- a/mods/test_2.js +++ b/mods/test_2.js @@ -2,9 +2,7 @@ var modName = "mods/test_2.js"; var libraryMod = "mods/code_library.js"; if(enabledMods.includes(libraryMod)) { - alert("this requires code library and i am out of time to add a dependency if-block"); - - function defaultIonizationColorFormula(state) { + /*function defaultIonizationColorFormula(state) { return convertColorFormats({r: 255, g: 221 - ((state + 1) * 32), b: 255 - ((state + 1) * 8)},"hex"); }; @@ -19,10 +17,33 @@ if(enabledMods.includes(libraryMod)) { function fourthTestDefaultIonizationColorFormula(state) { return convertColorFormats({r: 0x9f + (state * 4), g: 0xff - state, b: 0x7f - (state * 3)},"hex"); + };*/ + + function iHeliumColorFunction(state) { + return convertColorFormats({r: 128 - (state * 64), g: 0, b: 255},"hex") + }; + + function iCarbonColorFunction(state) { + return convertColorFormats({r: 128, g: 128 + (state * 25.6), b: 128},"hex") }; + function iNitrogenColorFunction(state) { + var fraction = 256/6; + return convertColorFormats({r: (state * fraction), g: (state * fraction), b: 256 - (state * fraction)},"hex") + }; + + function iOxygenColorFunction(state) { + return convertColorFormats({r: 255, g: 25, b: state * 24},"hex") + }; + + if(elements.carbon.reactions) { + var TheReVeFestival_Finale = structuredClone(elements.carbon.reactions) + }; + + delete elements.carbon; + scientificElementoids = { - defaultium: { sublimates: false, solidColor: "#EEEEEE", solidDensity: 1000, meltingPoint: 1200, solidHardness: 0.8, + /*defaultium: { sublimates: false, solidColor: "#EEEEEE", solidDensity: 1000, meltingPoint: 1200, solidHardness: 0.8, liquidColor: "#FFFFFF", liquidDensity: 850, liquidViscosity: 4000, boilingPoint: 2500, gasColor: "#FFDDFF", gasDensity: 3.5, ionizationEnergies_eV: [15,30,45,60,100], ionizationColorFormula: defaultIonizationColorFormula, @@ -42,21 +63,52 @@ if(enabledMods.includes(libraryMod)) { ionizationEnergies_eV: [11,22,33,44,55,66,77,88,99,110,121,1337], ionizationColorFormula: thirdTestDefaultIonizationColorFormula, defaultState: "gas" + },*/ + + hydrogen: { sublimates: false, solidColor: "#e6e6ff", solidDensity: 86, meltingPoint: -259.2, solidHardness: 0.3, + liquidColor: "#97afcf", liquidDensity: 70.85, liquidViscosity: 0.013, boilingPoint: -253, + gasColor: "#558bcf", gasDensity: 0.084, + ionizationEnergies_eV: [13.59844], ionizationColorFormula: function() { return "#FF00FF" }, + defaultState: "gas" }, - trollolium: { sublimates: false, solidColor: "#559933", solidDensity: 6969, meltingPoint: 1337, solidHardness: 0.69, - liquidColor: "#55aa33", liquidDensity: 4201, liquidViscosity: 12345, boilingPoint: 4444, - gasColor: "#9fff7f", gasDensity: 2.2, - ionizationEnergies_eV: [], - ionizationColorFormula: fourthTestDefaultIonizationColorFormula, + //non-superfluid viscosity: https://royalsocietypublishing.org/doi/pdf/10.1098/rspa.1950.0181 + helium: { sublimates: false, solidColor: "#faebeb", solidDensity: 214, meltingPoint: -Infinity, solidHardness: 0.3, + liquidColor: "#e3d3d3", liquidDensity: 124.8, liquidViscosity: 0.0033, boilingPoint: -268.9, + gasColor: "#a69494", gasDensity: 0.138 * airDensity, //i used a relative density because i can't make sense of the units in given liquid vs gas densities + ionizationEnergies_eV: [24.587387936,54.41776311], ionizationColorFormula: iHeliumColorFunction, + defaultState: "gas" + }, + + //lithium + + //beryllium + + //boron + + carbon: { sublimates: true, solidColor: "#171717", solidDensity: 3500, meltingPoint: 3642, solidHardness: 0.7, + liquidColor: ["#ffae9f", "#ffba80", "#ff9c8f"], liquidDensity: 1200, liquidViscosity: 69, boilingPoint: 3642, + gasColor: ["#ffce9f", "#ffda80", "#ffbc8f"], gasDensity: 2, //made-up due to insufficient science + ionizationEnergies_eV: [11.26030,24.38332,47.8878,64.4939,392.087,489.99334], ionizationColorFormula: iCarbonColorFunction, defaultState: "solid" - } - }; + }, + + nitrogen: { sublimates: false, solidColor: "#e6e6e6", solidDensity: 1026.5, meltingPoint: -210, solidHardness: 0.3, + liquidColor: "#d3e1e3", liquidDensity: 806.4, liquidViscosity: 0.00545, boilingPoint: -198.5, + gasColor: "#b8d1d4", gasDensity: 1.1606, + ionizationEnergies_eV: [14.53414,29.6013,47.44924,77.4735,97.8902,552.0718,667.046], ionizationColorFormula: iNitrogenColorFunction, + defaultState: "gas" + }, + + oxygen: { sublimates: false, solidColor: "#00cfc6", solidDensity: 214, meltingPoint: -218, solidHardness: 0.3, + liquidColor: "#00ad99", liquidDensity: 1141, liquidViscosity: 0.2849, boilingPoint: -189, + gasColor: "#99c7ff", gasDensity: 1.4291, + ionizationEnergies_eV: [13.61806,35.11730,54.9355,77.41353,113.8990,138.1197,739.29,871.4101], ionizationColorFormula: iOxygenColorFunction, + defaultState: "gas" + } + - for(var q = 1; q < 30; q++) { - scientificElementoids.trollolium.ionizationEnergies_eV.push(q); }; - scientificElementoids.trollolium.ionizationEnergies_eV.push(747.5802880508742); behaviors.HOT_GAS = [ "CR:fire%0.25 AND M2|M1|CR:fire%0.25 AND M2", @@ -257,9 +309,91 @@ if(enabledMods.includes(libraryMod)) { }; elements[names[elemInfo.defaultState]].hidden = false; + elements[names[elemInfo.defaultState]].temp = 20; }; -} else { - alert(`The ${libraryMod} mod is required and has been automatically inserted (reload for this to take effect).`) + + //Manual work for diatomic gases and other shit + elements.carbon_dioxide.tempHigh = 6275.6434478747902; //50% point + elements.carbon_dioxide.stateHigh = ["carbon","oxygen","carbon_dioxide","carbon_dioxide"]; + if(typeof(TheReVeFestival_Finale) !== "undefined") { + elements.carbon.reactions = TheReVeFestival_Finale; + }; + elements.carbon.behavior = behaviors.POWDER; + + elements.monatomic_nitrogen = { + temp: 13000, + tempLow: 12345, //Number pulled entirely out of my ass due to acute literature deficiency (does nobody care?) + stateLow: "nitrogen", + behavior: behaviors.GAS, + tempHigh: elements.nitrogen.tempHigh, + stateHigh: "ionized_nitrogen", + color: "#add2ff", + category: "gases", + state: "gas", + density: 1 + }; + elements.nitrogen.tempHigh = 12345; + elements.nitrogen.stateHigh = "monatomic_nitrogen"; + elements.ionized_nitrogen.tempLow = elements.monatomic_nitrogen.tempHigh; + elements.ionized_nitrogen.stateLow = "monatomic_nitrogen"; + + elements.monatomic_oxygen = { + temp: 18000, + tempLow: 16851, + stateLow: "oxygen", + behavior: behaviors.GAS, + tempHigh: elements.oxygen.tempHigh, + stateHigh: "ionized_oxygen", + color: "#d2adff", + category: "gases", + state: "gas", + density: 1 + }; + elements.oxygen.tempHigh = 16851; + elements.oxygen.stateHigh = "monatomic_oxygen"; + elements.ionized_oxygen.tempLow = elements.monatomic_oxygen.tempHigh; + elements.ionized_oxygen.stateLow = "monatomic_oxygen"; + + var newSteamTick = function(pixel) { + pixel.split ??= 0; + if(pixel.split == 0 && pixel.temp >= 2200) { + if(Math.random() < 0.03) { + changePixel(pixel,Math.random() < 1/3 ? "oxygen" : "hydrogen",false) + }; + pixel.split = 1 + } else if(pixel.split == 1 && pixel.temp >= 2600) { //made-up data point for smoothness + if(Math.random() < 0.097) { + changePixel(pixel,Math.random() < 1/3 ? "oxygen" : "hydrogen",false) + }; + pixel.split = 2 + } else if(pixel.split == 2 && pixel.temp >= 3000) { + if(Math.random() < 0.45) { + changePixel(pixel,Math.random() < 1/3 ? "oxygen" : "hydrogen",false) + }; + pixel.split = 3 + }; + if(pixel.split > 1 && Math.random() < 0.03) { pixel.split = 0 } + }; + + var tempkeys = {steam: 0, cloud: 0}; + for(var name in tempkeys) { + if(typeof(elements[name].tick) == "function") { + var tick1 = elements[name].tick; + var tick2 = newSteamTick; + elements[name].tick = function(pixel) { + tick1(pixel); + if(pixel && !(pixel.del)) { + tick2(pixel) + } + } + } else { + elements[name].tick = newSteamTick; + }; + }; + elements.hydrogen.reactions.oxygen.tempMax = 3000; + + } else { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); + alert(`The ${libraryMod} mod is required and has been automatically inserted (reload for this to take effect).`) }; From 0e65b1a8d78442c218cf92660442629a0e6124cb Mon Sep 17 00:00:00 2001 From: An Orbit <68935009+orbit-loona@users.noreply.github.com> Date: Wed, 10 May 2023 14:15:03 -0400 Subject: [PATCH 41/41] move ionization features to test_2 --- mods/boiling_things.js | 124 ----------------------------------------- 1 file changed, 124 deletions(-) diff --git a/mods/boiling_things.js b/mods/boiling_things.js index 21c8b095..635cc91e 100644 --- a/mods/boiling_things.js +++ b/mods/boiling_things.js @@ -182,132 +182,8 @@ if(enabledMods.includes(libraryMod)) { //Heat capacity is 0.918 J/(g*K) //in case the link goes down: c = Q/(m * delta-T); c = capacity, m = mass, delta-T = temp change, energy = Q //https://www.calctool.org/thermodynamics/specific-heat - elements.oxygen.tempHigh = 16851; - elements.oxygen.stateHigh = "monatomic_oxygen"; - - elements.monatomic_oxygen = { - temp: 18000, - tempLow: 16851, - stateLow: "oxygen", - behavior: behaviors.GAS, - tempHigh: 158051.204, - stateHigh: "ionized_oxygen", - color: "#d2adff", - category: "gases", - state: "gas", - density: 1 - }; - - elements.ionized_oxygen = { - color: "#ff1900", - category: "energy", - state: "gas", - behavior: behaviors.GAS, - //First ionization energy of oxygen (13.61806 eV) * eV-to-K conversion factor (11606 K/eV) = 158051 K - //https://byjus.com/question-answer/what-is-oxygen-ionization-energy/ - //https://astro.swarthmore.edu/~cohen/projects/prismspect/notes.html - temp: 160000, - tempLow: 157778.054, - stateLow: "monatomic_oxygen", - density: 1, //made up - }; - tupleAdverbs = ['Nullly', 'Singly', 'Doubly', 'Triply', 'Quadruply', 'Quintuply', 'Sextuply', 'Septuply', 'Octuply', 'Nonuply', 'Decuply', 'Undecuply', 'Duodecuply', 'Tredecuply', 'Quattuordecuply', 'Quindecuply', 'Sexdecuply', 'Septendecuply', 'Octodecuply', 'Novemdecuply', 'Vigintuply', 'Unvigintuply', 'Duovigintuply', 'Trevigintuply', 'Quattuorvigintuply', 'Quinvigintuply', 'Sexvigintuply', 'Septenvigintuply', 'Octovigintuply', 'Novemvigintuply', 'Trigintuply'].map(x => x.toLowerCase()); - var oxygenIonizationTemperatures = [-273.15,13.61806,35.11730,54.9355,77.41353,113.8990,138.1197,739.29,871.4101].map(x => (x * 11606) - 273.15); - for(var highUpGirlsCindy = 2; highUpGirlsCindy <= 8; highUpGirlsCindy++) { - var newName = `${tupleAdverbs[highUpGirlsCindy]}_ionized_oxygen`; - - elements[newName] = { - color: convertColorFormats({r: 255, g: 25, b: (highUpGirlsCindy - 1) * 24},"hex"), - category: "energy", - state: "gas", - behavior: behaviors.GAS, - temp: Math.ceil(oxygenIonizationTemperatures[highUpGirlsCindy]/10000)*10000, - tempLow: oxygenIonizationTemperatures[highUpGirlsCindy], - stateLow: `${tupleAdverbs[highUpGirlsCindy - 1]}_ionized_oxygen`.replace("singly_",""), - density: 1, //made up - }; - - if(highUpGirlsCindy < 8) { - elements[newName].tempHigh = oxygenIonizationTemperatures[highUpGirlsCindy + 1]; - elements[newName].stateHigh = `${tupleAdverbs[highUpGirlsCindy + 1]}_ionized_oxygen`; - }; - }; - elements.ionized_oxygen.tempHigh = 407571.3838; - elements.ionized_oxygen.stateHigh = "doubly_ionized_oxygen"; - - elements.carbon_gas = { - color: ["#ffce9f", "#ffda80", "#ffbc8f"], - behavior: behaviors.GAS, - state: "gas", - category: "gases", - tempLow: 3642, - tempHigh: 130687.0418, - stateHigh: "ionized_carbon", - stateLow: hasNM ? "molten_carbon" : "carbon", - density: 2 //made-up due to lack of academic literature - }; - - elements.ionized_carbon = { - color: "#7f7f8f", - category: "energy", - state: "gas", - behavior: behaviors.GAS, - temp: 140000, - tempLow: 130687.0418, - stateLow: "carbon_gas", - density: 1, //made up - }; - - var carbonIonizationTemperatures = [-273.15,11.26030,24.38332,47.8878,64.4939,392.087,489.99334].map(x => (x * 11606) - 273.15); - for(var highUpGirlsCindy = 2; highUpGirlsCindy <= 6; highUpGirlsCindy++) { - var newName = `${tupleAdverbs[highUpGirlsCindy]}_ionized_carbon`; - - console.log(highUpGirlsCindy,newName,carbonIonizationTemperatures[highUpGirlsCindy]); - elements[newName] = { - color: convertColorFormats({r: 127 + ((highUpGirlsCindy - 1) * 8), g: 127, b: 127 + (highUpGirlsCindy - 1) * 16},"hex"), - category: "energy", - state: "gas", - behavior: behaviors.GAS, - temp: Math.ceil(carbonIonizationTemperatures[highUpGirlsCindy]/10000)*10000, - tempLow: carbonIonizationTemperatures[highUpGirlsCindy], - stateLow: `${tupleAdverbs[highUpGirlsCindy - 1]}_ionized_carbon`.replace("singly_",""), - density: 1, //made up - }; - - if(highUpGirlsCindy < 6) { - elements[newName].tempHigh = carbonIonizationTemperatures[highUpGirlsCindy + 1]; - elements[newName].stateHigh = `${tupleAdverbs[highUpGirlsCindy + 1]}_ionized_carbon`; - }; - }; - elements.ionized_carbon.tempHigh = 282992.81192; - elements.ionized_carbon.stateHigh = "doubly_ionized_carbon"; - - if(hasNM) { - runAfterLoad(function() { - elements.carbon.density = 3500; - elements.molten_carbon.density = 1200; - - elements.carbon.tick = behaviors.POWDER; - - elements.molten_carbon.tempHigh = 3642; - elements.molten_carbon.stateHigh = "carbon_gas"; - }); - } else { - elements.carbon = { - color: "#171717", - behavior: behaviors.POWDER, - density: 3500, - tempHigh: 3642, - stateHigh: "carbon_gas", - state: "solid", - category: POWDERS, - }; - }; - - elements.carbon_dioxide.tempHigh = 6275.6434478747902; //50% point - elements.carbon_dioxide.stateHigh = ["carbon","oxygen","carbon_dioxide","carbon_dioxide"]; //} // baking soda {