diff --git a/mods/glenn_gases.js b/mods/glenn_gases.js index f59a151b..fee27216 100644 --- a/mods/glenn_gases.js +++ b/mods/glenn_gases.js @@ -30,11 +30,7 @@ elements.coal_dust = { elements.red_gas = { color: "#c74c52", - behavior: [ - "M2%50|M1%50|M2%50", - "M1|XX|M1", - "M2|M1|M2", - ], + behavior: behaviors.GAS, tick: function(pixel) { if(pixel.burning) { explodeAt(pixel.x,pixel.y,12,"fire,ignited_gas") @@ -51,11 +47,7 @@ elements.red_gas = { elements.nitrous_gas = { color: "#854428", - behavior: [ - "M2%50|M1%50|M2%50", - "M1|XX|M1", - "M2|M1|M2", - ], + behavior: behaviors.GAS, reactions: { "water": {"elem1": "acidic_vapour", "elem2": "acidic_vapour"} }, @@ -79,11 +71,7 @@ elements.acidic_vapour = { elements.void_gas = { color: "#111111", - behavior: [ - "M2%50|M1%50|M2%50", - "M1|XX|M1", - "M2|M1|M2", - ], + behavior: behaviors.GAS, reactions: { "light": { "elem1": null, "chance": 0.1 }, "fire": { "elem1": null, "chance": 0.08 }, @@ -96,11 +84,11 @@ elements.void_gas = { elements.electric_gas = { color: ["#3693b3", "#246e64"], behavior: [ - "M2%2 AND CR:electric%1|M1%2 AND CR:electric%1|M2%2 AND CR:electric%1", - "M1%2 AND CR:electric%1|XX |M1%2 AND CR:electric%1", - "M2%2 AND CR:electric%1|M1%2 AND CR:electric%1|M2%2 AND CR:electric%1", + "M2%33.3 AND CR:electric%1|M1%33.3 AND CR:electric%1|M2%33.3 AND CR:electric%1", + "M1%33.3 AND CR:electric%1|XX |M1%33.3 AND CR:electric%1", + "M2%33.3 AND CR:electric%1|M1%33.3 AND CR:electric%1|M2%33.3 AND CR:electric%1", ], - hardness: 0.6, + hardness: 0.8, reactions: { "corrosive_gas": { "elem2": "turquoise_dust", "elem1": "blue_dust", "chance": 0.5 }, "blue_dust": { "elem1": null, "elem2": "turquoise_dust", "chance": 0.5 }, @@ -115,41 +103,24 @@ corrosiveGasMaxHardness = 0.5 elements.corrosive_gas = { color: ["#2929e6", "#151cad"], behavior: [ - "M2%2|M1%2|M2%2", - "M1%2|XX |M1%2", - "M2%2|M1%2|M2%2", + "M2%33.3|M1%33.3|M2%33.3", + "M1%33.3|XX |M1%33.3", + "M2%33.3|M1%33.3|M2%33.3", ], - hardness: 0.6, + hardness: 0.8, tick: function(pixel) { //delete neighbors - if(!isEmpty(pixel.x-1,pixel.y) && !outOfBounds(pixel.x-1,pixel.y)) { - if(!elements[pixelMap[pixel.x-1][pixel.y].element].hardness || elements[pixelMap[pixel.x-1][pixel.y].element].hardness <= corrosiveGasMaxHardness) { - if(Math.random() < 0.2) { - deletePixel(pixel.x-1,pixel.y) - } - } - } - if(!isEmpty(pixel.x+1,pixel.y) && !outOfBounds(pixel.x+1,pixel.y)) { - if(!elements[pixelMap[pixel.x+1][pixel.y].element].hardness || elements[pixelMap[pixel.x+1][pixel.y].element].hardness <= corrosiveGasMaxHardness) { - if(Math.random() < 0.2) { - deletePixel(pixel.x+1,pixel.y) - } - } - } - if(!isEmpty(pixel.x,pixel.y-1) && !outOfBounds(pixel.x,pixel.y-1)) { - if(!elements[pixelMap[pixel.x][pixel.y-1].element].hardness || elements[pixelMap[pixel.x][pixel.y-1].element].hardness <= corrosiveGasMaxHardness) { - if(Math.random() < 0.2) { - deletePixel(pixel.x,pixel.y-1) - } - } - } - if(!isEmpty(pixel.x,pixel.y+1) && !outOfBounds(pixel.x,pixel.y+1)) { - if(!elements[pixelMap[pixel.x][pixel.y+1].element].hardness || elements[pixelMap[pixel.x][pixel.y+1].element].hardness <= corrosiveGasMaxHardness) { - if(Math.random() < 0.2) { - deletePixel(pixel.x,pixel.y+1) - } - } - } + for(i = 0; i < adjacentCoords.length; i++) { + nx = pixel.x + adjacentCoords[i][0]; + ny = pixel.y + adjacentCoords[i][1]; + if(!isEmpty(nx,ny,true)) { + if(!elements[pixelMap[nx][ny].element].hardness || elements[pixelMap[nx][ny].element].hardness <= corrosiveGasMaxHardness) { + if(Math.random() < 0.2) { + deletePixel(nx,ny); + }; + }; + }; + }; }, reactions: { "electric_gas": { "elem2": "blue_dust", "elem1": "turquoise_dust", "chance": 0.5 }, @@ -187,12 +158,8 @@ if(!settings.bg) { } elements.black_damp = { - color: "#000000", - behavior: [ - "M2|M1|M2", - "M1|XX|M1", - "M2|M1|M2", - ], + color: settings.bg, + behavior: behaviors.GAS, reactions: { "fire": { elem2: null }, }, @@ -215,19 +182,15 @@ elements.torch.reactions.black_damp = { elem1: "wood" } elements.rock_dust = { color: "#878783", - behavior: [ - "M2%50|M1%50|M2%50", - "M1|XX|M1", - "M2|M1|M2", - ], + behavior: behaviors.GAS, reactions: { "water": {"elem1": "dirty_water", "elem2": null } }, category: "gases", - density: 1.225, + density: 2.45, state: "gas", tempHigh: 950, - stateHigh: "magma", + stateHigh: [null,null,null,null,"magma"], } elements.rock.breakInto.push("rock_dust") @@ -238,11 +201,7 @@ ledArray = ["led_r", "led_g", "led_b"] elements.iocalfaeus_gas = { color: ["#562173", "#481b61"], - behavior: [ - "M1|XX|M1", - "M2|M1|M2", - "M2%50|M1%50|M2%50", - ], + behavior: behaviors.GAS, tick: function(pixel) { if(!pixel.hot) { pixel.hot = false @@ -250,7 +209,7 @@ elements.iocalfaeus_gas = { for (let i = -2; i < 3; i++) { for (let j = -2; j < 3; j++) { if (!isEmpty(pixel.x+j,pixel.y+i) && !outOfBounds(pixel.x+j,pixel.y+i)) { - if ((lightArray.includes(pixelMap[pixel.x+j][pixel.y+i].element)) || (pixelMap[pixel.x+j][pixel.y+i].element.includes("molten_")) || (pixelMap[pixel.x+j][pixel.y+i].element.includes("vaporized_")) || (ledArray.includes(pixelMap[pixel.x+j][pixel.y+i].element) && pixelMap[pixel.x+j][pixel.y+i].charge)) { + if ((lightArray.includes(pixelMap[pixel.x+j][pixel.y+i].element)) || (pixelMap[pixel.x+j][pixel.y+i].temp >= 525) || (ledArray.includes(pixelMap[pixel.x+j][pixel.y+i].element) && pixelMap[pixel.x+j][pixel.y+i].charge)) { pixel.hot = true } } @@ -264,7 +223,7 @@ elements.iocalfaeus_gas = { } }, category: "gases", - density: 1.2, + density: 0.97, state: "gas", } @@ -275,35 +234,38 @@ finineRange = 6 elements.finine = { color: ["#ffffec", "#fafade", "#ebebd5", "#c9c9b7", "#80806f"], behavior: [ - "M2%2|M1%2|M2%2", - "M1%2|XX |M1%2", - "M2%2|M1%2|M2%2", + "M2%33.3|M1%33.3|M2%33.3", + "M1%33.3|XX |M1%33.3", + "M2%33.3|M1%33.3|M2%33.3", ], tick: function(pixel) { - for (let i = -2; i < 3; i++) { - for (let j = -2; j < 3; j++) { - if (!isEmpty(pixel.x+j,pixel.y+i) && !outOfBounds(pixel.x+j,pixel.y+i)) { - if (lifeArray.includes(pixelMap[pixel.x+j][pixel.y+i].element)) { - pixel.eeex = pixel.x + Math.floor(Math.random() * ((2 * finineRange) + 1)) - finineRange - pixel.eeey = pixel.y + Math.floor(Math.random() * ((2 * finineRange) + 1)) - finineRange - //if human - //handle heads - if(pixelMap[pixel.x+j][pixel.y+i].element == "head") { - if(isEmpty(pixel.eeex,pixel.eeey) && !outOfBounds(pixel.eeex,pixel.eeey) && isEmpty(pixel.eeex,pixel.eeey+1) && !outOfBounds(pixel.eeex,pixel.eeey+1)) { - tryMove(pixelMap[pixel.x+j][pixel.y+i],pixel.eeex,pixel.eeey) - tryMove(pixelMap[pixel.x+j][pixel.y+i+1],pixel.eeex,pixel.eeey+1) - } - } else if(pixelMap[pixel.x+j][pixel.y+i].element == "body") { - - } else { - if(isEmpty(pixel.eeex,pixel.eeey) && !outOfBounds(pixel.eeex,pixel.eeey)) { - tryMove(pixelMap[pixel.x+j][pixel.y+i],pixel.eeex,pixel.eeey) - } - } - } - } - } - } + for(i = 0; i < adjacentCoords.length; i++) { + nx = pixel.x + adjacentCoords[i][0]; + ny = pixel.y + adjacentCoords[i][1]; + if(!isEmpty(nx,ny,true)) { + if (lifeArray.includes(pixelMap[nx][ny].element)) { + pixel.eeex = pixel.x + Math.floor(Math.random() * ((2 * finineRange) + 1)) - finineRange + pixel.eeey = pixel.y + Math.floor(Math.random() * ((2 * finineRange) + 1)) - finineRange + //if human + //handle heads + if(pixelMap[nx][ny].element == "head") { + if(isEmpty(pixel.eeex,pixel.eeey,false) && isEmpty(pixel.eeex,pixel.eeey+1,false)) { + tryMove(pixelMap[nx][ny],pixel.eeex,pixel.eeey) + tryMove(pixelMap[nx][ny+1],pixel.eeex,pixel.eeey+1) + }; + } else if(pixelMap[nx][ny].element == "body") { + if(isEmpty(pixel.eeex,pixel.eeey,false) && isEmpty(pixel.eeex,pixel.eeey-1,false)) { + tryMove(pixelMap[nx][ny],pixel.eeex,pixel.eeey) + tryMove(pixelMap[nx][ny-1],pixel.eeex,pixel.eeey-1) + }; + } else { + if(isEmpty(pixel.eeex,pixel.eeey,false)) { + tryMove(pixelMap[nx][ny],pixel.eeex,pixel.eeey) + }; + }; + }; + }; + }; }, category: "gases", density: 1.225, diff --git a/mods/page_color.js b/mods/page_color.js new file mode 100644 index 00000000..ac9fc0e0 --- /dev/null +++ b/mods/page_color.js @@ -0,0 +1,35 @@ +urlParams = new URLSearchParams(window.location.search); + +backgroundUseStrings = ["bg","background","settings.bg"] + +if(urlParams.get('pageColor') != null) { //null check + color = urlParams.get('pageColor'); + if(color === "" || color === null) { //NaN check + color = "black"; + }; + if(backgroundUseStrings.includes(color.toLowerCase())) { + !settings.bg ? color = "black" : color = settings.bg; + color = settings.bg; + }; + +color_Would_Be_A_Triplet_If_It_Started_With_An_Octothorpe = null; +color_Is_Supported_As_A_Background_By_The_Browser = null; + +if( /^#([0-9A-F]{3}){1,2}$/i.test("#" + color) ) { + color_Would_Be_A_Triplet_If_It_Started_With_An_Octothorpe = true +} else { + color_Would_Be_A_Triplet_If_It_Started_With_An_Octothorpe = false +} + +if( CSS.supports('background',color) ) { + color_Is_Supported_As_A_Background_By_The_Browser = true +} else { + color_Is_Supported_As_A_Background_By_The_Browser = false +} + +if(color_Is_Supported_As_A_Background_By_The_Browser == false && color_Would_Be_A_Triplet_If_It_Started_With_An_Octothorpe == true) { + color = "#" + color +} + +document.body.style.background = color; +}; diff --git a/mods/primordial_birthpool.js b/mods/primordial_birthpool.js new file mode 100644 index 00000000..e770309d --- /dev/null +++ b/mods/primordial_birthpool.js @@ -0,0 +1,36 @@ +if(enabledMods.includes("mods/fey_and_more.js")) { + elements.primordial_birthpool = { + color:["#5E7453","#5E745D","#5E744B","#6C7C50","#6C7C59","#6C7C47"], + state: "solid", + behavior: [ + "CR:foam%1|CR:sapling,wheat_seed,flower_seed,algae,cell,mushroom_spore,lichen,yeast,antibody,cellulose%0.5 AND CR:foam%2|CR:foam%1", + "M2|XX|M2", + "M1|M1|M1", + ], + reactions: { + "cancer": { "elem1":["toxic_mistake","dirty_water"] }, + "cyanide": { "elem1":["toxic_mistake","dirty_water"] }, + "infection": { "elem1":["toxic_mistake","dirty_water"] }, + "plague": { "elem1":["toxic_mistake","dirty_water"] }, + "ammonia": { "elem1":["algae","cell","mushroom_spore","lichen","yeast","antibody"], "chance":0.05 }, + "radiation": { "elem1":["algae","cell","mushroom_spore","lichen","yeast","antibody"], "chance":0.15 }, + "light": { "elem1":["algae","cell","mushroom_spore","lichen","yeast","antibody"], "chance":0.5 }, + "oxygen": { "elem1":["algae","cell","mushroom_spore","lichen","yeast","antibody"], "chance":0.02 }, + }, + density: 1110, + tempHigh: 100, + stateHigh: "steam", + conduct: 0.33, + category: "liquids", + hidden: true, + reactions: { + concoction: { "elem1": ["primordial_soup", "birthpool", "primordial_birthpool"], "elem2": ["primordial_soup", "birthpool", "primordial_birthpool"], "chance":0.0045}, + }, + }; + + if(!elements.birthpool.reactions) { + elements.birthpool.reactions = {} + } + + elements.birthpool.reactions.primordial_soup = { "elem1":"primordial_birthpool", "elem2":"primordial_birthpool" } +}; \ No newline at end of file diff --git a/mods/randomness_but_tool.js b/mods/randomness_but_tool.js index 493f5e33..2c94b864 100644 --- a/mods/randomness_but_tool.js +++ b/mods/randomness_but_tool.js @@ -1,5 +1,5 @@ -elements.igniter = { - color: elements.fire.color, +elements.burn = { + color: ["#FF6B21", "#FFA600", "#FF4000"], tool: function(pixel) { pixel.burnStart = pixelTicks; pixel.burning = true; @@ -8,81 +8,18 @@ elements.igniter = { excludeRandom: true, }; -elements.extinguisher = { - color: "#bad1e3", - tool: function(pixel) { - if(pixel.burnStart) { delete pixel.burnStart } - pixel.burning = false; - }, - category: "tools", - excludeRandom: true, -}; - elements.cursed_shock = { color: ["#ffff00", "#00ff00", "#ffff00", "#00ff00", "#ffff00", "#00ff00", "#ffff00", "#00ff00"], tool: function(pixel) { - var con = elements[pixel.element].conduct; - if (con == undefined) {con = 0} - if (Math.random() < con || con == 0) { // If random number is less than conductivity, or anyway - if (!pixel.charge && !pixel.chargeCD) { - pixel.charge = 1; - if (elements[pixel.element].colorOn) { - pixel.color = pixelColorPick(pixel); - } - } - } - if(Math.random() > con) { - if (elements[pixel.element].insulate != true) { // Otherwise heat the pixel (Resistance simulation) - pixel.temp += 0.25; - pixelTempCheck(pixel); - } - } - }, - category: "tools", - excludeRandom: true, -}; - -elements.extinguisher = { - color: "#bad1e3", - tool: function(pixel) { - if(pixel.burnStart) { delete pixel.burnStart } - pixel.burning = false; - }, - category: "tools", - excludeRandom: true, -}; - -elements.anti_gravity = { - color: [elements.dirt.color[1],elements.dirt.color[1],elements.oxygen.color,elements.oxygen.color], - tool: function(pixel) { - pixel.r = 2; - }, - category: "tools", - excludeRandom: true, -}; - -elements.normal_gravity = { - color: [elements.oxygen.color,elements.oxygen.color,elements.dirt.color[1],elements.dirt.color[1]], - tool: function(pixel) { - pixel.r = 0; - }, - category: "tools", - excludeRandom: true, -}; - -elements.rg1 = { - color: [elements.dirt.color[14],elements.dirt.color[14],elements.liquid_oxygen.color,elements.liquid_oxygen.color], - tool: function(pixel) { - pixel.r = 1; - }, - category: "tools", - excludeRandom: true, -}; - -elements.rg3 = { - color: [elements.liquid_oxygen.color,elements.liquid_oxygen.color,elements.dirt.color[14],elements.dirt.color[14]], - tool: function(pixel) { - pixel.r = 3; + if(pixel.chargeCD) { + delete pixel.chargeCD; + }; + if (!pixel.charge) { + pixel.charge = 1; + if (elements[pixel.element].colorOn) { + pixel.color = pixelColorPick(pixel); + }; + }; }, category: "tools", excludeRandom: true,