diff --git a/mods/Neutronium Mod.js b/mods/Neutronium Mod.js index 4b50d87e..d946248d 100644 --- a/mods/Neutronium Mod.js +++ b/mods/Neutronium Mod.js @@ -1088,6 +1088,52 @@ behavior: [ ], density: 1050, }; +elements.platinum = { +color: ["#cfdfe3", "#cfdfe3", "#f7f7f7", "#cfdfe3"], +category: "solids", +state: "solid", +behavior: behaviors.WALL, +tempHigh: 1768, +conduct: 1, +}; +elements.uranium233 = { +name: "Uranium-233", +color: "#95a395", +category: "powders", +state: "solid", +behavior: behaviors.RADIOACTIVE_POWDER, +tempHigh: 1132, +stateHigh: "molten_uranium233", +density: 19, +}; +elements.uranium235 = { +name: "Uranium-235", +color: "#7a997a", +category: "powders", +state: "solid", +behavior: [ +"XX|XX|XX", +"XX|DL%0.02|XX", +"XX|XX|XX", +], +tempHigh: 1132.2, +stateHigh: "molten_uranium235", +density: 19.1, +}; +elements.uranium238 = { +name: "Uranium-238", +color: "#4a754a", +category: "powders", +state: "solid", +behavior: [ +"XX|XX|XX", +"XX|DL%0.01 AND CH:uranium235%0.05|XX", +"M2|M1|M2", +], +tempHigh: 1131, +stateHigh: "molten_uranium238", +density: 20, +}; /* Unfinished: magnesium hematite mixture diff --git a/mods/laetium.js b/mods/laetium.js new file mode 100644 index 00000000..52f2405d --- /dev/null +++ b/mods/laetium.js @@ -0,0 +1,325 @@ +function splitRgbColor(color) { + var colorTempArray = color.split(",") + var r = colorTempArray[0].split(",")[0].substring(4) + var g = colorTempArray[1] + var b = colorTempArray[2].slice(0,-1) + return [r,g,b] +} + +function randomArrayChoice(array) { + return array[Math.floor(Math.random() * array.length)] +} + +elements.laetium = { + color: "#f57f87", + tempHigh: 2950, + hardness: 0.87252, + density: 6719, + conduct: 4.7E210, + behavior: behaviors.WALL, + state: "solid", + category: "solids", + tick: function(pixel) { + neighbors = [[-1,0],[0,-1],[1,0],[0,1]] + for(i = 0; i < neighbors.length; i++) { + if(!isEmpty(pixel.x+neighbors[i][0],pixel.y+neighbors[i][1],true)) { + if(elements[pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].element].category) { + if(elements[pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].element].category == "cum") { + pixel.temp += 5 + } + } + } + } + }, +} + +elements.molten_laetium = { + color: ['#ff9f44', '#ff7f44', '#ff5f00'], + behavior: behaviors.MOLTEN, + reactions: { + "ash": { "elem1": null, "elem2": "laetium_slag"}, + "dust": { "elem1": null, "elem2": "laetium_slag"}, + "magma": { "elem1": null, "elem2": "laetium_slag"}, + }, + tick: function(pixel) { + neighbors = [[-1,0],[0,-1],[1,0],[0,1]] + for(i = 0; i < neighbors.length; i++) { + if(!isEmpty(pixel.x+neighbors[i][0],pixel.y+neighbors[i][1],true)) { + if(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].element.category) { + if(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].element.category == "cum") { + pixel.temp += 5 + } + } + } + } + }, + density: 6100, + temp: 3000, + tempLow: 2944, + stateLow: "laetium", + tempHigh: 5837, + stateHigh: "vaporized_laetium", + viscosity: 1.517, + hidden: true, + state: "liquid", + category: "molten", +} + +elements.vaporized_laetium = { + color: ['#efdf54', '#efbf54', '#efaf10'], + behavior: behaviors.GAS, + tick: function(pixel) { + neighbors = [[-1,0],[0,-1],[1,0],[0,1]] + for(i = 0; i < neighbors.length; i++) { + if(!isEmpty(pixel.x+neighbors[i][0],pixel.y+neighbors[i][1],true)) { + if(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].element.category) { + if(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].element.category == "cum") { + pixel.temp += 5 + } + } + } + } + }, + density: 49, + temp: 6000, + tempLow: 5837, + stateLow: "molten_laetium", + viscosity: 0.1, + hidden: true, + state: "gas", + category: "gases", +} + +elements.atisanium = { + color: "#8dadb8", + conduct: 0.87, + colorOn: ["#ff00ff", "#e600e6", "#a300cc", "#ce07e8"], + tempLow: -44, + stateLow: "liquid_atisanium", + density: 1.225, + behavior: [ + "M1|M1|M1", + "M1|XX|M1", + "M1|M1|M1", + ], + state: "gas", + category: "gases", + tick: function(pixel) { + var neighbors = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]] + var neighborChoice = randomArrayChoice(neighbors) + if(isEmpty(neighborChoice[0],pixel.y+neighborChoice[1],true)) { + tryMove(pixel,pixel.x+neighborChoice[0],pixel.y+neighborChoice[1]) + } + if(pixel.chargeCD) { + if(pixel.chargeCD > 2) { + pixel.chargeCD = 2 + } + } + }, +} + +elements.liquid_atisanium = { + color: "#3f878a", + conduct: 0.96, + colorOn: ["#8307eb", "#8c00ff", "#9617ff", "#a02eff"], + tempHigh: -45, + stateHigh: "atisanium", + tempLow: -214, + stateLow: "alpha_atisanium", + temp: -100, + density: 15941, + behavior: behaviors.LIQUID, + state: "liquid", + category: "liquids", + tick: function(pixel) { + var moveSpotsA = [[-1,1],[0,1],[1,1]] + var moveSpotsB = [[-1,0],[1,0]] + var msaChoice = randomArrayChoice(moveSpotsA) + var msbChoice = randomArrayChoice(moveSpotsB) + if(isEmpty(msaChoice[0],pixel.y+msaChoice[1],true)) { + if(!tryMove(pixel,pixel.x+msaChoice[0],pixel.y+msaChoice[1])) { + tryMove(pixel,pixel.x+msbChoice[0],pixel.y+msbChoice[1]) + } + } + if(pixel.chargeCD) { + if(pixel.chargeCD > 2) { + pixel.chargeCD = 2 + } + } + if(pixel.chargeCD) { + if(pixel.chargeCD > 1) { + if(Math.random() < 0.2) { + pixel.chargeCD = 1 + } + } + } + }, +} + +elements.alpha_atisanium = { + color: "#00382a", + conduct: 0.987, + colorOn: ["#3700ff", "#6820f7", "#4b15bf"], + tempHigh: -213, + stateHigh: "liquid_atisanium", + tempLow: -261, + stateLow: "beta_atisanium", + temp: -240, + density: 51295, + behavior: behaviors.WALL, + state: "solid", + category: "solids", + tick: function(pixel) { + if(pixel.chargeCD) { + if(pixel.chargeCD > 2) { + pixel.chargeCD = 2 + } + } + if(pixel.chargeCD) { + if(pixel.chargeCD > 1) { + if(Math.random() < 0.4) { + pixel.chargeCD = 1 + } + } + } + }, +} + +elements.beta_atisanium = { + color: "#750e35", + conduct: Infinity, //This is where I would make it a superconductor. + colorOn: ["#0f0021", "#120324", "#4b106e", "#a6058e", "#42043a"], //pretend this is UV becoming more pronounced + tempHigh: -260, + stateHigh: "alpha_atisanium", + temp: -270, + density: 111295, + behavior: behaviors.WALL, + state: "solid", + category: "solids", + tick: function(pixel) { + if(pixel.chargeCD) { + if(pixel.chargeCD > 3) { + pixel.chargeCD = 3 + } + } + }, +} + +elements.polusium = { + color: "#dedc9e", + tempHigh: 1213, + hardness: 0.921952, + density: 4113, + conduct: 0.98, + behavior: behaviors.WALL, + state: "solid", + category: "solids", + tick: function(pixel) { + neighbors = [[-1,0],[0,-1],[1,0],[0,1]] + for(i = 0; i < neighbors.length; i++) { + if(isEmpty(pixel.x+neighbors[i][0],pixel.y+neighbors[i][1],true)) { + if(Math.random() < 0.002) { + changePixel(pixel,"polusium_oxide") + } + } + if(!isEmpty(pixel.x+neighbors[i][0],pixel.y+neighbors[i][1],true)) { + if(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].element == "salt_water") { + if(Math.random() < 0.006) { + changePixel(pixel,"polusium_oxide") + } + } + } + } + }, +} + +elements.molten_polusium = { + tick: function(pixel) { + neighbors = [[-1,0],[0,-1],[1,0],[0,1]] + for(i = 0; i < neighbors.length; i++) { + if(isEmpty(pixel.x+neighbors[i][0],pixel.y+neighbors[i][1],true)) { + if(Math.random() < 0.004) { + changePixel(pixel,"molten_polusium_oxide") + } + } + if(!isEmpty(pixel.x+neighbors[i][0],pixel.y+neighbors[i][1],true)) { + if(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].element == "salt_water") { + if(Math.random() < 0.024) { + changePixel(pixel,"molten_polusium_oxide") + } + } + } + } + }, + density: 3410, + temp: 1300, + tempLow: 1212, + stateLow: "polusium", + tempHigh: 3110, + stateHigh: "vaporized_polusium", + viscosity: 13, +} + +elements.vaporized_polusium = { + color: ["#fdffd1", "#edf2cb", "#fcfac7"], + behavior: behaviors.GAS, + tick: function(pixel) { + neighbors = [[-1,0],[0,-1],[1,0],[0,1]] + for(i = 0; i < neighbors.length; i++) { + if(isEmpty(pixel.x+neighbors[i][0],pixel.y+neighbors[i][1],true)) { + if(Math.random() < 0.015) { + changePixel(pixel,"vaporized_polusium_oxide") + } + } + if(!isEmpty(pixel.x+neighbors[i][0],pixel.y+neighbors[i][1],true)) { + if(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].element == "salt_water") { + if(Math.random() < 0.06) { + changePixel(pixel,"vaporized_polusium_oxide") + } + } + } + } + }, + density: 21, + temp: 3200, + tempLow: 3109, + stateLow: "molten_polusium", + viscosity: 0.2, + hidden: true, + state: "gas", + category: "gases", +} + +elements.polusium_oxide = { + color: "#a9b594", + tempHigh: 1300, + hardness: 0.511952, + density: 3717, + behavior: behaviors.POWDER, + state: "solid", + category: "solids", + viscosity: 13, +} + +elements.molten_polusium_oxide = { + temp: 1350, + tempHigh: 1400, + stateHigh: "vaporized_polusium_oxide", + density: 2917, +} + +elements.vaporized_polusium_oxide = { + color: "#faffc7", + temp: 1500, + tempLow: 1399, + stateLow: "molten_polusium_oxide", + density: 10, + behavior: behaviors.GAS, +} + +runAfterLoad(function() { + elements.laetium_slag = JSON.parse(JSON.stringify(elements.slag)) + elements.laetium_slag.color = ['#a05c5a', '#af6967', '#b06d6d', '#ae6b6c', '#b67a7a'] + elements.laetium_slag.tempHigh = 2950 + elements.laetium_slag.stateHigh = ["molten_slag","molten_laetium"] +}); diff --git a/mods/metals.js b/mods/metals.js index 422f4118..bfef7a80 100644 --- a/mods/metals.js +++ b/mods/metals.js @@ -1,3 +1,12 @@ +elements.iron.hardness = 0.74 +//https://www.engineeringtoolbox.com/bhn-brinell-hardness-number-d_1365.html +//https://en.wikipedia.org/wiki/Hardnesses_of_the_elements_(data_page) +//"Annealed chissel steel" hardness and then divided by iron hardness (Brinell) +//sqrt()ed like IACS-derived conductivities and scaled to the 0.8 hardness of steel +//and because 1 means infinite hardness, the others are derived using +//1-(0.26/(otherThingBHN/200)) +//it doesn't matter much anyway but I'd like to have some semblance/veneer of accuracy + //Copper exists elements.ruthenium = { @@ -7,6 +16,7 @@ elements.ruthenium = { category: "solids", density: 12450, conduct: 0.45, + hardness: 0.97593, }, elements.molten_ruthenium = { @@ -20,6 +30,7 @@ elements.rhodium = { category: "solids", density: 12410, conduct: 0.59, + hardness: 0.94694, }, elements.molten_rhodium = { @@ -33,6 +44,7 @@ elements.palladium = { category: "solids", density: 12023, conduct: 0.38, + hardness: 0.82667, }, elements.molten_palladium = { @@ -48,6 +60,7 @@ elements.rhenium = { category: "solids", density: 21020, conduct: 0.29, + hardness: 0.96061, }, elements.molten_rhenium = { @@ -61,6 +74,7 @@ elements.osmium = { category: "solids", density: 22590, conduct: 0.40, + hardness: 0.98673, }, elements.molten_osmium = { @@ -74,6 +88,7 @@ elements.iridium = { category: "solids", density: 22560, conduct: 0.54, + hardness: 0.96886, }, elements.molten_iridium = { @@ -87,6 +102,7 @@ elements.platinum = { category: "solids", density: 21450, conduct: 0.38, + hardness: 0.83226, }, elements.molten_platinum = { @@ -104,7 +120,8 @@ elements.mercury = { stateLow: "frozen_mercury", category: "liquids", density: 13534, - conduct: 0.13 + conduct: 0.13, + breakInto: "mercury_gas", }, elements.frozen_mercury = { @@ -117,6 +134,7 @@ elements.frozen_mercury = { stateHigh: "mercury", category: "solids", hidden: true, + hardness: 0.2775, //(desperately scaled Mohs hardness) }, elements.mercury_gas = { //hg d@bp extrapolated from density change with temperature: 12743 @@ -130,4 +148,4 @@ elements.mercury_gas = { //hg d@bp extrapolated from density change with tempera stateLow: "mercury", category: "gases", hidden: true, -} \ No newline at end of file +} diff --git a/mods/more_breaking.js b/mods/more_breaking.js index 549b9d61..e69c4db0 100644 --- a/mods/more_breaking.js +++ b/mods/more_breaking.js @@ -66,11 +66,9 @@ elements.oxidized_copper_scrap = { elements.copper.breakInto = ["copper_scrap","copper_scrap","copper_scrap","copper_scrap","copper_scrap","oxidized_copper_scrap"] -elements.gold.breakInto = "gold_coin" - elements.dry_ice.breakInto = "carbon_dioxide" -regularMetalArray = ["iron", "zinc", "tin", "nickel", "silver", "aluminum", "lead", "tungsten", "brass", "bronze", "sterling", "steel", "rose_gold", "solder"] +regularMetalArray = ["iron", "zinc", "tin", "nickel", "silver", "aluminum", "lead", "tungsten", "brass", "bronze", "sterling", "steel", "rose_gold", "solder", "gold"] if(enabledMods.includes("mods/Neutronium Mod.js")) { regularMetalArray.push("mythril") @@ -78,6 +76,21 @@ if(enabledMods.includes("mods/Neutronium Mod.js")) { regularMetalArray.push("titanium") regularMetalArray.push("ilitium") } +if(enabledMods.includes("mods/metals.js")) { + regularMetalArray.push("beryllium") + regularMetalArray.push("boron") + regularMetalArray.push("ruthenium") + regularMetalArray.push("rhodium") + regularMetalArray.push("palladium") + regularMetalArray.push("rhenium") + regularMetalArray.push("osmium") + regularMetalArray.push("iridium") + regularMetalArray.push("platinum") + regularMetalArray.push("frozen_mercury") + if(elements.mercury) { + elements.mercury.breakInto = "mercury_gas" + } +} if(enabledMods.includes("mods/ketchup_mod.js")) { regularMetalArray.push("ketchup_metal") diff --git a/mods/randomness_but_tick.js b/mods/randomness_but_tick.js index 9a674f9c..3b0f5190 100644 --- a/mods/randomness_but_tick.js +++ b/mods/randomness_but_tick.js @@ -1,3 +1,121 @@ +elements.bacteria = { + color: ["#e6d3f2", "#c098d9", "#6e318f", "#6e318f"], + behavior: behaviors.WALL, + tick: function(pixel) { + neighbors = [[-1,0],[0,-1],[1,0],[0,1]] + if(pixel.charge) { //when shocked + if(!outOfBounds(pixel.x,pixel.y+1) && !isEmpty(pixel.x,pixel.y+1)) { //check if a pixel exists below to store the element of + if(!pixel.active && !pixel.target && pixelMap[pixel.x][pixel.y+1].element != pixel.element) { //exclude self and only fire once + pixel.target = pixelMap[pixel.x][pixel.y+1].element + pixel.active = true + } else if(pixel.active || pixel.target || pixelMap[pixel.x][pixel.y+1].element == pixel.element) { + pixel.active = pixel.active + pixel.target = pixel.target + } + } + } + if(pixel.active) { + if(pixel.target) { //safety + for(i = 0; i < neighbors.length; i++) { //iterate through neighbor spots + if(!isEmpty(pixel.x+neighbors[i][0],pixel.y+neighbors[i][1],true)) { //check for neighbors + if(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].element == pixel.target) { //if neighbor element is the target + changePixel(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]],pixel.element) //change neighbors to itself + pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].target = pixel.target //set new bacteria target + pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].active = true //activate new bacteria + } + } + } + } + if(Math.random() < 0.02) { //decay + if(!isEmpty(pixel.x,pixel.y)) { //check if position is empty + if(pixelMap[pixel.x][pixel.y].element == pixel.element) { //check if position is still bacteria + deletePixel(pixel.x,pixel.y) + } + } + } + } + /*if(pixel.active && pixel.target) { //debug + pixel.color = "rgb(255,0,0)" + }*/ + }, + category: "special", + state: "solid", + density: 1, + conduct: elements.water.conduct + 0.1, +}, + +elements.replacer_bacteria = { + color: ["#fcbbc0", "#f28089", "#f04f5c", "#f04f5c"], + behavior: behaviors.WALL, + tick: function(pixel) { + neighbors = [[-1,0],[0,-1],[1,0],[0,1]] + if(pixel.charge) { //when shocked + if(!outOfBounds(pixel.x,pixel.y+1) && !isEmpty(pixel.x,pixel.y+1) && !outOfBounds(pixel.x,pixel.y-1) && !isEmpty(pixel.x,pixel.y-1)) { //check if pixels exists above and below to store the elements of + if(!pixel.active && !pixel.target && !pixel.replacement && pixelMap[pixel.x][pixel.y+1].element != pixel.element) { //exclude self and only fire once + pixel.target = pixelMap[pixel.x][pixel.y+1].element + pixel.replacement = pixelMap[pixel.x][pixel.y-1].element + pixel.active = true + } else if(pixel.active || pixel.target || pixel.replacement || pixelMap[pixel.x][pixel.y+1].element == pixel.element) { + pixel.active = pixel.active + pixel.target = pixel.target + pixel.replacement = pixel.replacement + } + } + } + if(pixel.active) { + if(pixel.target && pixel.replacement) { //safety + for(i = 0; i < neighbors.length; i++) { //iterate through neighbor spots + if(!isEmpty(pixel.x+neighbors[i][0],pixel.y+neighbors[i][1],true)) { //check for neighbors + if(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].element == pixel.target) { //if neighbor element is the target + changePixel(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]],pixel.element) //change neighbors to itself + pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].target = pixel.target //set new bacteria target + pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].replacement = pixel.replacement //set new bacteria replacement + pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].active = true //activate new bacteria + } + } + } + if(!isEmpty(pixel.x,pixel.y)) { //check if own position is empty + if(pixelMap[pixel.x][pixel.y].element == pixel.element) { //check if own position is still bacteria + changePixel(pixelMap[pixel.x][pixel.y],pixel.replacement) + } + } + } + } + /*if(pixel.active && pixel.target && pixel.replacement) { //debug + pixel.color = "rgb(0,255,0)" + }*/ + }, + category: "special", + state: "solid", + density: 1, + conduct: elements.water.conduct + 0.1, +}, + +elements.test337 = { + color: "#7f7f7f", + conduct: 1, + viscosity: 0.000001, + colorOn: ["#cf7fff"], + density: 2000, + behavior: behaviors.POWDER, + state: "solid", + category: "solids", + tick: function(pixel) { + for(i = 0; i < 3; i++) { + var moveSpotsA = [[0,1]] + var moveSpotsB = [[-1,1],[1,1]] + var msaChoice = randomArrayChoice(moveSpotsA) + var msbChoice = randomArrayChoice(moveSpotsB) + if(isEmpty(msaChoice[0],pixel.y+msaChoice[1],true)) { + if(!tryMove(pixel,pixel.x+msaChoice[0],pixel.y+msaChoice[1])) { + tryMove(pixel,pixel.x+msbChoice[0],pixel.y+msbChoice[1]) + } + } + pixelTick(pixel) + } + }, +}, + elements.sencc = { //same element neighbor count check color: "#000000", uwu: 0, @@ -30,8 +148,8 @@ elements.sencc2 = { //same element neighbor count check uwu: 0, tick: function(pixel) { pixel.uwu = 0 - for (let i = -2; i < 3; i++) { - for (let j = -2; j < 3; j++) { + for (let i = -3; i < 4; i++) { + for (let j = -3; j < 4; j++) { if (!isEmpty(pixel.x+j,pixel.y+i) && !outOfBounds(pixel.x+j,pixel.y+i)) { if (pixelMap[pixel.x+j][pixel.y+i].element == pixel.element) { pixel.uwu += 1 @@ -52,6 +170,258 @@ elements.sencc2 = { //same element neighbor count check hidden: true, }, +elements.sencc3 = { //same element neighbor count check + color: "#000000", + uwu: 0, + tick: function(pixel) { + pixel.uwu = 0 + var squadius = 3 + for (let i = (-1*squadius); i < (squadius+1); i++) { + for (let j = (-1*squadius); j < (squadius+1); j++) { + if (!isEmpty(pixel.x+j,pixel.y+i) && !outOfBounds(pixel.x+j,pixel.y+i)) { + if (pixelMap[pixel.x+j][pixel.y+i].element == pixel.element) { + pixel.uwu += 1 + } + } + } + } + pixel.uwu -= 1 + if(pixel.uwu == undefined || pixel.uwu == null || isNaN(pixel.uwu)) { + pixel.color = "rgb(127,127,127)" + } else { + pixel.color = "rgb(" + (255/((((squadius*2)+1)**2)-1))*pixel.uwu + ",0,0)" + } + }, + category: "machines", + insulate: true, + state: "solid", + hidden: true, +}, + +elements.sencc4 = { //same element neighbor count check + color: "#000000", + uwu: 0, + tick: function(pixel) { + pixel.uwu = 0 + var squadius = 4 + for (let i = (-1*squadius); i < (squadius+1); i++) { + for (let j = (-1*squadius); j < (squadius+1); j++) { + if (!isEmpty(pixel.x+j,pixel.y+i) && !outOfBounds(pixel.x+j,pixel.y+i)) { + if (pixelMap[pixel.x+j][pixel.y+i].element == pixel.element) { + pixel.uwu += 1 + } + } + } + } + pixel.uwu -= 1 + if(pixel.uwu == undefined || pixel.uwu == null || isNaN(pixel.uwu)) { + pixel.color = "rgb(127,127,127)" + } else { + pixel.color = "rgb(" + (255/((((squadius*2)+1)**2)-1))*pixel.uwu + ",0,0)" + } + }, + category: "machines", + insulate: true, + state: "solid", + hidden: true, +}, + +elements.sencc5 = { //same element neighbor count check + color: "#000000", + uwu: 0, + tick: function(pixel) { + pixel.uwu = 0 + var squadius = 5 + for (let i = (-1*squadius); i < (squadius+1); i++) { + for (let j = (-1*squadius); j < (squadius+1); j++) { + if (!isEmpty(pixel.x+j,pixel.y+i) && !outOfBounds(pixel.x+j,pixel.y+i)) { + if (pixelMap[pixel.x+j][pixel.y+i].element == pixel.element) { + pixel.uwu += 1 + } + } + } + } + pixel.uwu -= 1 + if(pixel.uwu == undefined || pixel.uwu == null || isNaN(pixel.uwu)) { + pixel.color = "rgb(127,127,127)" + } else { + pixel.color = "rgb(" + (255/((((squadius*2)+1)**2)-1))*pixel.uwu + ",0,0)" + } + }, + category: "machines", + insulate: true, + state: "solid", + hidden: true, +}, + +elements.sencc6 = { //same element neighbor count check + color: "#000000", + uwu: 0, + tick: function(pixel) { + pixel.uwu = 0 + var squadius = 6 + for (let i = (-1*squadius); i < (squadius+1); i++) { + for (let j = (-1*squadius); j < (squadius+1); j++) { + if (!isEmpty(pixel.x+j,pixel.y+i) && !outOfBounds(pixel.x+j,pixel.y+i)) { + if (pixelMap[pixel.x+j][pixel.y+i].element == pixel.element) { + pixel.uwu += 1 + } + } + } + } + pixel.uwu -= 1 + if(pixel.uwu == undefined || pixel.uwu == null || isNaN(pixel.uwu)) { + pixel.color = "rgb(127,127,127)" + } else { + pixel.color = "rgb(" + (255/((((squadius*2)+1)**2)-1))*pixel.uwu + ",0,0)" + } + }, + category: "machines", + insulate: true, + state: "solid", + hidden: true, +}, + +elements.sencc7 = { //same element neighbor count check + color: "#000000", + uwu: 0, + tick: function(pixel) { + pixel.uwu = 0 + var squadius = 7 + for (let i = (-1*squadius); i < (squadius+1); i++) { + for (let j = (-1*squadius); j < (squadius+1); j++) { + if (!isEmpty(pixel.x+j,pixel.y+i) && !outOfBounds(pixel.x+j,pixel.y+i)) { + if (pixelMap[pixel.x+j][pixel.y+i].element == pixel.element) { + pixel.uwu += 1 + } + } + } + } + pixel.uwu -= 1 + if(pixel.uwu == undefined || pixel.uwu == null || isNaN(pixel.uwu)) { + pixel.color = "rgb(127,127,127)" + } else { + pixel.color = "rgb(" + (255/((((squadius*2)+1)**2)-1))*pixel.uwu + ",0,0)" + } + }, + category: "machines", + insulate: true, + state: "solid", + hidden: true, +}, + +elements.sencc8 = { //same element neighbor count check + color: "#000000", + uwu: 0, + tick: function(pixel) { + pixel.uwu = 0 + var squadius = 8 + for (let i = (-1*squadius); i < (squadius+1); i++) { + for (let j = (-1*squadius); j < (squadius+1); j++) { + if (!isEmpty(pixel.x+j,pixel.y+i) && !outOfBounds(pixel.x+j,pixel.y+i)) { + if (pixelMap[pixel.x+j][pixel.y+i].element == pixel.element) { + pixel.uwu += 1 + } + } + } + } + pixel.uwu -= 1 + if(pixel.uwu == undefined || pixel.uwu == null || isNaN(pixel.uwu)) { + pixel.color = "rgb(127,127,127)" + } else { + pixel.color = "rgb(" + (255/((((squadius*2)+1)**2)-1))*pixel.uwu + ",0,0)" + } + }, + category: "machines", + insulate: true, + state: "solid", + hidden: true, +}, + +elements.sencc9 = { //same element neighbor count check + color: "#000000", + uwu: 0, + tick: function(pixel) { + pixel.uwu = 0 + var squadius = 9 + for (let i = (-1*squadius); i < (squadius+1); i++) { + for (let j = (-1*squadius); j < (squadius+1); j++) { + if (!isEmpty(pixel.x+j,pixel.y+i) && !outOfBounds(pixel.x+j,pixel.y+i)) { + if (pixelMap[pixel.x+j][pixel.y+i].element == pixel.element) { + pixel.uwu += 1 + } + } + } + } + pixel.uwu -= 1 + if(pixel.uwu == undefined || pixel.uwu == null || isNaN(pixel.uwu)) { + pixel.color = "rgb(127,127,127)" + } else { + pixel.color = "rgb(" + (255/((((squadius*2)+1)**2)-1))*pixel.uwu + ",0,0)" + } + }, + category: "machines", + insulate: true, + state: "solid", + hidden: true, +}, + +elements.sencc10 = { //same element neighbor count check + color: "#000000", + uwu: 0, + tick: function(pixel) { + pixel.uwu = 0 + var squadius = 10 + for (let i = (-1*squadius); i < (squadius+1); i++) { + for (let j = (-1*squadius); j < (squadius+1); j++) { + if (!isEmpty(pixel.x+j,pixel.y+i) && !outOfBounds(pixel.x+j,pixel.y+i)) { + if (pixelMap[pixel.x+j][pixel.y+i].element == pixel.element) { + pixel.uwu += 1 + } + } + } + } + pixel.uwu -= 1 + if(pixel.uwu == undefined || pixel.uwu == null || isNaN(pixel.uwu)) { + pixel.color = "rgb(127,127,127)" + } else { + pixel.color = "rgb(" + (255/((((squadius*2)+1)**2)-1))*pixel.uwu + ",0,0)" + } + }, + category: "machines", + insulate: true, + state: "solid", + hidden: true, +}, + +elements.sencc11 = { //same element neighbor count check + color: "#000000", + uwu: 0, + tick: function(pixel) { + pixel.uwu = 0 + var squadius = 11 + for (let i = (-1*squadius); i < (squadius+1); i++) { + for (let j = (-1*squadius); j < (squadius+1); j++) { + if (!isEmpty(pixel.x+j,pixel.y+i) && !outOfBounds(pixel.x+j,pixel.y+i)) { + if (pixelMap[pixel.x+j][pixel.y+i].element == pixel.element) { + pixel.uwu += 1 + } + } + } + } + pixel.uwu -= 1 + if(pixel.uwu == undefined || pixel.uwu == null || isNaN(pixel.uwu)) { + pixel.color = "rgb(127,127,127)" + } else { + pixel.color = "rgb(" + (255/((((squadius*2)+1)**2)-1))*pixel.uwu + ",0,0)" + } + }, + category: "machines", + insulate: true, + state: "solid", + hidden: true, +}, + elements.sencc2b = { //same element neighbor count check color: "#000000", uwu: 0, @@ -343,6 +713,189 @@ elements.void_first = { hardness: 1, }, +elements.converter = { + color: "#2ec408", + tick: function(pixel) { + //store 4 touching pixels in variables if the variables don't exist + if(!outOfBounds(pixel.x,pixel.y-1) && !isEmpty(pixel.x,pixel.y-1)) { + if(!pixel.dc1 && pixelMap[pixel.x][pixel.y-1].element != pixel.element) { + pixel.dc1 = pixelMap[pixel.x][pixel.y-1].element + } + } + if(!outOfBounds(pixel.x+1,pixel.y) && !isEmpty(pixel.x+1,pixel.y)) { + if(!pixel.dc2 && pixelMap[pixel.x+1][pixel.y].element != pixel.element) { + pixel.dc2 = pixelMap[pixel.x+1][pixel.y].element + } + } + if(!outOfBounds(pixel.x,pixel.y+1) && !isEmpty(pixel.x,pixel.y+1)) { + if(!pixel.dc3 && pixelMap[pixel.x][pixel.y+1].element != pixel.element) { + pixel.dc3 = pixelMap[pixel.x][pixel.y+1].element + } + } + if(!outOfBounds(pixel.x-1,pixel.y) && !isEmpty(pixel.x-1,pixel.y)) { + if(!pixel.dc3 && pixelMap[pixel.x-1][pixel.y].element != pixel.element) { + pixel.dc4 = pixelMap[pixel.x-1][pixel.y].element + } + } + //choose from 1 + if(pixel.dc1 && !pixel.dc2 && !pixel.dc3 && !pixel.dc4) { + if(!pixel.changeTo) { + pixel.changeTo = pixel.dc1 + } + } + if(!pixel.dc1 && pixel.dc2 && !pixel.dc3 && !pixel.dc4) { + if(!pixel.changeTo) { + pixel.changeTo = pixel.dc2 + } + } + if(!pixel.dc1 && !pixel.dc2 && pixel.dc3 && !pixel.dc4) { + if(!pixel.changeTo) { + pixel.changeTo = pixel.dc3 + } + } + if(!pixel.dc1 && !pixel.dc2 && !pixel.dc3 && pixel.dc4) { + if(!pixel.changeTo) { + pixel.changeTo = pixel.dc4 + } + } + ggg = Math.random() + hhh = Math.random() + iii = Math.random() + //choose from 2 + //1100 and 0011 + if(pixel.dc1 && pixel.dc2 && !pixel.dc3 && !pixel.dc4) { + if(!pixel.changeTo) { + if(ggg < 1/2) { + pixel.changeTo = pixel.dc1 + } else { + pixel.changeTo = pixel.dc2 + } + } + } + if(!pixel.dc1 && !pixel.dc2 && pixel.dc3 && pixel.dc4) { + if(!pixel.changeTo) { + if(ggg < 1/2) { + pixel.changeTo = pixel.dc3 + } else { + pixel.changeTo = pixel.dc4 + } + } + } + //1010 and 0101 + if(pixel.dc1 && !pixel.dc2 && pixel.dc3 && !pixel.dc4) { + if(!pixel.changeTo) { + if(ggg < 1/2) { + pixel.changeTo = pixel.dc1 + } else { + pixel.changeTo = pixel.dc3 + } + } + } + if(!pixel.dc1 && pixel.dc2 && !pixel.dc3 && pixel.dc4) { + if(!pixel.changeTo) { + if(ggg < 1/2) { + pixel.changeTo = pixel.dc2 + } else { + pixel.changeTo = pixel.dc4 + } + } + } + //0110 and 1001 + if(!pixel.dc1 && pixel.dc2 && pixel.dc3 && !pixel.dc4) { + if(!pixel.changeTo) { + if(ggg < 1/2) { + pixel.changeTo = pixel.dc2 + } else { + pixel.changeTo = pixel.dc3 + } + } + } + if(pixel.dc1 && !pixel.dc2 && !pixel.dc3 && pixel.dc4) { + if(!pixel.changeTo) { + if(ggg < 1/2) { + pixel.changeTo = pixel.dc1 + } else { + pixel.changeTo = pixel.dc4 + } + } + } + //choose from 3 + //0111 + if(!pixel.dc1 && pixel.dc2 && pixel.dc3 && pixel.dc4) { + if(!pixel.changeTo) { + if(hhh < 1/3) { + pixel.changeTo = pixel.dc2 + } else if(hhh < 2/3) { + pixel.changeTo = pixel.dc3 + } else { + pixel.changeTo = pixel.dc4 + } + } + } + //1011 + if(pixel.dc1 && !pixel.dc2 && pixel.dc3 && pixel.dc4) { + if(!pixel.changeTo) { + if(hhh < 1/3) { + pixel.changeTo = pixel.dc1 + } else if(hhh < 2/3) { + pixel.changeTo = pixel.dc3 + } else { + pixel.changeTo = pixel.dc4 + } + } + } + //1101 + if(pixel.dc1 && pixel.dc2 && !pixel.dc3 && pixel.dc4) { + if(!pixel.changeTo) { + if(hhh < 1/3) { + pixel.changeTo = pixel.dc1 + } else if(hhh < 2/3) { + pixel.changeTo = pixel.dc2 + } else { + pixel.changeTo = pixel.dc4 + } + } + } + //1110 + if(pixel.dc1 && pixel.dc2 && pixel.dc3 && !pixel.dc4) { + if(!pixel.changeTo) { + if(hhh < 1/3) { + pixel.changeTo = pixel.dc1 + } else if(hhh < 2/3) { + pixel.changeTo = pixel.dc2 + } else { + pixel.changeTo = pixel.dc3 + } + } + } + //choose from 4 + //1111 + if(pixel.dc1 && pixel.dc2 && pixel.dc3 && pixel.dc4) { + if(!pixel.changeTo) { + if(iii < 1/4) { + pixel.changeTo = pixel.dc1 + } else if(iii < 2/4) { + pixel.changeTo = pixel.dc2 + } else if(iii < 3/4) { + pixel.changeTo = pixel.dc3 + } else { + pixel.changeTo = pixel.dc4 + } + } + } + neighbors = [[-1,0],[0,-1],[1,0],[0,1]] + for(i = 0; i < neighbors.length; i++) { + if(!isEmpty(pixel.x+neighbors[i][0],pixel.y+neighbors[i][1],true)) { + if(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]].element != pixel.element) { + changePixel(pixelMap[pixel.x+neighbors[i][0]][pixel.y+neighbors[i][1]],pixel.changeTo) + } + } + } + }, + category:"special", + hardness: 1, +}, + conveyorIgnoreList = ["conveyor_1","conveyor_2","wall"] elements.conveyor_1 = { @@ -1226,6 +1779,166 @@ elements.ionized_polka_dotted_powder = { tempLow: 8000, stateLow: "vaporized_polka_dotted_powder", hidden: true, +}, + +elements.hdet = { + name: "heat- dependent explosion text", + color: "#33aa44", + behavior: behaviors.POWDER, + tick: function(pixel) { + if(pixel.charge > 0) { + var temp = pixel.temp + if(temp < 0) { + temp = 0 + } + if(temp >= 0 && temp < 1) { + temp = 1 + } + if(temp > 56000) { + temp = 56000 + } + if(isNaN(temp) || isNaN(pixel.temp)) { + temp = 20 + pixel.temp = 20 + } + var r = ((Math.sqrt((Math.log(temp)/Math.log(20)))*(temp**0.5))/(6000**0.126284318))/2 + explodeAt(pixel.x,pixel.y,Math.floor(r)) + if(temp > 200) { + if(Math.random() < (Math.log(temp)/Math.log(56000))**9) { + pixel.charge = 1 + if(pixel.chargeCD) { + delete pixel.chargeCD + } + } + } + if(isNaN(temp) || isNaN(pixel.temp)) { + temp = 20 + pixel.temp = 20 + } + } + }, + density: 1200, + conduct: 0.5, + state: "solid", + category: "special" +}, + +function randInt(max) { + return Math.floor(Math.random() * (max + 1)) +} + +function randIntR(min,max) { + return Math.floor(Math.random() * (max - min + 1)) + min +} + +elements.test293 = { + color: "#f0e7e0", + behavior: [ + "XX|SA%40 AND ST|XX", + "M2%10 AND SA%40 AND ST|XX|M2%10 AND SA%40 AND ST", + "M2 AND M1%10|M1 AND SA%40 AND ST|M2 AND M1%10" + ], + category: "weapons", + state: "solid", + density: 2222.22, + tick: function(pixel) { + if(pixel.burning) { + if(pixel.burning == true) { + if(isEmpty(pixel.x,pixel.y-1)) { + if(Math.random() < 0.04) { createPixel("fire",pixel.x,pixel.y-1) } + if(Math.random() < 0.04) { pixel.temp++ } + } + if(isEmpty(pixel.x,pixel.y+1)) { + if(Math.random() < 0.04) { createPixel("fire",pixel.x,pixel.y+1) } + if(Math.random() < 0.04) { pixel.temp++ } + } + if(isEmpty(pixel.x-1,pixel.y)) { + if(Math.random() < 0.04) { createPixel("fire",pixel.x-1,pixel.y) } + if(Math.random() < 0.04) { pixel.temp++ } + } + if(isEmpty(pixel.x+1,pixel.y)) { + if(Math.random() < 0.04) { createPixel("fire",pixel.x+1,pixel.y) } + if(Math.random() < 0.04) { pixel.temp++ } + } + if(Math.random() < 0.0001) { explodeAt(pixel.x,pixel.y,randIntR(7,10),("fire,fire,fire,fire,smoke,"+pixel.element+","+pixel.element)) } + } + } + doHeat(pixel); + }, + burn: 300, + burnTime: 500, +}, + +elements.test293b = { + color: "#e0e7f0", + behavior: [ + "XX|SA%40 AND ST|XX", + "M2%10 AND SA%40 AND ST|XX|M2%10 AND SA%40 AND ST", + "M2 AND M1%10|M1 AND SA%40 AND ST|M2 AND M1%10" + ], + category: "weapons", + state: "solid", + density: 2222.22, + tick: function(pixel) { + for(i = -1; i < 2; i++) { + for(j = -1; j < 2; j++) { + if(!isEmpty(pixel.x + i, pixel.y + j) && !outOfBounds(pixel.x + i, pixel.y + j)) { + if(pixelMap[pixel.x + i][pixel.y + j].element == "cold_fire" && !pixel.burning) { + pixel.burning = true + pixel.burnStart = pixelTicks + } + } + } + } + if(pixel.burning) { + if(pixel.burning == true) { + for(i = -1; i < 2; i++) { + for(j = -1; j < 2; j++) { + if(!isEmpty(pixel.x + i, pixel.y + j) && !outOfBounds(pixel.x + i, pixel.y + j)) { + if(pixelMap[pixel.x + i][pixel.y + j].element == "fire") { + deletePixel(pixel.x + i, pixel.y + j) + createPixel("cold_fire", pixel.x + i,pixel.y + j) + } + pixelMap[pixel.x + i][pixel.y + j].temp -= randIntR(1,2) + } + } + } + if(isEmpty(pixel.x,pixel.y-1)) { + if(Math.random() < 0.04) { createPixel("cold_fire",pixel.x,pixel.y-1) } + if(Math.random() < 0.04) { pixel.temp-- } + } + if(isEmpty(pixel.x,pixel.y+1)) { + if(Math.random() < 0.04) { createPixel("cold_fire",pixel.x,pixel.y+1) } + if(Math.random() < 0.04) { pixel.temp-- } + } + if(isEmpty(pixel.x-1,pixel.y)) { + if(Math.random() < 0.04) { createPixel("cold_fire",pixel.x-1,pixel.y) } + if(Math.random() < 0.04) { pixel.temp-- } + } + if(isEmpty(pixel.x+1,pixel.y)) { + if(Math.random() < 0.04) { createPixel("cold_fire",pixel.x+1,pixel.y) } + if(Math.random() < 0.04) { pixel.temp-- } + } + if(Math.random() < 0.0001) { + var amogus = randIntR(8,11) + var amog1 = (Math.ceil(amogus/2))*-1 + var amog2 = (Math.ceil(amogus/2))+1 + explodeAt(pixel.x,pixel.y,amogus,("cold_fire,cold_fire,cold_fire,cold_fire,cold_fire,"+pixel.element+","+pixel.element)) + for(i = amog1; i < amog2; i++) { + for(j = amog1; j < amog2; j++) { + if(!isEmpty(pixel.x + i, pixel.y + j) && !outOfBounds(pixel.x + i, pixel.y + j)) { + pixelMap[pixel.x + i][pixel.y + j].temp -= randIntR(160,240) + } + } + } + } + } + } + doHeat(pixel); + }, + burn: 300, + burnTime: 500, + burnInto: "cold_fire", } runAfterLoad(function() { diff --git a/mods/spouts.js b/mods/spouts.js index 4e890049..2974b30b 100644 --- a/mods/spouts.js +++ b/mods/spouts.js @@ -12,6 +12,7 @@ runAfterLoad(function() { ], category: "spouts", temp: elements[liquidArray[i]].temp, + hardness: 1, }; }; liquidArray.push("ketchup")