From 6b94611f765892b9f65cf578d58cb33bffad2037 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Tue, 29 Nov 2022 09:55:45 -0500 Subject: [PATCH 01/49] hotter radstuff --- mods/the_ground.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mods/the_ground.js b/mods/the_ground.js index 0ad8e7a9..0539ef19 100644 --- a/mods/the_ground.js +++ b/mods/the_ground.js @@ -1153,42 +1153,42 @@ Proper classification of limestone within these code comments behaviors.RAD_POWDER = [ "XX|CR:radiation%2|XX", - "CR:radiation%2|XX|CR:radiation%2", + "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|XX|CR:radiation%2", + "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|XX|SP AND CR:radiation%2", + "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|XX|SP AND CR:radiation%2", + "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|XX|M2 AND CR:radiation%2", + "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|XX%0000000000000|CR:radiation%1.4", + "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|M1 AND CR:radiation%2|M2 AND CR:radiation%1", - "M1 AND CR:radiation%2|XX AND CR:radiation%2|M1 AND CR:radiation%2", - "M2 AND CR:radiation%1|M1 AND CR:radiation%2|M2 AND CR:radiation%1", + "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|XX|M2 AND CR:radiation%1", + "M2 AND CR:radiation%1|HT%2|M2 AND CR:radiation%1", "M1|M1 AND CR:radiation%1|M1", ] From ed563dbce012351125c39ed447f7e0660e4f725e Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Sun, 4 Dec 2022 13:38:24 -0500 Subject: [PATCH 02/49] more destructible versions of elements --- mods/structure_test.js | 124 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 123 insertions(+), 1 deletion(-) diff --git a/mods/structure_test.js b/mods/structure_test.js index 69685eb8..562fa468 100644 --- a/mods/structure_test.js +++ b/mods/structure_test.js @@ -96,11 +96,13 @@ elements.glass_pane = { "radiation": { "elem1":"rad_glass_pane", "chance":0.33 }, }, tempHigh: 1500, + stateHigh: "molten_glass", hardness: 0.2, category: "solids", state: "solid", density: 2500, breakInto: "glass_shard", + hidden: true, }; elements.rad_glass_pane = { @@ -117,7 +119,7 @@ elements.rad_glass_pane = { state: "solid", density: 2500, breakInto: "rad_glass_shard", - hidden: true + hidden: true, }; elements.wood.hardness = 0.2; @@ -136,6 +138,94 @@ elements.wood_plank = { breakInto: "sawdust", }; +elements.hanging_concrete = { + color: "#ababab", + behavior: [ + "XX|SP|XX", + "XX|XX|XX", + "M2|M1|M2" //crumbling from the top down is acceptable + ], + tempHigh: 1500, + stateHigh: "magma", + category: "powders", + state: "solid", + density: 2400, + hardness: 0.5, + breakInto: "dust", + hidden: true, +}; + +elements.support_copper = { + color: ["#A95232","#BE4322","#C76035"], + behavior: behaviors.SUPPORT, + reactions: { + "water": { "elem1":"oxidized_copper", chance:0.0025 }, + "salt_water": { "elem1":"oxidized_copper", chance:0.005 }, + "dirty_water": { "elem1":"oxidized_copper", chance:0.04 }, + "sugar_water": { "elem1":"oxidized_copper", chance:0.0035 }, + "seltzer": { "elem1":"oxidized_copper", chance:0.006 }, + }, + category: "solids", + tempHigh: 1085, + stateHigh: "molten_copper", + density: 8960, + conduct: 0.95, + hardness: 0.3, + hidden: true, +}; + +elements.hanging_bulb = { + color: "#a8a897", + behavior: [ + "XX|SP|XX", + "XX|XX|XX", + "M2|M1|M2" + ], + behaviorOn: [ + "XX|SP AND CR:light|XX", + "CR:light|XX|CR:light", + "M2|M1 AND CR:light|M2", + ], + colorOn: "#ebebc3", + category: "machines", + tempHigh: 1500, + stateHigh: ["molten_glass","molten_glass","molten_copper"], + conduct: 1, + breakInto: "glass_shard", + hidden: true, +}; + +elements.support_plastic = { + color: "#c5dede", + behavior: behaviors.SUPPORT, + tempHigh: 250, + stateHigh: "molten_plastic", + burn: 10, + burnTime: 200, + burnInto: ["dioxin","smoke","dioxin","smoke","stench"], + category: "solids", + state: "solid", + density: 1052, + hidden: true, +}; + +elements.support_steel =: { + color: "#71797E", + behavior: behaviors.SUPPORT, + tempHigh: 1455.5, + stateHigh: "molten_steel", + category: "solids", + density: 7850, + conduct: 0.42, + hardness: 0.8, +}; + +var newAcidIgnores = ["glass_pane", "rad_glass_pane", "rad_glass_shard", "hanging_plastic"]; +for(i = 0; i < newAcidIgnores.length; i++) { + elements.acid.ignore.push(newAcidIgnores[i]); + elements.acid_gas.ignore.push(newAcidIgnores[i]); +}; + elements.rad_glass.breakInto = "rad_glass_shard"; if(!elements.glass_shard.reactions) { @@ -170,6 +260,38 @@ elements.molten_rad_glass = { ], }; +elements.steel_plate_ledge = { + color: "#F2F2F2", + tick: function(pixel) { + if(pixel.attached) { + if(pixel.attachOffsets === null) { + pixel.attached = false; + } else if(pixel.attachOffsets.includes(null)) { + pixel.attached = false; + } else { + var attachCoords = [pixel.x + pixel.attachOffsets[0], pixel.y + pixel.attachOffsets[1]]; + if(isEmpty(attachCoords[0],attachCoords[1],false)) { //consider OOB full + pixel.attached = false; + }; + }; + } else { //Move if not attached + tryMove(pixel,pixel.x,pixel.y+1); + }; + doDefaults(pixel); + }, + properties: { + "attached": false, + "attachOffsets": [null, null], + }, + tempHigh: 1455.5, + stateHigh: "molten_steel", + category: "solids", + density: 785, + conduct: 0.32, + hardness: 0.7, + breakInto: "metal_scrap", +}; + //Seeds elements.building_1_seed = { tick: function(pixel) { From f2ff60d0f4b2aaa7240134021c69b68195b65a11 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Mon, 5 Dec 2022 10:12:25 -0500 Subject: [PATCH 03/49] fix typo piss piss cum shit piss cum --- mods/structure_test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/structure_test.js b/mods/structure_test.js index 562fa468..83cef89e 100644 --- a/mods/structure_test.js +++ b/mods/structure_test.js @@ -209,7 +209,7 @@ elements.support_plastic = { hidden: true, }; -elements.support_steel =: { +elements.support_steel = { color: "#71797E", behavior: behaviors.SUPPORT, tempHigh: 1455.5, From 1867f613a19ac762a6635c899dfdc3da1a4fcc44 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Mon, 5 Dec 2022 11:01:44 -0500 Subject: [PATCH 04/49] more bbc structural variants --- mods/structure_test.js | 62 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 53 insertions(+), 9 deletions(-) diff --git a/mods/structure_test.js b/mods/structure_test.js index 83cef89e..9662ee18 100644 --- a/mods/structure_test.js +++ b/mods/structure_test.js @@ -44,6 +44,20 @@ altRoom= [["brick", "brick", "brick", "brick", "brick", "brick", "brick", return Math.floor(Math.random() * 256); };*/ +canSupportWithEdge = function(x,y) { + if(outOfBounds(x,y)) { //count edges + return true; + } else { + if(!isEmpty(x,y,true)) { //if there is a pixel + if(elements[pixelMap[x][y].element].state === "solid") { + return true; + } else { + return false; + }; + }; + }; +}; + function loadPixelRowFromArray(pixelArray,centerX,centerY,evenLengthBiasedLeft=true,doOverwrite=true) { var arrayLength = pixelArray.length; var leftmostOffset = (evenLengthBiasedLeft ? Math.floor(0 - ((arrayLength - 1) / 2)) : Math.ceil(0 - ((arrayLength - 1) / 2))) //floor and ceil have no effect on the integer values produced by odd lengths @@ -89,6 +103,40 @@ elements.glass.hardness = 0.25, elements.rad_glass.hardness = 0.25, //Prereq elements +elements.crumbling_concrete = { + color: "#ababab", + tick: function(pixel) { + var px = pixel.x; + var py = pixel.y; + + if (pixel.start === pixelTicks) {return} + + var supportCondition1 = (canSupportWithEdge(px-1,py-1) && canSupportWithEdge(px+1,py-1)) // V shape + var supportCondition2 = (canSupportWithEdge(px-1,py) && canSupportWithEdge(px+1,py)) // - shape + var supportCondition3 = (canSupportWithEdge(px-1,py+1) && canSupportWithEdge(px+1,py+1)) // Λ shape + var supportCondition4 = (canSupportWithEdge(px-1,py+1) && canSupportWithEdge(px+1,py-1)) // / shape + var supportCondition5 = (canSupportWithEdge(px-1,py-1) && canSupportWithEdge(px+1,py+1)) // \ shape + var supportCondition6 = (canSupportWithEdge(px-1,py-1) && canSupportWithEdge(px+1,py)) // '- shape + var supportCondition7 = (canSupportWithEdge(px-1,py+1) && canSupportWithEdge(px+1,py)) // ,- shape + var supportCondition8 = (canSupportWithEdge(px+1,py-1) && canSupportWithEdge(px-1,py)) // -' shape + var supportCondition9 = (canSupportWithEdge(px+1,py+1) && canSupportWithEdge(px-1,py)) // -, shape + var supportCondition10 = (canSupportWithEdge(px,py+1) && canSupportWithEdge(px,py-1)) // | shape + var supports = (supportCondition1 || supportCondition2 || supportCondition3 || supportCondition4 || supportCondition5 || supportCondition6 || supportCondition7 || supportCondition8 || supportCondition9 || supportCondition10); + + if(!supports) { + behaviors.POWDER(pixel); + }; + }, + tempHigh: 1500, + stateHigh: "magma", + category: "powders", + state: "solid", + density: 2400, + hardness: 0.5, + breakInto: "dust", +}; + + elements.glass_pane = { color: ["#5e807d","#679e99"], behavior: behaviors.SUPPORT, @@ -174,17 +222,13 @@ elements.support_copper = { hidden: true, }; -elements.hanging_bulb = { +elements.support_bulb = { color: "#a8a897", - behavior: [ - "XX|SP|XX", - "XX|XX|XX", - "M2|M1|M2" - ], + behavior: behaviors.SUPPORTPOWDER, behaviorOn: [ - "XX|SP AND CR:light|XX", - "CR:light|XX|CR:light", - "M2|M1 AND CR:light|M2", + "XX|CR:light|XX", + "CR:light AND SP|XX|CR:light AND SP", + "M2|CR:light AND M1|M2" ], colorOn: "#ebebc3", category: "machines", From 005389b9bce4e23ebaa670881961e49a29d199bf Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Tue, 6 Dec 2022 09:48:21 -0500 Subject: [PATCH 05/49] tick fix --- mods/structure_test.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mods/structure_test.js b/mods/structure_test.js index 9662ee18..9728ec26 100644 --- a/mods/structure_test.js +++ b/mods/structure_test.js @@ -126,6 +126,8 @@ elements.crumbling_concrete = { if(!supports) { behaviors.POWDER(pixel); }; + + doDefaults(pixel); }, tempHigh: 1500, stateHigh: "magma", From 0d9e39384be6ee20b110176983701ff2dde0a7ed Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Tue, 6 Dec 2022 15:13:43 -0500 Subject: [PATCH 06/49] New properties: fireSpawnTemp, fireSpawnChance temp is obvious chance is int 0-100 (default 10) --- mods/cold fire revamp and doBurning edits.js | 24 ++++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/mods/cold fire revamp and doBurning edits.js b/mods/cold fire revamp and doBurning edits.js index ac90dbf0..1494e1c5 100644 --- a/mods/cold fire revamp and doBurning edits.js +++ b/mods/cold fire revamp and doBurning edits.js @@ -20,7 +20,20 @@ function doBurning(pixel) { fire = fire[Math.floor(Math.random()*fire.length)]; } //End fire getter block - fireIsCold = (fire === "cold_fire"); + //Fire temp getter block + var fireTemp = info.fireSpawnTemp; + if (fireTemp == undefined) { + fireTemp = pixel.temp; + }; + //End fire temp getter block + //Fire chance getter block + var fireChance = info.fireSpawnChance; + if (fireChance == undefined) { + fireChance = 10; + }; + //End fire chance getter block + var fireIsCold = (fire === "cold_fire"); + var fireInfo = elements[fire]; pixel.temp += burnTempChange; pixelTempCheck(pixel); @@ -42,7 +55,6 @@ function doBurning(pixel) { //End fire getter block newFireIsCold = (newFire === "cold_fire"); - //console.log(`burning pixel ${pixel.element}: ${fire} (${fireIsCold}) / burned element ${newPixel.element}: ${newFire} (${newFireIsCold})`); if((!fireIsCold && !newFireIsCold) || (fireIsCold && newFireIsCold)) { if (elements[newPixel.element].burn && !newPixel.burning) { @@ -71,21 +83,23 @@ function doBurning(pixel) { pixel.color = pixelColorPick(pixel) } } - else if (Math.floor(Math.random()*100)<10 && !fireSpawnBlacklist.includes(pixel.element)) { // Spawn fire + else if (Math.floor(Math.random()*100) Date: Tue, 6 Dec 2022 15:14:49 -0500 Subject: [PATCH 07/49] update napalms adds "cold fire revamp and doBurning edits.js" dependency --- mods/randomness_but_tick.js | 2437 +++++++++++++++++------------------ 1 file changed, 1195 insertions(+), 1242 deletions(-) diff --git a/mods/randomness_but_tick.js b/mods/randomness_but_tick.js index 1e600736..5e5759cd 100644 --- a/mods/randomness_but_tick.js +++ b/mods/randomness_but_tick.js @@ -1,1343 +1,1296 @@ -elements.sencc = { //same element neighbor count check - color: "#000000", - uwu: 0, - tick: function(pixel) { - pixel.uwu = 0 - for (let i = -1; i < 2; i++) { - for (let j = -1; j < 2; 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/8)*pixel.uwu + ",0,0)" - } - }, - category: "machines", - insulate: true, - state: "solid", - hidden: true, -}, +var modName = "mods/randomness_but_tick.js"; +var coldFireMod = "mods/cold fire revamp and doBurning edits.js"; -elements.sencc2 = { //same element neighbor count check - color: "#000000", - uwu: 0, - tick: function(pixel) { - pixel.uwu = 0 - 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 - } - } - } - } - pixel.uwu -= 1 - if(pixel.uwu == undefined || pixel.uwu == null || isNaN(pixel.uwu)) { - pixel.color = "rgb(127,127,127)" - } else { - pixel.color = "rgb(" + (255/24)*pixel.uwu + ",0,0)" - } - }, - category: "machines", - insulate: true, - state: "solid", - 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, - owo: 0, - tick: function(pixel) { - pixel.uwu = 0 - pixel.owo = 0 - 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 (pixelMap[pixel.x+j][pixel.y+i].element == pixel.element) { - if(pixel.uwu < 8) { +if(enabledMods.includes(coldFireMod)) { + elements.sencc = { //same element neighbor count check + color: "#000000", + uwu: 0, + tick: function(pixel) { + pixel.uwu = 0 + for (let i = -1; i < 2; i++) { + for (let j = -1; j < 2; 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 - } else { - pixel.owo += 1 } } } } - } - pixel.owo -= 1 - if(pixel.uwu == undefined || pixel.uwu == null || isNaN(pixel.uwu) || pixel.owo == undefined || pixel.owo == null || isNaN(pixel.owo)) { - pixel.color = "rgb(127,127,127)" - } else { - pixel.color = "rgb(" + (255/8)*pixel.uwu + "," + (255/16)*pixel.owo + ",0)" - } - }, - category: "machines", - insulate: true, - state: "solid", - hidden: true, -}, - -elements.discharge = { - color: "#7f7f7f", - tick: function(pixel) { - for (var i = 1; i < width; i++) { - for (var j = 1; j < height; j++) { - if (!isEmpty(i,j)) { - pixelMap[i][j].charge = 0 - } - } - } - deletePixel(pixel.x, pixel.y) - }, - category:"special", - insulate:true, - state: "solid", - behavior: behaviors.SELFDELETE, -}, - -elements.troll_powder = { - color: ["#ffffff","#000000"], - tick: function(pixel) { - ddd = Math.random() - eee = Math.random() - fff = 1-eee - doHeat(pixel); - doBurning(pixel); - if(ddd < 0.9) { - if(!tryMove(pixel, pixel.x, pixel.y+1)) { - if(eee < 1/2) { tryMove(pixel, pixel.x-1, pixel.y+1) } else tryMove(pixel, pixel.x+1, pixel.y+1) - } - if(Math.random() < 0.0017) { - if(fff < 1/5) { tryMove(pixel, pixel.x-2, pixel.y-1) } - if(fff < 2/5) { tryMove(pixel, pixel.x-1, pixel.y-2) } - if(fff < 3/5) { tryMove(pixel, pixel.x, pixel.y-3) } - if(fff < 4/5) { tryMove(pixel, pixel.x+1, pixel.y-2) } - if(fff < 5/5) { tryMove(pixel, pixel.x+2, pixel.y-1) } - } - if(Math.random() < 0.0003) { tryMove(pixel, pixel.y, pixel.y); } - if(Math.random() < 0.0003) { tryMove(pixel, pixel.x, pixel.x); } - if(((Math.floor(pixel.x/2) % 2 == 0) && (Math.floor(pixel.y/2) % 2 == 0)) || ((Math.floor(pixel.x/2) % 2 == 1) && (Math.floor(pixel.y/2) % 2 == 1))) { - pixel.color = "rgb(32,32,32)" + pixel.uwu -= 1 + if(pixel.uwu == undefined || pixel.uwu == null || isNaN(pixel.uwu)) { + pixel.color = "rgb(127,127,127)" } else { - pixel.color = "rgb(224,224,224)" + pixel.color = "rgb(" + (255/8)*pixel.uwu + ",0,0)" } - } - - if(ddd >= 0.9) { - if(!tryMove(pixel, pixel.x, pixel.y-1)) { - if(eee < 1/2) { tryMove(pixel, pixel.x-1, pixel.y-1) } else tryMove(pixel, pixel.x+1, pixel.y-1) - } - if(Math.random() < 0.0017) { - if(fff < 1/5) { tryMove(pixel, pixel.x-2, pixel.y+1) } - if(fff < 2/5) { tryMove(pixel, pixel.x-1, pixel.y+2) } - if(fff < 3/5) { tryMove(pixel, pixel.x, pixel.y+3) } - if(fff < 4/5) { tryMove(pixel, pixel.x+1, pixel.y+2) } - if(fff < 5/5) { tryMove(pixel, pixel.x+2, pixel.y+1) } - } - if(Math.random() < 0.0003) { tryMove(pixel, pixel.y, pixel.y); } - if(Math.random() < 0.0003) { tryMove(pixel, pixel.x, pixel.x); } - if(((Math.floor(pixel.x/2) % 2 == 0) && (Math.floor(pixel.y/2) % 2 == 0)) || ((Math.floor(pixel.x/2) % 2 == 1) && (Math.floor(pixel.y/2) % 2 == 1))) { - pixel.color = "rgb(32,32,32)" - } else { - pixel.color = "rgb(224,224,224)" - } - pixel.temp = pixel.temp + ((Math.floor(Math.random()*3) - 1)*2) - } + }, + category: "machines", + insulate: true, + state: "solid", + hidden: true, }, - category: "powders", - state: "solid", - density: 1602, -}, -elements.void_first = { - color: "#262626", - tick: function(pixel) { - if(!pixel.void) { - //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.void) { - pixel.void = pixel.dc1 - } - } - if(!pixel.dc1 && pixel.dc2 && !pixel.dc3 && !pixel.dc4) { - if(!pixel.void) { - pixel.void = pixel.dc2 - } - } - if(!pixel.dc1 && !pixel.dc2 && pixel.dc3 && !pixel.dc4) { - if(!pixel.void) { - pixel.void = pixel.dc3 - } - } - if(!pixel.dc1 && !pixel.dc2 && !pixel.dc3 && pixel.dc4) { - if(!pixel.void) { - pixel.void = 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.void) { - if(ggg < 1/2) { - pixel.void = pixel.dc1 - } else { - pixel.void = pixel.dc2 - } - } - } - if(!pixel.dc1 && !pixel.dc2 && pixel.dc3 && pixel.dc4) { - if(!pixel.void) { - if(ggg < 1/2) { - pixel.void = pixel.dc3 - } else { - pixel.void = pixel.dc4 - } - } - } - //1010 and 0101 - if(pixel.dc1 && !pixel.dc2 && pixel.dc3 && !pixel.dc4) { - if(!pixel.void) { - if(ggg < 1/2) { - pixel.void = pixel.dc1 - } else { - pixel.void = pixel.dc3 - } - } - } - if(!pixel.dc1 && pixel.dc2 && !pixel.dc3 && pixel.dc4) { - if(!pixel.void) { - if(ggg < 1/2) { - pixel.void = pixel.dc2 - } else { - pixel.void = pixel.dc4 - } - } - } - //0110 and 1001 - if(!pixel.dc1 && pixel.dc2 && pixel.dc3 && !pixel.dc4) { - if(!pixel.void) { - if(ggg < 1/2) { - pixel.void = pixel.dc2 - } else { - pixel.void = pixel.dc3 - } - } - } - if(pixel.dc1 && !pixel.dc2 && !pixel.dc3 && pixel.dc4) { - if(!pixel.void) { - if(ggg < 1/2) { - pixel.void = pixel.dc1 - } else { - pixel.void = pixel.dc4 - } - } - } - //choose from 3 - //0111 - if(!pixel.dc1 && pixel.dc2 && pixel.dc3 && pixel.dc4) { - if(!pixel.void) { - if(hhh < 1/3) { - pixel.void = pixel.dc2 - } else if(hhh < 2/3) { - pixel.void = pixel.dc3 - } else { - pixel.void = pixel.dc4 - } - } - } - //1011 - if(pixel.dc1 && !pixel.dc2 && pixel.dc3 && pixel.dc4) { - if(!pixel.void) { - if(hhh < 1/3) { - pixel.void = pixel.dc1 - } else if(hhh < 2/3) { - pixel.void = pixel.dc3 - } else { - pixel.void = pixel.dc4 - } - } - } - //1101 - if(pixel.dc1 && pixel.dc2 && !pixel.dc3 && pixel.dc4) { - if(!pixel.void) { - if(hhh < 1/3) { - pixel.void = pixel.dc1 - } else if(hhh < 2/3) { - pixel.void = pixel.dc2 - } else { - pixel.void = pixel.dc4 - } - } - } - //1110 - if(pixel.dc1 && pixel.dc2 && pixel.dc3 && !pixel.dc4) { - if(!pixel.void) { - if(hhh < 1/3) { - pixel.void = pixel.dc1 - } else if(hhh < 2/3) { - pixel.void = pixel.dc2 - } else { - pixel.void = pixel.dc3 - } - } - } - //choose from 4 - //1111 - if(pixel.dc1 && pixel.dc2 && pixel.dc3 && pixel.dc4) { - if(!pixel.void) { - if(iii < 1/4) { - pixel.void = pixel.dc1 - } else if(iii < 2/4) { - pixel.void = pixel.dc2 - } else if(iii < 3/4) { - pixel.void = pixel.dc3 - } else { - pixel.void = pixel.dc4 - } - } - } - } else if(pixel.void) { - if(pixel.dc1 || pixel.dc2 || pixel.dc3 || pixel.dc4) { - delete pixel.dc1; - delete pixel.dc2; - delete pixel.dc3; - delete pixel.dc4; - } - } - - for(i = 0; i < adjacentCoords.length; i++) { - var pX = pixel.x; var pY = pixel.y; var oX = adjacentCoords[i][0]; var oY = adjacentCoords[i][1]; var nX = pX+oX; var nY = pY+oY; - if(!isEmpty(nX,nY,true)) { - var newPixel = pixelMap[nX][nY] - var newElement = newPixel.element; - if(newElement != pixel.element) { - deletePixel(nX,nY); - }; - }; - }; - }, - category:"special", - hardness: 1, -}, - -elements.converter = { - color: "#2ec408", - tick: function(pixel) { - if(!pixel.changeTo) { - //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 - } - } - } - } else if(pixel.changeTo) { - if(pixel.dc1 || pixel.dc2 || pixel.dc3 || pixel.dc4) { - delete pixel.dc1; - delete pixel.dc2; - delete pixel.dc3; - delete pixel.dc4; - } - } - - for(i = 0; i < adjacentCoords.length; i++) { - var pX = pixel.x; var pY = pixel.y; var oX = adjacentCoords[i][0]; var oY = adjacentCoords[i][1]; var nX = pX+oX; var nY = pY+oY; - if(!isEmpty(nX,nY,true)) { - var newPixel = pixelMap[nX][nY] - var newElement = newPixel.element; - if(newElement != pixel.element) { - changePixel(newPixel,pixel.changeTo) - }; - }; - }; - }, - category:"special", - hardness: 1, -}, - -conveyorIgnoreList = ["conveyor_1","conveyor_2","wall"] - -elements.conveyor_1 = { - color: "#7f7f7f", - tick: function(pixel) { - //top right - if (!isEmpty(pixel.x,pixel.y-1) && !outOfBounds(pixel.x,pixel.y-1)) { - if (pixelMap[pixel.x][pixel.y-1].element == "body") { - if(!isEmpty(pixel.x,pixel.y-2) && !outOfBounds(pixel.x,pixel.y-2)) { - if (pixelMap[pixel.x][pixel.y-2].element == "head") { - if(isEmpty(pixel.x+1,pixel.y-1) && isEmpty(pixel.x+1,pixel.y-2) && !outOfBounds(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-2)) { - tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x+1,pixel.y-1) - tryMove(pixelMap[pixel.x][pixel.y-2],pixel.x+1,pixel.y-2) + elements.sencc2 = { //same element neighbor count check + color: "#000000", + uwu: 0, + tick: function(pixel) { + pixel.uwu = 0 + 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 } } + } + } + pixel.uwu -= 1 + if(pixel.uwu == undefined || pixel.uwu == null || isNaN(pixel.uwu)) { + pixel.color = "rgb(127,127,127)" + } else { + pixel.color = "rgb(" + (255/24)*pixel.uwu + ",0,0)" + } + }, + category: "machines", + insulate: true, + state: "solid", + 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, + owo: 0, + tick: function(pixel) { + pixel.uwu = 0 + pixel.owo = 0 + 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 (pixelMap[pixel.x+j][pixel.y+i].element == pixel.element) { + if(pixel.uwu < 8) { + pixel.uwu += 1 + } else { + pixel.owo += 1 + } + } + } + } + } + pixel.owo -= 1 + if(pixel.uwu == undefined || pixel.uwu == null || isNaN(pixel.uwu) || pixel.owo == undefined || pixel.owo == null || isNaN(pixel.owo)) { + pixel.color = "rgb(127,127,127)" + } else { + pixel.color = "rgb(" + (255/8)*pixel.uwu + "," + (255/16)*pixel.owo + ",0)" + } + }, + category: "machines", + insulate: true, + state: "solid", + hidden: true, + }, + + elements.discharge = { + color: "#7f7f7f", + tick: function(pixel) { + for (var i = 1; i < width; i++) { + for (var j = 1; j < height; j++) { + if (!isEmpty(i,j)) { + pixelMap[i][j].charge = 0 + } + } + } + deletePixel(pixel.x, pixel.y) + }, + category:"special", + insulate:true, + state: "solid", + behavior: behaviors.SELFDELETE, + }, + + elements.troll_powder = { + color: ["#ffffff","#000000"], + tick: function(pixel) { + ddd = Math.random() + eee = Math.random() + fff = 1-eee + doHeat(pixel); + doBurning(pixel); + if(ddd < 0.9) { + if(!tryMove(pixel, pixel.x, pixel.y+1)) { + if(eee < 1/2) { tryMove(pixel, pixel.x-1, pixel.y+1) } else tryMove(pixel, pixel.x+1, pixel.y+1) + } + if(Math.random() < 0.0017) { + if(fff < 1/5) { tryMove(pixel, pixel.x-2, pixel.y-1) } + if(fff < 2/5) { tryMove(pixel, pixel.x-1, pixel.y-2) } + if(fff < 3/5) { tryMove(pixel, pixel.x, pixel.y-3) } + if(fff < 4/5) { tryMove(pixel, pixel.x+1, pixel.y-2) } + if(fff < 5/5) { tryMove(pixel, pixel.x+2, pixel.y-1) } + } + if(Math.random() < 0.0003) { tryMove(pixel, pixel.y, pixel.y); } + if(Math.random() < 0.0003) { tryMove(pixel, pixel.x, pixel.x); } + if(((Math.floor(pixel.x/2) % 2 == 0) && (Math.floor(pixel.y/2) % 2 == 0)) || ((Math.floor(pixel.x/2) % 2 == 1) && (Math.floor(pixel.y/2) % 2 == 1))) { + pixel.color = "rgb(32,32,32)" } else { - if(isEmpty(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-1)) { - tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x+1,pixel.y-1) + pixel.color = "rgb(224,224,224)" + } + } + + if(ddd >= 0.9) { + if(!tryMove(pixel, pixel.x, pixel.y-1)) { + if(eee < 1/2) { tryMove(pixel, pixel.x-1, pixel.y-1) } else tryMove(pixel, pixel.x+1, pixel.y-1) + } + if(Math.random() < 0.0017) { + if(fff < 1/5) { tryMove(pixel, pixel.x-2, pixel.y+1) } + if(fff < 2/5) { tryMove(pixel, pixel.x-1, pixel.y+2) } + if(fff < 3/5) { tryMove(pixel, pixel.x, pixel.y+3) } + if(fff < 4/5) { tryMove(pixel, pixel.x+1, pixel.y+2) } + if(fff < 5/5) { tryMove(pixel, pixel.x+2, pixel.y+1) } + } + if(Math.random() < 0.0003) { tryMove(pixel, pixel.y, pixel.y); } + if(Math.random() < 0.0003) { tryMove(pixel, pixel.x, pixel.x); } + if(((Math.floor(pixel.x/2) % 2 == 0) && (Math.floor(pixel.y/2) % 2 == 0)) || ((Math.floor(pixel.x/2) % 2 == 1) && (Math.floor(pixel.y/2) % 2 == 1))) { + pixel.color = "rgb(32,32,32)" + } else { + pixel.color = "rgb(224,224,224)" + } + pixel.temp = pixel.temp + ((Math.floor(Math.random()*3) - 1)*2) + } + }, + category: "powders", + state: "solid", + density: 1602, + }, + + elements.void_first = { + color: "#262626", + tick: function(pixel) { + if(!pixel.void) { + //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 } } - } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x][pixel.y-1].element)) { - tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x+1,pixel.y-1) + 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.void) { + pixel.void = pixel.dc1 + } + } + if(!pixel.dc1 && pixel.dc2 && !pixel.dc3 && !pixel.dc4) { + if(!pixel.void) { + pixel.void = pixel.dc2 + } + } + if(!pixel.dc1 && !pixel.dc2 && pixel.dc3 && !pixel.dc4) { + if(!pixel.void) { + pixel.void = pixel.dc3 + } + } + if(!pixel.dc1 && !pixel.dc2 && !pixel.dc3 && pixel.dc4) { + if(!pixel.void) { + pixel.void = 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.void) { + if(ggg < 1/2) { + pixel.void = pixel.dc1 + } else { + pixel.void = pixel.dc2 + } + } + } + if(!pixel.dc1 && !pixel.dc2 && pixel.dc3 && pixel.dc4) { + if(!pixel.void) { + if(ggg < 1/2) { + pixel.void = pixel.dc3 + } else { + pixel.void = pixel.dc4 + } + } + } + //1010 and 0101 + if(pixel.dc1 && !pixel.dc2 && pixel.dc3 && !pixel.dc4) { + if(!pixel.void) { + if(ggg < 1/2) { + pixel.void = pixel.dc1 + } else { + pixel.void = pixel.dc3 + } + } + } + if(!pixel.dc1 && pixel.dc2 && !pixel.dc3 && pixel.dc4) { + if(!pixel.void) { + if(ggg < 1/2) { + pixel.void = pixel.dc2 + } else { + pixel.void = pixel.dc4 + } + } + } + //0110 and 1001 + if(!pixel.dc1 && pixel.dc2 && pixel.dc3 && !pixel.dc4) { + if(!pixel.void) { + if(ggg < 1/2) { + pixel.void = pixel.dc2 + } else { + pixel.void = pixel.dc3 + } + } + } + if(pixel.dc1 && !pixel.dc2 && !pixel.dc3 && pixel.dc4) { + if(!pixel.void) { + if(ggg < 1/2) { + pixel.void = pixel.dc1 + } else { + pixel.void = pixel.dc4 + } + } + } + //choose from 3 + //0111 + if(!pixel.dc1 && pixel.dc2 && pixel.dc3 && pixel.dc4) { + if(!pixel.void) { + if(hhh < 1/3) { + pixel.void = pixel.dc2 + } else if(hhh < 2/3) { + pixel.void = pixel.dc3 + } else { + pixel.void = pixel.dc4 + } + } + } + //1011 + if(pixel.dc1 && !pixel.dc2 && pixel.dc3 && pixel.dc4) { + if(!pixel.void) { + if(hhh < 1/3) { + pixel.void = pixel.dc1 + } else if(hhh < 2/3) { + pixel.void = pixel.dc3 + } else { + pixel.void = pixel.dc4 + } + } + } + //1101 + if(pixel.dc1 && pixel.dc2 && !pixel.dc3 && pixel.dc4) { + if(!pixel.void) { + if(hhh < 1/3) { + pixel.void = pixel.dc1 + } else if(hhh < 2/3) { + pixel.void = pixel.dc2 + } else { + pixel.void = pixel.dc4 + } + } + } + //1110 + if(pixel.dc1 && pixel.dc2 && pixel.dc3 && !pixel.dc4) { + if(!pixel.void) { + if(hhh < 1/3) { + pixel.void = pixel.dc1 + } else if(hhh < 2/3) { + pixel.void = pixel.dc2 + } else { + pixel.void = pixel.dc3 + } + } + } + //choose from 4 + //1111 + if(pixel.dc1 && pixel.dc2 && pixel.dc3 && pixel.dc4) { + if(!pixel.void) { + if(iii < 1/4) { + pixel.void = pixel.dc1 + } else if(iii < 2/4) { + pixel.void = pixel.dc2 + } else if(iii < 3/4) { + pixel.void = pixel.dc3 + } else { + pixel.void = pixel.dc4 + } + } + } + } else if(pixel.void) { + if(pixel.dc1 || pixel.dc2 || pixel.dc3 || pixel.dc4) { + delete pixel.dc1; + delete pixel.dc2; + delete pixel.dc3; + delete pixel.dc4; + } } - } - //right down - if (!isEmpty(pixel.x+1,pixel.y) && !outOfBounds(pixel.x+1,pixel.y)) { - if (pixelMap[pixel.x+1][pixel.y].element == "body") { - if(!isEmpty(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-1)) { - if (pixelMap[pixel.x+1][pixel.y-1].element == "head") { + + for(i = 0; i < adjacentCoords.length; i++) { + var pX = pixel.x; var pY = pixel.y; var oX = adjacentCoords[i][0]; var oY = adjacentCoords[i][1]; var nX = pX+oX; var nY = pY+oY; + if(!isEmpty(nX,nY,true)) { + var newPixel = pixelMap[nX][nY] + var newElement = newPixel.element; + if(newElement != pixel.element) { + deletePixel(nX,nY); + }; + }; + }; + }, + category:"special", + hardness: 1, + }, + + elements.converter = { + color: "#2ec408", + tick: function(pixel) { + if(!pixel.changeTo) { + //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 + } + } + } + } else if(pixel.changeTo) { + if(pixel.dc1 || pixel.dc2 || pixel.dc3 || pixel.dc4) { + delete pixel.dc1; + delete pixel.dc2; + delete pixel.dc3; + delete pixel.dc4; + } + } + + for(i = 0; i < adjacentCoords.length; i++) { + var pX = pixel.x; var pY = pixel.y; var oX = adjacentCoords[i][0]; var oY = adjacentCoords[i][1]; var nX = pX+oX; var nY = pY+oY; + if(!isEmpty(nX,nY,true)) { + var newPixel = pixelMap[nX][nY] + var newElement = newPixel.element; + if(newElement != pixel.element) { + changePixel(newPixel,pixel.changeTo) + }; + }; + }; + }, + category:"special", + hardness: 1, + }, + + conveyorIgnoreList = ["conveyor_1","conveyor_2","wall"] + + elements.conveyor_1 = { + color: "#7f7f7f", + tick: function(pixel) { + //top right + if (!isEmpty(pixel.x,pixel.y-1) && !outOfBounds(pixel.x,pixel.y-1)) { + if (pixelMap[pixel.x][pixel.y-1].element == "body") { + if(!isEmpty(pixel.x,pixel.y-2) && !outOfBounds(pixel.x,pixel.y-2)) { + if (pixelMap[pixel.x][pixel.y-2].element == "head") { + if(isEmpty(pixel.x+1,pixel.y-1) && isEmpty(pixel.x+1,pixel.y-2) && !outOfBounds(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-2)) { + tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x+1,pixel.y-1) + tryMove(pixelMap[pixel.x][pixel.y-2],pixel.x+1,pixel.y-2) + } + } + } else { + if(isEmpty(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-1)) { + tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x+1,pixel.y-1) + } + } + } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x][pixel.y-1].element)) { + tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x+1,pixel.y-1) + } + } + //right down + if (!isEmpty(pixel.x+1,pixel.y) && !outOfBounds(pixel.x+1,pixel.y)) { + if (pixelMap[pixel.x+1][pixel.y].element == "body") { + if(!isEmpty(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-1)) { + if (pixelMap[pixel.x+1][pixel.y-1].element == "head") { + if(isEmpty(pixel.x+1,pixel.y+1) && !outOfBounds(pixel.x+1,pixel.y+1)) { + tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y+1) + tryMove(pixelMap[pixel.x+1][pixel.y-1],pixel.x+1,pixel.y) + } + } + } else { if(isEmpty(pixel.x+1,pixel.y+1) && !outOfBounds(pixel.x+1,pixel.y+1)) { tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y+1) - tryMove(pixelMap[pixel.x+1][pixel.y-1],pixel.x+1,pixel.y) } } - } else { - if(isEmpty(pixel.x+1,pixel.y+1) && !outOfBounds(pixel.x+1,pixel.y+1)) { - tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y+1) - } + } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x+1][pixel.y].element)) { + tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y+1) } - } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x+1][pixel.y].element)) { - tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y+1) } - } - //bottom left - if (!isEmpty(pixel.x,pixel.y+1) && !outOfBounds(pixel.x,pixel.y+1)) { - if (pixelMap[pixel.x][pixel.y+1].element == "head") { - if(!isEmpty(pixel.x,pixel.y+2) && !outOfBounds(pixel.x,pixel.y+2)) { - if (pixelMap[pixel.x][pixel.y+2].element == "body") { - if(isEmpty(pixel.x-1,pixel.y+1) && isEmpty(pixel.x-1,pixel.y+2) && !outOfBounds(pixel.x-1,pixel.y+2) && !outOfBounds(pixel.x-1,pixel.y+2)) { + //bottom left + if (!isEmpty(pixel.x,pixel.y+1) && !outOfBounds(pixel.x,pixel.y+1)) { + if (pixelMap[pixel.x][pixel.y+1].element == "head") { + if(!isEmpty(pixel.x,pixel.y+2) && !outOfBounds(pixel.x,pixel.y+2)) { + if (pixelMap[pixel.x][pixel.y+2].element == "body") { + if(isEmpty(pixel.x-1,pixel.y+1) && isEmpty(pixel.x-1,pixel.y+2) && !outOfBounds(pixel.x-1,pixel.y+2) && !outOfBounds(pixel.x-1,pixel.y+2)) { + tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x-1,pixel.y+1) + tryMove(pixelMap[pixel.x][pixel.y+2],pixel.x-1,pixel.y+2) + } + } + } else { + if(isEmpty(pixel.x-1,pixel.y+1) && !outOfBounds(pixel.x-1,pixel.y+1)) { tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x-1,pixel.y+1) - tryMove(pixelMap[pixel.x][pixel.y+2],pixel.x-1,pixel.y+2) } } - } else { - if(isEmpty(pixel.x-1,pixel.y+1) && !outOfBounds(pixel.x-1,pixel.y+1)) { - tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x-1,pixel.y+1) - } + } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x][pixel.y+1].element)) { + tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x-1,pixel.y+1) } - } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x][pixel.y+1].element)) { - tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x-1,pixel.y+1) } - } - //left up - if (!isEmpty(pixel.x-1,pixel.y) && !outOfBounds(pixel.x-1,pixel.y)) { - if (pixelMap[pixel.x-1][pixel.y].element == "head") { - if(!isEmpty(pixel.x-1,pixel.y+1) && !outOfBounds(pixel.x-1,pixel.y+1)) { - if (pixelMap[pixel.x-1][pixel.y+1].element == "body") { + //left up + if (!isEmpty(pixel.x-1,pixel.y) && !outOfBounds(pixel.x-1,pixel.y)) { + if (pixelMap[pixel.x-1][pixel.y].element == "head") { + if(!isEmpty(pixel.x-1,pixel.y+1) && !outOfBounds(pixel.x-1,pixel.y+1)) { + if (pixelMap[pixel.x-1][pixel.y+1].element == "body") { + if(isEmpty(pixel.x-1,pixel.y-1) && !outOfBounds(pixel.x-1,pixel.y-1)) { + tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y-1) + tryMove(pixelMap[pixel.x-1][pixel.y+1],pixel.x-1,pixel.y) + } + } + } else { if(isEmpty(pixel.x-1,pixel.y-1) && !outOfBounds(pixel.x-1,pixel.y-1)) { tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y-1) - tryMove(pixelMap[pixel.x-1][pixel.y+1],pixel.x-1,pixel.y) } } - } else { - if(isEmpty(pixel.x-1,pixel.y-1) && !outOfBounds(pixel.x-1,pixel.y-1)) { - tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y-1) - } + } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x-1][pixel.y].element)) { + tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y-1) } - } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x-1][pixel.y].element)) { - tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y-1) } - } + }, + category: "machines", + insulate: true, + state: "solid", }, - category: "machines", - insulate: true, - state: "solid", -}, -elements.conveyor_2 = { - color: "#7f7f7f", - tick: function(pixel) { - //top left - if (!isEmpty(pixel.x,pixel.y-1) && !outOfBounds(pixel.x,pixel.y-1)) { - if (pixelMap[pixel.x][pixel.y-1].element == "body") { - if(!isEmpty(pixel.x,pixel.y-2) && !outOfBounds(pixel.x,pixel.y-2)) { - if (pixelMap[pixel.x][pixel.y-2].element == "head") { - if(isEmpty(pixel.x-1,pixel.y-1) && isEmpty(pixel.x-1,pixel.y-2) && !outOfBounds(pixel.x-1,pixel.y-1) && !outOfBounds(pixel.x-1,pixel.y-2)) { + elements.conveyor_2 = { + color: "#7f7f7f", + tick: function(pixel) { + //top left + if (!isEmpty(pixel.x,pixel.y-1) && !outOfBounds(pixel.x,pixel.y-1)) { + if (pixelMap[pixel.x][pixel.y-1].element == "body") { + if(!isEmpty(pixel.x,pixel.y-2) && !outOfBounds(pixel.x,pixel.y-2)) { + if (pixelMap[pixel.x][pixel.y-2].element == "head") { + if(isEmpty(pixel.x-1,pixel.y-1) && isEmpty(pixel.x-1,pixel.y-2) && !outOfBounds(pixel.x-1,pixel.y-1) && !outOfBounds(pixel.x-1,pixel.y-2)) { + tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x-1,pixel.y-1) + tryMove(pixelMap[pixel.x][pixel.y-2],pixel.x-1,pixel.y-2) + } + } + } else { + if(isEmpty(pixel.x-1,pixel.y-1) && !outOfBounds(pixel.x-1,pixel.y-1)) { tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x-1,pixel.y-1) - tryMove(pixelMap[pixel.x][pixel.y-2],pixel.x-1,pixel.y-2) } } - } else { - if(isEmpty(pixel.x-1,pixel.y-1) && !outOfBounds(pixel.x-1,pixel.y-1)) { - tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x-1,pixel.y-1) - } + } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x][pixel.y-1].element)) { + tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x-1,pixel.y-1) } - } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x][pixel.y-1].element)) { - tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x-1,pixel.y-1) } - } - //right up - if (!isEmpty(pixel.x+1,pixel.y) && !outOfBounds(pixel.x+1,pixel.y)) { - if (pixelMap[pixel.x+1][pixel.y].element == "head") { - if(!isEmpty(pixel.x+1,pixel.y+1) && !outOfBounds(pixel.x+1,pixel.y+1)) { - if (pixelMap[pixel.x+1][pixel.y+1].element == "body") { + //right up + if (!isEmpty(pixel.x+1,pixel.y) && !outOfBounds(pixel.x+1,pixel.y)) { + if (pixelMap[pixel.x+1][pixel.y].element == "head") { + if(!isEmpty(pixel.x+1,pixel.y+1) && !outOfBounds(pixel.x+1,pixel.y+1)) { + if (pixelMap[pixel.x+1][pixel.y+1].element == "body") { + if(isEmpty(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-1)) { + tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y-1) + tryMove(pixelMap[pixel.x+1][pixel.y+1],pixel.x+1,pixel.y) + } + } + } else { if(isEmpty(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-1)) { tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y-1) - tryMove(pixelMap[pixel.x+1][pixel.y+1],pixel.x+1,pixel.y) } } - } else { - if(isEmpty(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-1)) { - tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y-1) - } + } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x+1][pixel.y].element)) { + tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y-1) } - } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x+1][pixel.y].element)) { - tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y-1) } - } - //bottom right - if (!isEmpty(pixel.x,pixel.y+1) && !outOfBounds(pixel.x,pixel.y+1)) { - if (pixelMap[pixel.x][pixel.y+1].element == "head") { - if(!isEmpty(pixel.x,pixel.y+2) && !outOfBounds(pixel.x,pixel.y+2)) { - if (pixelMap[pixel.x][pixel.y+2].element == "body") { - if(isEmpty(pixel.x+1,pixel.y+1) && isEmpty(pixel.x+1,pixel.y+2) && !outOfBounds(pixel.x+1,pixel.y+2) && !outOfBounds(pixel.x+1,pixel.y+2)) { + //bottom right + if (!isEmpty(pixel.x,pixel.y+1) && !outOfBounds(pixel.x,pixel.y+1)) { + if (pixelMap[pixel.x][pixel.y+1].element == "head") { + if(!isEmpty(pixel.x,pixel.y+2) && !outOfBounds(pixel.x,pixel.y+2)) { + if (pixelMap[pixel.x][pixel.y+2].element == "body") { + if(isEmpty(pixel.x+1,pixel.y+1) && isEmpty(pixel.x+1,pixel.y+2) && !outOfBounds(pixel.x+1,pixel.y+2) && !outOfBounds(pixel.x+1,pixel.y+2)) { + tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x+1,pixel.y+1) + tryMove(pixelMap[pixel.x][pixel.y+2],pixel.x+1,pixel.y+2) + } + } + } else { + if(isEmpty(pixel.x+1,pixel.y+1) && !outOfBounds(pixel.x+1,pixel.y+1)) { tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x+1,pixel.y+1) - tryMove(pixelMap[pixel.x][pixel.y+2],pixel.x+1,pixel.y+2) } } - } else { - if(isEmpty(pixel.x+1,pixel.y+1) && !outOfBounds(pixel.x+1,pixel.y+1)) { - tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x+1,pixel.y+1) - } + } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x][pixel.y+1].element)) { + tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x+1,pixel.y+1) } - } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x][pixel.y+1].element)) { - tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x+1,pixel.y+1) } - } - //left down - if (!isEmpty(pixel.x-1,pixel.y) && !outOfBounds(pixel.x-1,pixel.y)) { - if (pixelMap[pixel.x-1][pixel.y].element == "body") { - if(!isEmpty(pixel.x-1,pixel.y-1) && !outOfBounds(pixel.x-1,pixel.y-1)) { - if (pixelMap[pixel.x-1][pixel.y-1].element == "head") { + //left down + if (!isEmpty(pixel.x-1,pixel.y) && !outOfBounds(pixel.x-1,pixel.y)) { + if (pixelMap[pixel.x-1][pixel.y].element == "body") { + if(!isEmpty(pixel.x-1,pixel.y-1) && !outOfBounds(pixel.x-1,pixel.y-1)) { + if (pixelMap[pixel.x-1][pixel.y-1].element == "head") { + if(isEmpty(pixel.x-1,pixel.y+1) && !outOfBounds(pixel.x-1,pixel.y+1)) { + tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y+1) + tryMove(pixelMap[pixel.x-1][pixel.y-1],pixel.x-1,pixel.y) + } + } + } else { if(isEmpty(pixel.x-1,pixel.y+1) && !outOfBounds(pixel.x-1,pixel.y+1)) { tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y+1) - tryMove(pixelMap[pixel.x-1][pixel.y-1],pixel.x-1,pixel.y) } } + } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x-1][pixel.y].element)) { + tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y+1) + } + } + }, + category: "machines", + insulate: true, + state: "solid", + }, + + elements.vanishing_wall = { + behavior: behaviors.WALL, + color: "#8080b0", + density: 3333, + tick: function(pixel) { + pixelTick(pixel) + if(pixel.charge) { + if(!isEmpty(pixel.x,pixel.y)) { + deletePixel(pixel.x,pixel.y) + } + } + }, + category: "special", + state: "solid", + hardness: 1, + insulate: true, + conduct: 1, + extraInfo: "It disappears when charged.", + }, + + elements.polka_dotted_powder = { + color: ["#000000","#000000","#7f7f7f","#ffffff","#ffffff"], + behavior: behaviors.POWDER, + category: "powders", + state: "solid", + density: 1400, + tick: function(pixel) { + if(pixel.y % 6 == 0) { + if(pixel.x % 6 == 0) { + pixel.color = "rgb(255,255,255)" } else { - if(isEmpty(pixel.x-1,pixel.y+1) && !outOfBounds(pixel.x-1,pixel.y+1)) { - tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y+1) + if(!settings.bg || settings.bg == "#000000") { + pixel.color = "rgb(15,15,15)" + } else { + pixel.color = "rgb(0,0,0)" } - } - } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x-1][pixel.y].element)) { - tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y+1) - } - } - }, - category: "machines", - insulate: true, - state: "solid", -}, - -elements.vanishing_wall = { - behavior: behaviors.WALL, - color: "#8080b0", - density: 3333, - tick: function(pixel) { - pixelTick(pixel) - if(pixel.charge) { - if(!isEmpty(pixel.x,pixel.y)) { - deletePixel(pixel.x,pixel.y) - } - } - }, - category: "special", - state: "solid", - hardness: 1, - insulate: true, - conduct: 1, - extraInfo: "It disappears when charged.", -}, - -elements.polka_dotted_powder = { - color: ["#000000","#000000","#7f7f7f","#ffffff","#ffffff"], - behavior: behaviors.POWDER, - category: "powders", - state: "solid", - density: 1400, - tick: function(pixel) { - if(pixel.y % 6 == 0) { - if(pixel.x % 6 == 0) { - pixel.color = "rgb(255,255,255)" + } + } else if((pixel.y + 3) % 6 == 0) { + if((pixel.x + 3) % 6 == 0) { + pixel.color = "rgb(255,255,255)" + } else { + if(!settings.bg || settings.bg == "#000000") { + pixel.color = "rgb(15,15,15)" + } else { + pixel.color = "rgb(0,0,0)" + } + } } else { if(!settings.bg || settings.bg == "#000000") { pixel.color = "rgb(15,15,15)" } else { pixel.color = "rgb(0,0,0)" } - } - } else if((pixel.y + 3) % 6 == 0) { - if((pixel.x + 3) % 6 == 0) { - pixel.color = "rgb(255,255,255)" - } else { - if(!settings.bg || settings.bg == "#000000") { - pixel.color = "rgb(15,15,15)" - } else { - pixel.color = "rgb(0,0,0)" - } - } - } else { - if(!settings.bg || settings.bg == "#000000") { - pixel.color = "rgb(15,15,15)" - } else { - pixel.color = "rgb(0,0,0)" } - } + }, + tempHigh: 800, }, - tempHigh: 800, -}, -elements.molten_polka_dotted_powder = { - color: ["#ff7f00","#ff7f00","#ff9f00","#ffbf00","#ffbf00"], - density: 1100, - tick: function(pixel) { - if(pixel.y % 6 == 0) { - if(pixel.x % 6 == 0) { - pixel.color = "rgb(255,191,0)" + elements.molten_polka_dotted_powder = { + color: ["#ff7f00","#ff7f00","#ff9f00","#ffbf00","#ffbf00"], + density: 1100, + tick: function(pixel) { + if(pixel.y % 6 == 0) { + if(pixel.x % 6 == 0) { + pixel.color = "rgb(255,191,0)" + } else { + if(!settings.bg || settings.bg == "#ff7f00") { + pixel.color = "rgb(255,143,16)" + } else { + pixel.color = "rgb(255,127,16)" + } + } + } else if((pixel.y + 3) % 6 == 0) { + if((pixel.x + 3) % 6 == 0) { + pixel.color = "rgb(255,191,0)" + } else { + if(!settings.bg || settings.bg == "#ff7f00") { + pixel.color = "rgb(255,143,16)" + } else { + pixel.color = "rgb(255,127,16)" + } + } } else { if(!settings.bg || settings.bg == "#ff7f00") { pixel.color = "rgb(255,143,16)" } else { pixel.color = "rgb(255,127,16)" } - } - } else if((pixel.y + 3) % 6 == 0) { - if((pixel.x + 3) % 6 == 0) { - pixel.color = "rgb(255,191,0)" - } else { - if(!settings.bg || settings.bg == "#ff7f00") { - pixel.color = "rgb(255,143,16)" - } else { - pixel.color = "rgb(255,127,16)" - } - } - } else { - if(!settings.bg || settings.bg == "#ff7f00") { - pixel.color = "rgb(255,143,16)" - } else { - pixel.color = "rgb(255,127,16)" } - } + }, + temp: 850, + tempLow: 800, + stateLow: "polka_dotted_powder", + tempHigh: 2000, + stateHigh: "vaporized_polka_dotted_powder", + viscosity: 6, + hidden: true, }, - temp: 850, - tempLow: 800, - stateLow: "polka_dotted_powder", - tempHigh: 2000, - stateHigh: "vaporized_polka_dotted_powder", - viscosity: 6, - hidden: true, -}, -elements.vaporized_polka_dotted_powder = { - color: ["#ffdf7f","#ffdf7f","#ffefbf","#ffffff","#ffffff"], - behavior: behaviors.GAS, - category: "gases", - state: "gas", - density: 550, - tick: function(pixel) { - if(pixel.y % 6 == 0) { - if(pixel.x % 6 == 0) { - pixel.color = "rgb(255,255,255)" + elements.vaporized_polka_dotted_powder = { + color: ["#ffdf7f","#ffdf7f","#ffefbf","#ffffff","#ffffff"], + behavior: behaviors.GAS, + category: "gases", + state: "gas", + density: 550, + tick: function(pixel) { + if(pixel.y % 6 == 0) { + if(pixel.x % 6 == 0) { + pixel.color = "rgb(255,255,255)" + } else { + if(!settings.bg || settings.bg == "#ffdf7f") { + pixel.color = "rgb(255,233,137)" + } else { + pixel.color = "rgb(255,223,127)" + } + } + } else if((pixel.y + 3) % 6 == 0) { + if((pixel.x + 3) % 6 == 0) { + pixel.color = "rgb(255,255,255)" + } else { + if(!settings.bg || settings.bg == "#ffdf7f") { + pixel.color = "rgb(255,143,16)" + } else { + pixel.color = "rgb(255,233,137)" + } + } } else { if(!settings.bg || settings.bg == "#ffdf7f") { pixel.color = "rgb(255,233,137)" } else { pixel.color = "rgb(255,223,127)" } - } - } else if((pixel.y + 3) % 6 == 0) { - if((pixel.x + 3) % 6 == 0) { - pixel.color = "rgb(255,255,255)" - } else { - if(!settings.bg || settings.bg == "#ffdf7f") { - pixel.color = "rgb(255,143,16)" - } else { - pixel.color = "rgb(255,233,137)" - } - } - } else { - if(!settings.bg || settings.bg == "#ffdf7f") { - pixel.color = "rgb(255,233,137)" - } else { - pixel.color = "rgb(255,223,127)" } - } + }, + temp: 2200, + tempLow: 2000, + stateLow: "molten_polka_dotted_powder", + tempHigh: 8000, + stateHigh: "ionized_polka_dotted_powder", + hidden: true, }, - temp: 2200, - tempLow: 2000, - stateLow: "molten_polka_dotted_powder", - tempHigh: 8000, - stateHigh: "ionized_polka_dotted_powder", - hidden: true, -}, -elements.ionized_polka_dotted_powder = { - color: ["#fffff0","#fffff0","#fffff7","#ffffff","#ffffff"], - behavior: [ - "M2 AND CR:plasma%0.3|M1|M2 AND CR:plasma%0.3", - "M1|XX|M1", - "M2 AND CR:plasma%0.3|M1|M2 AND CR:plasma%0.3", - ], - category: "gases", - state: "gas", - density: 0.02, - tick: function(pixel) { - if(pixel.y % 6 == 0) { - if(pixel.x % 6 == 0) { - pixel.color = "rgb(255,255,255)" + elements.ionized_polka_dotted_powder = { + color: ["#fffff0","#fffff0","#fffff7","#ffffff","#ffffff"], + behavior: [ + "M2 AND CR:plasma%0.3|M1|M2 AND CR:plasma%0.3", + "M1|XX|M1", + "M2 AND CR:plasma%0.3|M1|M2 AND CR:plasma%0.3", + ], + category: "gases", + state: "gas", + density: 0.02, + tick: function(pixel) { + if(pixel.y % 6 == 0) { + if(pixel.x % 6 == 0) { + pixel.color = "rgb(255,255,255)" + } else { + if(!settings.bg || settings.bg == "#fffff0") { + pixel.color = "rgb(255,255,247)" + } else { + pixel.color = "rgb(255,255,240)" + } + } + } else if((pixel.y + 3) % 6 == 0) { + if((pixel.x + 3) % 6 == 0) { + pixel.color = "rgb(255,255,255)" + } else { + if(!settings.bg || settings.bg == "#fffff0") { + pixel.color = "rgb(255,255,247)" + } else { + pixel.color = "rgb(255,255,240)" + } + } } else { if(!settings.bg || settings.bg == "#fffff0") { pixel.color = "rgb(255,255,247)" } else { pixel.color = "rgb(255,255,240)" } - } - } else if((pixel.y + 3) % 6 == 0) { - if((pixel.x + 3) % 6 == 0) { - pixel.color = "rgb(255,255,255)" - } else { - if(!settings.bg || settings.bg == "#fffff0") { - pixel.color = "rgb(255,255,247)" - } else { - pixel.color = "rgb(255,255,240)" - } - } - } else { - if(!settings.bg || settings.bg == "#fffff0") { - pixel.color = "rgb(255,255,247)" - } else { - pixel.color = "rgb(255,255,240)" } - } + }, + temp: 8500, + tempLow: 8000, + stateLow: "vaporized_polka_dotted_powder", + hidden: true, }, - temp: 8500, - 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 + 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 + } } - if(isNaN(temp) || isNaN(pixel.temp)) { - temp = 20 - pixel.temp = 20 - } - } + }, + density: 1200, + conduct: 0.5, + state: "solid", + category: "special" }, - density: 1200, - conduct: 0.5, - state: "solid", - category: "special" -}, -function randInt(max) { - return Math.floor(Math.random() * (max + 1)) -} + function randInt(max) { + return Math.floor(Math.random() * (max + 1)) + } -function randIntR(min,max) { - if(min > max) { - var temp = max; //the need of a temporary space has always annoyed me - max = min; - min = temp; + function randIntR(min,max) { + if(min > max) { + var temp = max; //the need of a temporary space has always annoyed me + max = min; + min = temp; + }; + return Math.floor(Math.random() * (max - min + 1)) + min }; - return Math.floor(Math.random() * (max - min + 1)) + min + + elements.napalm = { + color: "#e0873e", + behavior: [ + "XX|SA%40 AND ST|XX", + "M2%10 AND SA%40 AND ST|XX|M2%10 AND SA%40 AND ST", + "M2%50 AND M1%10|M1 AND SA%40 AND ST|M2%50 AND M1%10" + ], + category: "weapons", + state: "liquid", + viscosity: 1000, + density: 1200, //google was f***ing useless and i'm not searching that again, so arbitrary 1.2 it is + burnTempChange: 2, + burn: 300, + burnTime: 500, + }, + + elements.hypernapalm = { + name: "h y p e r n a p a l m", //HYPERNAPALM + color: "#bd34eb", + behavior: [ + "XX|SA%40 AND ST|XX", + "M2%10 AND SA%40 AND ST|XX|M2%10 AND SA%40 AND ST", + "M2%50 AND M1%10|M1 AND SA%40 AND ST|M2%50 AND M1%10" + ], + category: "weapons", + state: "liquid", + viscosity: 1000, + density: 1200, + fireElement: "plasma", + fireSpawnChance: 33, + fireSpawnTemp: 7200, + burnTempChange: 30, + burn: 300, + burnTime: 500, + }, + + elements.cold_napalm = { + color: "#3e87e0", + behavior: [ + "XX|SA%40 AND ST|XX", + "M2%10 AND SA%40 AND ST|XX|M2%10 AND SA%40 AND ST", + "M2%50 AND M1%10|M1 AND SA%40 AND ST|M2%50 AND M1%10" + ], + category: "weapons", + state: "liquid", + viscosity: 1000, + density: 1200, + burn: 300, + burnTime: 500, + fireElement: "cold_fire", + burnTempChange: -1, + burnInto: "cold_fire", + } + + elements.lower_color_copy = { + behavior: behaviors.POWDER, + tick: function(pixel) { + if(!isEmpty(pixel.x,pixel.y+1,true)) { + pixel.color = pixelMap[pixel.x][pixel.y+1].color; + } else { + if(settings.bg) { + pixel.color = settings.bg; + } else { + pixel.color = "#000000"; + } + } + }, + color: ["#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#FF0000", "#FF7F00", "#FFFF00", "#00FF00", "#007FFF", "#0000FF", "#7F00FF"], + density: 1250, + breakInto: ["metal_scrap", "glass_shard"], + hardness: 0.7, + } +} else { + enabledMods.splice(enabledMods.indexOf(modName),0,coldFireMod); + localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); + alert(`The "${coldFireMod}" mod is required and has been automatically inserted (reload for this to take effect).`) }; - -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", -} - -elements.lower_color_copy = { - behavior: behaviors.POWDER, - tick: function(pixel) { - if(!isEmpty(pixel.x,pixel.y+1,true)) { - pixel.color = pixelMap[pixel.x][pixel.y+1].color; - } else { - if(settings.bg) { - pixel.color = settings.bg; - } else { - pixel.color = "#000000"; - } - } - }, - color: ["#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#FF0000", "#FF7F00", "#FFFF00", "#00FF00", "#007FFF", "#0000FF", "#7F00FF"], - density: 1250, - breakInto: ["metal_scrap", "glass_shard"], - hardness: 0.7, -} From f4880ae0d4da4d9dc70d71fdf8e5ef058428384d Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Tue, 6 Dec 2022 15:40:18 -0500 Subject: [PATCH 08/49] try to fix NaN occurring under certain circumstances --- mods/randomness_but_tick.js | 1 + 1 file changed, 1 insertion(+) diff --git a/mods/randomness_but_tick.js b/mods/randomness_but_tick.js index 5e5759cd..11ba535a 100644 --- a/mods/randomness_but_tick.js +++ b/mods/randomness_but_tick.js @@ -1231,6 +1231,7 @@ if(enabledMods.includes(coldFireMod)) { burnTempChange: 2, burn: 300, burnTime: 500, + temp: airTemp, }, elements.hypernapalm = { From 0967e9b99480cca216ff8caa17bee77b4d29544a Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Tue, 6 Dec 2022 15:42:54 -0500 Subject: [PATCH 09/49] add firebomb, explodeAtPlus.js dependency --- mods/more_bombs.js | 73 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 70 insertions(+), 3 deletions(-) diff --git a/mods/more_bombs.js b/mods/more_bombs.js index 309086c3..5d48e662 100644 --- a/mods/more_bombs.js +++ b/mods/more_bombs.js @@ -1,4 +1,5 @@ var modName = "mods/more_bombs.js"; +var explodeAtPlusMod = "mods/explodeAtPlus.js"; var runAfterAutogenMod = "mods/runAfterAutogen and onload restructure.js"; var libraryMod = "mods/code_library.js"; @@ -26,6 +27,38 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) }; }; + function firebombFire(pixel,x,y,radius,fire,smoke,power,damage) { + var coords = circleCoords(pixel.x,pixel.y,radius); + for (var i = 0; i < coords.length; i++) { + var x = coords[i].x; + var y = coords[i].y; + if(!isEmpty(x,y,true)) { + var pixel = pixelMap[x][y]; + var info = elements[pixel.element]; + var cursedFireChance = 0.15 + power; + if (info.burn) { //Light everything on fire + pixel.burning = true; + pixel.burnStart = pixelTicks; + pixel.temp += 10; //smoke prevention + } else if(Math.random() < cursedFireChance) { //(15+power)%/px cursed burning + pixel.burning = true; + pixel.burnStart = pixelTicks; + pixel.temp += 10; + }; + } else if(isEmpty(x,y)) { //if there's space for fire + if (Array.isArray(fire)) { //this should remain "fire" + var newfire = fire[Math.floor(Math.random() * fire.length)]; + } else { + var newfire = fire; + }; + createPixel(newfire,x,y); //add fire + var firePixel = pixelMap[x][y]; + firePixel.temp = Math.max(elements[newfire].temp,firePixel.temp); + firePixel.burning = true; + }; + }; + }; + if(urlParams.get('bombAmount') != null) { //null check bombAmount = urlParams.get('bombAmount') if(isNaN(bombAmount) || bombAmount === "" || bombAmount === null) { //NaN check @@ -48,6 +81,39 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) pixel.temp += (800 * ((1 + (7 * damage)) ** 2) * ((power ** 2) * 1.5)); }; + elements.firebomb = { + color: "#ee7e3e", + tick: function(pixel) { + if(!isEmpty(pixel.x,pixel.y-1,true)) { //[0][1] EX (ignore bounds) + var newPixel = pixelMap[pixel.x][pixel.y-1]; + var newElement = newPixel.element; + var newInfo = elements[newElement]; + if(newInfo.state !== "gas" && newElement !== pixel.element) { + explodeAtPlus(pixel.x,pixel.y,10,"fire,fire,fire,fire,fire,greek_fire","fire",null,firebombFire); + }; + }; + if(!isEmpty(pixel.x,pixel.y+1,true)) { //[2][1] EX (don't ignore bounds, non-bound case) + var newPixel = pixelMap[pixel.x][pixel.y+1]; + var newElement = newPixel.element; + var newInfo = elements[newElement]; + if(newInfo.state !== "gas" && newElement !== pixel.element) { + explodeAtPlus(pixel.x,pixel.y,10,"fire,fire,fire,fire,fire,greek_fire","fire",null,firebombFire); + }; + }; + if(outOfBounds(pixel.x,pixel.y+1)) { //[2][1] EX (don't ignore bounds, bound case) + explodeAtPlus(pixel.x,pixel.y,10,"fire,fire,fire,fire,fire,greek_fire","fire",null,firebombFire); + }; + if(!tryMove(pixel,pixel.x,pixel.y+1)) { //behaviors.POWDER + Math.random() < 0.5 ? tryMove(pixel,pixel.x-1,pixel.y+1) : tryMove(pixel,pixel.x+1,pixel.y+1); + }; + }, + category: "weapons", + state: "solid", + density: 1500, + excludeRandom: true, + desc: "An advanced incendiary weapon.
To enable automatic bomb generation, set the generateBombs query parameter.", + }; + elements.cluster_nuke = { color: "#e3f636", behavior: [ @@ -59,8 +125,9 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) state: "solid", density: 1500, excludeRandom: true, + desc: "It's a nuke that drops more nukes.
To enable automatic bomb generation, set the generateBombs query parameter.", }; - + elements.anti_bomb = { color: "#525c61", behavior: [ @@ -72,7 +139,6 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) state: "solid", density: 1300, excludeRandom: true, - desc: "It's a nuke that drops more nukes.
To enable automatic bomb generation, set the generateBombs query parameter.", }; elements.electric_bomblet = { @@ -439,7 +505,8 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) }); } else { if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,runAfterAutogenMod) }; + if(!enabledMods.includes(explodeAtPlusMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,explodeAtPlusMod) }; if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) }; - alert(`The "${runAfterAutogenMod}" and "${libraryMod}" mods are all required; any missing mods in this list have been automatically inserted (reload for this to take effect).`) localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); + alert(`The "${runAfterAutogenMod}", "${explodeAtPlusMod}", and "${libraryMod}" mods are all required; any missing mods in this list have been automatically inserted (reload for this to take effect).`) }; From 63f251e8ac61d71c37eee879058e1c08b7143ff8 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Tue, 6 Dec 2022 15:53:38 -0500 Subject: [PATCH 10/49] fix --- mods/cold fire revamp and doBurning edits.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/mods/cold fire revamp and doBurning edits.js b/mods/cold fire revamp and doBurning edits.js index 1494e1c5..5208300a 100644 --- a/mods/cold fire revamp and doBurning edits.js +++ b/mods/cold fire revamp and doBurning edits.js @@ -87,7 +87,6 @@ function doBurning(pixel) { if (isEmpty(pixel.x,pixel.y-1)) { createPixel(fire,pixel.x,pixel.y-1); pixelMap[pixel.x][pixel.y-1].temp = fireTemp; - pixelMap[pixel.x][pixel.y-1].temp = pixel.temp//+(pixelTicks - (pixel.burnStart || 0)); if (info.fireColor != undefined) { pixelMap[pixel.x][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x][pixel.y-1],info.fireColor); }; @@ -96,7 +95,6 @@ function doBurning(pixel) { else if (isEmpty(pixel.x,pixel.y+1)) { createPixel(fire,pixel.x,pixel.y+1); pixelMap[pixel.x][pixel.y+1].temp = fireTemp; - pixelMap[pixel.x][pixel.y+1].temp = pixel.temp//+(pixelTicks - (pixel.burnStart || 0)); if (info.fireColor != undefined) { pixelMap[pixel.x][pixel.y+1].color = pixelColorPick(pixelMap[pixel.x][pixel.y+1],info.fireColor); }; From 9491f0fdb0b1d973d766324f99cf5e07973629c2 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Wed, 7 Dec 2022 12:08:55 -0500 Subject: [PATCH 11/49] Add rad fire and some of the related elements + merge napalms in and shorten the name --- mods/cold fire revamp and doBurning edits.js | 237 ------ mods/fire_mod.js | 827 +++++++++++++++++++ 2 files changed, 827 insertions(+), 237 deletions(-) delete mode 100644 mods/cold fire revamp and doBurning edits.js create mode 100644 mods/fire_mod.js diff --git a/mods/cold fire revamp and doBurning edits.js b/mods/cold fire revamp and doBurning edits.js deleted file mode 100644 index 5208300a..00000000 --- a/mods/cold fire revamp and doBurning edits.js +++ /dev/null @@ -1,237 +0,0 @@ -//Variable -fireSpawnBlacklist = ["fire","cold_fire"]; - -//doBurning -function doBurning(pixel) { - if (pixel.burning) { // Burning - var info = elements[pixel.element]; - var burnTempChange = info.burnTempChange - if (burnTempChange == undefined) { - burnTempChange = 1; - }; - //move fire ahead so that cold burners don't light hot burners - var fireIsCold; - //Fire getter block - var fire = info.fireElement; - if (fire == undefined) { - fire = 'fire'; - } - else if(fire instanceof Array) { - fire = fire[Math.floor(Math.random()*fire.length)]; - } - //End fire getter block - //Fire temp getter block - var fireTemp = info.fireSpawnTemp; - if (fireTemp == undefined) { - fireTemp = pixel.temp; - }; - //End fire temp getter block - //Fire chance getter block - var fireChance = info.fireSpawnChance; - if (fireChance == undefined) { - fireChance = 10; - }; - //End fire chance getter block - var fireIsCold = (fire === "cold_fire"); - var fireInfo = elements[fire]; - - pixel.temp += burnTempChange; - pixelTempCheck(pixel); - for (var i = 0; i < adjacentCoords.length; i++) { // Burn adjacent pixels - 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 newInfo = elements[newPixel.element]; - var newFireIsCold; - //Fire getter block - var newFire = newInfo.fireElement; - if (newFire == undefined) { - newFire = 'fire'; - } - else if(newFire instanceof Array) { - newFire = newFire[Math.floor(Math.random()*newFire.length)]; - } - //End fire getter block - newFireIsCold = (newFire === "cold_fire"); - - //console.log(`burning pixel ${pixel.element}: ${fire} (${fireIsCold}) / burned element ${newPixel.element}: ${newFire} (${newFireIsCold})`); - if((!fireIsCold && !newFireIsCold) || (fireIsCold && newFireIsCold)) { - if (elements[newPixel.element].burn && !newPixel.burning) { - if (Math.floor(Math.random()*100) < elements[newPixel.element].burn) { - newPixel.burning = true; - newPixel.burnStart = pixelTicks; - } - } - } - } - } - - if ((pixelTicks - pixel.burnStart > (info.burnTime || 200)) && Math.floor(Math.random()*100)<(info.burn || 10)) { - var burnInto = info.burnInto; - if (burnInto == undefined) { - burnInto = 'fire'; - } - else if (burnInto instanceof Array) { - burnInto = burnInto[Math.floor(Math.random()*burnInto.length)]; - } - changePixel(pixel,burnInto,(burnInto !== "smoke")); - if (info.fireColor != undefined && burnInto == "fire") { - pixel.color = pixelColorPick(pixel,info.fireColor); - } - else { - pixel.color = pixelColorPick(pixel) - } - } - else if (Math.floor(Math.random()*100) (info.burnTime || 200)) && Math.floor(Math.random()*100)<(info.burn || 10)) { + var burnInto = info.burnInto; + if (burnInto == undefined) { + burnInto = 'fire'; + } + else if (burnInto instanceof Array) { + burnInto = burnInto[Math.floor(Math.random()*burnInto.length)]; + } + changePixel(pixel,burnInto,(burnInto !== "smoke")); + if (info.fireColor != undefined && burnInto == "fire") { + pixel.color = pixelColorPick(pixel,info.fireColor); + } + else { + pixel.color = pixelColorPick(pixel) + } + } + else if (Math.floor(Math.random()*100) r.tempMax) { + return false; + } + if (r.charged && !pixel.charge) { + return false; + } + if (r.chance !== undefined && Math.random() > r.chance) { + return false; + } + if (r.y !== undefined && (pixel1.y < r.y[0] || pixel1.y > r.y[1])) { + return false; + } + if (r.elem1 !== undefined) { + // if r.elem1 is an array, set elem1 to a random element from the array, otherwise set it to r.elem1 + if (Array.isArray(r.elem1)) { + var elem1 = r.elem1[Math.floor(Math.random() * r.elem1.length)]; + } else { var elem1 = r.elem1; } + + if (elem1 == null) { + deletePixel(pixel1.x,pixel1.y); + } + else { + changePixel(pixel1,elem1); + } + } + if (r.charge1) { pixel1.charge = r.charge1; } + if (r.temp1) { pixel1.temp += r.temp1; pixelTempCheck(pixel1); } + if (r.color1) { // if it's a list, use a random color from the list, else use the color1 attribute + pixel1.color = pixelColorPick(pixel1, Array.isArray(r.color1) ? r.color1[Math.floor(Math.random() * r.color1.length)] : r.color1); + } + if (r.attr1) { // add each attribute to pixel1 + for (var key in r.attr1) { + pixel1[key] = r.attr1[key]; + } + } + if (r.elem2 !== undefined) { + // if r.elem2 is an array, set elem2 to a random element from the array, otherwise set it to r.elem2 + if (Array.isArray(r.elem2)) { + var elem2 = r.elem2[Math.floor(Math.random() * r.elem2.length)]; + } else { var elem2 = r.elem2; } + + if (elem2 == null) { + deletePixel(pixel2.x,pixel2.y); + } + else { + changePixel(pixel2,elem2); + } + } + if (r.charge2) { pixel2.charge = r.charge2; } + if (r.temp2) { pixel2.temp += r.temp2; pixelTempCheck(pixel2); } + if (r.color2) { // if it's a list, use a random color from the list, else use the color2 attribute + pixel2.color = pixelColorPick(pixel2, Array.isArray(r.color2) ? r.color2[Math.floor(Math.random() * r.color2.length)] : r.color2); + } + if (r.attr2) { // add each attribute to pixel2 + for (var key in r.attr2) { + pixel2[key] = r.attr2[key]; + } + } + if (r.func) { r.func(pixel1,pixel2); } + return r.elem1!==undefined || r.elem2!==undefined; +}; + +//New elements + +elements.cold_fire.burning = true; +elements.cold_fire.burnTempChange = -1; +elements.cold_fire.burnTime = 25; +elements.cold_fire.burnInto = "cold_smoke"; +elements.cold_fire.fireElement = "cold_fire"; +elements.cold_fire.behavior = [ + "M1|M1|M1", + "M2|XX|M2", + "XX|M2|XX" +], + +elements.cold_smoke = { + color: "#282848", + behavior: behaviors.DGAS, + reactions: { + "steam": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "rain_cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "snow_cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "hail_cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "acid_cloud": { "elem1": "pyrocumulus", "chance":0.05, "y":[0,12], "setting":"clouds" }, + "fire_cloud": { "elem1": "pyrocumulus", "chance":0.05, "y":[0,12], "setting":"clouds" }, + "pyrocumulus": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + }, + temp: -100, + tempHigh: 0, + stateHigh: "smoke", + tempLow: -114, + stateLow: "cold_fire", + category: "gases", + state: "gas", + density: 1280, + stain: 0.075, +}; + +elements.rad_fire = { //this is BBB + color: ["#daff21","#a6ff00","#ffff00"], + behavior: [ + "XX|CR:radiation%0.1|XX", + "CR:radiation%0.1|XX|CR:radiation%0.1", + "XX|CR:radiation%0.1|XX", + ], + tick: function(pixel) { + if(Math.random() < 0.4) { + pixel.temp++; + }; + + var move1Spots = [[-1,-1],[0,-1],[1,-1]]; + var move2Spots = [[-1,0],[0,1],[1,0]]; + + var randomMove1 = move1Spots[Math.floor(Math.random() * move1Spots.length)]; + if(!tryMove(pixel, pixel.x+randomMove1[0], pixel.y+randomMove1[1])) { + //console.log((pixel.x+randomMove1[0]) + " " + (pixel.y+randomMove1[1])) + var newPixel = null; + if(!outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1])) { + newPixel = pixelMap[pixel.x+randomMove1[0]][pixel.y+randomMove1[1]]; //newPixel is AAA + }; + if(outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1]) || !reactionStealer(pixel,newPixel,"radiation")) { + var randomMove2 = move2Spots[Math.floor(Math.random() * move2Spots.length)]; + if(!tryMove(pixel, pixel.x+randomMove2[0], pixel.y+randomMove2[1])) { + var newPixel = null; + if(!outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1])) { + newPixel = pixelMap[pixel.x+randomMove1[0]][pixel.y+randomMove1[1]]; //newPixel is AAA + }; + if(newPixel !== null) { reactionStealer(pixel,newPixel,"radiation") }; + }; + }; + }; + doDefaults(pixel); + }, + reactions: { //fire + radiation reacts + //Spreading + "liquid_fire": { "elem2":"liquid_rad_fire", "chance":0.4 }, + "fire": { "elem2":"rad_fire", "chance":0.4 }, + "smoke": { "elem2":"rad_smoke", "chance":0.4 }, + //Merged water-radiation reactions, plus altered seltzer + "water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "steam": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "carbon_dioxide": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "dirty_water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "salt_water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "sugar_water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "seltzer": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + //Radiation reactions + "bubble": { "elem2":"rad_steam", "chance":0.4 }, + "foam": { "elem2":"rad_steam", "chance":0.4 }, + "ice": { "elem2":"rad_steam", "chance":0.4 }, + "snow": { "elem2":"rad_steam", "chance":0.4 }, + "packed_snow": { "elem2":"rad_steam", "chance":0.4 }, + "slime": { "elem2":"rad_steam", "chance":0.4 }, + "milk": { "elem2":"cheese", "chance":0.4 }, + "permafrost": { "elem1":"rad_steam", "elem2":"dirt", "chance":0.4 }, + "mud": { "elem1":"rad_steam", "elem2":"dirt", "chance":0.4 }, + "wet_sand": { "elem1":"rad_steam", "elem2":"sand", "chance":0.4 }, + "clay": { "elem1":"rad_steam", "elem2":"clay_soil", "chance":0.4 }, + "slaked_lime": { "elem1":"rad_steam", "elem2":"limestone", "chance":0.4 }, + "rain_cloud": { "elem2":"rad_cloud", "chance":0.4 }, + "snow_cloud": { "elem2":"rad_cloud", "chance":0.4 }, + "hail_cloud": { "elem2":"rad_cloud", "chance":0.4 }, + "plant": { "elem2":"dead_plant", "chance":0.4 }, + "frozen_plant": { "elem2":"dead_plant", "chance":0.4 }, + "grass": { "elem2":["dead_plant","straw","grass_seed","wheat_seed"], "chance":0.4 }, + "algae": { "elem2":["mushroom_spore","lichen","yeast"], "chance":0.4 }, + "mushroom_spore": { "elem2":["lichen","yeast"], "chance":0.4 }, + "mushroom_cap": { "elem2":["lichen","plant"], "chance":0.4 }, + "mushroom_stalk": { "elem2":["lichen","yeast"], "chance":0.4 }, + "mushroom_gill": { "elem2":["lichen","yeast"], "chance":0.4 }, + "flea": { "elem2":["ash","ant","termite"], "chance":0.4 }, + "ant": { "elem2":["ash","flea","termite"], "chance":0.4 }, + "termite": { "elem2":["ash","flea","ant"], "chance":0.4 }, + "fly": { "elem2":["ash","firefly","bee"], "chance":0.4 }, + "bee": { "elem2":["ash","firefly","fly"], "chance":0.4 }, + "firefly": { "elem2":["ash","bee","fly"], "chance":0.4 }, + "frog": { "elem2":["ash","meat","rotten_meat","cooked_meat"], "chance":0.4 }, + "tadpole": { "elem2":["frog","worm",null], "chance":0.4 }, + "fish": { "elem2":["ash","meat","rotten_meat","cooked_meat"], "chance":0.4 }, + "rat": { "elem2":["ash","meat","rotten_meat","cooked_meat","plague"], "chance":0.4 }, + "bird": { "elem2":["ash","meat","rotten_meat","cooked_meat","plague"], "chance":0.4 }, + "bone": { "elem2":["calcium","calcium","calcium","cancer"], "chance":0.4 }, + "meat": { "elem2":["ash","rotten_meat","cooked_meat"], "chance":0.4 }, + "rotten_meat": { "elem2":["ash","meat","cooked_meat"], "chance":0.4 }, + "cooked_meat": { "elem2":["ash","rotten_meat"], "chance":0.4 }, + "bamboo": { "elem2":["wood","plant","bamboo_plant"], "chance":0.4 }, + "bamboo_plant": { "elem2":["wood","plant","bamboo"], "chance":0.4 }, + "sapling": { "elem2":["wood","plant","tree_branch"], "chance":0.4 }, + "tree_branch": { "elem2":["wood","plant","sapling"], "chance":0.4 }, + "grass_seed": { "elem2":["straw","wheat_seed"], "chance":0.4 }, + "lichen": { "elem2":"algae", "chance":0.4 }, + "yeast": { "elem2":["algae","mushroom_spore","lichen"], "chance":0.4 }, + "wheat_seed": { "elem2":["straw","wheat","grass_seed"], "chance":0.4 }, + "flower_seed": { "elem2":["straw","grass","pistil","petal"], "chance":0.4 }, + "pistil": { "elem2":["straw","grass","flower_seed","petal"], "chance":0.4 }, + "petal": { "elem2":["straw","grass","flower_seed","pistil"], "chance":0.4 }, + "vine": { "elem1":["vine"], "chance":0.4 }, + "worm": { "elem2":"ash", "chance":0.4 }, + "corn": { "elem2":"popcorn", "chance":0.4 }, + "corn_seed": { "elem2":"corn", "chance":0.4 }, + "potato": { "elem2":"potato_seed", "chance":0.4 }, + "potato_seed": { "elem2":"potato", "chance":0.4 }, + "slug": { "elem2":"slime", "chance":0.4 }, + "snail": { "elem2":"slime", "chance":0.4 }, + "cell": { "elem2":"cancer", "chance":0.4 }, + "blood": { "elem2":["infection","cancer"], "chance":0.4 }, + "antibody": { "elem2":"cancer", "chance":0.4 }, + "infection": { "elem2":"cancer", "chance":0.4 }, + "cancer": { "elem2":null, "chance":0.1 }, + }, + temp:800, + tempLow:150, + stateLow: "rad_smoke", + //tempHigh: 7000, + //stateHigh: "rad_plasma", + category: "energy", + burning: true, + fireElement: "radiation", + state: "gas", + density: 0.1, + ignoreAir: true, +}; + +elements.rad_smoke = { + color: "#415c25", + behavior: behaviors.DGAS, + behavior: [ + "XX|CR:radiation%0.05|XX", + "CR:radiation%0.05|XX|CR:radiation%0.05", + "XX|CR:radiation%0.05|XX", + ], + tick: function(pixel) { + if(Math.random() < 0.05) { + deletePixel(pixel.x,pixel.y); + return; + }; + + if(Math.random() < 0.2) { + pixel.temp++; + }; + + var move1Spots = [[0,-1],[1,0],[0,1],[-1,0]]; + var move2Spots = [[-1,-1],[1,-1],[1,1],[-1,1]]; + + var randomMove1 = move1Spots[Math.floor(Math.random() * move1Spots.length)]; + if(!tryMove(pixel, pixel.x+randomMove1[0], pixel.y+randomMove1[1])) { + //console.log((pixel.x+randomMove1[0]) + " " + (pixel.y+randomMove1[1])) + var newPixel = null; + if(!outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1])) { + newPixel = pixelMap[pixel.x+randomMove1[0]][pixel.y+randomMove1[1]]; //newPixel is AAA + }; + if(outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1]) || !reactionStealer(pixel,newPixel,"radiation")) { + var randomMove2 = move2Spots[Math.floor(Math.random() * move2Spots.length)]; + if(!tryMove(pixel, pixel.x+randomMove2[0], pixel.y+randomMove2[1])) { + var newPixel = null; + if(!outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1])) { + newPixel = pixelMap[pixel.x+randomMove1[0]][pixel.y+randomMove1[1]]; //newPixel is AAA + }; + if(newPixel !== null) { reactionStealer(pixel,newPixel,"radiation") }; + }; + }; + }; + doDefaults(pixel); + }, + reactions: { + //Spreading + "liquid_fire": { "elem2":"liquid_rad_fire", "chance":0.2 }, + "fire": { "elem2":"rad_fire", "chance":0.2 }, + "smoke": { "elem2":"rad_smoke", "chance":0.2 }, + /*"steam": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "rain_cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "snow_cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "hail_cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "acid_cloud": { "elem1": "pyrocumulus", "chance":0.05, "y":[0,12], "setting":"clouds" }, + "fire_cloud": { "elem1": "pyrocumulus", "chance":0.05, "y":[0,12], "setting":"clouds" }, + "pyrocumulus": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" },*/ + //Radiation reactions + "bubble": { "elem2":"rad_steam", "chance":0.4 }, + "foam": { "elem2":"rad_steam", "chance":0.4 }, + "ice": { "elem2":"rad_steam", "chance":0.4 }, + "snow": { "elem2":"rad_steam", "chance":0.4 }, + "packed_snow": { "elem2":"rad_steam", "chance":0.4 }, + "slime": { "elem2":"rad_steam", "chance":0.4 }, + "milk": { "elem2":"cheese", "chance":0.4 }, + "permafrost": { "elem1":"rad_steam", "elem2":"dirt", "chance":0.4 }, + "mud": { "elem1":"rad_steam", "elem2":"dirt", "chance":0.4 }, + "wet_sand": { "elem1":"rad_steam", "elem2":"sand", "chance":0.4 }, + "clay": { "elem1":"rad_steam", "elem2":"clay_soil", "chance":0.4 }, + "slaked_lime": { "elem1":"rad_steam", "elem2":"limestone", "chance":0.4 }, + "rain_cloud": { "elem2":"rad_cloud", "chance":0.4 }, + "snow_cloud": { "elem2":"rad_cloud", "chance":0.4 }, + "hail_cloud": { "elem2":"rad_cloud", "chance":0.4 }, + "plant": { "elem2":"dead_plant", "chance":0.4 }, + "frozen_plant": { "elem2":"dead_plant", "chance":0.4 }, + "grass": { "elem2":["dead_plant","straw","grass_seed","wheat_seed"], "chance":0.4 }, + "algae": { "elem2":["mushroom_spore","lichen","yeast"], "chance":0.4 }, + "mushroom_spore": { "elem2":["lichen","yeast"], "chance":0.4 }, + "mushroom_cap": { "elem2":["lichen","plant"], "chance":0.4 }, + "mushroom_stalk": { "elem2":["lichen","yeast"], "chance":0.4 }, + "mushroom_gill": { "elem2":["lichen","yeast"], "chance":0.4 }, + "flea": { "elem2":["ash","ant","termite"], "chance":0.4 }, + "ant": { "elem2":["ash","flea","termite"], "chance":0.4 }, + "termite": { "elem2":["ash","flea","ant"], "chance":0.4 }, + "fly": { "elem2":["ash","firefly","bee"], "chance":0.4 }, + "bee": { "elem2":["ash","firefly","fly"], "chance":0.4 }, + "firefly": { "elem2":["ash","bee","fly"], "chance":0.4 }, + "frog": { "elem2":["ash","meat","rotten_meat","cooked_meat"], "chance":0.4 }, + "tadpole": { "elem2":["frog","worm",null], "chance":0.4 }, + "fish": { "elem2":["ash","meat","rotten_meat","cooked_meat"], "chance":0.4 }, + "rat": { "elem2":["ash","meat","rotten_meat","cooked_meat","plague"], "chance":0.4 }, + "bird": { "elem2":["ash","meat","rotten_meat","cooked_meat","plague"], "chance":0.4 }, + "bone": { "elem2":["calcium","calcium","calcium","cancer"], "chance":0.4 }, + "meat": { "elem2":["ash","rotten_meat","cooked_meat"], "chance":0.4 }, + "rotten_meat": { "elem2":["ash","meat","cooked_meat"], "chance":0.4 }, + "cooked_meat": { "elem2":["ash","rotten_meat"], "chance":0.4 }, + "bamboo": { "elem2":["wood","plant","bamboo_plant"], "chance":0.4 }, + "bamboo_plant": { "elem2":["wood","plant","bamboo"], "chance":0.4 }, + "sapling": { "elem2":["wood","plant","tree_branch"], "chance":0.4 }, + "tree_branch": { "elem2":["wood","plant","sapling"], "chance":0.4 }, + "grass_seed": { "elem2":["straw","wheat_seed"], "chance":0.4 }, + "lichen": { "elem2":"algae", "chance":0.4 }, + "yeast": { "elem2":["algae","mushroom_spore","lichen"], "chance":0.4 }, + "wheat_seed": { "elem2":["straw","wheat","grass_seed"], "chance":0.4 }, + "flower_seed": { "elem2":["straw","grass","pistil","petal"], "chance":0.4 }, + "pistil": { "elem2":["straw","grass","flower_seed","petal"], "chance":0.4 }, + "petal": { "elem2":["straw","grass","flower_seed","pistil"], "chance":0.4 }, + "vine": { "elem1":["vine"], "chance":0.4 }, + "worm": { "elem2":"ash", "chance":0.4 }, + "corn": { "elem2":"popcorn", "chance":0.4 }, + "corn_seed": { "elem2":"corn", "chance":0.4 }, + "potato": { "elem2":"potato_seed", "chance":0.4 }, + "potato_seed": { "elem2":"potato", "chance":0.4 }, + "slug": { "elem2":"slime", "chance":0.4 }, + "snail": { "elem2":"slime", "chance":0.4 }, + "cell": { "elem2":"cancer", "chance":0.4 }, + "blood": { "elem2":["infection","cancer"], "chance":0.4 }, + "antibody": { "elem2":"cancer", "chance":0.4 }, + "infection": { "elem2":"cancer", "chance":0.4 }, + "cancer": { "elem2":null, "chance":0.1 }, + }, + temp: 134, + tempHigh: 595, + stateHigh: "rad_fire", + category: "gases", + state: "gas", + density: 1340, + stain: 0.075, +}; + +elements.cold_torch = { + "color": "#4394d6", + "behavior": [ + "XX|CR:cold_fire|XX", + "XX|XX|XX", + "XX|XX|XX" + ], + "reactions": { + "water": { "elem1": "wood" }, + "sugar_water": { "elem1": "wood" }, + "salt_water": { "elem1": "wood" }, + "seltzer": { "elem1": "wood" }, + "dirty_water": { "elem1": "wood" }, + "pool_water": { "elem1": "wood" }, + "steam": { "elem1": "wood" }, + "smog": { "elem1": "wood" }, + "rain_cloud": { "elem1": "wood" }, + "cloud": { "elem1": "wood" }, + "snow_cloud": { "elem1": "wood" }, + "hail_cloud": { "elem1": "wood" }, + "black_damp": { "elem1": "wood" } + }, + "temp": -200, + "category": "special", + "breakInto": "sawdust", + "tempHigh": 600, + "stateHigh": "wood", +}; + +elements.rad_torch = { + "color": "#85d643", + "behavior": [ + "XX|CR:rad_fire|XX", + "XX|XX|XX", + "XX|XX|XX" + ], + "reactions": { + "water": { "elem1": "wood" }, + "sugar_water": { "elem1": "wood" }, + "salt_water": { "elem1": "wood" }, + "seltzer": { "elem1": "wood" }, + "dirty_water": { "elem1": "wood" }, + "pool_water": { "elem1": "wood" }, + "steam": { "elem1": "wood" }, + "smog": { "elem1": "wood" }, + "rain_cloud": { "elem1": "wood" }, + "cloud": { "elem1": "wood" }, + "snow_cloud": { "elem1": "wood" }, + "hail_cloud": { "elem1": "wood" }, + "black_damp": { "elem1": "wood" } + }, + "temp": 800, + "category": "special", + "breakInto": "sawdust", + "tempLow": -273, + "stateHigh": "wood", +}; + +elements.napalm = { + color: "#e0873e", + behavior: [ + "XX|SA%40 AND ST|XX", + "M2%10 AND SA%40 AND ST|XX|M2%10 AND SA%40 AND ST", + "M2%50 AND M1%10|M1 AND SA%40 AND ST|M2%50 AND M1%10" + ], + category: "weapons", + state: "liquid", + viscosity: 1000, + density: 1200, //google was f***ing useless and i'm not searching that again, so arbitrary 1.2 it is + burnTempChange: 2, + burn: 300, + burnTime: 500, + temp: airTemp, +}, + +elements.hypernapalm = { + name: "h y p e r n a p a l m", //HYPERNAPALM + color: "#bd34eb", + behavior: [ + "XX|SA%40 AND ST|XX", + "M2%10 AND SA%40 AND ST|XX|M2%10 AND SA%40 AND ST", + "M2%50 AND M1%10|M1 AND SA%40 AND ST|M2%50 AND M1%10" + ], + category: "weapons", + state: "liquid", + viscosity: 1000, + density: 1200, + fireElement: "plasma", + fireSpawnChance: 33, + fireSpawnTemp: 7200, + burnTempChange: 30, + burn: 300, + burnTime: 500, +}, + +elements.cold_napalm = { + color: "#3e87e0", + behavior: [ + "XX|SA%40 AND ST|XX", + "M2%10 AND SA%40 AND ST|XX|M2%10 AND SA%40 AND ST", + "M2%50 AND M1%10|M1 AND SA%40 AND ST|M2%50 AND M1%10" + ], + category: "weapons", + state: "liquid", + viscosity: 1000, + density: 1200, + burn: 300, + burnTime: 500, + fireElement: "cold_fire", + burnTempChange: -1, + burnInto: "cold_fire", +} + +elements.rad_napalm = { + color: "#cdf760", + behavior: [ + "XX|SA%40 AND ST AND CR:radiation%1|XX", + "M2%10 AND SA%40 AND ST AND CR:radiation%1|HT%2.5|M2%10 AND SA%40 AND ST AND CR:radiation%1", + "M2%50 AND M1%10|M1 AND SA%40 AND ST AND CR:radiation%1|M2%50 AND M1%10" + ], + category: "weapons", + state: "liquid", + viscosity: 1000, + density: 1300, + burnTempChange: 2, + burn: 300, + burnTime: 500, + fireElement: "rad_fire", + temp: airTemp, + burnInto: "rad_fire", +}, + +runAfterLoad(function() { + if(eLists.spout) { + eLists.spout.push("cold_torch"); + eLists.spout.push("rad_torch"); + }; + + if(enabledMods.includes("mods/liquid_energy.js")) { + elements.liquid_fire = { + color: ["#ff6b21","#ffa600","#ff4000"], + behavior: [ + "XX|M2|XX", + "M2|XX|M2", + "M1|M1|M1", + ], + reactions: { + "water": { "elem1": "liquid_smoke" }, + }, + temp:600, + tempLow:100, + stateLow: "liquid_smoke", + tempHigh: 7000, + stateHigh: "liquid_plasma", + category: "energy liquids", + burning: true, + burnTime: Infinity, + burnTempChange: 2, + fireChance: 5, + state: "liquid", + density: 21, + }; + + elements.liquid_cold_fire = { + color: ["#21cbff","#006aff","#00ffff"], + behavior: [ + "XX|M2|XX", + "M2|XX|M2", + "M1|M1|M1", + ], + reactions: { + "fire": { "elem1": "liquid_smoke", "elem2": "liquid_smoke" }, + "plasma": { "elem1": "le_liquid_light", "elem2": "le_liquid_light" }, //prefixed to avoid conflict with F&M liquid_light + }, + temp:-200, + tempHigh:0, + stateHigh: "liquid_smoke", + burning: true, + burnTempChange: -2, + fireChance: 5, + burnTime: Infinity, + fireElement: "cold_fire", + category: "energy liquids", + state: "liquid", + density: 42, + }; + + elements.liquid_rad_fire = { + color: ["#daff21","#a6ff00","#ffff00"], + behavior: [ + "XX|CR:radiation%0.1|XX", + "CR:radiation%0.1|XX|CR:radiation%0.1", + "XX|CR:radiation%0.1|XX", + ], + tick: function(pixel) { + if(Math.random() < 0.4) { + pixel.temp++; + }; + + var move1Spots = [[-1,1],[0,1],[1,1]]; + var move2Spots = [[-1,0],[0,-1],[1,0]]; + + var randomMove1 = move1Spots[Math.floor(Math.random() * move1Spots.length)]; + if(!tryMove(pixel, pixel.x+randomMove1[0], pixel.y+randomMove1[1])) { + //console.log((pixel.x+randomMove1[0]) + " " + (pixel.y+randomMove1[1])) + var newPixel = null; + if(!outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1])) { + newPixel = pixelMap[pixel.x+randomMove1[0]][pixel.y+randomMove1[1]]; //newPixel is AAA + }; + if(outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1]) || !reactionStealer(pixel,newPixel,"radiation")) { + var randomMove2 = move2Spots[Math.floor(Math.random() * move2Spots.length)]; + if(!tryMove(pixel, pixel.x+randomMove2[0], pixel.y+randomMove2[1])) { + var newPixel = null; + if(!outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1])) { + newPixel = pixelMap[pixel.x+randomMove1[0]][pixel.y+randomMove1[1]]; //newPixel is AAA + }; + if(newPixel !== null) { reactionStealer(pixel,newPixel,"radiation") }; + }; + }; + }; + doDefaults(pixel); + }, + reactions: { //fire + radiation reacts + //Spreading + "liquid_fire": { "elem2":"liquid_rad_fire", "chance":0.6 }, + "fire": { "elem2":"rad_fire", "chance":0.6 }, + "smoke": { "elem2":"rad_smoke", "chance":0.6 }, + //Merged water-radiation reactions, plus altered seltzer + "water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "steam": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "carbon_dioxide": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "dirty_water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "salt_water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "sugar_water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "seltzer": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + //Radiation reactions + "bubble": { "elem2":"rad_steam", "chance":0.4 }, + "foam": { "elem2":"rad_steam", "chance":0.4 }, + "ice": { "elem2":"rad_steam", "chance":0.4 }, + "snow": { "elem2":"rad_steam", "chance":0.4 }, + "packed_snow": { "elem2":"rad_steam", "chance":0.4 }, + "slime": { "elem2":"rad_steam", "chance":0.4 }, + "milk": { "elem2":"cheese", "chance":0.4 }, + "permafrost": { "elem1":"rad_steam", "elem2":"dirt", "chance":0.4 }, + "mud": { "elem1":"rad_steam", "elem2":"dirt", "chance":0.4 }, + "wet_sand": { "elem1":"rad_steam", "elem2":"sand", "chance":0.4 }, + "clay": { "elem1":"rad_steam", "elem2":"clay_soil", "chance":0.4 }, + "slaked_lime": { "elem1":"rad_steam", "elem2":"limestone", "chance":0.4 }, + "rain_cloud": { "elem2":"rad_cloud", "chance":0.4 }, + "snow_cloud": { "elem2":"rad_cloud", "chance":0.4 }, + "hail_cloud": { "elem2":"rad_cloud", "chance":0.4 }, + "plant": { "elem2":"dead_plant", "chance":0.4 }, + "frozen_plant": { "elem2":"dead_plant", "chance":0.4 }, + "grass": { "elem2":["dead_plant","straw","grass_seed","wheat_seed"], "chance":0.4 }, + "algae": { "elem2":["mushroom_spore","lichen","yeast"], "chance":0.4 }, + "mushroom_spore": { "elem2":["lichen","yeast"], "chance":0.4 }, + "mushroom_cap": { "elem2":["lichen","plant"], "chance":0.4 }, + "mushroom_stalk": { "elem2":["lichen","yeast"], "chance":0.4 }, + "mushroom_gill": { "elem2":["lichen","yeast"], "chance":0.4 }, + "flea": { "elem2":["ash","ant","termite"], "chance":0.4 }, + "ant": { "elem2":["ash","flea","termite"], "chance":0.4 }, + "termite": { "elem2":["ash","flea","ant"], "chance":0.4 }, + "fly": { "elem2":["ash","firefly","bee"], "chance":0.4 }, + "bee": { "elem2":["ash","firefly","fly"], "chance":0.4 }, + "firefly": { "elem2":["ash","bee","fly"], "chance":0.4 }, + "frog": { "elem2":["ash","meat","rotten_meat","cooked_meat"], "chance":0.4 }, + "tadpole": { "elem2":["frog","worm",null], "chance":0.4 }, + "fish": { "elem2":["ash","meat","rotten_meat","cooked_meat"], "chance":0.4 }, + "rat": { "elem2":["ash","meat","rotten_meat","cooked_meat","plague"], "chance":0.4 }, + "bird": { "elem2":["ash","meat","rotten_meat","cooked_meat","plague"], "chance":0.4 }, + "bone": { "elem2":["calcium","calcium","calcium","cancer"], "chance":0.4 }, + "meat": { "elem2":["ash","rotten_meat","cooked_meat"], "chance":0.4 }, + "rotten_meat": { "elem2":["ash","meat","cooked_meat"], "chance":0.4 }, + "cooked_meat": { "elem2":["ash","rotten_meat"], "chance":0.4 }, + "bamboo": { "elem2":["wood","plant","bamboo_plant"], "chance":0.4 }, + "bamboo_plant": { "elem2":["wood","plant","bamboo"], "chance":0.4 }, + "sapling": { "elem2":["wood","plant","tree_branch"], "chance":0.4 }, + "tree_branch": { "elem2":["wood","plant","sapling"], "chance":0.4 }, + "grass_seed": { "elem2":["straw","wheat_seed"], "chance":0.4 }, + "lichen": { "elem2":"algae", "chance":0.4 }, + "yeast": { "elem2":["algae","mushroom_spore","lichen"], "chance":0.4 }, + "wheat_seed": { "elem2":["straw","wheat","grass_seed"], "chance":0.4 }, + "flower_seed": { "elem2":["straw","grass","pistil","petal"], "chance":0.4 }, + "pistil": { "elem2":["straw","grass","flower_seed","petal"], "chance":0.4 }, + "petal": { "elem2":["straw","grass","flower_seed","pistil"], "chance":0.4 }, + "vine": { "elem1":["vine"], "chance":0.4 }, + "worm": { "elem2":"ash", "chance":0.4 }, + "corn": { "elem2":"popcorn", "chance":0.4 }, + "corn_seed": { "elem2":"corn", "chance":0.4 }, + "potato": { "elem2":"potato_seed", "chance":0.4 }, + "potato_seed": { "elem2":"potato", "chance":0.4 }, + "slug": { "elem2":"slime", "chance":0.4 }, + "snail": { "elem2":"slime", "chance":0.4 }, + "cell": { "elem2":"cancer", "chance":0.4 }, + "blood": { "elem2":["infection","cancer"], "chance":0.4 }, + "antibody": { "elem2":"cancer", "chance":0.4 }, + "infection": { "elem2":"cancer", "chance":0.4 }, + "cancer": { "elem2":null, "chance":0.1 }, + }, + temp:800, + //tempLow:100, + //stateLow: "liquid_smoke", + //tempHigh: 7000, + //stateHigh: "liquid_plasma", + category: "energy liquids", + burning: true, + burnTime: Infinity, + burnTempChange: 3, + fireChance: 5, + fireElement: "rad_fire", + state: "liquid", + density: 21, + }; + }; + + if(enabledMods.includes("mods/randomness.js")) { + elements.unnamed_gas.burnTempChange = 10; + elements.unnamed_gas.fireElement = "plasma"; + elements.unnamed_powder.burnTempChange = 20; + elements.unnamed_powder.fireElement = "plasma"; + elements.burning_unnamed_gas.burnTempChange = 15; + elements.burning_unnamed_gas.fireElement = "plasma"; + elements.burning_unnamed_powder.burnTempChange = 30; + elements.burning_unnamed_powder.fireElement = "plasma"; + }; +}); From 5566f54ed7c6112043fb52c7ee1064a8ab5871da Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Wed, 7 Dec 2022 12:09:57 -0500 Subject: [PATCH 12/49] Move napalms out and remove dependency --- mods/randomness_but_tick.js | 2220 +++++++++++++++++------------------ 1 file changed, 1078 insertions(+), 1142 deletions(-) diff --git a/mods/randomness_but_tick.js b/mods/randomness_but_tick.js index 11ba535a..87a95e3f 100644 --- a/mods/randomness_but_tick.js +++ b/mods/randomness_but_tick.js @@ -1,1297 +1,1233 @@ -var modName = "mods/randomness_but_tick.js"; -var coldFireMod = "mods/cold fire revamp and doBurning edits.js"; +elements.sencc = { //same element neighbor count check + color: "#000000", + uwu: 0, + tick: function(pixel) { + pixel.uwu = 0 + for (let i = -1; i < 2; i++) { + for (let j = -1; j < 2; 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/8)*pixel.uwu + ",0,0)" + } + }, + category: "machines", + insulate: true, + state: "solid", + hidden: true, +}, -if(enabledMods.includes(coldFireMod)) { - elements.sencc = { //same element neighbor count check - color: "#000000", - uwu: 0, - tick: function(pixel) { - pixel.uwu = 0 - for (let i = -1; i < 2; i++) { - for (let j = -1; j < 2; 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) { +elements.sencc2 = { //same element neighbor count check + color: "#000000", + uwu: 0, + tick: function(pixel) { + pixel.uwu = 0 + 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 + } + } + } + } + pixel.uwu -= 1 + if(pixel.uwu == undefined || pixel.uwu == null || isNaN(pixel.uwu)) { + pixel.color = "rgb(127,127,127)" + } else { + pixel.color = "rgb(" + (255/24)*pixel.uwu + ",0,0)" + } + }, + category: "machines", + insulate: true, + state: "solid", + 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, + owo: 0, + tick: function(pixel) { + pixel.uwu = 0 + pixel.owo = 0 + 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 (pixelMap[pixel.x+j][pixel.y+i].element == pixel.element) { + if(pixel.uwu < 8) { pixel.uwu += 1 + } else { + pixel.owo += 1 } } } } - pixel.uwu -= 1 - if(pixel.uwu == undefined || pixel.uwu == null || isNaN(pixel.uwu)) { - pixel.color = "rgb(127,127,127)" + } + pixel.owo -= 1 + if(pixel.uwu == undefined || pixel.uwu == null || isNaN(pixel.uwu) || pixel.owo == undefined || pixel.owo == null || isNaN(pixel.owo)) { + pixel.color = "rgb(127,127,127)" + } else { + pixel.color = "rgb(" + (255/8)*pixel.uwu + "," + (255/16)*pixel.owo + ",0)" + } + }, + category: "machines", + insulate: true, + state: "solid", + hidden: true, +}, + +elements.discharge = { + color: "#7f7f7f", + tick: function(pixel) { + for (var i = 1; i < width; i++) { + for (var j = 1; j < height; j++) { + if (!isEmpty(i,j)) { + pixelMap[i][j].charge = 0 + } + } + } + deletePixel(pixel.x, pixel.y) + }, + category:"special", + insulate:true, + state: "solid", + behavior: behaviors.SELFDELETE, +}, + +elements.troll_powder = { + color: ["#ffffff","#000000"], + tick: function(pixel) { + ddd = Math.random() + eee = Math.random() + fff = 1-eee + doHeat(pixel); + doBurning(pixel); + if(ddd < 0.9) { + if(!tryMove(pixel, pixel.x, pixel.y+1)) { + if(eee < 1/2) { tryMove(pixel, pixel.x-1, pixel.y+1) } else tryMove(pixel, pixel.x+1, pixel.y+1) + } + if(Math.random() < 0.0017) { + if(fff < 1/5) { tryMove(pixel, pixel.x-2, pixel.y-1) } + if(fff < 2/5) { tryMove(pixel, pixel.x-1, pixel.y-2) } + if(fff < 3/5) { tryMove(pixel, pixel.x, pixel.y-3) } + if(fff < 4/5) { tryMove(pixel, pixel.x+1, pixel.y-2) } + if(fff < 5/5) { tryMove(pixel, pixel.x+2, pixel.y-1) } + } + if(Math.random() < 0.0003) { tryMove(pixel, pixel.y, pixel.y); } + if(Math.random() < 0.0003) { tryMove(pixel, pixel.x, pixel.x); } + if(((Math.floor(pixel.x/2) % 2 == 0) && (Math.floor(pixel.y/2) % 2 == 0)) || ((Math.floor(pixel.x/2) % 2 == 1) && (Math.floor(pixel.y/2) % 2 == 1))) { + pixel.color = "rgb(32,32,32)" } else { - pixel.color = "rgb(" + (255/8)*pixel.uwu + ",0,0)" + pixel.color = "rgb(224,224,224)" } - }, - category: "machines", - insulate: true, - state: "solid", - hidden: true, - }, + } - elements.sencc2 = { //same element neighbor count check - color: "#000000", - uwu: 0, - tick: function(pixel) { - pixel.uwu = 0 - 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 - } - } - } + if(ddd >= 0.9) { + if(!tryMove(pixel, pixel.x, pixel.y-1)) { + if(eee < 1/2) { tryMove(pixel, pixel.x-1, pixel.y-1) } else tryMove(pixel, pixel.x+1, pixel.y-1) } - pixel.uwu -= 1 - if(pixel.uwu == undefined || pixel.uwu == null || isNaN(pixel.uwu)) { - pixel.color = "rgb(127,127,127)" + if(Math.random() < 0.0017) { + if(fff < 1/5) { tryMove(pixel, pixel.x-2, pixel.y+1) } + if(fff < 2/5) { tryMove(pixel, pixel.x-1, pixel.y+2) } + if(fff < 3/5) { tryMove(pixel, pixel.x, pixel.y+3) } + if(fff < 4/5) { tryMove(pixel, pixel.x+1, pixel.y+2) } + if(fff < 5/5) { tryMove(pixel, pixel.x+2, pixel.y+1) } + } + if(Math.random() < 0.0003) { tryMove(pixel, pixel.y, pixel.y); } + if(Math.random() < 0.0003) { tryMove(pixel, pixel.x, pixel.x); } + if(((Math.floor(pixel.x/2) % 2 == 0) && (Math.floor(pixel.y/2) % 2 == 0)) || ((Math.floor(pixel.x/2) % 2 == 1) && (Math.floor(pixel.y/2) % 2 == 1))) { + pixel.color = "rgb(32,32,32)" } else { - pixel.color = "rgb(" + (255/24)*pixel.uwu + ",0,0)" + pixel.color = "rgb(224,224,224)" } - }, - category: "machines", - insulate: true, - state: "solid", - hidden: true, + pixel.temp = pixel.temp + ((Math.floor(Math.random()*3) - 1)*2) + } }, + category: "powders", + state: "solid", + density: 1602, +}, - 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 - } - } +elements.void_first = { + color: "#262626", + tick: function(pixel) { + if(!pixel.void) { + //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 } } - 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 - } - } + 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 } } - 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 - } - } + 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 } } - 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 - } - } + 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 } } - 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 - } - } + //choose from 1 + if(pixel.dc1 && !pixel.dc2 && !pixel.dc3 && !pixel.dc4) { + if(!pixel.void) { + pixel.void = pixel.dc1 } } - 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 - } - } + if(!pixel.dc1 && pixel.dc2 && !pixel.dc3 && !pixel.dc4) { + if(!pixel.void) { + pixel.void = pixel.dc2 } } - 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 - } - } + if(!pixel.dc1 && !pixel.dc2 && pixel.dc3 && !pixel.dc4) { + if(!pixel.void) { + pixel.void = pixel.dc3 } } - 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 - } - } + if(!pixel.dc1 && !pixel.dc2 && !pixel.dc3 && pixel.dc4) { + if(!pixel.void) { + pixel.void = pixel.dc4 } } - 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, - owo: 0, - tick: function(pixel) { - pixel.uwu = 0 - pixel.owo = 0 - 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 (pixelMap[pixel.x+j][pixel.y+i].element == pixel.element) { - if(pixel.uwu < 8) { - pixel.uwu += 1 - } else { - pixel.owo += 1 - } - } - } - } - } - pixel.owo -= 1 - if(pixel.uwu == undefined || pixel.uwu == null || isNaN(pixel.uwu) || pixel.owo == undefined || pixel.owo == null || isNaN(pixel.owo)) { - pixel.color = "rgb(127,127,127)" - } else { - pixel.color = "rgb(" + (255/8)*pixel.uwu + "," + (255/16)*pixel.owo + ",0)" - } - }, - category: "machines", - insulate: true, - state: "solid", - hidden: true, - }, - - elements.discharge = { - color: "#7f7f7f", - tick: function(pixel) { - for (var i = 1; i < width; i++) { - for (var j = 1; j < height; j++) { - if (!isEmpty(i,j)) { - pixelMap[i][j].charge = 0 - } - } - } - deletePixel(pixel.x, pixel.y) - }, - category:"special", - insulate:true, - state: "solid", - behavior: behaviors.SELFDELETE, - }, - - elements.troll_powder = { - color: ["#ffffff","#000000"], - tick: function(pixel) { - ddd = Math.random() - eee = Math.random() - fff = 1-eee - doHeat(pixel); - doBurning(pixel); - if(ddd < 0.9) { - if(!tryMove(pixel, pixel.x, pixel.y+1)) { - if(eee < 1/2) { tryMove(pixel, pixel.x-1, pixel.y+1) } else tryMove(pixel, pixel.x+1, pixel.y+1) - } - if(Math.random() < 0.0017) { - if(fff < 1/5) { tryMove(pixel, pixel.x-2, pixel.y-1) } - if(fff < 2/5) { tryMove(pixel, pixel.x-1, pixel.y-2) } - if(fff < 3/5) { tryMove(pixel, pixel.x, pixel.y-3) } - if(fff < 4/5) { tryMove(pixel, pixel.x+1, pixel.y-2) } - if(fff < 5/5) { tryMove(pixel, pixel.x+2, pixel.y-1) } - } - if(Math.random() < 0.0003) { tryMove(pixel, pixel.y, pixel.y); } - if(Math.random() < 0.0003) { tryMove(pixel, pixel.x, pixel.x); } - if(((Math.floor(pixel.x/2) % 2 == 0) && (Math.floor(pixel.y/2) % 2 == 0)) || ((Math.floor(pixel.x/2) % 2 == 1) && (Math.floor(pixel.y/2) % 2 == 1))) { - pixel.color = "rgb(32,32,32)" - } else { - pixel.color = "rgb(224,224,224)" - } - } - - if(ddd >= 0.9) { - if(!tryMove(pixel, pixel.x, pixel.y-1)) { - if(eee < 1/2) { tryMove(pixel, pixel.x-1, pixel.y-1) } else tryMove(pixel, pixel.x+1, pixel.y-1) - } - if(Math.random() < 0.0017) { - if(fff < 1/5) { tryMove(pixel, pixel.x-2, pixel.y+1) } - if(fff < 2/5) { tryMove(pixel, pixel.x-1, pixel.y+2) } - if(fff < 3/5) { tryMove(pixel, pixel.x, pixel.y+3) } - if(fff < 4/5) { tryMove(pixel, pixel.x+1, pixel.y+2) } - if(fff < 5/5) { tryMove(pixel, pixel.x+2, pixel.y+1) } - } - if(Math.random() < 0.0003) { tryMove(pixel, pixel.y, pixel.y); } - if(Math.random() < 0.0003) { tryMove(pixel, pixel.x, pixel.x); } - if(((Math.floor(pixel.x/2) % 2 == 0) && (Math.floor(pixel.y/2) % 2 == 0)) || ((Math.floor(pixel.x/2) % 2 == 1) && (Math.floor(pixel.y/2) % 2 == 1))) { - pixel.color = "rgb(32,32,32)" - } else { - pixel.color = "rgb(224,224,224)" - } - pixel.temp = pixel.temp + ((Math.floor(Math.random()*3) - 1)*2) - } - }, - category: "powders", - state: "solid", - density: 1602, - }, - - elements.void_first = { - color: "#262626", - tick: function(pixel) { - if(!pixel.void) { - //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.void) { + 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.void) { + if(ggg < 1/2) { pixel.void = pixel.dc1 - } - } - if(!pixel.dc1 && pixel.dc2 && !pixel.dc3 && !pixel.dc4) { - if(!pixel.void) { + } else { pixel.void = pixel.dc2 } } - if(!pixel.dc1 && !pixel.dc2 && pixel.dc3 && !pixel.dc4) { - if(!pixel.void) { + } + if(!pixel.dc1 && !pixel.dc2 && pixel.dc3 && pixel.dc4) { + if(!pixel.void) { + if(ggg < 1/2) { pixel.void = pixel.dc3 - } - } - if(!pixel.dc1 && !pixel.dc2 && !pixel.dc3 && pixel.dc4) { - if(!pixel.void) { + } else { pixel.void = 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.void) { - if(ggg < 1/2) { - pixel.void = pixel.dc1 - } else { - pixel.void = pixel.dc2 - } + } + //1010 and 0101 + if(pixel.dc1 && !pixel.dc2 && pixel.dc3 && !pixel.dc4) { + if(!pixel.void) { + if(ggg < 1/2) { + pixel.void = pixel.dc1 + } else { + pixel.void = pixel.dc3 } } - if(!pixel.dc1 && !pixel.dc2 && pixel.dc3 && pixel.dc4) { - if(!pixel.void) { - if(ggg < 1/2) { - pixel.void = pixel.dc3 - } else { - pixel.void = pixel.dc4 - } - } - } - //1010 and 0101 - if(pixel.dc1 && !pixel.dc2 && pixel.dc3 && !pixel.dc4) { - if(!pixel.void) { - if(ggg < 1/2) { - pixel.void = pixel.dc1 - } else { - pixel.void = pixel.dc3 - } - } - } - if(!pixel.dc1 && pixel.dc2 && !pixel.dc3 && pixel.dc4) { - if(!pixel.void) { - if(ggg < 1/2) { - pixel.void = pixel.dc2 - } else { - pixel.void = pixel.dc4 - } - } - } - //0110 and 1001 - if(!pixel.dc1 && pixel.dc2 && pixel.dc3 && !pixel.dc4) { - if(!pixel.void) { - if(ggg < 1/2) { - pixel.void = pixel.dc2 - } else { - pixel.void = pixel.dc3 - } - } - } - if(pixel.dc1 && !pixel.dc2 && !pixel.dc3 && pixel.dc4) { - if(!pixel.void) { - if(ggg < 1/2) { - pixel.void = pixel.dc1 - } else { - pixel.void = pixel.dc4 - } - } - } - //choose from 3 - //0111 - if(!pixel.dc1 && pixel.dc2 && pixel.dc3 && pixel.dc4) { - if(!pixel.void) { - if(hhh < 1/3) { - pixel.void = pixel.dc2 - } else if(hhh < 2/3) { - pixel.void = pixel.dc3 - } else { - pixel.void = pixel.dc4 - } - } - } - //1011 - if(pixel.dc1 && !pixel.dc2 && pixel.dc3 && pixel.dc4) { - if(!pixel.void) { - if(hhh < 1/3) { - pixel.void = pixel.dc1 - } else if(hhh < 2/3) { - pixel.void = pixel.dc3 - } else { - pixel.void = pixel.dc4 - } - } - } - //1101 - if(pixel.dc1 && pixel.dc2 && !pixel.dc3 && pixel.dc4) { - if(!pixel.void) { - if(hhh < 1/3) { - pixel.void = pixel.dc1 - } else if(hhh < 2/3) { - pixel.void = pixel.dc2 - } else { - pixel.void = pixel.dc4 - } - } - } - //1110 - if(pixel.dc1 && pixel.dc2 && pixel.dc3 && !pixel.dc4) { - if(!pixel.void) { - if(hhh < 1/3) { - pixel.void = pixel.dc1 - } else if(hhh < 2/3) { - pixel.void = pixel.dc2 - } else { - pixel.void = pixel.dc3 - } - } - } - //choose from 4 - //1111 - if(pixel.dc1 && pixel.dc2 && pixel.dc3 && pixel.dc4) { - if(!pixel.void) { - if(iii < 1/4) { - pixel.void = pixel.dc1 - } else if(iii < 2/4) { - pixel.void = pixel.dc2 - } else if(iii < 3/4) { - pixel.void = pixel.dc3 - } else { - pixel.void = pixel.dc4 - } - } - } - } else if(pixel.void) { - if(pixel.dc1 || pixel.dc2 || pixel.dc3 || pixel.dc4) { - delete pixel.dc1; - delete pixel.dc2; - delete pixel.dc3; - delete pixel.dc4; - } } - - for(i = 0; i < adjacentCoords.length; i++) { - var pX = pixel.x; var pY = pixel.y; var oX = adjacentCoords[i][0]; var oY = adjacentCoords[i][1]; var nX = pX+oX; var nY = pY+oY; - if(!isEmpty(nX,nY,true)) { - var newPixel = pixelMap[nX][nY] - var newElement = newPixel.element; - if(newElement != pixel.element) { - deletePixel(nX,nY); - }; + if(!pixel.dc1 && pixel.dc2 && !pixel.dc3 && pixel.dc4) { + if(!pixel.void) { + if(ggg < 1/2) { + pixel.void = pixel.dc2 + } else { + pixel.void = pixel.dc4 + } + } + } + //0110 and 1001 + if(!pixel.dc1 && pixel.dc2 && pixel.dc3 && !pixel.dc4) { + if(!pixel.void) { + if(ggg < 1/2) { + pixel.void = pixel.dc2 + } else { + pixel.void = pixel.dc3 + } + } + } + if(pixel.dc1 && !pixel.dc2 && !pixel.dc3 && pixel.dc4) { + if(!pixel.void) { + if(ggg < 1/2) { + pixel.void = pixel.dc1 + } else { + pixel.void = pixel.dc4 + } + } + } + //choose from 3 + //0111 + if(!pixel.dc1 && pixel.dc2 && pixel.dc3 && pixel.dc4) { + if(!pixel.void) { + if(hhh < 1/3) { + pixel.void = pixel.dc2 + } else if(hhh < 2/3) { + pixel.void = pixel.dc3 + } else { + pixel.void = pixel.dc4 + } + } + } + //1011 + if(pixel.dc1 && !pixel.dc2 && pixel.dc3 && pixel.dc4) { + if(!pixel.void) { + if(hhh < 1/3) { + pixel.void = pixel.dc1 + } else if(hhh < 2/3) { + pixel.void = pixel.dc3 + } else { + pixel.void = pixel.dc4 + } + } + } + //1101 + if(pixel.dc1 && pixel.dc2 && !pixel.dc3 && pixel.dc4) { + if(!pixel.void) { + if(hhh < 1/3) { + pixel.void = pixel.dc1 + } else if(hhh < 2/3) { + pixel.void = pixel.dc2 + } else { + pixel.void = pixel.dc4 + } + } + } + //1110 + if(pixel.dc1 && pixel.dc2 && pixel.dc3 && !pixel.dc4) { + if(!pixel.void) { + if(hhh < 1/3) { + pixel.void = pixel.dc1 + } else if(hhh < 2/3) { + pixel.void = pixel.dc2 + } else { + pixel.void = pixel.dc3 + } + } + } + //choose from 4 + //1111 + if(pixel.dc1 && pixel.dc2 && pixel.dc3 && pixel.dc4) { + if(!pixel.void) { + if(iii < 1/4) { + pixel.void = pixel.dc1 + } else if(iii < 2/4) { + pixel.void = pixel.dc2 + } else if(iii < 3/4) { + pixel.void = pixel.dc3 + } else { + pixel.void = pixel.dc4 + } + } + } + } else if(pixel.void) { + if(pixel.dc1 || pixel.dc2 || pixel.dc3 || pixel.dc4) { + delete pixel.dc1; + delete pixel.dc2; + delete pixel.dc3; + delete pixel.dc4; + } + } + + for(i = 0; i < adjacentCoords.length; i++) { + var pX = pixel.x; var pY = pixel.y; var oX = adjacentCoords[i][0]; var oY = adjacentCoords[i][1]; var nX = pX+oX; var nY = pY+oY; + if(!isEmpty(nX,nY,true)) { + var newPixel = pixelMap[nX][nY] + var newElement = newPixel.element; + if(newElement != pixel.element) { + deletePixel(nX,nY); }; }; - }, - category:"special", - hardness: 1, + }; }, + category:"special", + hardness: 1, +}, - elements.converter = { - color: "#2ec408", - tick: function(pixel) { - if(!pixel.changeTo) { - //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 - } +elements.converter = { + color: "#2ec408", + tick: function(pixel) { + if(!pixel.changeTo) { + //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+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,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 - } + } + 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) { + } + //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 - } - } - if(!pixel.dc1 && pixel.dc2 && !pixel.dc3 && !pixel.dc4) { - if(!pixel.changeTo) { + } else { pixel.changeTo = pixel.dc2 } } - if(!pixel.dc1 && !pixel.dc2 && pixel.dc3 && !pixel.dc4) { - if(!pixel.changeTo) { + } + if(!pixel.dc1 && !pixel.dc2 && pixel.dc3 && pixel.dc4) { + if(!pixel.changeTo) { + if(ggg < 1/2) { pixel.changeTo = pixel.dc3 - } - } - if(!pixel.dc1 && !pixel.dc2 && !pixel.dc3 && pixel.dc4) { - if(!pixel.changeTo) { + } else { 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 - } + } + //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.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 - } - } - } - } else if(pixel.changeTo) { - if(pixel.dc1 || pixel.dc2 || pixel.dc3 || pixel.dc4) { - delete pixel.dc1; - delete pixel.dc2; - delete pixel.dc3; - delete pixel.dc4; - } } - - for(i = 0; i < adjacentCoords.length; i++) { - var pX = pixel.x; var pY = pixel.y; var oX = adjacentCoords[i][0]; var oY = adjacentCoords[i][1]; var nX = pX+oX; var nY = pY+oY; - if(!isEmpty(nX,nY,true)) { - var newPixel = pixelMap[nX][nY] - var newElement = newPixel.element; - if(newElement != pixel.element) { - changePixel(newPixel,pixel.changeTo) - }; + 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 + } + } + } + } else if(pixel.changeTo) { + if(pixel.dc1 || pixel.dc2 || pixel.dc3 || pixel.dc4) { + delete pixel.dc1; + delete pixel.dc2; + delete pixel.dc3; + delete pixel.dc4; + } + } + + for(i = 0; i < adjacentCoords.length; i++) { + var pX = pixel.x; var pY = pixel.y; var oX = adjacentCoords[i][0]; var oY = adjacentCoords[i][1]; var nX = pX+oX; var nY = pY+oY; + if(!isEmpty(nX,nY,true)) { + var newPixel = pixelMap[nX][nY] + var newElement = newPixel.element; + if(newElement != pixel.element) { + changePixel(newPixel,pixel.changeTo) }; }; - }, - category:"special", - hardness: 1, + }; }, + category:"special", + hardness: 1, +}, - conveyorIgnoreList = ["conveyor_1","conveyor_2","wall"] +conveyorIgnoreList = ["conveyor_1","conveyor_2","wall"] - elements.conveyor_1 = { - color: "#7f7f7f", - tick: function(pixel) { - //top right - if (!isEmpty(pixel.x,pixel.y-1) && !outOfBounds(pixel.x,pixel.y-1)) { - if (pixelMap[pixel.x][pixel.y-1].element == "body") { - if(!isEmpty(pixel.x,pixel.y-2) && !outOfBounds(pixel.x,pixel.y-2)) { - if (pixelMap[pixel.x][pixel.y-2].element == "head") { - if(isEmpty(pixel.x+1,pixel.y-1) && isEmpty(pixel.x+1,pixel.y-2) && !outOfBounds(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-2)) { - tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x+1,pixel.y-1) - tryMove(pixelMap[pixel.x][pixel.y-2],pixel.x+1,pixel.y-2) - } - } - } else { - if(isEmpty(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-1)) { +elements.conveyor_1 = { + color: "#7f7f7f", + tick: function(pixel) { + //top right + if (!isEmpty(pixel.x,pixel.y-1) && !outOfBounds(pixel.x,pixel.y-1)) { + if (pixelMap[pixel.x][pixel.y-1].element == "body") { + if(!isEmpty(pixel.x,pixel.y-2) && !outOfBounds(pixel.x,pixel.y-2)) { + if (pixelMap[pixel.x][pixel.y-2].element == "head") { + if(isEmpty(pixel.x+1,pixel.y-1) && isEmpty(pixel.x+1,pixel.y-2) && !outOfBounds(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-2)) { tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x+1,pixel.y-1) + tryMove(pixelMap[pixel.x][pixel.y-2],pixel.x+1,pixel.y-2) } } - } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x][pixel.y-1].element)) { - tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x+1,pixel.y-1) + } else { + if(isEmpty(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-1)) { + tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x+1,pixel.y-1) + } } + } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x][pixel.y-1].element)) { + tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x+1,pixel.y-1) } - //right down - if (!isEmpty(pixel.x+1,pixel.y) && !outOfBounds(pixel.x+1,pixel.y)) { - if (pixelMap[pixel.x+1][pixel.y].element == "body") { - if(!isEmpty(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-1)) { - if (pixelMap[pixel.x+1][pixel.y-1].element == "head") { - if(isEmpty(pixel.x+1,pixel.y+1) && !outOfBounds(pixel.x+1,pixel.y+1)) { - tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y+1) - tryMove(pixelMap[pixel.x+1][pixel.y-1],pixel.x+1,pixel.y) - } - } - } else { + } + //right down + if (!isEmpty(pixel.x+1,pixel.y) && !outOfBounds(pixel.x+1,pixel.y)) { + if (pixelMap[pixel.x+1][pixel.y].element == "body") { + if(!isEmpty(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-1)) { + if (pixelMap[pixel.x+1][pixel.y-1].element == "head") { if(isEmpty(pixel.x+1,pixel.y+1) && !outOfBounds(pixel.x+1,pixel.y+1)) { tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y+1) + tryMove(pixelMap[pixel.x+1][pixel.y-1],pixel.x+1,pixel.y) } } - } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x+1][pixel.y].element)) { - tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y+1) + } else { + if(isEmpty(pixel.x+1,pixel.y+1) && !outOfBounds(pixel.x+1,pixel.y+1)) { + tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y+1) + } } + } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x+1][pixel.y].element)) { + tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y+1) } - //bottom left - if (!isEmpty(pixel.x,pixel.y+1) && !outOfBounds(pixel.x,pixel.y+1)) { - if (pixelMap[pixel.x][pixel.y+1].element == "head") { - if(!isEmpty(pixel.x,pixel.y+2) && !outOfBounds(pixel.x,pixel.y+2)) { - if (pixelMap[pixel.x][pixel.y+2].element == "body") { - if(isEmpty(pixel.x-1,pixel.y+1) && isEmpty(pixel.x-1,pixel.y+2) && !outOfBounds(pixel.x-1,pixel.y+2) && !outOfBounds(pixel.x-1,pixel.y+2)) { - tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x-1,pixel.y+1) - tryMove(pixelMap[pixel.x][pixel.y+2],pixel.x-1,pixel.y+2) - } - } - } else { - if(isEmpty(pixel.x-1,pixel.y+1) && !outOfBounds(pixel.x-1,pixel.y+1)) { + } + //bottom left + if (!isEmpty(pixel.x,pixel.y+1) && !outOfBounds(pixel.x,pixel.y+1)) { + if (pixelMap[pixel.x][pixel.y+1].element == "head") { + if(!isEmpty(pixel.x,pixel.y+2) && !outOfBounds(pixel.x,pixel.y+2)) { + if (pixelMap[pixel.x][pixel.y+2].element == "body") { + if(isEmpty(pixel.x-1,pixel.y+1) && isEmpty(pixel.x-1,pixel.y+2) && !outOfBounds(pixel.x-1,pixel.y+2) && !outOfBounds(pixel.x-1,pixel.y+2)) { tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x-1,pixel.y+1) + tryMove(pixelMap[pixel.x][pixel.y+2],pixel.x-1,pixel.y+2) } } - } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x][pixel.y+1].element)) { - tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x-1,pixel.y+1) + } else { + if(isEmpty(pixel.x-1,pixel.y+1) && !outOfBounds(pixel.x-1,pixel.y+1)) { + tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x-1,pixel.y+1) + } } + } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x][pixel.y+1].element)) { + tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x-1,pixel.y+1) } - //left up - if (!isEmpty(pixel.x-1,pixel.y) && !outOfBounds(pixel.x-1,pixel.y)) { - if (pixelMap[pixel.x-1][pixel.y].element == "head") { - if(!isEmpty(pixel.x-1,pixel.y+1) && !outOfBounds(pixel.x-1,pixel.y+1)) { - if (pixelMap[pixel.x-1][pixel.y+1].element == "body") { - if(isEmpty(pixel.x-1,pixel.y-1) && !outOfBounds(pixel.x-1,pixel.y-1)) { - tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y-1) - tryMove(pixelMap[pixel.x-1][pixel.y+1],pixel.x-1,pixel.y) - } - } - } else { + } + //left up + if (!isEmpty(pixel.x-1,pixel.y) && !outOfBounds(pixel.x-1,pixel.y)) { + if (pixelMap[pixel.x-1][pixel.y].element == "head") { + if(!isEmpty(pixel.x-1,pixel.y+1) && !outOfBounds(pixel.x-1,pixel.y+1)) { + if (pixelMap[pixel.x-1][pixel.y+1].element == "body") { if(isEmpty(pixel.x-1,pixel.y-1) && !outOfBounds(pixel.x-1,pixel.y-1)) { tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y-1) + tryMove(pixelMap[pixel.x-1][pixel.y+1],pixel.x-1,pixel.y) } } - } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x-1][pixel.y].element)) { - tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y-1) + } else { + if(isEmpty(pixel.x-1,pixel.y-1) && !outOfBounds(pixel.x-1,pixel.y-1)) { + tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y-1) + } } + } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x-1][pixel.y].element)) { + tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y-1) } - }, - category: "machines", - insulate: true, - state: "solid", + } }, + category: "machines", + insulate: true, + state: "solid", +}, - elements.conveyor_2 = { - color: "#7f7f7f", - tick: function(pixel) { - //top left - if (!isEmpty(pixel.x,pixel.y-1) && !outOfBounds(pixel.x,pixel.y-1)) { - if (pixelMap[pixel.x][pixel.y-1].element == "body") { - if(!isEmpty(pixel.x,pixel.y-2) && !outOfBounds(pixel.x,pixel.y-2)) { - if (pixelMap[pixel.x][pixel.y-2].element == "head") { - if(isEmpty(pixel.x-1,pixel.y-1) && isEmpty(pixel.x-1,pixel.y-2) && !outOfBounds(pixel.x-1,pixel.y-1) && !outOfBounds(pixel.x-1,pixel.y-2)) { - tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x-1,pixel.y-1) - tryMove(pixelMap[pixel.x][pixel.y-2],pixel.x-1,pixel.y-2) - } - } - } else { - if(isEmpty(pixel.x-1,pixel.y-1) && !outOfBounds(pixel.x-1,pixel.y-1)) { +elements.conveyor_2 = { + color: "#7f7f7f", + tick: function(pixel) { + //top left + if (!isEmpty(pixel.x,pixel.y-1) && !outOfBounds(pixel.x,pixel.y-1)) { + if (pixelMap[pixel.x][pixel.y-1].element == "body") { + if(!isEmpty(pixel.x,pixel.y-2) && !outOfBounds(pixel.x,pixel.y-2)) { + if (pixelMap[pixel.x][pixel.y-2].element == "head") { + if(isEmpty(pixel.x-1,pixel.y-1) && isEmpty(pixel.x-1,pixel.y-2) && !outOfBounds(pixel.x-1,pixel.y-1) && !outOfBounds(pixel.x-1,pixel.y-2)) { tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x-1,pixel.y-1) + tryMove(pixelMap[pixel.x][pixel.y-2],pixel.x-1,pixel.y-2) } } - } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x][pixel.y-1].element)) { - tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x-1,pixel.y-1) + } else { + if(isEmpty(pixel.x-1,pixel.y-1) && !outOfBounds(pixel.x-1,pixel.y-1)) { + tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x-1,pixel.y-1) + } } + } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x][pixel.y-1].element)) { + tryMove(pixelMap[pixel.x][pixel.y-1],pixel.x-1,pixel.y-1) } - //right up - if (!isEmpty(pixel.x+1,pixel.y) && !outOfBounds(pixel.x+1,pixel.y)) { - if (pixelMap[pixel.x+1][pixel.y].element == "head") { - if(!isEmpty(pixel.x+1,pixel.y+1) && !outOfBounds(pixel.x+1,pixel.y+1)) { - if (pixelMap[pixel.x+1][pixel.y+1].element == "body") { - if(isEmpty(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-1)) { - tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y-1) - tryMove(pixelMap[pixel.x+1][pixel.y+1],pixel.x+1,pixel.y) - } - } - } else { + } + //right up + if (!isEmpty(pixel.x+1,pixel.y) && !outOfBounds(pixel.x+1,pixel.y)) { + if (pixelMap[pixel.x+1][pixel.y].element == "head") { + if(!isEmpty(pixel.x+1,pixel.y+1) && !outOfBounds(pixel.x+1,pixel.y+1)) { + if (pixelMap[pixel.x+1][pixel.y+1].element == "body") { if(isEmpty(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-1)) { tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y-1) + tryMove(pixelMap[pixel.x+1][pixel.y+1],pixel.x+1,pixel.y) } } - } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x+1][pixel.y].element)) { - tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y-1) + } else { + if(isEmpty(pixel.x+1,pixel.y-1) && !outOfBounds(pixel.x+1,pixel.y-1)) { + tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y-1) + } } + } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x+1][pixel.y].element)) { + tryMove(pixelMap[pixel.x+1][pixel.y],pixel.x+1,pixel.y-1) } - //bottom right - if (!isEmpty(pixel.x,pixel.y+1) && !outOfBounds(pixel.x,pixel.y+1)) { - if (pixelMap[pixel.x][pixel.y+1].element == "head") { - if(!isEmpty(pixel.x,pixel.y+2) && !outOfBounds(pixel.x,pixel.y+2)) { - if (pixelMap[pixel.x][pixel.y+2].element == "body") { - if(isEmpty(pixel.x+1,pixel.y+1) && isEmpty(pixel.x+1,pixel.y+2) && !outOfBounds(pixel.x+1,pixel.y+2) && !outOfBounds(pixel.x+1,pixel.y+2)) { - tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x+1,pixel.y+1) - tryMove(pixelMap[pixel.x][pixel.y+2],pixel.x+1,pixel.y+2) - } - } - } else { - if(isEmpty(pixel.x+1,pixel.y+1) && !outOfBounds(pixel.x+1,pixel.y+1)) { + } + //bottom right + if (!isEmpty(pixel.x,pixel.y+1) && !outOfBounds(pixel.x,pixel.y+1)) { + if (pixelMap[pixel.x][pixel.y+1].element == "head") { + if(!isEmpty(pixel.x,pixel.y+2) && !outOfBounds(pixel.x,pixel.y+2)) { + if (pixelMap[pixel.x][pixel.y+2].element == "body") { + if(isEmpty(pixel.x+1,pixel.y+1) && isEmpty(pixel.x+1,pixel.y+2) && !outOfBounds(pixel.x+1,pixel.y+2) && !outOfBounds(pixel.x+1,pixel.y+2)) { tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x+1,pixel.y+1) + tryMove(pixelMap[pixel.x][pixel.y+2],pixel.x+1,pixel.y+2) } } - } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x][pixel.y+1].element)) { - tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x+1,pixel.y+1) + } else { + if(isEmpty(pixel.x+1,pixel.y+1) && !outOfBounds(pixel.x+1,pixel.y+1)) { + tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x+1,pixel.y+1) + } } + } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x][pixel.y+1].element)) { + tryMove(pixelMap[pixel.x][pixel.y+1],pixel.x+1,pixel.y+1) } - //left down - if (!isEmpty(pixel.x-1,pixel.y) && !outOfBounds(pixel.x-1,pixel.y)) { - if (pixelMap[pixel.x-1][pixel.y].element == "body") { - if(!isEmpty(pixel.x-1,pixel.y-1) && !outOfBounds(pixel.x-1,pixel.y-1)) { - if (pixelMap[pixel.x-1][pixel.y-1].element == "head") { - if(isEmpty(pixel.x-1,pixel.y+1) && !outOfBounds(pixel.x-1,pixel.y+1)) { - tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y+1) - tryMove(pixelMap[pixel.x-1][pixel.y-1],pixel.x-1,pixel.y) - } - } - } else { + } + //left down + if (!isEmpty(pixel.x-1,pixel.y) && !outOfBounds(pixel.x-1,pixel.y)) { + if (pixelMap[pixel.x-1][pixel.y].element == "body") { + if(!isEmpty(pixel.x-1,pixel.y-1) && !outOfBounds(pixel.x-1,pixel.y-1)) { + if (pixelMap[pixel.x-1][pixel.y-1].element == "head") { if(isEmpty(pixel.x-1,pixel.y+1) && !outOfBounds(pixel.x-1,pixel.y+1)) { tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y+1) + tryMove(pixelMap[pixel.x-1][pixel.y-1],pixel.x-1,pixel.y) } } - } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x-1][pixel.y].element)) { - tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y+1) - } - } - }, - category: "machines", - insulate: true, - state: "solid", - }, - - elements.vanishing_wall = { - behavior: behaviors.WALL, - color: "#8080b0", - density: 3333, - tick: function(pixel) { - pixelTick(pixel) - if(pixel.charge) { - if(!isEmpty(pixel.x,pixel.y)) { - deletePixel(pixel.x,pixel.y) - } - } - }, - category: "special", - state: "solid", - hardness: 1, - insulate: true, - conduct: 1, - extraInfo: "It disappears when charged.", - }, - - elements.polka_dotted_powder = { - color: ["#000000","#000000","#7f7f7f","#ffffff","#ffffff"], - behavior: behaviors.POWDER, - category: "powders", - state: "solid", - density: 1400, - tick: function(pixel) { - if(pixel.y % 6 == 0) { - if(pixel.x % 6 == 0) { - pixel.color = "rgb(255,255,255)" } else { - if(!settings.bg || settings.bg == "#000000") { - pixel.color = "rgb(15,15,15)" - } else { - pixel.color = "rgb(0,0,0)" + if(isEmpty(pixel.x-1,pixel.y+1) && !outOfBounds(pixel.x-1,pixel.y+1)) { + tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y+1) } - } - } else if((pixel.y + 3) % 6 == 0) { - if((pixel.x + 3) % 6 == 0) { - pixel.color = "rgb(255,255,255)" - } else { - if(!settings.bg || settings.bg == "#000000") { - pixel.color = "rgb(15,15,15)" - } else { - pixel.color = "rgb(0,0,0)" - } - } + } + } else if(!conveyorIgnoreList.includes(pixelMap[pixel.x-1][pixel.y].element)) { + tryMove(pixelMap[pixel.x-1][pixel.y],pixel.x-1,pixel.y+1) + } + } + }, + category: "machines", + insulate: true, + state: "solid", +}, + +elements.vanishing_wall = { + behavior: behaviors.WALL, + color: "#8080b0", + density: 3333, + tick: function(pixel) { + pixelTick(pixel) + if(pixel.charge) { + if(!isEmpty(pixel.x,pixel.y)) { + deletePixel(pixel.x,pixel.y) + } + } + }, + category: "special", + state: "solid", + hardness: 1, + insulate: true, + conduct: 1, + extraInfo: "It disappears when charged.", +}, + +elements.polka_dotted_powder = { + color: ["#000000","#000000","#7f7f7f","#ffffff","#ffffff"], + behavior: behaviors.POWDER, + category: "powders", + state: "solid", + density: 1400, + tick: function(pixel) { + if(pixel.y % 6 == 0) { + if(pixel.x % 6 == 0) { + pixel.color = "rgb(255,255,255)" } else { if(!settings.bg || settings.bg == "#000000") { pixel.color = "rgb(15,15,15)" } else { pixel.color = "rgb(0,0,0)" } + } + } else if((pixel.y + 3) % 6 == 0) { + if((pixel.x + 3) % 6 == 0) { + pixel.color = "rgb(255,255,255)" + } else { + if(!settings.bg || settings.bg == "#000000") { + pixel.color = "rgb(15,15,15)" + } else { + pixel.color = "rgb(0,0,0)" + } + } + } else { + if(!settings.bg || settings.bg == "#000000") { + pixel.color = "rgb(15,15,15)" + } else { + pixel.color = "rgb(0,0,0)" } - }, - tempHigh: 800, + } }, + tempHigh: 800, +}, - elements.molten_polka_dotted_powder = { - color: ["#ff7f00","#ff7f00","#ff9f00","#ffbf00","#ffbf00"], - density: 1100, - tick: function(pixel) { - if(pixel.y % 6 == 0) { - if(pixel.x % 6 == 0) { - pixel.color = "rgb(255,191,0)" - } else { - if(!settings.bg || settings.bg == "#ff7f00") { - pixel.color = "rgb(255,143,16)" - } else { - pixel.color = "rgb(255,127,16)" - } - } - } else if((pixel.y + 3) % 6 == 0) { - if((pixel.x + 3) % 6 == 0) { - pixel.color = "rgb(255,191,0)" - } else { - if(!settings.bg || settings.bg == "#ff7f00") { - pixel.color = "rgb(255,143,16)" - } else { - pixel.color = "rgb(255,127,16)" - } - } +elements.molten_polka_dotted_powder = { + color: ["#ff7f00","#ff7f00","#ff9f00","#ffbf00","#ffbf00"], + density: 1100, + tick: function(pixel) { + if(pixel.y % 6 == 0) { + if(pixel.x % 6 == 0) { + pixel.color = "rgb(255,191,0)" } else { if(!settings.bg || settings.bg == "#ff7f00") { pixel.color = "rgb(255,143,16)" } else { pixel.color = "rgb(255,127,16)" } + } + } else if((pixel.y + 3) % 6 == 0) { + if((pixel.x + 3) % 6 == 0) { + pixel.color = "rgb(255,191,0)" + } else { + if(!settings.bg || settings.bg == "#ff7f00") { + pixel.color = "rgb(255,143,16)" + } else { + pixel.color = "rgb(255,127,16)" + } + } + } else { + if(!settings.bg || settings.bg == "#ff7f00") { + pixel.color = "rgb(255,143,16)" + } else { + pixel.color = "rgb(255,127,16)" } - }, - temp: 850, - tempLow: 800, - stateLow: "polka_dotted_powder", - tempHigh: 2000, - stateHigh: "vaporized_polka_dotted_powder", - viscosity: 6, - hidden: true, + } }, + temp: 850, + tempLow: 800, + stateLow: "polka_dotted_powder", + tempHigh: 2000, + stateHigh: "vaporized_polka_dotted_powder", + viscosity: 6, + hidden: true, +}, - elements.vaporized_polka_dotted_powder = { - color: ["#ffdf7f","#ffdf7f","#ffefbf","#ffffff","#ffffff"], - behavior: behaviors.GAS, - category: "gases", - state: "gas", - density: 550, - tick: function(pixel) { - if(pixel.y % 6 == 0) { - if(pixel.x % 6 == 0) { - pixel.color = "rgb(255,255,255)" - } else { - if(!settings.bg || settings.bg == "#ffdf7f") { - pixel.color = "rgb(255,233,137)" - } else { - pixel.color = "rgb(255,223,127)" - } - } - } else if((pixel.y + 3) % 6 == 0) { - if((pixel.x + 3) % 6 == 0) { - pixel.color = "rgb(255,255,255)" - } else { - if(!settings.bg || settings.bg == "#ffdf7f") { - pixel.color = "rgb(255,143,16)" - } else { - pixel.color = "rgb(255,233,137)" - } - } +elements.vaporized_polka_dotted_powder = { + color: ["#ffdf7f","#ffdf7f","#ffefbf","#ffffff","#ffffff"], + behavior: behaviors.GAS, + category: "gases", + state: "gas", + density: 550, + tick: function(pixel) { + if(pixel.y % 6 == 0) { + if(pixel.x % 6 == 0) { + pixel.color = "rgb(255,255,255)" } else { if(!settings.bg || settings.bg == "#ffdf7f") { pixel.color = "rgb(255,233,137)" } else { pixel.color = "rgb(255,223,127)" } + } + } else if((pixel.y + 3) % 6 == 0) { + if((pixel.x + 3) % 6 == 0) { + pixel.color = "rgb(255,255,255)" + } else { + if(!settings.bg || settings.bg == "#ffdf7f") { + pixel.color = "rgb(255,143,16)" + } else { + pixel.color = "rgb(255,233,137)" + } + } + } else { + if(!settings.bg || settings.bg == "#ffdf7f") { + pixel.color = "rgb(255,233,137)" + } else { + pixel.color = "rgb(255,223,127)" } - }, - temp: 2200, - tempLow: 2000, - stateLow: "molten_polka_dotted_powder", - tempHigh: 8000, - stateHigh: "ionized_polka_dotted_powder", - hidden: true, + } }, + temp: 2200, + tempLow: 2000, + stateLow: "molten_polka_dotted_powder", + tempHigh: 8000, + stateHigh: "ionized_polka_dotted_powder", + hidden: true, +}, - elements.ionized_polka_dotted_powder = { - color: ["#fffff0","#fffff0","#fffff7","#ffffff","#ffffff"], - behavior: [ - "M2 AND CR:plasma%0.3|M1|M2 AND CR:plasma%0.3", - "M1|XX|M1", - "M2 AND CR:plasma%0.3|M1|M2 AND CR:plasma%0.3", - ], - category: "gases", - state: "gas", - density: 0.02, - tick: function(pixel) { - if(pixel.y % 6 == 0) { - if(pixel.x % 6 == 0) { - pixel.color = "rgb(255,255,255)" - } else { - if(!settings.bg || settings.bg == "#fffff0") { - pixel.color = "rgb(255,255,247)" - } else { - pixel.color = "rgb(255,255,240)" - } - } - } else if((pixel.y + 3) % 6 == 0) { - if((pixel.x + 3) % 6 == 0) { - pixel.color = "rgb(255,255,255)" - } else { - if(!settings.bg || settings.bg == "#fffff0") { - pixel.color = "rgb(255,255,247)" - } else { - pixel.color = "rgb(255,255,240)" - } - } +elements.ionized_polka_dotted_powder = { + color: ["#fffff0","#fffff0","#fffff7","#ffffff","#ffffff"], + behavior: [ + "M2 AND CR:plasma%0.3|M1|M2 AND CR:plasma%0.3", + "M1|XX|M1", + "M2 AND CR:plasma%0.3|M1|M2 AND CR:plasma%0.3", + ], + category: "gases", + state: "gas", + density: 0.02, + tick: function(pixel) { + if(pixel.y % 6 == 0) { + if(pixel.x % 6 == 0) { + pixel.color = "rgb(255,255,255)" } else { if(!settings.bg || settings.bg == "#fffff0") { pixel.color = "rgb(255,255,247)" } else { pixel.color = "rgb(255,255,240)" } + } + } else if((pixel.y + 3) % 6 == 0) { + if((pixel.x + 3) % 6 == 0) { + pixel.color = "rgb(255,255,255)" + } else { + if(!settings.bg || settings.bg == "#fffff0") { + pixel.color = "rgb(255,255,247)" + } else { + pixel.color = "rgb(255,255,240)" + } + } + } else { + if(!settings.bg || settings.bg == "#fffff0") { + pixel.color = "rgb(255,255,247)" + } else { + pixel.color = "rgb(255,255,240)" } - }, - temp: 8500, - tempLow: 8000, - stateLow: "vaporized_polka_dotted_powder", - hidden: true, + } }, + temp: 8500, + 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 - } +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" + 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 randInt(max) { + return Math.floor(Math.random() * (max + 1)) +} - function randIntR(min,max) { - if(min > max) { - var temp = max; //the need of a temporary space has always annoyed me - max = min; - min = temp; - }; - return Math.floor(Math.random() * (max - min + 1)) + min +function randIntR(min,max) { + if(min > max) { + var temp = max; //the need of a temporary space has always annoyed me + max = min; + min = temp; }; - - elements.napalm = { - color: "#e0873e", - behavior: [ - "XX|SA%40 AND ST|XX", - "M2%10 AND SA%40 AND ST|XX|M2%10 AND SA%40 AND ST", - "M2%50 AND M1%10|M1 AND SA%40 AND ST|M2%50 AND M1%10" - ], - category: "weapons", - state: "liquid", - viscosity: 1000, - density: 1200, //google was f***ing useless and i'm not searching that again, so arbitrary 1.2 it is - burnTempChange: 2, - burn: 300, - burnTime: 500, - temp: airTemp, - }, - - elements.hypernapalm = { - name: "h y p e r n a p a l m", //HYPERNAPALM - color: "#bd34eb", - behavior: [ - "XX|SA%40 AND ST|XX", - "M2%10 AND SA%40 AND ST|XX|M2%10 AND SA%40 AND ST", - "M2%50 AND M1%10|M1 AND SA%40 AND ST|M2%50 AND M1%10" - ], - category: "weapons", - state: "liquid", - viscosity: 1000, - density: 1200, - fireElement: "plasma", - fireSpawnChance: 33, - fireSpawnTemp: 7200, - burnTempChange: 30, - burn: 300, - burnTime: 500, - }, - - elements.cold_napalm = { - color: "#3e87e0", - behavior: [ - "XX|SA%40 AND ST|XX", - "M2%10 AND SA%40 AND ST|XX|M2%10 AND SA%40 AND ST", - "M2%50 AND M1%10|M1 AND SA%40 AND ST|M2%50 AND M1%10" - ], - category: "weapons", - state: "liquid", - viscosity: 1000, - density: 1200, - burn: 300, - burnTime: 500, - fireElement: "cold_fire", - burnTempChange: -1, - burnInto: "cold_fire", - } - - elements.lower_color_copy = { - behavior: behaviors.POWDER, - tick: function(pixel) { - if(!isEmpty(pixel.x,pixel.y+1,true)) { - pixel.color = pixelMap[pixel.x][pixel.y+1].color; - } else { - if(settings.bg) { - pixel.color = settings.bg; - } else { - pixel.color = "#000000"; - } - } - }, - color: ["#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#FF0000", "#FF7F00", "#FFFF00", "#00FF00", "#007FFF", "#0000FF", "#7F00FF"], - density: 1250, - breakInto: ["metal_scrap", "glass_shard"], - hardness: 0.7, - } -} else { - enabledMods.splice(enabledMods.indexOf(modName),0,coldFireMod); - localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); - alert(`The "${coldFireMod}" mod is required and has been automatically inserted (reload for this to take effect).`) + return Math.floor(Math.random() * (max - min + 1)) + min }; + +elements.lower_color_copy = { + behavior: behaviors.POWDER, + tick: function(pixel) { + if(!isEmpty(pixel.x,pixel.y+1,true)) { + pixel.color = pixelMap[pixel.x][pixel.y+1].color; + } else { + if(settings.bg) { + pixel.color = settings.bg; + } else { + pixel.color = "#000000"; + } + } + }, + color: ["#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#FF0000", "#FF7F00", "#FFFF00", "#00FF00", "#007FFF", "#0000FF", "#7F00FF"], + density: 1250, + breakInto: ["metal_scrap", "glass_shard"], + hardness: 0.7, +} From 38c6e36fe0ac047f43d9cc7e489f91dd17867df3 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Wed, 7 Dec 2022 12:19:00 -0500 Subject: [PATCH 13/49] fix varnames --- mods/fire_mod.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/fire_mod.js b/mods/fire_mod.js index 762fc05e..f6f1c2cc 100644 --- a/mods/fire_mod.js +++ b/mods/fire_mod.js @@ -657,7 +657,7 @@ runAfterLoad(function() { burning: true, burnTime: Infinity, burnTempChange: 2, - fireChance: 5, + fireSpawnChance: 5, state: "liquid", density: 21, }; @@ -678,7 +678,7 @@ runAfterLoad(function() { stateHigh: "liquid_smoke", burning: true, burnTempChange: -2, - fireChance: 5, + fireSpawnChance: 5, burnTime: Infinity, fireElement: "cold_fire", category: "energy liquids", @@ -807,7 +807,7 @@ runAfterLoad(function() { burning: true, burnTime: Infinity, burnTempChange: 3, - fireChance: 5, + fireSpawnChance: 5, fireElement: "rad_fire", state: "liquid", density: 21, From 5f5a0a6a27f3fc79b9425a83bda857c4d9db38d8 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Wed, 7 Dec 2022 13:29:31 -0500 Subject: [PATCH 14/49] terminology change, rad dry dirt irradiated is the exact wrong term to use, now it says radioactive --- mods/the_ground.js | 528 ++++++++++++++++++++++++--------------------- 1 file changed, 285 insertions(+), 243 deletions(-) diff --git a/mods/the_ground.js b/mods/the_ground.js index 0539ef19..3540dd1e 100644 --- a/mods/the_ground.js +++ b/mods/the_ground.js @@ -1,3 +1,5 @@ +//This mod is on indefinite hiatus + /* TODO: Fill in remaining IRs (if they exist, and i might make some up if they don't) @@ -53,8 +55,8 @@ Proper classification of limestone within these code comments 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(irradiatedObject,elementToCheck)) { - changePixel(destPixel,getKeyByValue(irradiatedObject,elementToCheck)); + if(getKeyByValue(radioactiveObject,elementToCheck)) { + changePixel(destPixel,getKeyByValue(radioactiveObject,elementToCheck)); }; }; } else { @@ -80,8 +82,8 @@ Proper classification of limestone within these code comments 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(irradiatedObject,elementToCheck)) { - changePixel(destPixel,getKeyByValue(irradiatedObject,elementToCheck)); + if(getKeyByValue(radioactiveObject,elementToCheck)) { + changePixel(destPixel,getKeyByValue(radioactiveObject,elementToCheck)); }; }; } else { @@ -262,155 +264,155 @@ Proper classification of limestone within these code comments //TODO - //Irradiated (unmoved/TODO) + //Radioactive (unmoved/TODO) //Dry - //Irradiated Clay + //Radioactive Clay //Clay exists - //Irradiated Silty clay + //Radioactive Silty clay //TODO - //Irradiated Silty Clay Loam + //Radioactive Silty Clay Loam //TODO - //Irradiated Silty Loam + //Radioactive Silty Loam //TODO - //Irradiated Silt + //Radioactive Silt //TODO - //Irradiated Clay Loam + //Radioactive Clay Loam //Clay Soil exists - //Irradiated Medium Loam + //Radioactive Medium Loam //Dirt exists - //Irradiated Sandy Clay + //Radioactive Sandy Clay //TODO - //Irradiated Sandy Clay Loam + //Radioactive Sandy Clay Loam //TODO - //Irradiated Sandy Loam + //Radioactive Sandy Loam //TODO - //Irradiated Loamy Sand + //Radioactive Loamy Sand //TODO - //Irradiated Sand + //Radioactive Sand //Sand exists //Wet - //Irradiated Wet Clay + //Radioactive Wet Clay //TODO - //Irradiated Wet Silty clay + //Radioactive Wet Silty clay //TODO - //Irradiated Wet Silty Clay Loam + //Radioactive Wet Silty Clay Loam //TODO - //Irradiated Wet Silty Loam + //Radioactive Wet Silty Loam //TODO - //Irradiated Wet Silt + //Radioactive Wet Silt //TODO - //Irradiated Wet Clay Loam + //Radioactive Wet Clay Loam //TODO - //Irradiated Wet Medium Loam + //Radioactive Wet Medium Loam //Mud exists - //Irradiated Wet Sandy Clay + //Radioactive Wet Sandy Clay //TODO - //Irradiated Wet Sandy Clay Loam + //Radioactive Wet Sandy Clay Loam //TODO - //Irradiated Wet Sandy Loam + //Radioactive Wet Sandy Loam //TODO - //Irradiated Wet Loamy Sand + //Radioactive Wet Loamy Sand //TODO - //Irradiated Wet Sand + //Radioactive Wet Sand //Wet Sand exists //Permafrost - //Irradiated Clay Permafrost + //Radioactive Clay Permafrost //TODO - //Irradiated Silty clay Permafrost + //Radioactive Silty clay Permafrost //TODO - //Irradiated Silty Clay Loam Permafrost + //Radioactive Silty Clay Loam Permafrost //TODO - //Irradiated Silty Loam Permafrost + //Radioactive Silty Loam Permafrost //TODO - //Irradiated Silt Permafrost + //Radioactive Silt Permafrost //TODO - //Irradiated Clay Loam Permafrost + //Radioactive Clay Loam Permafrost //TODO - //Irradiated Medium Loam Permafrost + //Radioactive Medium Loam Permafrost //Permafrost exists - //Irradiated Sandy Clay Permafrost + //Radioactive Sandy Clay Permafrost //TODO - //Irradiated Sandy Clay Loam Permafrost + //Radioactive Sandy Clay Loam Permafrost //TODO - //Irradiated Sandy Loam Permafrost + //Radioactive Sandy Loam Permafrost //TODO - //Irradiated Loamy Sand Permafrost + //Radioactive Loamy Sand Permafrost //TODO - //Irradiated Sand Permafrost + //Radioactive Sand Permafrost //TODO @@ -753,7 +755,7 @@ Proper classification of limestone within these code comments //Elements from which simplified lithification can spread - sandstoneLithificationElements = ["sand_sediment", "sandstone", "irradiated_sand_sediment", "irradiated_sandstone"/*, "crimson_sandstone", "crimson_sand_sediment"*/] + sandstoneLithificationElements = ["sand_sediment", "sandstone", "radioactive_sand_sediment", "radioactive_sandstone"/*, "crimson_sandstone", "crimson_sand_sediment"*/] //Water reaction to pick up the fine material (this is very simplified) @@ -763,9 +765,9 @@ Proper classification of limestone within these code comments chance: 0.01 }; - elements.water.reactions.irradiated_wet_sand = { - "elem1": "irradiated_sandy_water", - "elem2": ["irradiated_wet_sand","irradiated_wet_sand","irradiated_wet_sand","irradiated_wet_sand","irradiated_wet_sand",null], + elements.water.reactions.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 }; @@ -1135,11 +1137,19 @@ Proper classification of limestone within these code comments 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 } + + if(!elements.dirt.reactions) { + elements.dirt.reactions = {}; + }; + elements.dirt.reactions.dry_dirt = { elem1: "dry_dirt", elem2: "dirt", chance: 0.03 } + elements.dirt.reactions.radioactive_dry_dirt = { elem1: "radioactive_dry_dirt", elem2: "radioactive_dirt", chance: 0.03 } //Land Element Cults /* @@ -1147,9 +1157,9 @@ Proper classification of limestone within these code comments 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... */ - //Irradiated land + //Radioactive land - //Irradiated behavior cult (see above) + //Radioactive behavior cult (see above) behaviors.RAD_POWDER = [ "XX|CR:radiation%2|XX", @@ -1204,44 +1214,44 @@ Proper classification of limestone within these code comments }; }; - elements.water.reactions.radiation = { elem1: "irradiated_water", elem2: null, chance:0.25 }, - elements.radiation.reactions.water = { elem2: "irradiated_water", elem1: null, chance:0.25 }, - elements.dirt.reactions.radiation = { elem1: "irradiated_dirt", elem2: null, chance:0.25 }, - elements.radiation.reactions.dirt = { elem2: "irradiated_dirt", elem1: null, chance:0.25 }, - elements.sand.reactions.radiation = { elem1: "irradiated_sand", elem2: null, chance:0.25 }, - elements.radiation.reactions.sand = { elem2: "irradiated_sand", elem1: null, chance:0.25 }, - elements.mud.reactions.radiation = { elem1: "irradiated_mud", elem2: null, chance:0.25 }, - elements.radiation.reactions.mud = { elem2: "irradiated_mud", elem1: null, chance:0.25 }, - elements.wet_sand.reactions.radiation = { elem1: "irradiated_wet_sand", elem2: null, chance:0.25 }, - elements.radiation.reactions.wet_sand = { elem2: "irradiated_wet_sand", elem1: null, chance:0.25 }, + 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 - irradiatedObject = { - dirt: "irradiated_dirt", - molten_dirt: "molten_irradiated_dirt", - glass: "irradiated_glass", - molten_glass: "molten_irradiated_glass", - glass_shard: "irradiated_glass_shard", - sand: "irradiated_sand", - mud: "irradiated_mud", - wet_sand: "irradiated_wet_sand", - water: "irradiated_water", - permafrost: "irradiated_permafrost", - mudstone: "irradiated_mudstone", - packed_sand: "irradiated_packed_sand", - ice: "irradiated_ice", - snow: "irradiated_snow", - packed_snow: "irradiated_packed_snow", + radioactiveObject = { + dirt: "radioactive_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", + 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: "irradiated_rock", - gravel: "irradiated_gravel", - basalt: "irradiated_basalt", - magma: "irradiated_magma", - sandstone: "irradiated_sandstone", - sand_sediment: "irradiated_sand_sediment" + rock: "radioactive_rock", + gravel: "radioactive_gravel", + basalt: "radioactive_basalt", + magma: "radioactive_magma", + sandstone: "radioactive_sandstone", + sand_sediment: "radioactive_sand_sediment" }; //Reverse lookup function @@ -1253,35 +1263,53 @@ Proper classification of limestone within these code comments //Main elements - elements.irradiated_dirt = { + elements.radioactive_dirt = { color: ["#70762b","#4c5c21","#50571a","#4c6b1e"], behavior: behaviors.RAD_POWDER, - tempHigh:1200, - stateHigh: "molten_irradiated_dirt", + tempHigh:110, + stateHigh: "radioactive_dry_dirt", reactions: { - "dirt": { "elem1":"dirt", "elem2":"irradiated_dirt", "chance":0.0005, "oneway":true }, + "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: "irradiated_permafrost", - category: "Irradiated", + stateLow: "radioactive_permafrost", + category: "Radioactive", state: "solid", density: 1220, }; - elements.molten_irradiated_dirt = { + 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": "Irradiated", + "category": "Radioactive", "color": ["#e09315", "#e07615", "#e05800", "#987310", "#985c10", "#984500", "#a06c0d", "#a0570d", "#a04100", "#98850f", "#986b0f", "#985000"], "temp": 1250, "tempLow": 1100, - "stateLow": "irradiated_dirt", + "stateLow": "radioactive_dirt", "density": 1098, "viscosity": 10000 } - elements.irradiated_glass = { + elements.radioactive_glass = { color: ["#597a58","#719171"], colorOn: ["#6dab67","#88b567"], behavior: behaviors.RAD_WALL, @@ -1289,102 +1317,103 @@ Proper classification of limestone within these code comments category: "solids", state: "solid", density: 2500, - breakInto: "irradiated_glass_shard", + breakInto: "radioactive_glass_shard", conduct: 0.01, }; - elements.molten_irradiated_glass = { + elements.molten_radioactive_glass = { behavior: behaviors.RAD_MOLTEN, - category: "Irradiated", + category: "Radioactive", }; - elements.irradiated_glass_shard = { + elements.radioactive_glass_shard = { color: ["#597a58","#719171", "#628263"], colorOn: ["#6dab67","#88b567", "#7bad6f"], behavior: behaviors.RAD_POWDER, tempHigh: 1500, - stateHigh: "molten_irradiated_glass", + stateHigh: "molten_radioactive_glass", category: "powders", state: "solid", density: 2500, conduct: 0.01, }; - elements.irradiated_sand = { + elements.radioactive_sand = { color: "#cbdb7b", behavior: behaviors.RAD_POWDER, tempHigh: 1700, - stateHigh: "molten_irradiated_glass", - category: "Irradiated", + stateHigh: "molten_radioactive_glass", + category: "Radioactive", state: "solid", density: 1602 }; - elements.irradiated_mud = { + elements.radioactive_mud = { color: "#3c401c", behavior: behaviors.RAD_STURDYPOWDER, reactions: { - "irradiated_dirt": { "elem1":"irradiated_dirt", "elem2":"irradiated_mud", "chance":0.0005, "oneway":true }, - "irradiated_sand": { "elem1":"irradiated_dirt", "elem2":"irradiated_wet_sand", "chance":0.0005, "oneway":true }, - "sand": { "elem1":"irradiated_dirt", "elem2":"irradiated_wet_sand", "chance":0.0005, "oneway":true }, - "dirt": { "elem1":"irradiated_dirt", "elem2":"irradiated_mud", "chance":0.0005, "oneway":true }, + "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: "irradiated_mudstone", + stateHigh: "radioactive_mudstone", tempLow: -50, - stateLow: "irradiated_permafrost", - category: "Irradiated", + stateLow: "radioactive_permafrost", + category: "Radioactive", state: "solid", density: 1730, stain: 0.02, }; - elements.irradiated_wet_sand = { + elements.radioactive_wet_sand = { color: ["#848c3a","#969e4c"], behavior: behaviors.RAD_STURDYPOWDER, reactions: { - "irradiated_sand": { "elem1":"irradiated_sand", "elem2":"irradiated_wet_sand", "chance":0.0005, "oneway":true }, - "irradiated_dirt": { "elem1":"irradiated_sand", "elem2":"irradiated_mud", "chance":0.0005, "oneway":true }, - "sand": { "elem1":"irradiated_sand", "elem2":"irradiated_wet_sand", "chance":0.0005, "oneway":true }, - "dirt": { "elem1":"irradiated_sand", "elem2":"irradiated_mud", "chance":0.0005, "oneway":true }, - "wet_sand": { "elem1":"irradiated_sand", "elem2":"irradiated_sand_sediment", "chance":0.0005, "oneway":true }, - "sand_sediment": { "elem1":"irradiated_sand", "elem2":"irradiated_sand_sediment", "chance":0.0005, "oneway":true }, - "irradiated_wet_sand": { "elem1":"irradiated_sand", "elem2":"irradiated_sand_sediment", "chance":0.0005, "oneway":true }, - "irradiated_sand_sediment": { "elem1":"irradiated_sand", "elem2":"irradiated_sand_sediment", "chance":0.0005, "oneway":true }, + "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: "irradiated_packed_sand", - category: "Irradiated", + stateHigh: "radioactive_packed_sand", + category: "Radioactive", state: "solid", density: 1905, }; - elements.irradiated_sandy_water = { + elements.radioactive_sandy_water = { color: ["#84A244", "#90AE50"], behavior: behaviors.RAD_LIQUID, tempHigh: 100, - stateHigh: ["rad_steam","rad_steam","irradiated_sand"], + stateHigh: ["rad_steam","rad_steam","radioactive_sand"], //tempLow: 0, - //stateLow: "irradiated_sandy_ice", - category: "Irradiated", + //stateLow: "radioactive_sandy_ice", + category: "Radioactive", heatCapacity: 4.184, //unimplemented reactions: { "dirt": { // React with (water reacts with dirt to make mud) - "elem1": [null,null,"irradiated_wet_sand"], // First element transforms into; in this case, water deletes itself - "elem2": "irradiated_mud", // Second element transforms into; in this case, dirt turns to 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 }, - "irradiated_dirt": { // React with (water reacts with dirt to make mud) - "elem1": [null,null,"irradiated_wet_sand"], // First element transforms into; in this case, water deletes itself - "elem2": "irradiated_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":"irradiated_water", "elem2":"irradiated_sandy_water", "chance":0.025 }, - "irradiated_water": { "elem1":"irradiated_water", "elem2":"irradiated_sandy_water", "chance":0.025 }, - "sand": { "elem1": [null,null,"irradiated_wet_sand"], "elem2": "irradiated_wet_sand", }, - "irradiated_sand": { "elem1": [null,null,"irradiated_wet_sand"], "elem2": "irradiated_wet_sand", }, - "sandy_water": { "elem1":"irradiated_wet_sand", "elem2":"irradiated_sand_sediment", "chance": 0.001 }, - "irradiated_sandy_water": { "elem1":"irradiated_wet_sand", "elem2":"irradiated_sand_sediment", "chance": 0.001 }, - "wet_sand": { "elem1": "irradiated_water", "elem2":"irradiated_sand_sediment", "chance": 0.0005 }, - "irradiated_wet_sand": { "elem1": "irradiated_water", "elem2":"irradiated_sand_sediment", "chance": 0.0005 }, + "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, }, @@ -1402,8 +1431,8 @@ Proper classification of limestone within these code comments "quicklime": { "elem1": [null,null,"wet_sand"], "elem2": "slaked_lime", }, "rock": { "elem2": "wet_sand", "chance": 0.00035 }, "ruins": { "elem2": "rock", "chance": 0.00035 },*/ - "mudstone": { "elem2": "irradiated_mud", "chance": 0.00035 }, - "irradiated_mudstone": { "elem2": "irradiated_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 }, @@ -1417,75 +1446,77 @@ Proper classification of limestone within these code comments stain: 0.01, } - elements.irradiated_sand_sediment = { + elements.radioactive_sand_sediment = { hidden: true, color: "#afd182", hardness: 0.2, behavior: [ "XX|XX|XX", "XX|XX|XX", - "SW:wet_sand,irradiated_wet_sand%1.5 AND M2|SW:wet_sand,irradiated_wet_sand%2.5 AND M1|SW:wet_sand,irradiated_wet_sand%1.5 AND M2" + "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":"irradiated_sandy_water", "elem2":"irradiated_sandy_water", "chance":0.025 }, - "irradiated_water": { "elem1":"irradiated_sandy_water", "elem2":"irradiated_sandy_water", "chance":0.025 }, - "sand": { "elem1": [null,null,"irradiated_wet_sand"], "elem2": "irradiated_wet_sand", }, - "irradiated_sand": { "elem1": [null,null,"irradiated_wet_sand"], "elem2": "irradiated_wet_sand", }, - "sandy_water": { "elem1":["irradiated_water","irradiated_water","irradiated_sand_sediment"], "chance":0.001 }, - "irradiated_sandy_water": { "elem1":["irradiated_water","irradiated_water","irradiated_sand_sediment"], "chance":0.001 }, - "wet_sand": { "elem2": "irradiated_sand_sediment", "chance": 0.0005 }, - "irradiated_wet_sand": { "elem2": "irradiated_sand_sediment", "chance": 0.0005 }, + "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_irradiated_glass", - category: "Irradiated", + stateHigh: "molten_radioactive_glass", + category: "Radioactive", state: "solid", density: 1602, - breakInto: "irradiated_sand", + breakInto: "radioactive_sand", tick: function(pixel) { - sedimentation(pixel,sandstoneLithificationElements,"irradiated_sandstone") + sedimentation(pixel,sandstoneLithificationElements,"radioactive_sandstone") }, } - elements.irradiated_sandstone = { + elements.radioactive_sandstone = { color: ["#85b357", "#b5d177", "#9cd184", "#7bc25f"], behavior: behaviors.RAD_WALL, tempHigh: 1500, - stateHigh: "molten_irradiated_glass", - category: "Irradiated", + stateHigh: "molten_radioactive_glass", + category: "Radioactive", state: "solid", density: 2323, //wide range hardness: 0.5, - breakInto: "irradiated_sand", + breakInto: "radioactive_sand", } - elements.irradiated_water = { + elements.radioactive_water = { color: "#85cf57", behavior: behaviors.RAD_LIQUID, tempHigh: 100, stateHigh: ["rad_steam","rad_steam","fallout"], tempLow: -5, - stateLow: "irradiated_ice", - category: "Irradiated", + stateLow: "radioactive_ice", + category: "Radioactive", heatCapacity: 4.184, reactions: { - "water": { elem1: "water", elem2: "irradiated_water", chance:0.05 }, //swap + "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": "irradiated_dirt", // Second element transforms into; in this case, dirt turns to mud + "elem2": "radioactive_dirt", // Second element transforms into; in this case, dirt turns to mud }, - "sand": { "elem1": null, "elem2": "irradiated_wet_sand", }, - "wet_sand": { "elem1": "irradiated_sandy_water", "elem2": ["irradiated_wet_sand","irradiated_wet_sand","irradiated_wet_sand","irradiated_wet_sand","irradiated_wet_sand",null], chance: 0.01 }, - "irradiated_wet_sand": { "elem1": "irradiated_sandy_water", "elem2": ["irradiated_wet_sand","irradiated_wet_sand","irradiated_wet_sand","irradiated_wet_sand","irradiated_wet_sand",null], chance: 0.01 }, + "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": "irradiated_wet_sand", "chance": 0.00035 }, + "rock": { "elem2": "radioactive_wet_sand", "chance": 0.00035 }, //"ruins": { "elem2": "rock", "chance": 0.00035 }, - "mudstone": { "elem2": "irradiated_mud", "chance": 0.00035 }, - "irradiated_mudstone": { "elem2": "irradiated_mud", "chance": 0.00035 }, - "packed_sand": { "elem2": "irradiated_wet_sand", "chance": 0.00035 }, - "irradiated_packed_sand": { "elem2": "irradiated_wet_sand", "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 }, @@ -1498,85 +1529,96 @@ Proper classification of limestone within these code comments } elements.rad_steam.behavior = behaviors.RAD_GAS; - elements.rad_steam.stateLow = "irradiated_water"; + elements.rad_steam.stateLow = "radioactive_water"; elements.rad_cloud.behavior = [ "XX|XX|XX", - "XX|CH:fallout,radiation,irradiated_water%0.025|M1%2.5 AND BO", + "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.irradiated_permafrost = { + elements.radioactive_permafrost = { color: ["#51613d","#495234","#3b4a30","#4a4f35"], behavior: behaviors.RAD_SUPPORT, temp: -50, tempHigh: 10, - stateHigh: "irradiated_mudstone", - category: "Irradiated", + stateHigh: "radioactive_mudstone", + category: "Radioactive", state: "solid", density: 700, }; - elements.irradiated_mudstone = { + 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", + density: 1200, + } + + elements.radioactive_mudstone = { color: "#4f5e25", behavior: behaviors.RAD_SUPPORT, tempHigh:1200, - stateHigh: "molten_irradiated_dirt", + stateHigh: "molten_radioactive_dirt", tempLow: -50, - stateLow: "irradiated_permafrost", - category: "Irradiated", + stateLow: "radioactive_permafrost", + category: "Radioactive", state: "solid", density: 1250, - breakInto: "irradiated_dirt", + breakInto: "radioactive_dirt", }; - elements.irradiated_packed_sand = { + elements.radioactive_packed_sand = { color: "#79945c", behavior: behaviors.RAD_SUPPORT, tempHigh: 1700, - stateHigh: "molten_irradiated_glass", - category: "Irradiated", + stateHigh: "molten_radioactive_glass", + category: "Radioactive", state: "solid", density: 1682, - breakInto: "irradiated_sand", + breakInto: "radioactive_sand", }; - elements.irradiated_ice = { + elements.radioactive_ice = { color: "#b7e0b4", behavior: behaviors.RAD_WALL, temp: 0, tempHigh: 5, - stateHigh: "irradiated_water", + stateHigh: "radioactive_water", category: "solids", state: "solid", density: 917, - breakInto: "irradiated_snow", + breakInto: "radioactive_snow", }; - elements.irradiated_snow = { + elements.radioactive_snow = { color: "#d5f2d3", behavior: behaviors.RAD_POWDER, temp: 0, tempHigh: 5, tempLow: -100, - stateLow: "irradiated_packed_snow", - stateHigh: "irradiated_water", - category: "Irradiated", + stateLow: "radioactive_packed_snow", + stateHigh: "radioactive_water", + category: "Radioactive", state: "solid", density: 100, }; - elements.irradiated_packed_snow = { + elements.radioactive_packed_snow = { color: "#a7d4a3", behavior: behaviors.RAD_SUPPORTPOWDER, temp: 0, tempHigh: 20, tempLow: -200, - stateLow: "irradiated_ice", - stateHigh: "irradiated_water", - category: "Irradiated", + stateLow: "radioactive_ice", + stateHigh: "radioactive_water", + category: "Radioactive", state: "solid", density: 400, hidden: true, @@ -1586,10 +1628,10 @@ Proper classification of limestone within these code comments color: ["#2d6e31","#416e21"], behavior: [ "XX|XX|XX", - "XX|CH:fallout,radiation,irradiated_snow%0.025|M1%2.5 AND BO", + "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:"Irradiated", + category:"Radioactive", hidden: true, state: "gas", density: 0.5, @@ -1610,7 +1652,7 @@ Proper classification of limestone within these code comments "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:"Irradiated", + category:"Radioactive", hidden: true, state: "gas", density: 0.5, @@ -1619,55 +1661,55 @@ Proper classification of limestone within these code comments stateHigh: "rad_cloud", }; - elements.irradiated_rock = { + elements.radioactive_rock = { color: ["#768063","#444f3f","#7a9476"], behavior: behaviors.RAD_POWDER, tempHigh: 950, - stateHigh: "irradiated_magma", - category: "Irradiated", + stateHigh: "radioactive_magma", + category: "Radioactive", state: "solid", density: 2550, hardness: 0.5, - breakInto: ["irradiated_sand","irradiated_gravel"], + breakInto: ["radioactive_sand","radioactive_gravel"], }; - elements.irradiated_gravel = { + elements.radioactive_gravel = { color: ["#d1e3c8","#a6b090","#657360","#4d523f"], behavior: behaviors.RAD_POWDER, - category: "Irradiated", + category: "Radioactive", tempHigh: 950, - stateHigh: "irradiated_magma", + stateHigh: "radioactive_magma", state: "solid", density: 1680, hardness: 0.2, - breakInto: "irradiated_sand", + breakInto: "radioactive_sand", }; - elements.irradiated_basalt = { + elements.radioactive_basalt = { color: ["#262e20","#23331f","#3f4235"], behavior: behaviors.RAD_STURDYPOWDER, tempHigh: 1262.5, - stateHigh: "irradiated_magma", - category: "Irradiated", + stateHigh: "radioactive_magma", + category: "Radioactive", state: "solid", density: 3000, hardness: 0.65, - breakInto: "irradiated_gravel", + breakInto: "radioactive_gravel", }; - elements.irradiated_magma = { + elements.radioactive_magma = { color: ["#ff9100","#ffae00","#ff8400"], behavior: behaviors.RAD_MOLTEN, reactions: { - "ice": { "elem1": "irradiated_basalt" }, - "irradiated_ice": { "elem1": "irradiated_basalt" }, - "magma": { "elem1":"magma", "elem2":"irradiated_magma", "chance":0.0005, "oneway":true }, + "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: ["irradiated_basalt","irradiated_basalt","irradiated_basalt","irradiated_rock"], + stateLow: ["radioactive_basalt","radioactive_basalt","radioactive_basalt","radioactive_rock"], viscosity: 5000, - category: "Irradiated", + category: "Radioactive", state: "liquid", density: 2725, }; @@ -1680,7 +1722,7 @@ Proper classification of limestone within these code comments var twentiethOfTemp = pixel.temp / 20; var roundOf20th = Math.round(twentiethOfTemp); var boundedR20 = Math.max(1,Math.min(roundOf20th,11)); - transformAround(pixel,boundedR20,irradiatedObject) + transformAround(pixel,boundedR20,radioactiveObject) }, category:"machines", insulate: true, @@ -1693,7 +1735,7 @@ Proper classification of limestone within these code comments var twentiethOfTemp = pixel.temp / 20; var roundOf20th = Math.round(twentiethOfTemp); var boundedR20 = Math.max(1,Math.min(roundOf20th,11)); - transformAround(pixel,boundedR20,irradiatedObject,reverse=true) + transformAround(pixel,boundedR20,radioactiveObject,reverse=true) }, category:"machines", insulate: true, @@ -1705,7 +1747,7 @@ Proper classification of limestone within these code comments behavior: behaviors.RAD_LIQUID, tick: function(pixel) { for(i = 0; i < adjacentCoords.length; i++) { - transformAdjacent(pixel,irradiatedObject) + transformAdjacent(pixel,radioactiveObject) } }, //Becomes rainbow sand by water or poison, as well as by protocite, or bio-ooze @@ -1726,47 +1768,47 @@ Proper classification of limestone within these code comments //Inter-mod compatibility if(enabledMods.includes("mods/some_tf_liquids.js")) { - elements.irradiated_basalt_gravel = { + elements.radioactive_basalt_gravel = { color: ["#394d37", "#3b452f", "#3f452a", "#2d3d2c"], behavior: behaviors.RAD_POWDER, tempHigh: 1262.5, - stateHigh: "irradiated_magma", - category: "Irradiated", + stateHigh: "radioactive_magma", + category: "Radioactive", state: "solid", density: 1975, hardness: 0.26, } - elements.irradiated_basalt.breakInto = "irradiated_basalt_gravel"; + elements.radioactive_basalt.breakInto = "radioactive_basalt_gravel"; }; //Worldgen preset for testing - worldgentypes.irradiated_sandstone_test_ocean = { + worldgentypes.radioactive_sandstone_test_ocean = { layers: [ - [0.9, "irradiated_wet_sand", 0.2], - [0.9, "irradiated_sand", 0.2], - [0.8, "irradiated_sandy_water", 0.7], - [0.25, "irradiated_water"], - [0.1, "irradiated_sand", 0.1], + [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, "irradiated_gravel", 0.2], - [0.1, "irradiated_wet_sand"], - [0.03, "irradiated_gravel", 0.5], - [0.03, "irradiated_rock"], - [0, "irradiated_basalt"], + [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 = ["irradiated_water", "irradiated_wet_sand"] + waterIrradiationExclusionArray = ["radioactive_water", "radioactive_wet_sand"] filteredWaterIrradiationArray = Object.keys(elements).filter(function(e) { - return elements[e].category === "Irradiated" && (!waterIrradiationExclusionArray.includes(e)); + return elements[e].category === "Radioactive" && (!waterIrradiationExclusionArray.includes(e)); }); for(i = 0; i < filteredWaterIrradiationArray.length; i++) { - elements.water.reactions[filteredWaterIrradiationArray[i]] = { "elem1":"irradiated_water", chance: 0.01 } + elements.water.reactions[filteredWaterIrradiationArray[i]] = { "elem1":"radioactive_water", chance: 0.01 } };*/ //Generation @@ -1895,11 +1937,11 @@ Proper classification of limestone within these code comments [0.82, "fallout", 0.4], [0.7, "liquid_irradium", 0.05], [0.7, "dead_plant", 0.12], - [0.55, "irradiated_dirt"], - [0.45, "irradiated_rock"], + [0.55, "radioactive_dirt"], + [0.45, "radioactive_rock"], [0.25, "uranium", 0.4], - [0.35, "irradiated_rock", 0.5], - [0.3, "irradiated_gravel", 0.5], + [0.35, "radioactive_rock", 0.5], + [0.3, "radioactive_gravel", 0.5], [0.2, "uranium", 0.2], [0.05, "rock"], [0, "basalt"], @@ -1933,23 +1975,23 @@ Proper classification of limestone within these code comments ] }; - //Irradiated Desert + //Radioactive Desert //Main preset worldgentypes.nuclear_wasteland_desert = { layers: [ [0.97, "fallout", 0.4], - [0.95, "irradiated_gravel", 0.6], + [0.95, "radioactive_gravel", 0.6], [0.65, "liquid_irradium", 0.01], [0.65, "cancer", 0.02], [0.65, "bone", 0.02], - [0.65, "irradiated_sand"], + [0.65, "radioactive_sand"], [0.55, "cancer", 0.01], [0.55, "bone", 0.01], - [0.3, "irradiated_sandstone"], - [0.05, "irradiated_rock"], - [-0.78, "irradiated_basalt"] + [0.3, "radioactive_sandstone"], + [0.05, "radioactive_rock"], + [-0.78, "radioactive_basalt"] ], temperature: -13 }; From 02f897e1cdd2faec7dfb22cf7d31bf6f5802b683 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Wed, 7 Dec 2022 13:30:09 -0500 Subject: [PATCH 15/49] corresponding rename in gg --- mods/glenn_gases.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mods/glenn_gases.js b/mods/glenn_gases.js index 4bc05b93..da1dd6d9 100644 --- a/mods/glenn_gases.js +++ b/mods/glenn_gases.js @@ -385,27 +385,27 @@ runAfterLoad(function() { elements.coal.breakInto = "coal_dust" } if(enabledMods.includes("mods/the_ground.js")) { - elements.irradiated_rock_dust = { + elements.radioactive_rock_dust = { color: "#839e78", behavior: behaviors.RAD_GAS, reactions: { - "water": {"elem1": "irradiated_water", "elem2": null } + "water": {"elem1": "radioactive_water", "elem2": null } }, category: "gases", density: 2.45, state: "gas", tempHigh: 950, - stateHigh: [null,null,null,null,"irradiated_magma"], + stateHigh: [null,null,null,null,"radioactive_magma"], } - elements.irradiated_rock.breakInto.push("irradiated_rock_dust") + 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")) { - elements.irradiated_rock_dust.tempHigh = 3000 - elements.irradiated_rock_dust.stateHigh = "vaporized_rock" + elements.radioactive_rock_dust.tempHigh = 3000 + elements.radioactive_rock_dust.stateHigh = "vaporized_rock" } } }); From 55b8eb04df8a86f1dceb5d811fc9812c8270ec1b Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Wed, 7 Dec 2022 13:37:16 -0500 Subject: [PATCH 16/49] hiatus but not b4 upd8ing rad obj --- mods/the_ground.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/mods/the_ground.js b/mods/the_ground.js index 3540dd1e..e6fedb75 100644 --- a/mods/the_ground.js +++ b/mods/the_ground.js @@ -1229,6 +1229,7 @@ Proper classification of limestone within these code comments radioactiveObject = { dirt: "radioactive_dirt", + dry_dirt: "radioactive_dry_dirt", molten_dirt: "molten_radioactive_dirt", glass: "radioactive_glass", molten_glass: "molten_radioactive_glass", @@ -1238,6 +1239,7 @@ Proper classification of limestone within these code comments 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", @@ -1253,6 +1255,21 @@ Proper classification of limestone within these code comments 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 From 74a9abb6906390c1651d03b6f3eda530892f0a66 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Wed, 7 Dec 2022 15:37:41 -0500 Subject: [PATCH 17/49] fix dirt-dry dirt inerface Shit myself today, aah Let it go today (to the tune of Olivia Hye - Egoist) --- mods/the_ground.js | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mods/the_ground.js b/mods/the_ground.js index e6fedb75..87a9f83e 100644 --- a/mods/the_ground.js +++ b/mods/the_ground.js @@ -1145,12 +1145,6 @@ Proper classification of limestone within these code comments 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 } - if(!elements.dirt.reactions) { - elements.dirt.reactions = {}; - }; - elements.dirt.reactions.dry_dirt = { elem1: "dry_dirt", elem2: "dirt", chance: 0.03 } - elements.dirt.reactions.radioactive_dry_dirt = { elem1: "radioactive_dry_dirt", elem2: "radioactive_dirt", chance: 0.03 } - //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. From bb7a18b6f9410180768e4c46f9ba9a55bf455484 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Thu, 8 Dec 2022 11:02:32 -0500 Subject: [PATCH 18/49] move circle functions out to library (1) --- mods/cpt_alt.js | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/mods/cpt_alt.js b/mods/cpt_alt.js index 0e398a29..59ce90ad 100644 --- a/mods/cpt_alt.js +++ b/mods/cpt_alt.js @@ -5,36 +5,6 @@ var libraryMod = "mods/code_library.js"; if(enabledMods.includes(explodeAtPlusMod) && enabledMods.includes(libraryMod)) { actExcludedElements = ["wall","alt_controllable_pixel"]; - function breakCircle(x,y,radius,respectHardness=false,changeTemp=false,defaultBreakIntoDust=false) { - var coords = circleCoords(x,y,radius); - for(i = 0; i < coords.length; i++) { - coordX = coords[i].x; - coordY = coords[i].y; - if(!isEmpty(coordX,coordY,true)) { - var pixel = pixelMap[coordX][coordY]; - respectHardness ? tryBreak(pixel,changeTemp,defaultBreakIntoDust) : breakPixel(pixel,changeTemp,defaultBreakIntoDust); - }; - }; - }; - - function fillCircle(element,x,y,radius,overwrite=false) { - var coords = circleCoords(x,y,radius); - var newElement = element; - if(Array.isArray(newElement)) { - newElement = newElement[Math.floor(Math.random() * newElement.length)]; - }; - for(i = 0; i < coords.length; i++) { - coordX = coords[i].x; - coordY = coords[i].y; - if(overwrite && !isEmpty(coordX,coordY,true)) { - changePixel(pixelMap[coordX][coordY],element); - }; - if(isEmpty(coordX,coordY,false)) { - createPixel(element,coordX,coordY); - }; - }; - }; - function actTryMove(pixel,x,y) { if(!tryMove(pixel,x,y)) { if(outOfBounds(x,y)) { From 1e4dbcd62304d91db5f5c6f413b9a6870551ddc2 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Thu, 8 Dec 2022 11:03:20 -0500 Subject: [PATCH 19/49] move circle functions out to library (2) also a logic fix --- mods/code_library.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/mods/code_library.js b/mods/code_library.js index 183e0fb4..b9f5a178 100644 --- a/mods/code_library.js +++ b/mods/code_library.js @@ -410,7 +410,7 @@ }; }; } else if(typeof(color) === "object") { - if(!color.r || !color.g || !color.b) { + if(typeof(color.r) === "undefined" || typeof(color.g) === "undefined" || typeof(color.b) === "undefined") { throw new Error("Color must be of the form {r: red, g: green, b: blue}"); }; @@ -1094,6 +1094,38 @@ }; }; +//World + + function breakCircle(x,y,radius,respectHardness=false,changeTemp=false,defaultBreakIntoDust=false) { + var coords = circleCoords(x,y,radius); + for(i = 0; i < coords.length; i++) { + coordX = coords[i].x; + coordY = coords[i].y; + if(!isEmpty(coordX,coordY,true)) { + var pixel = pixelMap[coordX][coordY]; + respectHardness ? tryBreak(pixel,changeTemp,defaultBreakIntoDust) : breakPixel(pixel,changeTemp,defaultBreakIntoDust); + }; + }; + }; + + function fillCircle(element,x,y,radius,overwrite=false) { + var coords = circleCoords(x,y,radius); + var newElement = element; + if(Array.isArray(newElement)) { + newElement = newElement[Math.floor(Math.random() * newElement.length)]; + }; + for(i = 0; i < coords.length; i++) { + coordX = coords[i].x; + coordY = coords[i].y; + if(overwrite && !isEmpty(coordX,coordY,true)) { + changePixel(pixelMap[coordX][coordY],element); + }; + if(isEmpty(coordX,coordY,false)) { + createPixel(element,coordX,coordY); + }; + }; + }; + //Logic function xor(c1,c2) { From b7bb697f01e03ed54d53522d4f35a12bcb2ef559 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Thu, 8 Dec 2022 11:20:31 -0500 Subject: [PATCH 20/49] numbered bomb support --- mods/more_bombs.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/mods/more_bombs.js b/mods/more_bombs.js index 5d48e662..1ef6f9f5 100644 --- a/mods/more_bombs.js +++ b/mods/more_bombs.js @@ -326,7 +326,9 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) }; //genfunc - function generateBomb(bombElements,isAfterScriptLoading=false) {//it can be a single element, though + function generateBomb(bombElements,isAfterScriptLoading=false,bombNumber=1) {//it can be a single element, though + bombNumber = Math.max(0,bombNumber); + //To specify an array bomb, have the array be inside another array. /*For reasons related to how element colors are loaded, if this function is being run from a JS mod file, isAfterScriptLoading should be false. Otherwise, you'll get TypeErrors for some reason when trying to place your bomb. If this is being run after the game has loaded (e.g. in the console), @@ -403,9 +405,14 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) }; elementOfBomb = tryJoin(elementOfBomb,","); + descElement = tryJoin(elementOfBomb,", "); //console.log(elementOfBomb); + if(bombNumber !== 1) { + bombName += `_${bombNumber}`; + }; + if(!elementExists(bombName)) { elements[bombName] = { color: startColor, @@ -413,11 +420,12 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) flippableX: true, colorObject: newColorObject, behavior: [ - ["XX",`EX:10>${elementOfBomb}`,"XX"], + ["XX",`EX:${5*(bombNumber+1)}>${elementOfBomb}`,"XX"], ["XX","XX","XX"], - ["M2",`M1 AND EX:10>${elementOfBomb}`,"M2"] + ["M2",`M1 AND EX:${5*(bombNumber+1)}>${elementOfBomb}`,"M2"] ], category: "auto_bombs", + desc: `Explodes into ${descElement}
Radius: ${5*(bombNumber+1)}`, temp: firstTemp, excludeRandom: true, }; From 9f512db22436178ca53468596cf6f5bd16b56efb Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Thu, 8 Dec 2022 11:21:27 -0500 Subject: [PATCH 21/49] bomb numbers for prompt number of 1 = radius of 10 number of 2 = radius of 15 number of 3 = radius of 20 ... default: 1 --- mods/generator_prompt.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mods/generator_prompt.js b/mods/generator_prompt.js index 61f88835..c8b2bfc8 100644 --- a/mods/generator_prompt.js +++ b/mods/generator_prompt.js @@ -65,7 +65,10 @@ function generatorPrompt() { generateCloud(elements,true); break; case "bomb": - generateBomb(elements,true); + var number = prompt(`Enter a bomb number (default: 1) + 1 corresponds to radius 10, 2 corresponds to radius 15, etc.`); + if(isNaN(parseFloat(number))) { number = 1 }; + generateBomb(elements,true,number); break; default: alert("An invalid type made it past the if statement. You shouldn't ever see this error."); From 6f7fd0e569539eb112014f846d6d5a3af31fff2c Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Thu, 8 Dec 2022 13:16:58 -0500 Subject: [PATCH 22/49] mlu --- mods/a_bundle_of_tests.js | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/mods/a_bundle_of_tests.js b/mods/a_bundle_of_tests.js index 0b5b0778..84c91cea 100644 --- a/mods/a_bundle_of_tests.js +++ b/mods/a_bundle_of_tests.js @@ -8,7 +8,7 @@ if(urlParams.get('loadTheModList') !== null || urlParams.get('ltml') !== null) { } if(loadTheModList) { - enabledMods = ["mods/code_library.js", "mods/adjustablepixelsize.js", "mods/boiling_rock.js", "mods/chalcopyrite.js", "mods/clone_liquid.js", "mods/conveyance.js", "mods/CrashTestDummy.js", "mods/crimson.js", "mods/delete_all_of_element.js", "mods/evenmoretemptools.js", "mods/extra_element_info.js", "mods/fairy_chain.js", "mods/fantastic_creatures.js", "mods/fey_and_more.js", "mods/glenn_gases.js", "mods/grav_mudstones.js", "mods/icb.js", "mods/ketchup_mod.js", "mods/laetium.js", "mods/liquid_energy.js", "mods/metals.js", "mods/minecraft.js", "mods/minesweeper.js", "mods/more_breaking.js", "mods/moreliquids.js", "mods/moretools.js", "mods/move_tools.js", "mods/nested_for_reaction_example.js", "mods/Neutronium Mod.js", "mods/portal.js", "mods/pushers.js", "mods/rainbow_tests.js", "mods/random_elems.js", "mods/random_liquids.js", "mods/random_rocks.js", "mods/randomness.js", "mods/randomness_but_tick.js", "mods/randomness_but_tool.js", "mods/slag_fix.js", "mods/some_tf_liquids.js", "mods/structure_test.js", "mods/test.js", "mods/ticking_temp_stuff.js", "mods/time.js", "mods/toothpaste.js", "mods/troll.js", "mods/unhide.js", "mods/worldgen_test.js", "mods/page_color.js", "mods/invisible_wall.js", "mods/replace_all.js", "mods/bacteria_mod.js", "mods/controllable_pixel_test.js", "mods/fire_slime.js", "mods/bioooze.js", "mods/color_tools.js", "mods/cells.js", "mods/triggerable_random_powders.js", "mods/replace.js", "mods/change.js", "mods/prompt.js", "mods/miscible_psoup_and_birthpool.js", "mods/primordial_birthpool.js", "mods/liquid_void.js", "mods/solid_rock.js", "mods/invisible_dye.js", "mods/alcohol.js", "mods/a_bundle_of_tests.js", "mods/paint_event.js", "mods/amogus.js", "mods/chem.js", "mods/roseyiede.js", "mods/state_voids.js", "mods/the_ground.js", "mods/lone_urea.js", "mods/fwibblen.js", "mods/velocity.js", "mods/prop and prompt variables.js", "mods/prop.js", "mods/x_dependent_change_test.js", "mods/alkahest.js", "mods/tool_pixel_behavior.js", "mods/onTryMoveInto.js", "mods/human_edit.js", "mods/runAfterAutogen and onload restructure.js", "mods/explodeAtPlus.js", "mods/note_block.js", "mods/wirelike_test.js", "mods/no_random_grbs.js", "mods/bananas.js", "mods/iean.js", "mods/cpt_alt.js", "mods/code_library.js", "mods/cold fire revamp and doBurning edits.js", "mods/spouts.js", "mods/funny elements 2022-11-15.js", "mods/spouts.js", "mods/mobs.js", "mods/more_fairies.js", "mods/more_clouds.js", "mods/more_bombs.js", "https://cdn.jsdelivr.net/gh/DimpyRed/cancermod@c2c4fe40d0049c8b56bbbdb7203387778b55b05d/cancermelt.js"]; + enabledMods = ["mods/code_library.js","mods/adjustablepixelsize.js","mods/boiling_rock.js","mods/chalcopyrite.js","mods/clone_liquid.js","mods/conveyance.js","mods/CrashTestDummy.js","mods/crimson.js","mods/delete_all_of_element.js","mods/evenmoretemptools.js","mods/extra_element_info.js","mods/fairy_chain.js","mods/fantastic_creatures.js","mods/fey_and_more.js","mods/glenn_gases.js","mods/grav_mudstones.js","mods/icb.js","mods/iean.js","mods/ketchup_mod.js","mods/laetium.js","mods/liquid_energy.js","mods/metals.js","mods/minecraft.js","mods/minesweeper.js","mods/more_breaking.js","mods/moreliquids.js","mods/moretools.js","mods/move_tools.js","mods/nested_for_reaction_example.js","mods/Neutronium Mod.js","mods/portal.js","mods/pushers.js","mods/rainbow_tests.js","mods/random_elems.js","mods/random_liquids.js","mods/random_rocks.js","mods/randomness.js","mods/randomness_but_tick.js","mods/randomness_but_tool.js","mods/slag_fix.js","mods/some_tf_liquids.js","mods/structure_test.js","mods/test.js","mods/ticking_temp_stuff.js","mods/time.js","mods/toothpaste.js","mods/troll.js","mods/unhide.js","mods/worldgen_test.js","mods/page_color.js","mods/color_tools.js","mods/invisible_wall.js","mods/replace_all.js","mods/bacteria_mod.js","mods/controllable_pixel_test.js","mods/fire_slime.js","mods/bioooze.js","mods/color_tools.js","mods/cells.js","mods/triggerable_random_powders.js","mods/replace.js","mods/change.js","mods/prompt.js","mods/miscible_psoup_and_birthpool.js","mods/primordial_birthpool.js","mods/liquid_void.js","mods/solid_rock.js","mods/invisible_dye.js","mods/alcohol.js","mods/a_bundle_of_tests.js","mods/paint_event.js","mods/amogus.js","mods/chem.js","mods/roseyiede.js","mods/state_voids.js","mods/the_ground.js","mods/lone_urea.js","mods/fwibblen.js","mods/velocity.js","mods/prop and prompt variables.js","mods/prop.js","mods/x_dependent_change_test.js","mods/alkahest.js","mods/tool_pixel_behavior.js","mods/onTryMoveInto.js","mods/human_edit.js","mods/runAfterAutogen and onload restructure.js","mods/explodeAtPlus.js","mods/more_bombs.js","mods/note_block.js","mods/wirelike_test.js","mods/no_random_grbs.js","mods/bananas.js","mods/trapdoor.js","mods/apioforms.js","mods/cpt_alt.js","mods/more_fairies.js","mods/spouts.js","mods/mobs.js","mods/more_clouds.js","mods/funny elements 2022-11-15.js","mods/generator_prompt.js","mods/fire_mod.js","mods/test_4.js","mods/save_loading.js","mods/apioforms_pre.js","mods/cover_yourself_in.js","mods/fill_script.js","mods/find.js","mods/place_all_elements.js"]; localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); alert("Mod list loaded. Refresh the page without the loadTheModList query parameter."); console.log("Mod list loaded. Refresh the page without the loadTheModList query parameter."); @@ -312,6 +312,35 @@ elements.distance_display_anchor = { desc: `Distance display pixels get blue in its distance.`, }; +/* +blackObject = {r: 0, g: 0, b: 0}; +pinkObject = {r: 255, g: 148, b: 255}; + +elements.black_pink_test = { + color: ["#000000","#FF94FF"], + behavior: behaviors.WALL, + properties: { + offset: Math.floor(Math.random() * (Math.random() > 0.5 ? -1 : 1) * Math.random() * 15) + }, + tick: function(pixel) { + if(typeof(pixel.offset) !== "number") { + pixel.offset = Math.floor(Math.random() * (Math.random() > 0.5 ? -1 : 1) * Math.random() * 15); + }; + + var fraction = Math.min(1.0,Math.max(0.0,scale(pixel.y,1,height-1,0.0,1.0))); + + var color = averageColorObjects(pinkObject,blackObject,fraction); + + var offsettedColor = lightenColor(color,pixel.offset,"rgb"); + + pixel.color = offsettedColor; + }, + category: "machines", + state: "solid", + desc: "blackpink in your area", +}; +*/ + function updateDistanceDisplayDescription() { elements.distance_display.desc = `It gets more blue the closer it gets to a distance display anchor. The current scale factor is ${distanceScale} (bigger number = smaller blue radius). Click here to open the scale prompt.
Note: Info pages do not update automatically and must be closed and reopened to show the changed scale.`; }; From 5016359fb261863fe73f2f383c13c2d670b3b320 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Thu, 8 Dec 2022 13:26:05 -0500 Subject: [PATCH 23/49] made rad fire more rady --- mods/fire_mod.js | 233 ++++++++--------------------------------------- 1 file changed, 36 insertions(+), 197 deletions(-) diff --git a/mods/fire_mod.js b/mods/fire_mod.js index f6f1c2cc..28471b3b 100644 --- a/mods/fire_mod.js +++ b/mods/fire_mod.js @@ -259,10 +259,17 @@ elements.rad_fire = { //this is BBB pixel.temp++; }; + if(Math.random() < 0.05) { //5%/t to radify + if(typeof(transformAdjacent) === "function" && typeof(radioactiveObject) === "object") { + transformAdjacent(pixel,radioactiveObject); + }; + }; + var move1Spots = [[-1,-1],[0,-1],[1,-1]]; var move2Spots = [[-1,0],[0,1],[1,0]]; var randomMove1 = move1Spots[Math.floor(Math.random() * move1Spots.length)]; + if(!tryMove(pixel, pixel.x+randomMove1[0], pixel.y+randomMove1[1])) { //console.log((pixel.x+randomMove1[0]) + " " + (pixel.y+randomMove1[1])) var newPixel = null; @@ -283,10 +290,6 @@ elements.rad_fire = { //this is BBB doDefaults(pixel); }, reactions: { //fire + radiation reacts - //Spreading - "liquid_fire": { "elem2":"liquid_rad_fire", "chance":0.4 }, - "fire": { "elem2":"rad_fire", "chance":0.4 }, - "smoke": { "elem2":"rad_smoke", "chance":0.4 }, //Merged water-radiation reactions, plus altered seltzer "water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, "steam": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, @@ -295,69 +298,7 @@ elements.rad_fire = { //this is BBB "salt_water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, "sugar_water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, "seltzer": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, - //Radiation reactions - "bubble": { "elem2":"rad_steam", "chance":0.4 }, - "foam": { "elem2":"rad_steam", "chance":0.4 }, - "ice": { "elem2":"rad_steam", "chance":0.4 }, - "snow": { "elem2":"rad_steam", "chance":0.4 }, - "packed_snow": { "elem2":"rad_steam", "chance":0.4 }, - "slime": { "elem2":"rad_steam", "chance":0.4 }, - "milk": { "elem2":"cheese", "chance":0.4 }, - "permafrost": { "elem1":"rad_steam", "elem2":"dirt", "chance":0.4 }, - "mud": { "elem1":"rad_steam", "elem2":"dirt", "chance":0.4 }, - "wet_sand": { "elem1":"rad_steam", "elem2":"sand", "chance":0.4 }, - "clay": { "elem1":"rad_steam", "elem2":"clay_soil", "chance":0.4 }, - "slaked_lime": { "elem1":"rad_steam", "elem2":"limestone", "chance":0.4 }, - "rain_cloud": { "elem2":"rad_cloud", "chance":0.4 }, - "snow_cloud": { "elem2":"rad_cloud", "chance":0.4 }, - "hail_cloud": { "elem2":"rad_cloud", "chance":0.4 }, - "plant": { "elem2":"dead_plant", "chance":0.4 }, - "frozen_plant": { "elem2":"dead_plant", "chance":0.4 }, - "grass": { "elem2":["dead_plant","straw","grass_seed","wheat_seed"], "chance":0.4 }, - "algae": { "elem2":["mushroom_spore","lichen","yeast"], "chance":0.4 }, - "mushroom_spore": { "elem2":["lichen","yeast"], "chance":0.4 }, - "mushroom_cap": { "elem2":["lichen","plant"], "chance":0.4 }, - "mushroom_stalk": { "elem2":["lichen","yeast"], "chance":0.4 }, - "mushroom_gill": { "elem2":["lichen","yeast"], "chance":0.4 }, - "flea": { "elem2":["ash","ant","termite"], "chance":0.4 }, - "ant": { "elem2":["ash","flea","termite"], "chance":0.4 }, - "termite": { "elem2":["ash","flea","ant"], "chance":0.4 }, - "fly": { "elem2":["ash","firefly","bee"], "chance":0.4 }, - "bee": { "elem2":["ash","firefly","fly"], "chance":0.4 }, - "firefly": { "elem2":["ash","bee","fly"], "chance":0.4 }, - "frog": { "elem2":["ash","meat","rotten_meat","cooked_meat"], "chance":0.4 }, - "tadpole": { "elem2":["frog","worm",null], "chance":0.4 }, - "fish": { "elem2":["ash","meat","rotten_meat","cooked_meat"], "chance":0.4 }, - "rat": { "elem2":["ash","meat","rotten_meat","cooked_meat","plague"], "chance":0.4 }, - "bird": { "elem2":["ash","meat","rotten_meat","cooked_meat","plague"], "chance":0.4 }, - "bone": { "elem2":["calcium","calcium","calcium","cancer"], "chance":0.4 }, - "meat": { "elem2":["ash","rotten_meat","cooked_meat"], "chance":0.4 }, - "rotten_meat": { "elem2":["ash","meat","cooked_meat"], "chance":0.4 }, - "cooked_meat": { "elem2":["ash","rotten_meat"], "chance":0.4 }, - "bamboo": { "elem2":["wood","plant","bamboo_plant"], "chance":0.4 }, - "bamboo_plant": { "elem2":["wood","plant","bamboo"], "chance":0.4 }, - "sapling": { "elem2":["wood","plant","tree_branch"], "chance":0.4 }, - "tree_branch": { "elem2":["wood","plant","sapling"], "chance":0.4 }, - "grass_seed": { "elem2":["straw","wheat_seed"], "chance":0.4 }, - "lichen": { "elem2":"algae", "chance":0.4 }, - "yeast": { "elem2":["algae","mushroom_spore","lichen"], "chance":0.4 }, - "wheat_seed": { "elem2":["straw","wheat","grass_seed"], "chance":0.4 }, - "flower_seed": { "elem2":["straw","grass","pistil","petal"], "chance":0.4 }, - "pistil": { "elem2":["straw","grass","flower_seed","petal"], "chance":0.4 }, - "petal": { "elem2":["straw","grass","flower_seed","pistil"], "chance":0.4 }, - "vine": { "elem1":["vine"], "chance":0.4 }, - "worm": { "elem2":"ash", "chance":0.4 }, - "corn": { "elem2":"popcorn", "chance":0.4 }, - "corn_seed": { "elem2":"corn", "chance":0.4 }, - "potato": { "elem2":"potato_seed", "chance":0.4 }, - "potato_seed": { "elem2":"potato", "chance":0.4 }, - "slug": { "elem2":"slime", "chance":0.4 }, - "snail": { "elem2":"slime", "chance":0.4 }, - "cell": { "elem2":"cancer", "chance":0.4 }, - "blood": { "elem2":["infection","cancer"], "chance":0.4 }, - "antibody": { "elem2":"cancer", "chance":0.4 }, - "infection": { "elem2":"cancer", "chance":0.4 }, - "cancer": { "elem2":null, "chance":0.1 }, + //Radiation reactions added programatically }, temp:800, tempLow:150, @@ -390,6 +331,12 @@ elements.rad_smoke = { pixel.temp++; }; + if(Math.random() < 0.04) { //4%/t to radify + if(typeof(transformAdjacent) === "function" && typeof(radioactiveObject) === "object") { + transformAdjacent(pixel,radioactiveObject); + }; + }; + var move1Spots = [[0,-1],[1,0],[0,1],[-1,0]]; var move2Spots = [[-1,-1],[1,-1],[1,1],[-1,1]]; @@ -426,69 +373,7 @@ elements.rad_smoke = { "acid_cloud": { "elem1": "pyrocumulus", "chance":0.05, "y":[0,12], "setting":"clouds" }, "fire_cloud": { "elem1": "pyrocumulus", "chance":0.05, "y":[0,12], "setting":"clouds" }, "pyrocumulus": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" },*/ - //Radiation reactions - "bubble": { "elem2":"rad_steam", "chance":0.4 }, - "foam": { "elem2":"rad_steam", "chance":0.4 }, - "ice": { "elem2":"rad_steam", "chance":0.4 }, - "snow": { "elem2":"rad_steam", "chance":0.4 }, - "packed_snow": { "elem2":"rad_steam", "chance":0.4 }, - "slime": { "elem2":"rad_steam", "chance":0.4 }, - "milk": { "elem2":"cheese", "chance":0.4 }, - "permafrost": { "elem1":"rad_steam", "elem2":"dirt", "chance":0.4 }, - "mud": { "elem1":"rad_steam", "elem2":"dirt", "chance":0.4 }, - "wet_sand": { "elem1":"rad_steam", "elem2":"sand", "chance":0.4 }, - "clay": { "elem1":"rad_steam", "elem2":"clay_soil", "chance":0.4 }, - "slaked_lime": { "elem1":"rad_steam", "elem2":"limestone", "chance":0.4 }, - "rain_cloud": { "elem2":"rad_cloud", "chance":0.4 }, - "snow_cloud": { "elem2":"rad_cloud", "chance":0.4 }, - "hail_cloud": { "elem2":"rad_cloud", "chance":0.4 }, - "plant": { "elem2":"dead_plant", "chance":0.4 }, - "frozen_plant": { "elem2":"dead_plant", "chance":0.4 }, - "grass": { "elem2":["dead_plant","straw","grass_seed","wheat_seed"], "chance":0.4 }, - "algae": { "elem2":["mushroom_spore","lichen","yeast"], "chance":0.4 }, - "mushroom_spore": { "elem2":["lichen","yeast"], "chance":0.4 }, - "mushroom_cap": { "elem2":["lichen","plant"], "chance":0.4 }, - "mushroom_stalk": { "elem2":["lichen","yeast"], "chance":0.4 }, - "mushroom_gill": { "elem2":["lichen","yeast"], "chance":0.4 }, - "flea": { "elem2":["ash","ant","termite"], "chance":0.4 }, - "ant": { "elem2":["ash","flea","termite"], "chance":0.4 }, - "termite": { "elem2":["ash","flea","ant"], "chance":0.4 }, - "fly": { "elem2":["ash","firefly","bee"], "chance":0.4 }, - "bee": { "elem2":["ash","firefly","fly"], "chance":0.4 }, - "firefly": { "elem2":["ash","bee","fly"], "chance":0.4 }, - "frog": { "elem2":["ash","meat","rotten_meat","cooked_meat"], "chance":0.4 }, - "tadpole": { "elem2":["frog","worm",null], "chance":0.4 }, - "fish": { "elem2":["ash","meat","rotten_meat","cooked_meat"], "chance":0.4 }, - "rat": { "elem2":["ash","meat","rotten_meat","cooked_meat","plague"], "chance":0.4 }, - "bird": { "elem2":["ash","meat","rotten_meat","cooked_meat","plague"], "chance":0.4 }, - "bone": { "elem2":["calcium","calcium","calcium","cancer"], "chance":0.4 }, - "meat": { "elem2":["ash","rotten_meat","cooked_meat"], "chance":0.4 }, - "rotten_meat": { "elem2":["ash","meat","cooked_meat"], "chance":0.4 }, - "cooked_meat": { "elem2":["ash","rotten_meat"], "chance":0.4 }, - "bamboo": { "elem2":["wood","plant","bamboo_plant"], "chance":0.4 }, - "bamboo_plant": { "elem2":["wood","plant","bamboo"], "chance":0.4 }, - "sapling": { "elem2":["wood","plant","tree_branch"], "chance":0.4 }, - "tree_branch": { "elem2":["wood","plant","sapling"], "chance":0.4 }, - "grass_seed": { "elem2":["straw","wheat_seed"], "chance":0.4 }, - "lichen": { "elem2":"algae", "chance":0.4 }, - "yeast": { "elem2":["algae","mushroom_spore","lichen"], "chance":0.4 }, - "wheat_seed": { "elem2":["straw","wheat","grass_seed"], "chance":0.4 }, - "flower_seed": { "elem2":["straw","grass","pistil","petal"], "chance":0.4 }, - "pistil": { "elem2":["straw","grass","flower_seed","petal"], "chance":0.4 }, - "petal": { "elem2":["straw","grass","flower_seed","pistil"], "chance":0.4 }, - "vine": { "elem1":["vine"], "chance":0.4 }, - "worm": { "elem2":"ash", "chance":0.4 }, - "corn": { "elem2":"popcorn", "chance":0.4 }, - "corn_seed": { "elem2":"corn", "chance":0.4 }, - "potato": { "elem2":"potato_seed", "chance":0.4 }, - "potato_seed": { "elem2":"potato", "chance":0.4 }, - "slug": { "elem2":"slime", "chance":0.4 }, - "snail": { "elem2":"slime", "chance":0.4 }, - "cell": { "elem2":"cancer", "chance":0.4 }, - "blood": { "elem2":["infection","cancer"], "chance":0.4 }, - "antibody": { "elem2":"cancer", "chance":0.4 }, - "infection": { "elem2":"cancer", "chance":0.4 }, - "cancer": { "elem2":null, "chance":0.1 }, + //Radiation reactions added programatically }, temp: 134, tempHigh: 595, @@ -698,6 +583,12 @@ runAfterLoad(function() { pixel.temp++; }; + if(Math.random() < 0.06) { //6%/t to radify + if(typeof(transformAdjacent) === "function" && typeof(radioactiveObject) === "object") { + transformAdjacent(pixel,radioactiveObject); + }; + }; + var move1Spots = [[-1,1],[0,1],[1,1]]; var move2Spots = [[-1,0],[0,-1],[1,0]]; @@ -722,10 +613,6 @@ runAfterLoad(function() { doDefaults(pixel); }, reactions: { //fire + radiation reacts - //Spreading - "liquid_fire": { "elem2":"liquid_rad_fire", "chance":0.6 }, - "fire": { "elem2":"rad_fire", "chance":0.6 }, - "smoke": { "elem2":"rad_smoke", "chance":0.6 }, //Merged water-radiation reactions, plus altered seltzer "water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, "steam": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, @@ -734,69 +621,7 @@ runAfterLoad(function() { "salt_water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, "sugar_water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, "seltzer": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, - //Radiation reactions - "bubble": { "elem2":"rad_steam", "chance":0.4 }, - "foam": { "elem2":"rad_steam", "chance":0.4 }, - "ice": { "elem2":"rad_steam", "chance":0.4 }, - "snow": { "elem2":"rad_steam", "chance":0.4 }, - "packed_snow": { "elem2":"rad_steam", "chance":0.4 }, - "slime": { "elem2":"rad_steam", "chance":0.4 }, - "milk": { "elem2":"cheese", "chance":0.4 }, - "permafrost": { "elem1":"rad_steam", "elem2":"dirt", "chance":0.4 }, - "mud": { "elem1":"rad_steam", "elem2":"dirt", "chance":0.4 }, - "wet_sand": { "elem1":"rad_steam", "elem2":"sand", "chance":0.4 }, - "clay": { "elem1":"rad_steam", "elem2":"clay_soil", "chance":0.4 }, - "slaked_lime": { "elem1":"rad_steam", "elem2":"limestone", "chance":0.4 }, - "rain_cloud": { "elem2":"rad_cloud", "chance":0.4 }, - "snow_cloud": { "elem2":"rad_cloud", "chance":0.4 }, - "hail_cloud": { "elem2":"rad_cloud", "chance":0.4 }, - "plant": { "elem2":"dead_plant", "chance":0.4 }, - "frozen_plant": { "elem2":"dead_plant", "chance":0.4 }, - "grass": { "elem2":["dead_plant","straw","grass_seed","wheat_seed"], "chance":0.4 }, - "algae": { "elem2":["mushroom_spore","lichen","yeast"], "chance":0.4 }, - "mushroom_spore": { "elem2":["lichen","yeast"], "chance":0.4 }, - "mushroom_cap": { "elem2":["lichen","plant"], "chance":0.4 }, - "mushroom_stalk": { "elem2":["lichen","yeast"], "chance":0.4 }, - "mushroom_gill": { "elem2":["lichen","yeast"], "chance":0.4 }, - "flea": { "elem2":["ash","ant","termite"], "chance":0.4 }, - "ant": { "elem2":["ash","flea","termite"], "chance":0.4 }, - "termite": { "elem2":["ash","flea","ant"], "chance":0.4 }, - "fly": { "elem2":["ash","firefly","bee"], "chance":0.4 }, - "bee": { "elem2":["ash","firefly","fly"], "chance":0.4 }, - "firefly": { "elem2":["ash","bee","fly"], "chance":0.4 }, - "frog": { "elem2":["ash","meat","rotten_meat","cooked_meat"], "chance":0.4 }, - "tadpole": { "elem2":["frog","worm",null], "chance":0.4 }, - "fish": { "elem2":["ash","meat","rotten_meat","cooked_meat"], "chance":0.4 }, - "rat": { "elem2":["ash","meat","rotten_meat","cooked_meat","plague"], "chance":0.4 }, - "bird": { "elem2":["ash","meat","rotten_meat","cooked_meat","plague"], "chance":0.4 }, - "bone": { "elem2":["calcium","calcium","calcium","cancer"], "chance":0.4 }, - "meat": { "elem2":["ash","rotten_meat","cooked_meat"], "chance":0.4 }, - "rotten_meat": { "elem2":["ash","meat","cooked_meat"], "chance":0.4 }, - "cooked_meat": { "elem2":["ash","rotten_meat"], "chance":0.4 }, - "bamboo": { "elem2":["wood","plant","bamboo_plant"], "chance":0.4 }, - "bamboo_plant": { "elem2":["wood","plant","bamboo"], "chance":0.4 }, - "sapling": { "elem2":["wood","plant","tree_branch"], "chance":0.4 }, - "tree_branch": { "elem2":["wood","plant","sapling"], "chance":0.4 }, - "grass_seed": { "elem2":["straw","wheat_seed"], "chance":0.4 }, - "lichen": { "elem2":"algae", "chance":0.4 }, - "yeast": { "elem2":["algae","mushroom_spore","lichen"], "chance":0.4 }, - "wheat_seed": { "elem2":["straw","wheat","grass_seed"], "chance":0.4 }, - "flower_seed": { "elem2":["straw","grass","pistil","petal"], "chance":0.4 }, - "pistil": { "elem2":["straw","grass","flower_seed","petal"], "chance":0.4 }, - "petal": { "elem2":["straw","grass","flower_seed","pistil"], "chance":0.4 }, - "vine": { "elem1":["vine"], "chance":0.4 }, - "worm": { "elem2":"ash", "chance":0.4 }, - "corn": { "elem2":"popcorn", "chance":0.4 }, - "corn_seed": { "elem2":"corn", "chance":0.4 }, - "potato": { "elem2":"potato_seed", "chance":0.4 }, - "potato_seed": { "elem2":"potato", "chance":0.4 }, - "slug": { "elem2":"slime", "chance":0.4 }, - "snail": { "elem2":"slime", "chance":0.4 }, - "cell": { "elem2":"cancer", "chance":0.4 }, - "blood": { "elem2":["infection","cancer"], "chance":0.4 }, - "antibody": { "elem2":"cancer", "chance":0.4 }, - "infection": { "elem2":"cancer", "chance":0.4 }, - "cancer": { "elem2":null, "chance":0.1 }, + //Radiation reactions added programatically }, temp:800, //tempLow:100, @@ -814,6 +639,20 @@ runAfterLoad(function() { }; }; + elements.radiation.reactions.liquid_fire = { "elem2":"liquid_rad_fire", "chance":0.4 }; + elements.radiation.reactions.fire = { "elem2":"rad_fire", "chance":0.4 }; + elements.radiation.reactions.smoke = { "elem2":"rad_smoke", "chance":0.4 }; + + runAfterLoad(function() { + for(key in elements.radiation.reactions) { + var value = elements.radiation.reactions[key]; + + if(typeof(elements.rad_fire.reactions[key]) === "undefined") { + elements.rad_fire.reactions[key] = value; + }; + }; + }); + if(enabledMods.includes("mods/randomness.js")) { elements.unnamed_gas.burnTempChange = 10; elements.unnamed_gas.fireElement = "plasma"; From 410ca9ce66d0ad55fc543da079b553c85fd064e8 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Thu, 8 Dec 2022 17:56:33 -0500 Subject: [PATCH 24/49] add option to copy as text (trollge) --- mods/save_loading.js | 60 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/mods/save_loading.js b/mods/save_loading.js index b31c28c2..fc3892c3 100644 --- a/mods/save_loading.js +++ b/mods/save_loading.js @@ -14,6 +14,20 @@ function getSimulationState() { return simulationState; }; +//https://stackoverflow.com/a/46118025 +function copyToClipboard(text) { + var dummy = document.createElement("textarea"); + // to avoid breaking orgain page when copying more words + // cant copy when adding below this code + // dummy.style.display = 'none' + document.body.appendChild(dummy); + //Be careful if you use textarea. setAttribute('value', value), which works with "input" does not work with "textarea". – Eduard + dummy.value = text; + dummy.select(); + document.execCommand("copy"); + document.body.removeChild(dummy); +} + const saveTemplateAsFile = (filename, dataObjToWrite) => { //from https://stackoverflow.com/a/65939108 const blob = new Blob([JSON.stringify(dataObjToWrite)], { type: "text/json" }); const link = document.createElement("a"); @@ -74,6 +88,11 @@ function downloadSave(filename=null) { saveTemplateAsFile(filename, getSimulationState()); }; +function copySaveJSON(doAlert=true) { + copyToClipboard(JSON.stringify(getSimulationState())); + if(doAlert) { alert("Save copied as JSON") }; +}; + function loadFile() { //Initialize var json; @@ -114,6 +133,40 @@ function loadFile() { }; }; +function loadText() { + //Initialize + var json; + + //load JSON + var json = document.getElementById('mytext').value; + if(json === "") { + if(document.getElementById("textFormStatus") !== "null") { + document.getElementById("textFormStatus").style.color = "red"; + document.getElementById("textFormStatus").innerHTML = "No text was present!"; + }; + throw new Error("No text was present"); + }; + + //validate + try { + json = JSON.parse(json); + } catch (error) { + if(document.getElementById("textFormStatus") !== "null") { + document.getElementById("textFormStatus").style.color = "red"; + document.getElementById("textFormStatus").innerHTML = "The text wasn't valid JSON!"; + }; + throw error; + }; + + if(document.getElementById("textFormStatus") !== "null") { + document.getElementById("textFormStatus").style.color = "yellow"; + document.getElementById("textFormStatus").innerHTML = "JSON was parsed successfully"; + }; + + //return json; + return importJsonState(json); +}; + function importJsonState(json) { //check keys var jsonKeys = Object.keys(json); @@ -214,10 +267,15 @@ function setPixelSize(size=null) { var saveLoaderDescription = `
Download simulation +Alternatively, copy simulation JSON No file loader status -One file, please: +One file, please: +Or paste JSON +No text loader status + + No size setter status Pixel size (rendering only): (Use if the save looks cut off) From a07127d41ce9b37177f8ca85fc07e9195f3e0cfd Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Thu, 8 Dec 2022 18:45:06 -0500 Subject: [PATCH 25/49] apply canonical ZA density of -800 eggTF --- mods/some_tf_liquids.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/some_tf_liquids.js b/mods/some_tf_liquids.js index d7ab29de..326eb8b3 100644 --- a/mods/some_tf_liquids.js +++ b/mods/some_tf_liquids.js @@ -181,7 +181,7 @@ elements.acid.reactions.limestone_gravel = { "elem1":"neutral_acid", "elem2":nul elements.zephyrean_aerotheum = { color: ["#FFFCD9","#FEFFFC","#FDFFDB","#FFFFE8","#FBF6D3","#F1EDD0"], behavior: behaviors.AGLIQUID, - viscosity: 0.1**4, + viscosity: -800, category: "liquids", state: "liquid", density:-800, From 4494b6b076f289e382d1f2da0123711e77fcaa8b Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Thu, 8 Dec 2022 18:45:43 -0500 Subject: [PATCH 26/49] misread/manual revert --- mods/some_tf_liquids.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/some_tf_liquids.js b/mods/some_tf_liquids.js index 326eb8b3..d7ab29de 100644 --- a/mods/some_tf_liquids.js +++ b/mods/some_tf_liquids.js @@ -181,7 +181,7 @@ elements.acid.reactions.limestone_gravel = { "elem1":"neutral_acid", "elem2":nul elements.zephyrean_aerotheum = { color: ["#FFFCD9","#FEFFFC","#FDFFDB","#FFFFE8","#FBF6D3","#F1EDD0"], behavior: behaviors.AGLIQUID, - viscosity: -800, + viscosity: 0.1**4, category: "liquids", state: "liquid", density:-800, From bd33129bb984c8be4bbfabe37382a59980fdad27 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Fri, 9 Dec 2022 12:50:15 -0500 Subject: [PATCH 27/49] iocalfaeus clones --- mods/iocalfaeus_clones.js | 100 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) create mode 100644 mods/iocalfaeus_clones.js diff --git a/mods/iocalfaeus_clones.js b/mods/iocalfaeus_clones.js new file mode 100644 index 00000000..d6e03c78 --- /dev/null +++ b/mods/iocalfaeus_clones.js @@ -0,0 +1,100 @@ +elements.iorefrius_gas = { + color: ["#217349", "#1b5f3c"], + behavior: behaviors.GAS, + tick: function(pixel) { + if(!pixel.cold) { + pixel.cold = false + } + for (let i = -2; i < 3; i++) { + for (let j = -2; j < 3; j++) { + if (!isEmpty(pixel.x+j,pixel.y+i,true)) { + var newPixel = pixelMap[pixel.x+j][pixel.y+i]; + if ((lightArray.includes(newPixel.element)) || (newPixel.temp >= 525) || (ledArray.includes(newPixel.element) && newPixel.charge) || (newPixel.cold && Math.random() < 0.04)) { + pixel.cold = true; + }; + }; + }; + }; + if(pixel.cold == true) { + pixel.temp -= 16; + }; + if(pixel.cold == true && Math.random() < 0.02) { + pixel.cold = false; + }; + }, + category: "gases", + density: 0.97, + state: "gas", +}; + +elements.iolucius_gas = { + color: ["#e9c5ed", "#e2b0e8"], + behavior: behaviors.GAS, + tick: function(pixel) { + if(!pixel.lit) { + pixel.lit = false + } + for (let i = -2; i < 3; i++) { + for (let j = -2; j < 3; j++) { + if (!isEmpty(pixel.x+j,pixel.y+i,true)) { + var newPixel = pixelMap[pixel.x+j][pixel.y+i]; + if ((lightArray.includes(newPixel.element)) || (newPixel.temp >= 525) || (ledArray.includes(newPixel.element) && newPixel.charge) || (newPixel.lit && Math.random() < 0.04)) { + pixel.lit = true; + }; + }; + }; + }; + if(Math.random() < 0.05) { + if(pixel.lit == true) { + var randomLightOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; + var lightX = pixel.x + randomLightOffset[0]; + var lightY = pixel.y + randomLightOffset[1]; + if(isEmpty(lightX,lightY,false)) { + createPixel("light",lightX,lightY); + }; + }; + }; + if(pixel.lit == true && Math.random() < 0.02) { + pixel.lit = false; + }; + }, + category: "gases", + density: 0.97, + state: "gas", +}; + +elements.ioradius_gas = { + color: ["#a6a258", "#97944e"], + behavior: behaviors.GAS, + tick: function(pixel) { + if(!pixel.rlit) { + pixel.rlit = false + } + for (let i = -2; i < 3; i++) { + for (let j = -2; j < 3; j++) { + if (!isEmpty(pixel.x+j,pixel.y+i,true)) { + var newPixel = pixelMap[pixel.x+j][pixel.y+i]; + if ((lightArray.includes(newPixel.element)) || newPixel.element === "radiation" || (newPixel.temp >= 525) || (ledArray.includes(newPixel.element) && newPixel.charge) || (newPixel.rlit && Math.random() < 0.04)) { + pixel.rlit = true; + }; + }; + }; + }; + if(Math.random() < 0.05) { + if(pixel.rlit == true) { + var randomRadiationOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; + var radiationX = pixel.x + randomRadiationOffset[0]; + var radiationY = pixel.y + randomRadiationOffset[1]; + if(isEmpty(radiationX,radiationY,false)) { + createPixel("radiation",radiationX,radiationY); + }; + }; + }; + if(pixel.rlit == true && Math.random() < 0.02) { + pixel.rlit = false; + }; + }, + category: "gases", + density: 0.97, + state: "gas", +}; \ No newline at end of file From 40436449adb3e114dcc5d187cd083834ca5ec0f3 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Sat, 10 Dec 2022 17:53:56 -0500 Subject: [PATCH 28/49] Haseulite MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Turns "Loona" into an ore of a green metal called "Haseulite". • Haseulite absorbs *something* from (in increasing order) light, radiation, fire, rad_fire, or plasma, as well as from nearby explosions. • If it absorbs too much, the haseulite will explode cryogenically. • "Haseulite Vent" vents this out of the haseulite, releasing cold fire. - They can be formed by treating steel with powdered haseulite at 1200°C. • If it is somehow ignited, it burns green. --- mods/haseulite.js | 308 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 308 insertions(+) create mode 100644 mods/haseulite.js diff --git a/mods/haseulite.js b/mods/haseulite.js new file mode 100644 index 00000000..29250091 --- /dev/null +++ b/mods/haseulite.js @@ -0,0 +1,308 @@ +var modName = "mods/haseulite.js"; +var loonaMod = "mods/funny elements 2022-11-15.js"; +var runAfterAutogenMod = "mods/runAfterAutogen and onload restructure.js"; +var explodeAtPlusMod = "mods/explodeAtPlus.js"; +var libraryMod = "mods/code_library.js"; + +if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlusMod) && enabledMods.includes(libraryMod)) { + //move explodeAt to YG Entertainment's dungeon + + oldExplodeAt = explodeAt; + explodeAt = explodeAtPlus; + haseuliteSpreadWhitelist = ["haseulite","haseulite_powder","molten_haseulite"]; + + function coldExplosionAfterCooling(pixel,x,y,radius,fire,smoke,power,damage) { + pixel.temp -= 2*damage*radius*power; + }; + + elements.loona = { + color: ["#6f7d54","#4f5d34","#7c8a61"], + behavior: behaviors.POWDER, + tempHigh: 1031, + category: "random rocks", + state: "solid", + density: 2466.73, + hardness: 0.56, + breakInto: ["rock","sulfur","loona_gravel","loona_gravel","loona_gravel","haseulite_powder"], + }, + + runAfterAutogen(function() { + elements.loona.stateHigh = ["molten_loona","rock","rock","rock","sulfur_gas","sulfur_gas","molten_haseulite"]; + }); + + elements.loona_gravel = { + color: ["#b3be98","#919a6f","#68744b","#515931"], + behavior: behaviors.POWDER, + tempHigh: 1031, + stateHigh: ["molten_loona","rock","rock","rock","sulfur_gas","sulfur_gas","molten_haseulite"], + category: "random rocks", + state: "solid", + density: 1625.14, + hardness: 0.97, + breakInto: ["rock","sulfur","rock","haseulite_powder"], + }; + + haseuliteValueObject = { + light: 1, + radiation: 4, + fire: [6, "smoke"], + rad_fire: [10, "rad_smoke"], + plasma: [15, "fire"] + }; + + function haseuliteValueSpreading(pixel) { + var randomNeighborOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; + var rX = randomNeighborOffset[0]; + var rY = randomNeighborOffset[1]; + var rfX = pixel.x+rX; + var rfY = pixel.y+rY; + if(!isEmpty(rfX,rfY,true)) { + var rOtherPixel = pixelMap[rfX][rfY]; + var rOtherElement = rOtherPixel.element; + if(haseuliteSpreadWhitelist.includes(rOtherElement)) { + if(typeof(rOtherPixel.value) !== "number") { + rOtherPixel.value = 0; + }; + if(typeof(rOtherPixel) === "undefined" || isEmpty(rfX,rfY,true)) { + return false; + }; + var averageValue = (pixel.value + rOtherPixel.value) / 2; + pixel.value = averageValue; + rOtherPixel.value = averageValue; + }; + }; + return true; + }; + + function haseuliteValueAbsorbency(pixel) { + for(i = 0; i < adjacentCoords.length; i++) { + var oX = adjacentCoords[i][0]; + var oY = adjacentCoords[i][1]; + var fX = pixel.x+oX; + var fY = pixel.y+oY; + if(!isEmpty(fX,fY,true)) { + var otherPixel = pixelMap[fX][fY]; + var otherElement = otherPixel.element; + var otherInfo = elements[otherElement]; + if(haseuliteValueObject[otherElement]) { + if(typeof(otherPixel) === "undefined" || isEmpty(fX,fY,true)) { + return false; + }; + var haseuliteValueData = haseuliteValueObject[otherElement]; + if(haseuliteValueData instanceof Array) { + var finalElement = haseuliteValueData[1]; + if(finalElement instanceof Array) { finalElement = finalElement[Math.floor(Math.random() * finalElement.length)] }; + changePixel(otherPixel,haseuliteValueData[1]); + pixel.value += haseuliteValueData[0]; + } else if(typeof(haseuliteValueData) === "number") { + deletePixel(otherPixel.x,otherPixel.y); + pixel.value += haseuliteValueData[0]; + }; + }; + }; + }; + return true; + }; + + function haseuliteValueFunction(pixel) { + if(typeof(pixel.value) === "undefined") { + pixel.value = 0; + }; + + var oldValue = pixel.value; + if(!haseuliteValueAbsorbency(pixel) || isNaN(pixel.value)) { + pixel.value = oldValue; + }; + + var oldValue = pixel.value; + if(!haseuliteValueSpreading(pixel) || isNaN(pixel.value)) { + pixel.value = oldValue; + }; + } + + function haseulitoidTick(pixel) { + haseuliteValueFunction(pixel); + if(pixel.oldColor === null) { pixel.oldColor = pixel.color }; + pixel.color = lightenColor(pixel.oldColor,pixel.value / 3); + + if(pixel.value >= 350) { + var coldBoomChance = Math.max(0.008 * ((pixel.value - 350) / 100), 0.001); + if(Math.random() < coldBoomChance) { + var coldBoomRadius = Math.min(30,Math.floor(7 + ((pixel.value - 350) / 100))); + explodeAtPlus(pixel.x,pixel.y,coldBoomRadius,"cold_fire","cold_smoke",null,coldExplosionAfterCooling); + }; + }; + } + + elements.haseulite = { + color: ["#3cb00e", "#25d119", "#79f553"], + properties: { + value: 0, + oldColor: null + }, + behavior: behaviors.WALL, + tick: function(pixel) { haseulitoidTick(pixel) }, + excludeVelocity: true, //wall shouldn't move + tempHigh: 1757, + onExplosionBreakOrSurvive: function(pixel,x,y,radius) { + /*power is always radius/10 + r 5: value 7 + r 10: value 14 + r 15: value 28 + r 20: value 56 + r 25: value 112 + r 30: value 224 + */ + pixel.value += (2**(((radius) / 5) - 1) * 7); + }, + category: "solids", + state: "solid", + density: 7550, + hardness: 0.93, + breakInto: "haseulite_powder", + conduct: 0.84, + }; + + if(!elements.steel.reactions) { + elements.steel.reactions = {}; + }; + + elements.steel.reactions.haseulite_powder = { + elem1: "haseulite_vent", + elem2: null, + chance: 0.01, + tempMin: 1200, + }; + + adjacentCoordsInverted = [[0,-1],[0,1],[-1,0],[1,0]]; + + elements.haseulite_vent = { + color: "#88b058", + behavior: behaviors.WALL, + rotatable: true, + desc: "This uses rotation, so just use debug to see the r value. r 0 means it vents haseulite below it upwards, r 1 means it vents haseulite above it downwards, r 2 means it vents left, and r 3 means it vents right.", + tick: function(pixel) { + if(isNaN(pixel.r)) { + pixel.r = 0; + }; + pixel.r = pixel.r % 4; + var coord = adjacentCoords[pixel.r]; + var invertCoord = adjacentCoordsInverted[pixel.r]; + + var fX = pixel.x+coord[0]; + var fY = pixel.y+coord[1]; + + if(!isEmpty(fX,fY,true)) { + var otherPixel = pixelMap[fX][fY]; + var otherElement = otherPixel.element; + var otherInfo = elements[otherElement]; + if(typeof(otherPixel) === "undefined" || isEmpty(fX,fY,true)) { + return false; + }; + if(haseuliteSpreadWhitelist.includes(otherElement)) { + var ventLimit = Math.min(10,Math.floor(1 + (Math.sqrt(Math.max(otherPixel.value,1)) / 2))); + for(i = 1; i <= ventLimit; i++) { + if(otherPixel.value >= 3) { + var fIX = pixel.x+(invertCoord[0] * i); + var fIY = pixel.y+(invertCoord[1] * i); + if(isEmpty(fIX,fIY,false)) { + createPixel("cold_fire",fIX,fIY); + otherPixel.value -= 3; + } else { //if the pixel to place isn't empty + if(!outOfBounds(fIX,fIY)) { //if it isn't OoB + if(pixelMap[fIX][fIY].element !== "cold_fire") { //if it isn't cold fire + break; + }; + } else { //if it is OoB + break; + }; + }; + } else { + break; + }; + }; + }; + }; + return true; + }, + excludeVelocity: true, //wall shouldn't move + tempHigh: elements.steel.tempHigh, + stateHigh: ["molten_steel","haseulite_powder"], + breakInto: ["metal_scrap","haseulite_powder"], + category: "solids", + state: "solid", + density: 7550, + hardness: 0.93, + breakInto: "haseulite_powder", + conduct: 0.84, + } + + elements.haseulite_powder = { + color: ["#5fb33e", "#32ba29", "#63d141"], + properties: { + value: 0, + oldColor: null + }, + tempHigh: 1757, + behavior: behaviors.POWDER, + tick: function(pixel) { haseulitoidTick(pixel) }, + onExplosionBreakOrSurvive: function(pixel,x,y,radius) { + /*power is always radius/10 + r 5: value 7 + r 10: value 14 + r 15: value 28 + r 20: value 56 + r 25: value 112 + r 30: value 224 + */ + pixel.value += (2**(((radius) / 5) - 1) * 7); + }, + stateHigh: "molten_haseulite", + category: "powders", + state: "solid", + hidden: true, + density: 4512, + hardness: 0.7, + conduct: 0.43, + }; + + elements.molten_haseulite = { + color: ["#cbf569","#f1ffd6","#fdffb5", "#fffa99"], + fireColor: ["#08a953", "#2ea332", "#d1e0d3"], + properties: { + value: 0, + oldColor: null + }, + tick: function(pixel) { haseulitoidTick(pixel) }, + onExplosionBreakOrSurvive: function(pixel,x,y,radius) { + /*power is always radius/10 + r 5: value 7 + r 10: value 14 + r 15: value 28 + r 20: value 56 + r 25: value 112 + r 30: value 224 + */ + pixel.value += (2**(((radius) / 5) - 1) * 7); + }, + density: 7214, + hardness: 0.52, + breakInto: "haseulite_gas", + tempHigh: 3100, + conduct: 0.23, + }; + + elements.haseulite_gas = { + color: ["#ffff9d", "#ffffff", "#e9ffe6", "#ffffe5"], + density: 0.289, + hardness: 1, + conduct: 0.13, + }; +} else { + if(!enabledMods.includes(loonaMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,loonaMod) }; + if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,runAfterAutogenMod) }; + if(!enabledMods.includes(explodeAtPlusMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,explodeAtPlusMod) }; + if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) }; + localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); + alert(`The "${runAfterAutogenMod}", "${loonaMod}", "${libraryMod}", and "${explodeAtPlusMod}" mods are all required; any missing mods in this list have been automatically inserted (reload for this to take effect).`) +}; \ No newline at end of file From 43a31a888288977d9326f40cfb74bcdb60e8d944 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Sat, 10 Dec 2022 18:23:01 -0500 Subject: [PATCH 29/49] function onExplosionBreakOrSurvive fires if a pixel is broken by or survives an explosion --- mods/explodeAtPlus.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/mods/explodeAtPlus.js b/mods/explodeAtPlus.js index 4167ab67..34252672 100644 --- a/mods/explodeAtPlus.js +++ b/mods/explodeAtPlus.js @@ -1,3 +1,5 @@ +velocityBlacklist = []; + function explodeAtPlus(x,y,radius,fire="fire",smoke="smoke",beforeFunction=null,afterFunction=null,changeTemp=true) { // if fire contains , split it into an array if(fire !== null) { @@ -84,6 +86,9 @@ function explodeAtPlus(x,y,radius,fire="fire",smoke="smoke",beforeFunction=null, } // change the pixel to the result changePixel(pixel,result,changeTemp); + if(info.onExplosionBreakOrSurvive) { + info.onExplosionBreakOrSurvive(pixel,x,y,radius,fire,smoke,power,damage); + }; continue; } else { @@ -100,6 +105,10 @@ function explodeAtPlus(x,y,radius,fire="fire",smoke="smoke",beforeFunction=null, } continue; } + } else { + if(info.onExplosionBreakOrSurvive) { + info.onExplosionBreakOrSurvive(pixel,x,y,radius,fire,smoke,power,damage); + }; } if (damage > 0.75 && info.burn) { pixel.burning = true; @@ -107,6 +116,14 @@ function explodeAtPlus(x,y,radius,fire="fire",smoke="smoke",beforeFunction=null, } pixel.temp += damage*radius*power; pixelTempCheck(pixel); + if(enabledMods.includes("mods/velocity.js")) { + // set the pixel.vx and pixel.vy depending on the angle and power + if (!elements[pixel.element].excludeRandom && !elements[pixel.element].excludeVelocity) { + var angle = Math.atan2(pixel.y-y,pixel.x-x); + pixel.vx = Math.round((pixel.vx|0) + Math.cos(angle) * (radius * power/10)); + pixel.vy = Math.round((pixel.vy|0) + Math.sin(angle) * (radius * power/10)); + } + }; if(typeof(afterFunction) === "function") { //console.log(`running afterFunction ${afterFunction}`) //console.log(`arguments: ${pixel}, ${x}, ${y}, ${radius}, ${fire}, ${smoke}, ${power}, ${damage}`) @@ -115,4 +132,3 @@ function explodeAtPlus(x,y,radius,fire="fire",smoke="smoke",beforeFunction=null, }; }; }; - From ef4aca06b35ffe000bb6aa92bdb84e21c975fe84 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Sat, 10 Dec 2022 18:29:25 -0500 Subject: [PATCH 30/49] =?UTF-8?q?I=20forgor=20to=20describe=20my=20changes?= =?UTF-8?q?=20=F0=9F=92=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mods/haseulite.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/mods/haseulite.js b/mods/haseulite.js index 29250091..b7f5203f 100644 --- a/mods/haseulite.js +++ b/mods/haseulite.js @@ -136,6 +136,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && elements.haseulite = { color: ["#3cb00e", "#25d119", "#79f553"], + fireColor: ["#08a953", "#2ea332", "#d1e0d3"], properties: { value: 0, oldColor: null @@ -178,6 +179,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && elements.haseulite_vent = { color: "#88b058", + fireColor: ["#08a953", "#2ea332", "#d1e0d3"], behavior: behaviors.WALL, rotatable: true, desc: "This uses rotation, so just use debug to see the r value. r 0 means it vents haseulite below it upwards, r 1 means it vents haseulite above it downwards, r 2 means it vents left, and r 3 means it vents right.", @@ -243,6 +245,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && value: 0, oldColor: null }, + fireColor: ["#08a953", "#2ea332", "#d1e0d3"], tempHigh: 1757, behavior: behaviors.POWDER, tick: function(pixel) { haseulitoidTick(pixel) }, @@ -288,13 +291,31 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && density: 7214, hardness: 0.52, breakInto: "haseulite_gas", + temp: 1957, tempHigh: 3100, conduct: 0.23, }; elements.haseulite_gas = { color: ["#ffff9d", "#ffffff", "#e9ffe6", "#ffffe5"], + properties: { + value: 0, + oldColor: null + }, + tick: function(pixel) { haseulitoidTick(pixel) }, + onExplosionBreakOrSurvive: function(pixel,x,y,radius) { + /*power is always radius/10 + r 5: value 7 + r 10: value 14 + r 15: value 28 + r 20: value 56 + r 25: value 112 + r 30: value 224 + */ + pixel.value += (2**(((radius) / 5) - 1) * 7); + }, density: 0.289, + temp: 3700, hardness: 1, conduct: 0.13, }; @@ -305,4 +326,4 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) }; localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); alert(`The "${runAfterAutogenMod}", "${loonaMod}", "${libraryMod}", and "${explodeAtPlusMod}" mods are all required; any missing mods in this list have been automatically inserted (reload for this to take effect).`) -}; \ No newline at end of file +}; From 6562354191b2754f6cce8e0ab6e4b999c09cbbc0 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Mon, 12 Dec 2022 01:59:21 -0500 Subject: [PATCH 31/49] Heejinite * Rose metal, powder and gas... * Lower density and transition points * Changes in hue, which is more pronounced at higher temperatures * Weird, unstable (in-universe, not as in buggy) behavior at 1,387.5+ Celsius --- mods/haseulite.js | 258 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 258 insertions(+) diff --git a/mods/haseulite.js b/mods/haseulite.js index b7f5203f..4b93322d 100644 --- a/mods/haseulite.js +++ b/mods/haseulite.js @@ -26,8 +26,106 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && breakInto: ["rock","sulfur","loona_gravel","loona_gravel","loona_gravel","haseulite_powder"], }, + function spoutCriteria(name) { + if(typeof(elements[name]) !== "object") { + throw new Error(`Nonexistent element ${name}`); + }; + var info = elements[name]; + //console.log(`${name} (${JSON.stringify(elements[name])})`); + if(typeof(info.state) === "undefined") { + var state = null; + } else { + var state = info.state; + }; + if(typeof(info.category) === "undefined") { + var category = "other"; + } else { + var category = info.category; + }; + if(excludedSpoutElements.includes(name)) { + return false + }; + var include = false; + if(["liquid","gas"].includes(state)) { + include = true; + }; + if(info.movable) { + include = true; + }; + if(backupCategoryWhitelist.includes(category)) { + include = true; + }; + if(backupElementWhitelist.includes(name)) { + include = true; + }; + if(category.includes("mudstone")) { + include = true; + }; + //console.log(include); + return include; + }; + + function heejiniteHeatCriteria(name) { + if(typeof(elements[name]) !== "object") { + throw new Error(`Nonexistent element ${name}`); + }; + var info = elements[name]; + //console.log(`${name} (${JSON.stringify(elements[name])})`); + if(typeof(info.tempLow) === "undefined") { + return false; + }; + if(typeof(info.tempHigh) !== "undefined" && info.tempHigh < elements.heejinite.tempHigh) { + return false; + }; + return (info.tempLow < elements.heejinite.tempHigh) || ((typeof(info.state) !== "undefined") && (info.state === "gas")); + }; + + spoutCriteria = function(name) { + if(typeof(elements[name]) !== "object") { + throw new Error(`Nonexistent element ${name}`); + }; + var info = elements[name]; + //console.log(`${name} (${JSON.stringify(elements[name])})`); + if(typeof(info.state) === "undefined") { + var state = null; + } else { + var state = info.state; + }; + if(typeof(info.category) === "undefined") { + var category = "other"; + } else { + var category = info.category; + }; + if(excludedSpoutElements.includes(name)) { + return false + }; + var include = false; + if(["liquid","gas"].includes(state)) { + include = true; + }; + if(info.movable) { + include = true; + }; + if(backupCategoryWhitelist.includes(category)) { + include = true; + }; + if(backupElementWhitelist.includes(name)) { + include = true; + }; + if(category.includes("mudstone")) { + include = true; + }; + //console.log(include); + return include; + }; + + //it doesn't want to acknowledge spoutCriteria, so... + runAfterAutogen(function() { elements.loona.stateHigh = ["molten_loona","rock","rock","rock","sulfur_gas","sulfur_gas","molten_haseulite"]; + hotHeejiniteElements = Object.keys(elements).filter(function(e) { + return spoutCriteria(e) && heejiniteHeatCriteria(e) && !elements[e].excludeRandom; + }); }); elements.loona_gravel = { @@ -50,6 +148,62 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && plasma: [15, "fire"] }; + /*function customStaining(pixel,customColorRgb,stainOverride=null) { + if (settings["stainoff"]) { return } + var stain = (stainOverride !== null ? stainOverride : elements[pixel.element].stain); + if (stain > 0) { + var newColor = customColorRgb.match(/\d+/g); + } + else { + var newColor = null; + } + + 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]; + if (elements[pixel.element].ignore && elements[pixel.element].ignore.indexOf(newPixel.element) !== -1) { + continue; + } + if ((elements[newPixel.element].id !== elements[pixel.element].id || elements[newPixel.element].stainSelf) && (solidStates[elements[newPixel.element].state] || elements[newPixel.element].id === elements[pixel.element].id)) { + if (Math.random() < Math.abs(stain)) { + if (stain < 0) { + if (newPixel.origColor) { + newColor = newPixel.origColor; + } + else { continue; } + } + else if (!newPixel.origColor) { + newPixel.origColor = newPixel.color.match(/\d+/g); + } + // if newPixel.color doesn't start with rgb, continue + if (!newPixel.color.match(/^rgb/)) { continue; } + // parse rgb color string of newPixel rgb(r,g,b) + var rgb = newPixel.color.match(/\d+/g); + if (elements[pixel.element].stainSelf && elements[newPixel.element].id === elements[pixel.element].id) { + // if rgb and newColor are the same, continue + if (rgb[0] === newColor[0] && rgb[1] === newColor[1] && rgb[2] === newColor[2]) { continue; } + var avg = []; + for (var j = 0; j < rgb.length; j++) { + avg[j] = Math.round((rgb[j]*(1-Math.abs(stain))) + (newColor[j]*Math.abs(stain))); + } + } + else { + // get the average of rgb and newColor, more intense as stain reaches 1 + var avg = []; + for (var j = 0; j < rgb.length; j++) { + avg[j] = Math.floor((rgb[j]*(1-Math.abs(stain))) + (newColor[j]*Math.abs(stain))); + } + } + // set newPixel color to avg + newPixel.color = "rgb("+avg.join(",")+")"; + } + } + } + } + }*/ + function haseuliteValueSpreading(pixel) { var randomNeighborOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; var rX = randomNeighborOffset[0]; @@ -298,6 +452,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && elements.haseulite_gas = { color: ["#ffff9d", "#ffffff", "#e9ffe6", "#ffffe5"], + fireColor: ["#08a953", "#2ea332", "#d1e0d3"], properties: { value: 0, oldColor: null @@ -319,6 +474,109 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && hardness: 1, conduct: 0.13, }; + + /* + var shimmeringColor = convertHslObjects(hslColorStringToObject(`hsl(${(pixelTicks / 2) % 360},100%,50%)`,"rgb")); + customStaining(pixel,shimmeringColor,0.2); + */ + + function heejinitoidTick(pixel) { + if(pixel.oldColor === null) { pixel.oldColor = pixel.color }; + var color = rgbStringToHSL(convertColorFormats(pixel.oldColor,"rgb"),"json"); + var heejiniteHueSpread = 30 + (pixel.temp/9.25) + var hueOffset = (Math.sin(pixelTicks / 11) * heejiniteHueSpread) + 15; color.h += hueOffset; + var color = convertHslObjects(color,"rgb"); + pixel.color = color; + }; + + function hotHeejinitoidTick(pixel) { + if(Math.random() < (pixel.temp >= 1500 ? 0.02 : 0.01)) { + if(pixel.temp >= 1387.5) { + var randomNeighborOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; + var rX = randomNeighborOffset[0]; + var rY = randomNeighborOffset[1]; + var rfX = pixel.x+rX; + var rfY = pixel.y+rY; + if(isEmpty(rfX,rfY,false)) { + var randomEligibleHotElement = hotHeejiniteElements[Math.floor(Math.random() * hotHeejiniteElements.length)]; + createPixel(randomEligibleHotElement,rfX,rfY); + }; + }; + }; + } + + elements.heejinite = { + color: ["#cf1172", "#fa1977", "#ff619e"], + fireColor: ["#a9085e", "#a32e61", "#fca7c6"], + properties: { + oldColor: null + }, + behavior: behaviors.WALL, + tick: function(pixel) { heejinitoidTick(pixel) }, + excludeVelocity: true, //wall shouldn't move + tempHigh: 837, + category: "solids", + state: "solid", + density: 3773, + stain: 0.1, + hardness: 0.79, + breakInto: "heejinite_powder", + conduct: 0.86, + }; + + elements.heejinite_powder = { + color: ["#d64790", "#e63e84", "#f054ac"], + fireColor: ["#a9085e", "#a32e61", "#fca7c6"], + properties: { + oldColor: null + }, + behavior: behaviors.WALL, + tick: function(pixel) { heejinitoidTick(pixel) }, + excludeVelocity: true, //wall shouldn't move + tempHigh: 837, + category: "solids", + state: "solid", + density: 1412, + stain: 0.1, + hardness: 0.66, + breakInto: "heejinite_powder", + conduct: 0.42, + }; + + elements.molten_heejinite = { + color: ["#ff0f77","#ff59c2","#ff405c", "#fa5a48"], + fireColor: ["#a9085e", "#a32e61", "#fca7c6"], + properties: { + oldColor: null + }, + tick: function(pixel) { + heejinitoidTick(pixel); + hotHeejinitoidTick(pixel); + }, + density: 3121, + hardness: 0.5, + breakInto: "heejinite_gas", + temp: 1000, + tempHigh: 1501, + conduct: 0.22, + }; + + elements.heejinite_gas = { + color: ["#fffab8", "#ffdab3", "#ffd1d1", "#ffc4df", "#ffb0eb"], + fireColor: ["#a9085e", "#a32e61", "#fca7c6"], + properties: { + oldColor: null + }, + tick: function(pixel) { + heejinitoidTick(pixel); + hotHeejinitoidTick(pixel); + }, + density: 0.117, + temp: 1800, + hardness: 1, + conduct: 0.12, + }; + } else { if(!enabledMods.includes(loonaMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,loonaMod) }; if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,runAfterAutogenMod) }; From 96863e094c792d23ba02ed0cec50d0ef9a35b83b Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Mon, 12 Dec 2022 09:15:01 -0500 Subject: [PATCH 32/49] chlorine trifluoride spicy juice --- mods/clf3.js | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 mods/clf3.js diff --git a/mods/clf3.js b/mods/clf3.js new file mode 100644 index 00000000..d9facdbf --- /dev/null +++ b/mods/clf3.js @@ -0,0 +1,86 @@ +var modName = "mods/clf3.js"; +var chemMod = "mods/chem.js"; + +if(enabledMods.includes(chemMod)) { + function finishBurn(pixel) { + var info = elements[pixel.element]; + + var burnInto = info.burnInto; + if (burnInto == undefined) { + burnInto = 'fire'; + } + else if (burnInto instanceof Array) { + burnInto = burnInto[Math.floor(Math.random()*burnInto.length)]; + } + changePixel(pixel,burnInto,(burnInto !== "smoke")); + if (info.fireColor != undefined && burnInto == "fire") { + pixel.color = pixelColorPick(pixel,info.fireColor); + } + else { + pixel.color = pixelColorPick(pixel) + } + }; + + function clf3Tick(pixel) { + for(i = 0; i < adjacentCoords.length; i++) { + var oX = adjacentCoords[i][0]; + var oY = adjacentCoords[i][1]; + var fX = pixel.x+oX; + var fY = pixel.y+oY; + if(!isEmpty(fX,fY,true)) { + var otherPixel = pixelMap[fX][fY]; + var otherElement = otherPixel.element; + if(otherElement === "water") { + explodeAt(otherPixel.x,otherPixel.y,7,"fire,hydrofluoric_acid,oxygen,acid,chlorine") + }; + if(!elements.chlorine_trifluoride.ignore.includes(otherElement)) { + if(!otherPixel.burning) { otherPixel.burning = true }; + if(!otherPixel.burnStart) { otherPixel.burnStart = pixelTicks }; + var instaburnChance = 0.05 + (pixelTicks - otherPixel.burnStart) / 1000 + if(Math.random() < instaburnChance) { + finishBurn(otherPixel); + }; + }; + }; + }; + }; + + var clf3IgnoreList = ["FOOF","solid_FOOF","oxygen","liquid_oxygen","oxygen_ice","chlorine","liquid_chlorine","liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","acid_gas","neutral_acid","acid","acid_cloud","nitrogen","helium","neon","argon","krypton","xenon","radon","wall","chlorine_trifluoride","chlorine_trifluoride_ice","chlorine_trifluoride_gas","quartz"]; + + //todo: PTFE, passivation + + elements.chlorine_trifluoride = { + color: "#8aa65b", + behavior: behaviors.LIQUID, + //ignore list copied from chem.js + ignore: clf3IgnoreList, //the elements that don't exist won't trigger any error here becuase the code's just checking pixels' elements against this list + tick: function(pixel) { + clf3Tick(pixel); + }, + category:"liquids", + state: "liquid", + density: 1770, + tempLow: -76.34, + tempHigh: 11.75, + temp: 5, + }; + + elements.chlorine_trifluoride_gas = { + tick: function(pixel) { + clf3Tick(pixel); + }, + density: 3.78, //variously or 3.18, + //tempHigh: 220, //variously or 180, + //stateHigh: ["chlorine_fluoride","fluorine"], + }; + + elements.chlorine_trifluoride_ice = { + tick: function(pixel) { + clf3Tick(pixel); + }, + }; +} else { + enabledMods.splice(enabledMods.indexOf(modName),0,chemMod); + localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); + alert(`The ${chemMod} mod is required and has been automatically inserted (reload for this to take effect).`); +}; \ No newline at end of file From ad283c50f1c9ef9a5188bbd202e55c9ca7f33744 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Mon, 12 Dec 2022 09:38:03 -0500 Subject: [PATCH 33/49] ignore hypothetical states, NM comp@ --- mods/clf3.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/clf3.js b/mods/clf3.js index d9facdbf..8eb57d9d 100644 --- a/mods/clf3.js +++ b/mods/clf3.js @@ -45,7 +45,7 @@ if(enabledMods.includes(chemMod)) { }; }; - var clf3IgnoreList = ["FOOF","solid_FOOF","oxygen","liquid_oxygen","oxygen_ice","chlorine","liquid_chlorine","liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","acid_gas","neutral_acid","acid","acid_cloud","nitrogen","helium","neon","argon","krypton","xenon","radon","wall","chlorine_trifluoride","chlorine_trifluoride_ice","chlorine_trifluoride_gas","quartz"]; + var clf3IgnoreList = ["FOOF","solid_FOOF","oxygen","liquid_oxygen","oxygen_ice","chlorine","liquid_chlorine","liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","acid_gas","neutral_acid","acid","acid_cloud","nitrogen","helium","liquid_helium","tralphium","liquid_tralphium","neon","liquid_neon","solid_neon","neon_ice","neon_snow","argon","liquid_argon","solid_argon","argon_ice","argon_snow", "krypton","liquid_krypton","solid_krypton","krypton_ice","krypton_snow", "xenon","liquid_xenon","solid_xenon","xenon_ice","xenon_snow", "radon","liquid_radon","solid_radon","radon_ice","radon_snow","ionized_helium","ionized_tralphium","wall","chlorine_trifluoride","chlorine_trifluoride_ice","chlorine_trifluoride_gas","quartz"]; //todo: PTFE, passivation @@ -83,4 +83,4 @@ if(enabledMods.includes(chemMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,chemMod); localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); alert(`The ${chemMod} mod is required and has been automatically inserted (reload for this to take effect).`); -}; \ No newline at end of file +}; From cbce59d74dc94f223cc345ee807025c2761776ea Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Mon, 12 Dec 2022 09:52:40 -0500 Subject: [PATCH 34/49] bug fixes also no more radiation from heejinite --- mods/haseulite.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/mods/haseulite.js b/mods/haseulite.js index 4b93322d..b428e58c 100644 --- a/mods/haseulite.js +++ b/mods/haseulite.js @@ -23,7 +23,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && state: "solid", density: 2466.73, hardness: 0.56, - breakInto: ["rock","sulfur","loona_gravel","loona_gravel","loona_gravel","haseulite_powder"], + breakInto: ["rock","sulfur","loona_gravel","loona_gravel","loona_gravel","haseulite_powder", "rock","sulfur","loona_gravel","loona_gravel","loona_gravel","haseulite_powder", "rock","sulfur","loona_gravel","loona_gravel","loona_gravel","heejinite_powder"], }, function spoutCriteria(name) { @@ -122,9 +122,9 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && //it doesn't want to acknowledge spoutCriteria, so... runAfterAutogen(function() { - elements.loona.stateHigh = ["molten_loona","rock","rock","rock","sulfur_gas","sulfur_gas","molten_haseulite"]; + elements.loona.stateHigh = ["molten_loona","rock","rock","rock","sulfur_gas","sulfur_gas","molten_haseulite","molten_loona","rock","rock","rock","sulfur_gas","sulfur_gas","molten_haseulite","molten_loona","rock","rock","rock","sulfur_gas","sulfur_gas","molten_heejinite"]; hotHeejiniteElements = Object.keys(elements).filter(function(e) { - return spoutCriteria(e) && heejiniteHeatCriteria(e) && !elements[e].excludeRandom; + return spoutCriteria(e) && heejiniteHeatCriteria(e) && !elements[e].excludeRandom && !e.startsWith("rad"); }); }); @@ -132,12 +132,12 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && color: ["#b3be98","#919a6f","#68744b","#515931"], behavior: behaviors.POWDER, tempHigh: 1031, - stateHigh: ["molten_loona","rock","rock","rock","sulfur_gas","sulfur_gas","molten_haseulite"], + stateHigh: ["molten_loona","rock","rock","rock","sulfur_gas","sulfur_gas","molten_haseulite","molten_loona","rock","rock","rock","sulfur_gas","sulfur_gas","molten_haseulite","molten_loona","rock","rock","rock","sulfur_gas","sulfur_gas","molten_heejinite"], category: "random rocks", state: "solid", density: 1625.14, hardness: 0.97, - breakInto: ["rock","sulfur","rock","haseulite_powder"], + breakInto: ["rock","sulfur","rock","haseulite_powder","rock","sulfur","rock","haseulite_powder","rock","sulfur","rock","heejinite_powder"], }; haseuliteValueObject = { @@ -385,7 +385,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && tempHigh: elements.steel.tempHigh, stateHigh: ["molten_steel","haseulite_powder"], breakInto: ["metal_scrap","haseulite_powder"], - category: "solids", + category: "machines", state: "solid", density: 7550, hardness: 0.93, @@ -530,10 +530,11 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && properties: { oldColor: null }, - behavior: behaviors.WALL, + behavior: behaviors.POWDER, tick: function(pixel) { heejinitoidTick(pixel) }, excludeVelocity: true, //wall shouldn't move tempHigh: 837, + stateHigh: "molten_heejinite", category: "solids", state: "solid", density: 1412, From 18f664a5a09254fa36c719d527cd2ebd06418fa3 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Mon, 12 Dec 2022 10:55:15 -0500 Subject: [PATCH 35/49] mlu 2 --- mods/a_bundle_of_tests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/a_bundle_of_tests.js b/mods/a_bundle_of_tests.js index 84c91cea..f95a2cef 100644 --- a/mods/a_bundle_of_tests.js +++ b/mods/a_bundle_of_tests.js @@ -8,7 +8,7 @@ if(urlParams.get('loadTheModList') !== null || urlParams.get('ltml') !== null) { } if(loadTheModList) { - enabledMods = ["mods/code_library.js","mods/adjustablepixelsize.js","mods/boiling_rock.js","mods/chalcopyrite.js","mods/clone_liquid.js","mods/conveyance.js","mods/CrashTestDummy.js","mods/crimson.js","mods/delete_all_of_element.js","mods/evenmoretemptools.js","mods/extra_element_info.js","mods/fairy_chain.js","mods/fantastic_creatures.js","mods/fey_and_more.js","mods/glenn_gases.js","mods/grav_mudstones.js","mods/icb.js","mods/iean.js","mods/ketchup_mod.js","mods/laetium.js","mods/liquid_energy.js","mods/metals.js","mods/minecraft.js","mods/minesweeper.js","mods/more_breaking.js","mods/moreliquids.js","mods/moretools.js","mods/move_tools.js","mods/nested_for_reaction_example.js","mods/Neutronium Mod.js","mods/portal.js","mods/pushers.js","mods/rainbow_tests.js","mods/random_elems.js","mods/random_liquids.js","mods/random_rocks.js","mods/randomness.js","mods/randomness_but_tick.js","mods/randomness_but_tool.js","mods/slag_fix.js","mods/some_tf_liquids.js","mods/structure_test.js","mods/test.js","mods/ticking_temp_stuff.js","mods/time.js","mods/toothpaste.js","mods/troll.js","mods/unhide.js","mods/worldgen_test.js","mods/page_color.js","mods/color_tools.js","mods/invisible_wall.js","mods/replace_all.js","mods/bacteria_mod.js","mods/controllable_pixel_test.js","mods/fire_slime.js","mods/bioooze.js","mods/color_tools.js","mods/cells.js","mods/triggerable_random_powders.js","mods/replace.js","mods/change.js","mods/prompt.js","mods/miscible_psoup_and_birthpool.js","mods/primordial_birthpool.js","mods/liquid_void.js","mods/solid_rock.js","mods/invisible_dye.js","mods/alcohol.js","mods/a_bundle_of_tests.js","mods/paint_event.js","mods/amogus.js","mods/chem.js","mods/roseyiede.js","mods/state_voids.js","mods/the_ground.js","mods/lone_urea.js","mods/fwibblen.js","mods/velocity.js","mods/prop and prompt variables.js","mods/prop.js","mods/x_dependent_change_test.js","mods/alkahest.js","mods/tool_pixel_behavior.js","mods/onTryMoveInto.js","mods/human_edit.js","mods/runAfterAutogen and onload restructure.js","mods/explodeAtPlus.js","mods/more_bombs.js","mods/note_block.js","mods/wirelike_test.js","mods/no_random_grbs.js","mods/bananas.js","mods/trapdoor.js","mods/apioforms.js","mods/cpt_alt.js","mods/more_fairies.js","mods/spouts.js","mods/mobs.js","mods/more_clouds.js","mods/funny elements 2022-11-15.js","mods/generator_prompt.js","mods/fire_mod.js","mods/test_4.js","mods/save_loading.js","mods/apioforms_pre.js","mods/cover_yourself_in.js","mods/fill_script.js","mods/find.js","mods/place_all_elements.js"]; + enabledMods = ["mods/code_library.js","mods/adjustablepixelsize.js","mods/boiling_rock.js","mods/chalcopyrite.js","mods/clone_liquid.js","mods/conveyance.js","mods/CrashTestDummy.js","mods/crimson.js","mods/delete_all_of_element.js","mods/evenmoretemptools.js","mods/extra_element_info.js","mods/fairy_chain.js","mods/fantastic_creatures.js","mods/fey_and_more.js","mods/glenn_gases.js","mods/iocalfaeus_clones.js","mods/grav_mudstones.js","mods/icb.js","mods/iean.js","mods/ketchup_mod.js","mods/laetium.js","mods/liquid_energy.js","mods/metals.js","mods/minecraft.js","mods/minesweeper.js","mods/more_breaking.js","mods/moreliquids.js","mods/moretools.js","mods/move_tools.js","mods/nested_for_reaction_example.js","mods/Neutronium Mod.js","mods/portal.js","mods/pushers.js","mods/rainbow_tests.js","mods/random_elems.js","mods/random_liquids.js","mods/random_rocks.js","mods/randomness.js","mods/randomness_but_tick.js","mods/randomness_but_tool.js","mods/slag_fix.js","mods/some_tf_liquids.js","mods/structure_test.js","mods/test.js","mods/ticking_temp_stuff.js","mods/time.js","mods/toothpaste.js","mods/troll.js","mods/unhide.js","mods/worldgen_test.js","mods/page_color.js","mods/color_tools.js","mods/invisible_wall.js","mods/replace_all.js","mods/bacteria_mod.js","mods/controllable_pixel_test.js","mods/fire_slime.js","mods/bioooze.js","mods/color_tools.js","mods/cells.js","mods/triggerable_random_powders.js","mods/replace.js","mods/change.js","mods/prompt.js","mods/miscible_psoup_and_birthpool.js","mods/primordial_birthpool.js","mods/liquid_void.js","mods/solid_rock.js","mods/invisible_dye.js","mods/alcohol.js","mods/a_bundle_of_tests.js","mods/paint_event.js","mods/amogus.js","mods/chem.js","mods/clf3.js","mods/roseyiede.js","mods/state_voids.js","mods/the_ground.js","mods/lone_urea.js","mods/fwibblen.js","mods/velocity.js","mods/prop and prompt variables.js","mods/prop.js","mods/x_dependent_change_test.js","mods/alkahest.js","mods/tool_pixel_behavior.js","mods/onTryMoveInto.js","mods/human_edit.js","mods/runAfterAutogen and onload restructure.js","mods/explodeAtPlus.js","mods/more_bombs.js","mods/note_block.js","mods/wirelike_test.js","mods/no_random_grbs.js","mods/bananas.js","mods/trapdoor.js","mods/apioforms.js","mods/cpt_alt.js","mods/more_fairies.js","mods/spouts.js","mods/mobs.js","mods/more_clouds.js","mods/funny elements 2022-11-15.js","mods/haseulite.js","mods/generator_prompt.js","mods/fire_mod.js","mods/test_4.js","mods/save_loading.js","mods/apioforms_pre.js","mods/cover_yourself_in.js","mods/fill_script.js","mods/find.js","mods/place_all_elements.js"]; localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); alert("Mod list loaded. Refresh the page without the loadTheModList query parameter."); console.log("Mod list loaded. Refresh the page without the loadTheModList query parameter."); From ea89778e5055a1efb1d38f276ba300e55340c5d5 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Mon, 12 Dec 2022 11:01:13 -0500 Subject: [PATCH 36/49] space to _ for prompt inputs --- mods/generator_prompt.js | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/mods/generator_prompt.js b/mods/generator_prompt.js index c8b2bfc8..180f201c 100644 --- a/mods/generator_prompt.js +++ b/mods/generator_prompt.js @@ -85,20 +85,22 @@ elements.generator_prompt = { }; function parseForLateGenerationParameter(input) { - if(typeof(input) === "string") { //it should be an array, so string check - //console.log("String detected"); - if(input.includes(",")) { //comma-separated string? - //console.log("Splitting string to array"); - input = input.split(","); //,SS to array - } else { - //console.log("Wrapping string in array"); - input = [input]; //single string to array - }; - }; - for(i = 0; i < input.length; i++) { - if(input[i].includes("+")) { - input[i] = input[i].split("+") - }; - }; - return input; + if(typeof(input) === "string") { //it should be an array, so string check + input = input.replace(/ /g,"_"); + //console.log("String detected"); + if(input.includes(",")) { //comma-separated string? + //console.log("Splitting string to array"); + input = input.split(","); //,SS to array + } else { + //console.log("Wrapping string in array"); + input = [input]; //single string to array + }; + }; + for(i = 0; i < input.length; i++) { + input[i] = input[i].replace(/ /g,"_"); + if(input[i].includes("+")) { + input[i] = input[i].split("+") + }; + }; + return input; }; From a5dbbe35197cafdf6dac93a47c1469f96864a374 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Mon, 12 Dec 2022 11:29:12 -0500 Subject: [PATCH 37/49] bugfix --- mods/haseulite.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mods/haseulite.js b/mods/haseulite.js index b428e58c..9f839be6 100644 --- a/mods/haseulite.js +++ b/mods/haseulite.js @@ -96,9 +96,6 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && } else { var category = info.category; }; - if(excludedSpoutElements.includes(name)) { - return false - }; var include = false; if(["liquid","gas"].includes(state)) { include = true; @@ -500,6 +497,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && if(isEmpty(rfX,rfY,false)) { var randomEligibleHotElement = hotHeejiniteElements[Math.floor(Math.random() * hotHeejiniteElements.length)]; createPixel(randomEligibleHotElement,rfX,rfY); + pixelMap[rfX][rfY].temp = pixel.temp; }; }; }; From 9785d559f5600aaff932547f8436f219952074d0 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Mon, 12 Dec 2022 11:34:08 -0500 Subject: [PATCH 38/49] add missing dependency --- mods/haseulite.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mods/haseulite.js b/mods/haseulite.js index 9f839be6..06f03a0f 100644 --- a/mods/haseulite.js +++ b/mods/haseulite.js @@ -1,10 +1,11 @@ var modName = "mods/haseulite.js"; var loonaMod = "mods/funny elements 2022-11-15.js"; +var fireMod = "mods/fire_mod.js"; var runAfterAutogenMod = "mods/runAfterAutogen and onload restructure.js"; var explodeAtPlusMod = "mods/explodeAtPlus.js"; var libraryMod = "mods/code_library.js"; -if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlusMod) && enabledMods.includes(libraryMod)) { +if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlusMod) && enabledMods.includes(libraryMod)) { //move explodeAt to YG Entertainment's dungeon oldExplodeAt = explodeAt; @@ -24,7 +25,10 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && density: 2466.73, hardness: 0.56, breakInto: ["rock","sulfur","loona_gravel","loona_gravel","loona_gravel","haseulite_powder", "rock","sulfur","loona_gravel","loona_gravel","loona_gravel","haseulite_powder", "rock","sulfur","loona_gravel","loona_gravel","loona_gravel","heejinite_powder"], - }, + }; + + var backupCategoryWhitelist = ["land","powders","weapons","food","life","corruption","states","fey","Fantastic Creatures","dyes","energy liquids","random liquids","random gases","random rocks"]; + 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"]; function spoutCriteria(name) { if(typeof(elements[name]) !== "object") { @@ -578,9 +582,10 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(runAfterAutogenMod) && } else { if(!enabledMods.includes(loonaMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,loonaMod) }; + if(!enabledMods.includes(fireMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,fireMod) }; if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,runAfterAutogenMod) }; if(!enabledMods.includes(explodeAtPlusMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,explodeAtPlusMod) }; if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) }; localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); - alert(`The "${runAfterAutogenMod}", "${loonaMod}", "${libraryMod}", and "${explodeAtPlusMod}" mods are all required; any missing mods in this list have been automatically inserted (reload for this to take effect).`) + alert(`The "${runAfterAutogenMod}", "${loonaMod}", "${fireMod}", "${libraryMod}", and "${explodeAtPlusMod}" mods are all required; any missing mods in this list have been automatically inserted (reload for this to take effect).`) }; From d52508293477269510fc1612395e6668fa6a178d Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Mon, 12 Dec 2022 12:39:58 -0500 Subject: [PATCH 39/49] more entertaining reaction to irradium --- mods/haseulite.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/mods/haseulite.js b/mods/haseulite.js index 06f03a0f..de9e1099 100644 --- a/mods/haseulite.js +++ b/mods/haseulite.js @@ -146,7 +146,11 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod radiation: 4, fire: [6, "smoke"], rad_fire: [10, "rad_smoke"], - plasma: [15, "fire"] + liquid_fire: [12, ["fire","liquid_smoke","smoke"]], + plasma: [15, "fire"], + liquid_rad_fire: [20, [null,"rad_fire","rad_fire","rad_smoke","rad_smoke"]], + liquid_plasma: [30, ["plasma","liquid_fire","fire"]], + liquid_irradium: [4, null] }; /*function customStaining(pixel,customColorRgb,stainOverride=null) { @@ -246,8 +250,16 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod var haseuliteValueData = haseuliteValueObject[otherElement]; if(haseuliteValueData instanceof Array) { var finalElement = haseuliteValueData[1]; - if(finalElement instanceof Array) { finalElement = finalElement[Math.floor(Math.random() * finalElement.length)] }; - changePixel(otherPixel,haseuliteValueData[1]); + if(finalElement instanceof Array) { + finalElement = finalElement[Math.floor(Math.random() * finalElement.length)]; + }; + if(finalElement !== null) { + if(finalElement === -1) { + deletePixel(otherPixel.x,otherPixel.y); + } else { + changePixel(otherPixel,finalElement); + }; + }; pixel.value += haseuliteValueData[0]; } else if(typeof(haseuliteValueData) === "number") { deletePixel(otherPixel.x,otherPixel.y); From 0057fe6a116ad6bce6694eccd1a99bbc87fbb6c1 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Mon, 12 Dec 2022 17:40:56 -0500 Subject: [PATCH 40/49] Jinsoulite (wets things haha jinsoul blue water fish in the rain) --- mods/haseulite.js | 310 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 310 insertions(+) diff --git a/mods/haseulite.js b/mods/haseulite.js index de9e1099..ae291561 100644 --- a/mods/haseulite.js +++ b/mods/haseulite.js @@ -16,6 +16,86 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod pixel.temp -= 2*damage*radius*power; }; + function reactionStealerImmutableElem2(pixel,newPixel,reactionTarget,ignoreSelf=true) { + if(!elements[reactionTarget]) { + throw new Error(`No such element ${reactionTarget}!`); + }; + if(typeof(newPixel) === "undefined") { //timing issue? + return false; + }; + var newElement = newPixel.element; + if(ignoreSelf && newElement === pixel.element) { + return false; + }; + var newInfo = elements[newElement]; + if(typeof(newInfo.reactions) === "undefined") { + return false; + }; + if(typeof(newInfo.reactions[reactionTarget]) === "undefined") { + return false; + }; + var pixel2 = pixel; + var pixel1 = newPixel; + var r = newInfo.reactions[reactionTarget]; + + if (r.setting && settings[r.setting]===0) { + return false; + } + // r has the attribute "y" which is a range between two y values + // r.y example: [10,30] + // return false if y is defined and pixel1's y is not in the range + if (r.tempMin !== undefined && pixel1.temp < r.tempMin) { + return false; + } + if (r.tempMax !== undefined && pixel1.temp > r.tempMax) { + return false; + } + if (r.charged && !pixel.charge) { + return false; + } + if (r.chance !== undefined && Math.random() > r.chance) { + return false; + } + if (r.y !== undefined && (pixel1.y < r.y[0] || pixel1.y > r.y[1])) { + return false; + } + if (r.elem1 !== undefined) { + // if r.elem1 is an array, set elem1 to a random element from the array, otherwise set it to r.elem1 + if (Array.isArray(r.elem1)) { + var elem1 = r.elem1[Math.floor(Math.random() * r.elem1.length)]; + } else { var elem1 = r.elem1; } + + if (elem1 == null) { + deletePixel(pixel1.x,pixel1.y); + } + else { + changePixel(pixel1,elem1); + } + } + if (r.charge1) { pixel1.charge = r.charge1; } + if (r.temp1) { pixel1.temp += r.temp1; pixelTempCheck(pixel1); } + if (r.color1) { // if it's a list, use a random color from the list, else use the color1 attribute + pixel1.color = pixelColorPick(pixel1, Array.isArray(r.color1) ? r.color1[Math.floor(Math.random() * r.color1.length)] : r.color1); + } + if (r.attr1) { // add each attribute to pixel1 + for (var key in r.attr1) { + pixel1[key] = r.attr1[key]; + } + } + if (r.charge2) { pixel2.charge = r.charge2; } + if (r.temp2) { pixel2.temp += r.temp2; pixelTempCheck(pixel2); } + if (r.color2) { // if it's a list, use a random color from the list, else use the color2 attribute + pixel2.color = pixelColorPick(pixel2, Array.isArray(r.color2) ? r.color2[Math.floor(Math.random() * r.color2.length)] : r.color2); + } + if (r.attr2) { // add each attribute to pixel2 + for (var key in r.attr2) { + pixel2[key] = r.attr2[key]; + } + } + if (r.func) { r.func(pixel1,pixel2); } + return r.elem1!==undefined; + }; + elements.loona = { color: ["#6f7d54","#4f5d34","#7c8a61"], behavior: behaviors.POWDER, @@ -592,6 +672,236 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod conduct: 0.12, }; + jinsouliteReducedSwapWhitelist = ["slime","glue","soda","milk","chocolate_milk","fruit_milk","ink","blood","vaccine","antibody","infection","sap","ketchup","spirit_tear","enchanted_ketchup","lean","poisoned_ketchup","dirty_ketchup","zombie_blood"]; + + function jinsouliteDissolution(pixel) { + var did = false; + for(i = 0; i < 2; i++) { + var randomNeighborOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; + if(Math.random() < 0.6) { randomNeighborOffset = [0,-1] }; //bias upwards + var rfX = pixel.x+randomNeighborOffset[0]; + var rfY = pixel.y+randomNeighborOffset[1]; + if(!isEmpty(rfX,rfY,true)) { + var rOtherPixel = pixelMap[rfX][rfY]; + if(!rOtherPixel) { return false }; + var rOtherElement = rOtherPixel.element; + if(rOtherElement.includes("water") || (Math.random() < 0.3 && jinsouliteReducedSwapWhitelist.includes(rOtherElement))) { + swapPixels(pixel,rOtherPixel); + did = true; + }; + }; + }; + return did; + }; + + function jinsouliteMovement(pixel,move1Spots,move2Spots) { + if(move1Spots.length > 0) { + var randomMove1 = move1Spots[Math.floor(Math.random() * move1Spots.length)]; + if(!tryMove(pixel, pixel.x+randomMove1[0], pixel.y+randomMove1[1])) { + //console.log((pixel.x+randomMove1[0]) + " " + (pixel.y+randomMove1[1])) + var newPixel = null; + if(!outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1])) { + newPixel = pixelMap[pixel.x+randomMove1[0]][pixel.y+randomMove1[1]]; //newPixel is AAA + }; + if(outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1]) || !reactionStealerImmutableElem2(pixel,newPixel,"water")) { + if(move2Spots.length > 0) { + var randomMove2 = move2Spots[Math.floor(Math.random() * move2Spots.length)]; + if(!tryMove(pixel, pixel.x+randomMove2[0], pixel.y+randomMove2[1])) { + var newPixel = null; + if(!outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1])) { + newPixel = pixelMap[pixel.x+randomMove1[0]][pixel.y+randomMove1[1]]; //newPixel is AAA + }; + if(newPixel !== null) { reactionStealerImmutableElem2(pixel,newPixel,"water") }; + }; + }; + }; + }; + }; + doDefaults(pixel); + }; + + function jinsouliteSolidNonWaterSideReactions(pixel) { + var randomNeighborOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; + var rfX = pixel.x+randomNeighborOffset[0]; + var rfY = pixel.y+randomNeighborOffset[1]; + if(!isEmpty(rfX,rfY,true)) { + var rOtherPixel = pixelMap[rfX][rfY]; + if(typeof(rOtherPixel) === "undefined" || isEmpty(rfX,rfY,true)) { + return false; + }; + reactionStealerImmutableElem2(pixel,rOtherPixel,"water"); + }; + return true; + }; + + function jinsouliteSolidWaterSideReactions(pixel) { + var randomNeighborOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; + var rfX = pixel.x+randomNeighborOffset[0]; + var rfY = pixel.y+randomNeighborOffset[1]; + if(!isEmpty(rfX,rfY,true)) { + var pixel2 = pixelMap[rfX][rfY]; + if(typeof(pixel2) === "undefined" || isEmpty(rfX,rfY,true)) { + return false; + }; + var rOtherElement = pixel2.element; + var waterReactions = elements.water.reactions; + if(waterReactions[rOtherElement]) { + var r = waterReactions[rOtherElement]; + + if (r.setting && settings[r.setting]===0) { + return false; + } + // r has the attribute "y" which is a range between two y values + // r.y example: [10,30] + // return false if y is defined and pixel1's y is not in the range + if (r.tempMin !== undefined && pixel1.temp < r.tempMin) { + return false; + } + if (r.tempMax !== undefined && pixel1.temp > r.tempMax) { + return false; + } + if (r.charged && !pixel.charge) { + return false; + } + if (r.chance !== undefined && Math.random() > r.chance) { + return false; + } + if (r.y !== undefined && (pixel1.y < r.y[0] || pixel1.y > r.y[1])) { + return false; + } + if (r.charge1) { pixel1.charge = r.charge1; } + if (r.temp1) { pixel1.temp += r.temp1; pixelTempCheck(pixel1); } + if (r.color1) { // if it's a list, use a random color from the list, else use the color1 attribute + pixel1.color = pixelColorPick(pixel1, Array.isArray(r.color1) ? r.color1[Math.floor(Math.random() * r.color1.length)] : r.color1); + } + if (r.attr1) { // add each attribute to pixel1 + for (var key in r.attr1) { + pixel1[key] = r.attr1[key]; + } + } + if (r.elem2 !== undefined) { + // if r.elem2 is an array, set elem2 to a random element from the array, otherwise set it to r.elem2 + if (Array.isArray(r.elem2)) { + var elem2 = r.elem2[Math.floor(Math.random() * r.elem2.length)]; + } else { var elem2 = r.elem2; } + + if (elem2 == null) { + deletePixel(pixel2.x,pixel2.y); + } + else { + changePixel(pixel2,elem2); + } + } + if (r.charge2) { pixel2.charge = r.charge2; } + if (r.temp2) { pixel2.temp += r.temp2; pixelTempCheck(pixel2); } + if (r.color2) { // if it's a list, use a random color from the list, else use the color2 attribute + pixel2.color = pixelColorPick(pixel2, Array.isArray(r.color2) ? r.color2[Math.floor(Math.random() * r.color2.length)] : r.color2); + } + if (r.attr2) { // add each attribute to pixel2 + for (var key in r.attr2) { + pixel2[key] = r.attr2[key]; + } + } + if (r.func) { r.func(pixel1,pixel2); } + return r.elem1!==undefined || r.elem2!==undefined; + }; + }; + return true; + }; + + function jinsoulitoidTick(pixel,move1Spots=[],move2Spots=[]) { + if(jinsouliteDissolution(pixel)) { + return; + }; + jinsouliteMovement(pixel,move1Spots,move2Spots); + }; + + elements.jinsoulite = { + color: ["#0e51b0", "#2129ff", "#3b3dbf"], + fireColor: ["#121978", "#6a9fe6", "#5963d9"], + /*properties: { + oldColor: null + },*/ + behavior: behaviors.WALL, + tick: function(pixel) { + jinsouliteSolidNonWaterSideReactions(pixel); + jinsouliteSolidWaterSideReactions(pixel); + }, + tempHigh: 2606, + category: "solids", + state: "solid", + density: 8331, + hardness: 0.82, + breakInto: "jinsoulite_powder", + conduct: 0.93, + }; + + elements.jinsoulite_powder = { + color: ["#4580ba", "#355eb0", "#2d6fc4"], + fireColor: ["#121978", "#6a9fe6", "#5963d9"], + tempHigh: 2606, + behavior: behaviors.POWDER, + tick: function(pixel) { jinsoulitoidTick(pixel,[[0,1]],[[-1,1],[1,1]]) }, + stateHigh: "molten_jinsoulite", + category: "powders", + state: "solid", + hidden: true, + density: 5801, + hardness: 0.7, + conduct: 0.43, + }; + + elements.molten_jinsoulite = { + behavior: [ + "XX|CR:fire%0.5|XX", + "XX|XX|XX", + "XX|XX|XX" + ], + color: ["#4e35db","#7767eb","#a876f5", "#78acff"], + fireColor: ["#121978", "#6a9fe6", "#5963d9"], + tick: function(pixel) { jinsoulitoidTick(pixel,[[-1,1],[0,1],[1,1]],[[-1,0],[1,0]]); }, + density: 6448, + hardness: 0.61, + breakInto: "jinsoulite_gas", + temp: 3000, + tempHigh: 5532.8509, + conduct: 0.34, + }; + + elements.jinsoulite_gas = { + color: ["#c0f0ef", "#c2c1db", "#c0bff5", "#cdcce6"], + fireColor: ["#08a953", "#2ea332", "#d1e0d3"], + properties: { + value: 0, + oldColor: null + }, + tick: function(pixel) { jinsoulitoidTick(pixel,adjacentCoords,[[-1,-1],[1,-1],[1,1],[-1,1]]) }, + density: 0.5833, + temp: 6000, + hardness: 1, + conduct: 0.19, + }; + + runAfterLoad(function() { + for(key in elements.water.reactions) { + var value = JSON.parse(JSON.stringify(elements.water.reactions[key])); + if(value.elem2 === null && value.elem1 !== null) { + value.elem2 = value.elem1; + }; + delete value.elem1; + + var movableJinsoulitoids = ["jinsoulite_powder","molten_jinsoulite","jinsoulite_gas"]; + for(j = 0; j < movableJinsoulitoids.length; j++) { + var jinsoulitoid = movableJinsoulitoids[j]; + if(typeof(elements[jinsoulitoid].reactions) === "undefined") { + elements[jinsoulitoid].reactions = {}; + }; + if(typeof(elements[jinsoulitoid].reactions[key]) === "undefined") { + elements[jinsoulitoid].reactions[key] = value; + }; + }; + }; + }); } else { if(!enabledMods.includes(loonaMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,loonaMod) }; if(!enabledMods.includes(fireMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,fireMod) }; From 14ad649beaead53efae3f2834ad993d50fd688ff Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Mon, 12 Dec 2022 18:59:20 -0500 Subject: [PATCH 41/49] jinsoulite now soaks clouds and spits rain --- mods/haseulite.js | 112 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 93 insertions(+), 19 deletions(-) diff --git a/mods/haseulite.js b/mods/haseulite.js index ae291561..1c3c5c72 100644 --- a/mods/haseulite.js +++ b/mods/haseulite.js @@ -11,6 +11,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod oldExplodeAt = explodeAt; explodeAt = explodeAtPlus; haseuliteSpreadWhitelist = ["haseulite","haseulite_powder","molten_haseulite"]; + jinsouliteSpreadWhitelist = ["jinsoulite","jinsoulite_powder","molten_jinsoulite"]; function coldExplosionAfterCooling(pixel,x,y,radius,fire,smoke,power,damage) { pixel.temp -= 2*damage*radius*power; @@ -233,6 +234,14 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod liquid_irradium: [4, null] }; + jinsouliteValueObject = { + steam: [1, ["steam",null]], + cloud: [1, ["cloud",null]], + snow_cloud: [1, ["snow_cloud",null]], + hail_cloud: [1, ["hail_cloud",null]], + rain_cloud: [3, ["rain_cloud","rain_cloud",null]] + }; + /*function customStaining(pixel,customColorRgb,stainOverride=null) { if (settings["stainoff"]) { return } var stain = (stainOverride !== null ? stainOverride : elements[pixel.element].stain); @@ -289,7 +298,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod } }*/ - function haseuliteValueSpreading(pixel) { + function valueSpreading(pixel,whitelist=null) { var randomNeighborOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; var rX = randomNeighborOffset[0]; var rY = randomNeighborOffset[1]; @@ -298,7 +307,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod if(!isEmpty(rfX,rfY,true)) { var rOtherPixel = pixelMap[rfX][rfY]; var rOtherElement = rOtherPixel.element; - if(haseuliteSpreadWhitelist.includes(rOtherElement)) { + if(whitelist === null || (whitelist !== null && whitelist.includes(rOtherElement))) { if(typeof(rOtherPixel.value) !== "number") { rOtherPixel.value = 0; }; @@ -313,7 +322,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod return true; }; - function haseuliteValueAbsorbency(pixel) { + function valueAbsorbency(pixel,valueObject) { for(i = 0; i < adjacentCoords.length; i++) { var oX = adjacentCoords[i][0]; var oY = adjacentCoords[i][1]; @@ -323,13 +332,13 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod var otherPixel = pixelMap[fX][fY]; var otherElement = otherPixel.element; var otherInfo = elements[otherElement]; - if(haseuliteValueObject[otherElement]) { + if(valueObject[otherElement]) { if(typeof(otherPixel) === "undefined" || isEmpty(fX,fY,true)) { return false; }; - var haseuliteValueData = haseuliteValueObject[otherElement]; - if(haseuliteValueData instanceof Array) { - var finalElement = haseuliteValueData[1]; + var ValueData = valueObject[otherElement]; + if(ValueData instanceof Array) { + var finalElement = ValueData[1]; if(finalElement instanceof Array) { finalElement = finalElement[Math.floor(Math.random() * finalElement.length)]; }; @@ -340,10 +349,10 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod changePixel(otherPixel,finalElement); }; }; - pixel.value += haseuliteValueData[0]; - } else if(typeof(haseuliteValueData) === "number") { + pixel.value += ValueData[0]; + } else if(typeof(ValueData) === "number") { deletePixel(otherPixel.x,otherPixel.y); - pixel.value += haseuliteValueData[0]; + pixel.value += ValueData[0]; }; }; }; @@ -351,24 +360,24 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod return true; }; - function haseuliteValueFunction(pixel) { + function valueFunction(pixel,valueObject,elementWhitelist=null) { if(typeof(pixel.value) === "undefined") { pixel.value = 0; }; var oldValue = pixel.value; - if(!haseuliteValueAbsorbency(pixel) || isNaN(pixel.value)) { + if(!valueAbsorbency(pixel,valueObject) || isNaN(pixel.value)) { pixel.value = oldValue; }; var oldValue = pixel.value; - if(!haseuliteValueSpreading(pixel) || isNaN(pixel.value)) { + if(!valueSpreading(pixel,elementWhitelist) || isNaN(pixel.value)) { pixel.value = oldValue; }; } function haseulitoidTick(pixel) { - haseuliteValueFunction(pixel); + valueFunction(pixel,haseuliteValueObject,haseuliteSpreadWhitelist); if(pixel.oldColor === null) { pixel.oldColor = pixel.color }; pixel.color = lightenColor(pixel.oldColor,pixel.value / 3); @@ -809,21 +818,53 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod return true; }; + function jinsouliteValue(pixel) { + valueFunction(pixel,jinsouliteValueObject,jinsouliteSpreadWhitelist); + if(pixel.oldColor === null) { pixel.oldColor = pixel.color }; + pixel.color = changeSaturation(pixel.oldColor,pixel.value / 3,"subtract","rgb") + + if(pixel.value > 1) { + if(Math.random() < Math.min((pixel.value / 200),0.5)) { + var randomNeighborOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; + var rX = randomNeighborOffset[0]; + var rY = randomNeighborOffset[1]; + var rfX = pixel.x+rX; + var rfY = pixel.y+rY; + if(isEmpty(rfX,rfY,false)) { + createPixel("water",rfX,rfY); + pixel.value--; + }; + }; + }; + } + function jinsoulitoidTick(pixel,move1Spots=[],move2Spots=[]) { if(jinsouliteDissolution(pixel)) { return; }; + jinsouliteValue(pixel); jinsouliteMovement(pixel,move1Spots,move2Spots); }; elements.jinsoulite = { color: ["#0e51b0", "#2129ff", "#3b3dbf"], fireColor: ["#121978", "#6a9fe6", "#5963d9"], - /*properties: { + behavior: [ + "XX|CR:water%0.03|XX", + "CR:water%0.03|XX|CR:water%0.03", + "XX|CR:water%0.03|XX" + ], + behaviorOn: [ + "XX|CR:water%0.1|XX", + "CR:water%0.1|XX|CR:water%0.1", + "XX|CR:water%0.1|XX" + ], + properties: { + value: 0, oldColor: null - },*/ - behavior: behaviors.WALL, + }, tick: function(pixel) { + jinsouliteValue(pixel); jinsouliteSolidNonWaterSideReactions(pixel); jinsouliteSolidWaterSideReactions(pixel); }, @@ -840,7 +881,20 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod color: ["#4580ba", "#355eb0", "#2d6fc4"], fireColor: ["#121978", "#6a9fe6", "#5963d9"], tempHigh: 2606, - behavior: behaviors.POWDER, + behavior: [ + "XX|CR:water%0.03|XX", + "CR:water%0.03|XX|CR:water%0.03", + "XX|CR:water%0.03|XX" + ], + properties: { + value: 0, + oldColor: null + }, + behaviorOn: [ + "XX|CR:water%0.1|XX", + "CR:water%0.1|XX|CR:water%0.1", + "XX|CR:water%0.1|XX" + ], tick: function(pixel) { jinsoulitoidTick(pixel,[[0,1]],[[-1,1],[1,1]]) }, stateHigh: "molten_jinsoulite", category: "powders", @@ -853,12 +907,22 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod elements.molten_jinsoulite = { behavior: [ - "XX|CR:fire%0.5|XX", + "XX|CR:fire,fire,steam%0.5|XX", "XX|XX|XX", "XX|XX|XX" ], + behaviorOn: [ + "XX|CR:fire,steam,steam%0.7|XX", + "CR:steam%0.1|XX|CR:steam%0.1", + "XX|CR:steam%0.1|XX" + ], + properties: { + value: 0, + oldColor: null + }, color: ["#4e35db","#7767eb","#a876f5", "#78acff"], fireColor: ["#121978", "#6a9fe6", "#5963d9"], + fireElement: ["fire","fire","steam"], tick: function(pixel) { jinsoulitoidTick(pixel,[[-1,1],[0,1],[1,1]],[[-1,0],[1,0]]); }, density: 6448, hardness: 0.61, @@ -870,6 +934,16 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod elements.jinsoulite_gas = { color: ["#c0f0ef", "#c2c1db", "#c0bff5", "#cdcce6"], + behavior: [ + "XX|CR:steam%0.5|XX", + "CR:steam%0.5|XX|CR:steam%0.5", + "XX|CR:steam%0.5|XX", + ], + behaviorOn: [ + "XX|CR:steam%1|XX", + "CR:steam%1|XX|CR:steam%1", + "XX|CR:steam%1|XX", + ], fireColor: ["#08a953", "#2ea332", "#d1e0d3"], properties: { value: 0, From abfc50248506101b52c258577a5014ab5b76674b Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Mon, 12 Dec 2022 19:13:04 -0500 Subject: [PATCH 42/49] cat fixes --- mods/haseulite.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mods/haseulite.js b/mods/haseulite.js index 1c3c5c72..f89e7bb6 100644 --- a/mods/haseulite.js +++ b/mods/haseulite.js @@ -501,6 +501,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod value: 0, oldColor: null }, + category: "powders", fireColor: ["#08a953", "#2ea332", "#d1e0d3"], tempHigh: 1757, behavior: behaviors.POWDER, @@ -637,8 +638,9 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod tick: function(pixel) { heejinitoidTick(pixel) }, excludeVelocity: true, //wall shouldn't move tempHigh: 837, + hidden: true, stateHigh: "molten_heejinite", - category: "solids", + category: "powders", state: "solid", density: 1412, stain: 0.1, @@ -890,6 +892,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod value: 0, oldColor: null }, + category: "powders", behaviorOn: [ "XX|CR:water%0.1|XX", "CR:water%0.1|XX|CR:water%0.1", From aec6972e58cd41a6185a2dcd6b942200f572083b Mon Sep 17 00:00:00 2001 From: lllllllllwith10ls <38187754+lllllllllwith10ls@users.noreply.github.com> Date: Mon, 12 Dec 2022 20:12:47 -0600 Subject: [PATCH 43/49] Added acids and tetrafluoroethylene synthesis --- mods/chem.js | 590 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 555 insertions(+), 35 deletions(-) diff --git a/mods/chem.js b/mods/chem.js index 3b7459f8..1800fbb1 100644 --- a/mods/chem.js +++ b/mods/chem.js @@ -1,7 +1,7 @@ elements.fluorine = { color: "#FFFFBF", behavior: behaviors.GAS, - ignore: ["FOOF","solid_FOOF","oxygen","liquid_oxygen","oxygen_ice","chlorine","liquid_chlorine","liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","smoke","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","hydrogen"], + ignore: ["FOOF","solid_FOOF","oxygen","liquid_oxygen","oxygen_ice","chlorine","liquid_chlorine","liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","smoke","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","hydrogen","polytetrafluoroethylene","molten_polytetrafluoroethylene"], tick: function(pixel) { let change = false; for (let i = -1; i <= 1; i++) { @@ -37,12 +37,12 @@ elements.fluorine = { category:"gases", density: 1.7, stain: 0.005, -} +}; elements.liquid_fluorine = { color: "#ffff3b", behavior: behaviors.LIQUID, - ignore: ["FOOF","solid_FOOF","oxygen","liquid_oxygen","oxygen_ice","chlorine","liquid_chlorine","liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","smoke","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","hydrogen"], + ignore: ["FOOF","solid_FOOF","oxygen","liquid_oxygen","oxygen_ice","chlorine","liquid_chlorine","liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","smoke","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","hydrogen","polytetrafluoroethylene","molten_polytetrafluoroethylene"], tick: function(pixel) { let change = false; for (let i = -1; i <= 1; i++) { @@ -77,13 +77,13 @@ elements.liquid_fluorine = { tempLow: -219.7, state: "liquid", category:"liquids", - density: 1.7, + density: 1505, stain: 0.005, -} +}; elements.hydrofluoric_acid = { color: ["#c8cf91","#efff5e","#a0cc39"], - ignore: ["fire","liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold"], + ignore: ["fire","liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","polytetrafluoroethylene","molten_polytetrafluoroethylene","chloroform","chloroform_gas","chloroform_ice","tetrafluoroethylene"], tick: function(pixel) { let change = false; for (let i = -1; i <= 1; i++) { @@ -117,15 +117,15 @@ elements.hydrofluoric_acid = { category:"liquids", density: 1150, stain: 0.005, - tempHigh: 400, - stateHigh: "fire", + tempHigh: 100, + stateHigh: "hydrofluoric_acid_gas", tempLow: -58.88, -} +}; elements.hydrofluoric_acid_gas = { color: ["#acb37d","#bfcc4b","#668224"], - ignore: ["liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold"], + ignore: ["liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","polytetrafluoroethylene","molten_polytetrafluoroethylene","chloroform","chloroform_gas","chloroform_ice","tetrafluoroethylene"], tick: function(pixel) { let change = false; for (let i = -1; i <= 1; i++) { @@ -162,12 +162,12 @@ elements.hydrofluoric_acid_gas = { tempLow: -10, stateLow: "hydrofluoric_acid", category:"gases", -} +}; elements.hydrogen_fluoride = { color: "#f2f28d", behavior: behaviors.GAS, - ignore: ["liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","smoke","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","hydrogen"], + ignore: ["liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","smoke","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","hydrogen","polytetrafluoroethylene","molten_polytetrafluoroethylene","chloroform","chloroform_gas","chloroform_ice","tetrafluoroethylene"], tick: function(pixel) { let change = false; for (let i = -1; i <= 1; i++) { @@ -201,12 +201,12 @@ elements.hydrogen_fluoride = { stain: 0.005, tempLow: -19.5, stateLow: "liquid_hydrogen_fluoride", -} +}; elements.liquid_hydrogen_fluoride = { color: "#e2e28d", behavior: behaviors.LIQUID, - ignore: ["liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","smoke","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","hydrogen"], + ignore: ["liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","smoke","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","hydrogen","polytetrafluoroethylene","molten_polytetrafluoroethylene","chloroform","chloroform_gas","chloroform_ice","tetrafluoroethylene"], tick: function(pixel) { let change = false; for (let i = -1; i <= 1; i++) { @@ -242,12 +242,12 @@ elements.liquid_hydrogen_fluoride = { tempHigh: -19.5, stateHigh: "hydrogen_fluoride", tempLow: -83.6, -} +}; elements.FOOF = { color: "#fa1e1e", behavior: behaviors.LIQUID, - ignore: ["FOOF","solid_FOOF","fluorine","liquid_fluorine","fluorine_ice","liquid_oxygen","oxygen_ice","oxygen","fire"], + ignore: ["FOOF","solid_FOOF","fluorine","liquid_fluorine","fluorine_ice","liquid_oxygen","oxygen_ice","oxygen","fire","polytetrafluoroethylene","molten_polytetrafluoroethylene"], tick: function(pixel) { let change = false; for (let i = -1; i <= 1; i++) { @@ -280,12 +280,12 @@ elements.FOOF = { stateHigh: ["oxygen","fluorine","explosion"], tempLow: -154, stateLow: "solid_FOOF", -} +}; elements.solid_FOOF = { color: "#fa4a1e", behavior: behaviors.WALL, - ignore: ["FOOF","solid_FOOF","fluorine","liquid_fluorine","fluorine_ice","liquid_oxygen","oxygen_ice","oxygen","fire"], + ignore: ["FOOF","solid_FOOF","fluorine","liquid_fluorine","fluorine_ice","liquid_oxygen","oxygen_ice","oxygen","fire","polytetrafluoroethylene","molten_polytetrafluoroethylene"], tick: function(pixel) { let change = false; for (let i = -1; i <= 1; i++) { @@ -316,19 +316,132 @@ elements.solid_FOOF = { temp: -160, tempHigh: -154, stateHigh: "FOOF", -} +}; if (!elements.acid.ignore) { acid.ignore = []; -} +}; if (!elements.acid_gas.ignore) { acid_gas.ignore = []; -} +}; elements.acid.ignore.push("liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas"); elements.acid_gas.ignore.push("liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas"); +let defaultAcidReactions = { + "ash": { "elem1":"neutral_acid", "elem2":null }, + "limestone": { "elem1":"neutral_acid", "elem2":null }, + "quicklime": { "elem1":"neutral_acid", "elem2":null }, + "slaked_lime": { "elem1":"neutral_acid", "elem2":null }, + "borax": { "elem1":"neutral_acid", "elem2":null }, + "ammonia": { "elem1":"neutral_acid", "elem2":null }, + "bleach": { "elem1":"neutral_acid", "elem2":null }, + "water": { "elem1":null, "elem2":"dirty_water" }, + "salt_water": { "elem1":null, "elem2":"water" }, + "sugar_water": { "elem1":null, "elem2":"water" }, + "charcoal": { "elem1":null, "elem2":"carbon_dioxide" }, + "grape": { "elem2":"juice", "color1":"#291824" }, + "soap": { "elem1": "hydrogen" }, + "sodium": { "elem1":"explosion" }, + "meat": { "elem2":"rotten_meat", "elem1":null, "chance":0.5 }, +} + +let defaultAcidGasReactions = { + "acid_gas": { "elem1": null, "elem2": "acid_cloud", "chance":0.3, "y":[0,12], "setting":"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" }, + "ash": { "elem1":"hydrogen", "elem2":null, "chance":0.05 }, + "limestone": { "elem1":"hydrogen", "elem2":null, "chance":0.05 }, + "quicklime": { "elem1":"hydrogen", "elem2":null, "chance":0.05 }, + "slaked_lime": { "elem1":"hydrogen", "elem2":null, "chance":0.05 }, + "borax": { "elem1":"hydrogen", "elem2":null, "chance":0.05 }, + "ammonia": { "elem1":"hydrogen", "elem2":null, "chance":0.05 }, + "bleach": { "elem1":"hydrogen", "elem2":null, "chance":0.05 }, + "grape": { "elem2":"juice", "color1":"#291824" }, + "soap": { "elem1": "hydrogen" }, + "sodium": { "elem1":"explosion" }, + "meat": { "elem2":"rotten_meat", "elem1":null, "chance":0.4 }, +} + +acids = [elements.acid, elements.acid_gas]; +ignoreAcid = []; + +function createAcid(name,reactions, gasReactions, color, colorGas, category, categoryGas, tempHigh, tempLowGas, tempLow, tempHighGas, density, densityGas) +{ + elements[name] = { + color: color, + behavior: [ + "XX|DB%5|XX", + "DB%5 AND M2|XX|DB%5 AND M2", + "DB%5 AND M2|DB%10 AND M1|DB%5 AND M2", + ], + ignore: elements.acid.ignore.concat(ignoreAcid), + reactions: reactions, + category: category, + tempHigh: tempHigh, + stateHigh: name + "_gas", + tempLow: tempLow, + burn: 30, + burnTime: 1, + state: "liquid", + density: density, + } + elements[name+"_gas"] = { + color: colorGas, + behavior: [ + "M1|DB%5 AND M1|M1", + "DB%5 AND M1|XX|DB%5 AND M1", + "DB%5 AND M1|DB%10 AND M1|DB%5 AND M1", + ], + ignore: elements.acid_gas.ignore.concat(ignoreAcid), + reactions: gasReactions, + category: categoryGas, + tempHigh: tempHighGas, + stateHigh: "fire", + tempLow: tempLowGas, + stateLow: name, + temp: tempLowGas + 20, + burn: 30, + burnTime: 1, + state: "gas", + density: densityGas, + } + acids.push(elements[name], elements[name+"_gas"]); + acidIgnore([name, name + "_gas"]); +} + +function acidIgnore(ignore) +{ + for(let i = 0; i < acids.length; i++) + { + acids[i].ignore = acids[i].ignore.concat(ignore); + } + ignoreAcid = ignoreAcid.concat(ignore); +} + +acidIgnore(["acid", "acid_gas"]); +elements.acid.name = "hydrochloric acid"; +elements.acid_gas.name = "hydrochloric acid gas"; + + +createAcid("generic_acid",defaultAcidReactions,defaultAcidGasReactions,"#80d488","#9bf4a4","hidden","hidden",110,100,-10,400,1020,1) +elements.generic_acid.name = "acid"; +elements.generic_acid_gas.name = "acid_gas"; + +elements.acid_cloud.behavior = [ + "XX|XX|XX", + "XX|CH:generic_acid%0.05|M1%2.5 AND BO", + "XX|XX|XX", + ]; + +createAcid("nitric_acid",defaultAcidReactions,defaultAcidGasReactions,["#5ee9c7","#7ac2b1","#7c9f96"],["#78edd2","#8eccbe","#8aa8a1"],"liquids","gases",83,70,-42,400,1500,1.5) + +elements.nitric_acid.reactions["ammonia"] = { "elem1": "fertilizer", "elem2": null}; elements.nitric_oxide = { color: "#b8926c", @@ -341,21 +454,20 @@ elements.nitric_oxide = { category: "gases", state: "gas", density: 1.34, -} +}; 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 }, - "ammonia": { "elem1": "fertilizer", "elem2": null}, "blood": { "elem1":null, "elem2":"infection", "chance":0.01 }, - "water": { "elem1":null, "elem2":"dirty_water", "chance":0.01 }, + "water": { "elem1":null, "elem2":"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 }, @@ -380,19 +492,29 @@ elements.nitrogen_dioxide = { "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" }, }, temp: 30, tempLow: 21.15, category: "gases", state: "gas", density: 1.88, -} +}; elements.liquid_nitrogen_dioxide = { tempLow: -9.3, hidden: true, -} + reactions: structuredClone(elements.nitrogen_dioxide.reactions), +}; +elements.acid.ignore.push("nitric_oxide","liquid_nitric_oxide","nitric_oxide_ice","nitrogen_dioxide","liquid_nitrogen_dioxide","nitrogen_dioxide_ice"); +elements.acid_gas.ignore.push("nitric_oxide","liquid_nitric_oxide","nitric_oxide_ice","nitrogen_dioxide","liquid_nitrogen_dioxide","nitrogen_dioxide_ice"); elements.fertilizer = { color: "#e6c3a1", @@ -420,15 +542,15 @@ elements.fertilizer = { category: "powders", state: "solid", density: 1725, -} +}; -elements.ammonia.reactions["oxygen"] = { "elem1": "steam", "elem2": "nitric_oxide" } +elements.ammonia.reactions["oxygen"] = { "elem1": "steam", "elem2": "nitric_oxide" }; 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|XX|XX", -] +]; elements.gamma_ray_burst = { @@ -446,7 +568,7 @@ elements.gamma_ray_burst = { hidden: true, excludeRandom: true, maxSize: 1, -} +}; elements.neutronium = { @@ -459,11 +581,13 @@ elements.neutronium = { temp: 1e6, tempHigh: 1e7, stateHigh: "liquid_neutronium", + tempLow: 1e5, + stateLow: ["molten_uranium","molten_gold","molten_tungsten","molten_lead"], breakInto: "gamma_ray_burst", category: "special", state: "solid", density: 4e17, -} +}; @@ -498,7 +622,7 @@ elements.liquid_neutronium = { category: "special", state: "liquid", density: 2e17, -} +}; elements.liquid_helium.behavior2 = [ "XX|XX|XX".split("|"), @@ -522,7 +646,7 @@ elements.liquid_helium.tick = function(pixel) { { pixelTick(pixel,elements.liquid_helium.behavior2); } -} +}; elements.quark_matter = { @@ -542,4 +666,400 @@ elements.quark_matter = { category: "special", state: "liquid", density: 4e18, -} \ No newline at end of file +}; + +elements.sulfur.burnInto = ["sulfur_dioxide"]; +elements.molten_sulfur.burnInto = ["sulfur_dioxide"]; +elements.sulfur_gas.burnInto = ["sulfur_dioxide"]; + + +elements.sulfur_dioxide = { + color: "#FFF700", + behavior: behaviors.GAS, + reactions: { + "water": { "elem1": "sulfuric_acid", "elem2": null }, + "salt_water": { "elem1": "sulfuric_acid", "elem2": null }, + "sugar_water": { "elem1": "sulfuric_acid", "elem2": null }, + "dirty_water": { "elem1": "sulfuric_acid", "elem2": null }, + "steam": { "elem1": "sulfuric_acid_gas", "elem2": null }, + "acid_gas": { "elem1": "sulfuric_acid_gas", "elem2": null }, + "neutral_acid": { "elem1": "sulfuric_acid", "elem2": null }, + //poison + "blood": { "elem1":null, "elem2":"infection" }, + "soap": { "elem1":null, "chance":0.02 }, + "plant": { "elem1":null, "elem2":"dead_plant" }, + "grass": { "elem1":null, "elem2":"dead_plant" }, + "vine": { "elem1":null, "elem2":"dead_plant" }, + "algae": { "elem1":null, "elem2":null }, + "mushroom_spore": { "elem1":null, "elem2":null }, + "lichen": { "elem1":null, "elem2":null }, + "yeast": { "elem1":null, "elem2":null }, + "rat": { "elem1":null, "elem2":"rotten_meat" }, + "frog": { "elem1":null, "elem2":"rotten_meat" }, + "tadpole": { "elem2":null }, + "fish": { "elem1":null, "elem2":"rotten_meat" }, + "bird": { "elem1":null, "elem2":"rotten_meat" }, + "head": { "elem1":null, "elem2":"rotten_meat" }, + "body": { "elem1":null, "elem2":"rotten_meat" }, + "ant": { "elem1":null, "elem2":"dead_bug" }, + "worm": { "elem1":null, "elem2":"dead_bug" }, + "fly": { "elem1":null, "elem2":"dead_bug" }, + "firefly": { "elem1":null, "elem2":"dead_bug" }, + "bee": { "elem1":null, "elem2":"dead_bug" }, + "stink_bug": { "elem1":null, "elem2":"dead_bug" }, + "termite": { "elem1":null, "elem2":"dead_bug" }, + "flea": { "elem1":null, "elem2":"dead_bug" }, + "slug": { "elem1":null, "elem2":"slime" }, + "snail": { "elem1":null, "elem2":"calcium" }, + "sapling": { "elem1":null, "elem2":"dead_plant" }, + "root": { "elem1":null, "elem2":"dead_plant" }, + "flower_seed": { "elem1":null, "elem2":"dead_plant" }, + "pistil": { "elem1":null, "elem2":"dead_plant" }, + "petal": { "elem1":null, "elem2":"dead_plant" }, + "grass_seed": { "elem1":null, "elem2":"dead_plant" }, + "meat": { "elem1":null, "elem2":"rotten_meat" }, + //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" }, + }, + tempLow: -10, + stateLow: "liquid_sulfur_dioxide", + state: "gas", + category:"gases", + density: 2.6, +}; + +elements.liquid_sulfur_dioxide = { + color: "#d1cb17", + behavior: behaviors.LIQUID, + reactions: elements.sulfur_dioxide.reactions, + tempLow: -72, + state: "liquid", + hidden: true, + density: 1435, +}; + +acidIgnore(["sulfur_dioxide","liquid_sulfur_dioxide","sulfur_dioxide_ice"]); + +createAcid("sulfuric_acid",defaultAcidReactions,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"); +elements.sulfuric_acid.reactions["chocolate"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["grape"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["juice"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["corn"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["popcorn"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["potato"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["bread"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["toast"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["wheat"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["flour"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["dough"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["sugar"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["candy"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +delete elements.sulfuric_acid.reactions["charcoal"]; +elements.sulfuric_acid_gas.reactions["chocolate"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["grape"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["juice"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["corn"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["popcorn"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["potato"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["bread"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["toast"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["wheat"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["flour"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["dough"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["sugar"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["candy"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +delete elements.sulfuric_acid_gas.reactions["charcoal"]; + +elements.polytetrafluoroethylene = { + color: "#efefef", + behavior: behaviors.WALL, + properties: { + colored: false + }, + tick: function(pixel) { + if(!pixel.colored) + { + let rgb = elements.polytetrafluoroethylene.colorObject; + + let coloroffset = Math.floor(Math.random() * (Math.random() > 0.5 ? -1 : 1) * Math.random() * 2); + let r = rgb.r + coloroffset; + let g = rgb.g + coloroffset; + let b = rgb.b + coloroffset; + pixel.color = "rgb("+r+","+g+","+b+")"; + pixel.colored = true; + pixel.origColor = pixel.color; + } + if (pixel.origColor != pixel.color) { + pixel.color = pixel.origColor; + } + }, + state: "solid", + category: "solids", + density: 1450, + tempHigh: 327, +} +acidIgnore(["polytetrafluoroethylene", "molten_polytetrafluoroethylene", "tetrafluoroethylene"]); + + +function doStaining(pixel) { + if (settings["stainoff"]) { return } + var stain = elements[pixel.element].stain; + if (stain > 0) { + var newColor = pixel.color.match(/\d+/g); + } + else { + var newColor = null; + } + + 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]; + if ((elements[pixel.element].ignore && elements[pixel.element].ignore.indexOf(newPixel.element) !== -1) || newPixel.element == "polytetrafluoroethylene") { + continue; + } + if ((elements[newPixel.element].id !== elements[pixel.element].id || elements[newPixel.element].stainSelf) && (solidStates[elements[newPixel.element].state] || elements[newPixel.element].id === elements[pixel.element].id)) { + if (Math.random() < Math.abs(stain)) { + if (stain < 0) { + if (newPixel.origColor) { + newColor = newPixel.origColor; + } + else { continue; } + } + else if (!newPixel.origColor) { + newPixel.origColor = newPixel.color.match(/\d+/g); + } + // if newPixel.color doesn't start with rgb, continue + if (!newPixel.color.match(/^rgb/)) { continue; } + // parse rgb color string of newPixel rgb(r,g,b) + var rgb = newPixel.color.match(/\d+/g); + if (elements[pixel.element].stainSelf && elements[newPixel.element].id === elements[pixel.element].id) { + // if rgb and newColor are the same, continue + if (rgb[0] === newColor[0] && rgb[1] === newColor[1] && rgb[2] === newColor[2]) { continue; } + var avg = []; + for (var j = 0; j < rgb.length; j++) { + avg[j] = Math.round((rgb[j]*(1-Math.abs(stain))) + (newColor[j]*Math.abs(stain))); + } + } + else { + // get the average of rgb and newColor, more intense as stain reaches 1 + var avg = []; + for (var j = 0; j < rgb.length; j++) { + avg[j] = Math.floor((rgb[j]*(1-Math.abs(stain))) + (newColor[j]*Math.abs(stain))); + } + } + // set newPixel color to avg + newPixel.color = "rgb("+avg.join(",")+")"; + } + } + } + } + } +elements["bleach"].reactions.vinegar = { "elem1":"chlorine", "elem2":null }; +elements["bleach"].reactions.alchohol = { "elem1":"chloroform", "elem2":null }; +elements["chlorine"].reactions.methane = { "elem1":"chloroform", "elem2":null }; + +elements.chloroform = { + color: "#7f7f7f", + behavior: behaviors.LIQUID, + reactions: elements.poison.reactions, + state: "liquid", + category: "liquids", + density: 1564, + tempLow: -63, + tempHigh: 61, +} + +elements.chloroform_gas = { + color: "#8f8f8f", + behavior: behaviors.GAS, + reactions: elements.poison.reactions, + state: "gas", + hidden: true, + density: 4.12, + tempLow: 61, + stateLow: "chloroform" +} + +elements["chloroform_gas"].reactions.hydrogen_fluoride = { "elem1":"tetrafluoroethylene", "elem2": null, tempMin: 550 }; + + +elements.tetrafluoroethylene = { + color: "#8f8f8f", + behavior: behaviors.GAS, + reactions: { + "oxygen": { "elem1":"fire", "elem2":"fire" }, + "sulfuric_acid": { "elem1":"polytetrafluoroethylene", "elem2":"sulfuric_acid", "chance":0.25 }, + "sulfuric_acid_gas": { "elem1":"polytetrafluoroethylene", "elem2":"sulfuric_acid_gas", "chance":0.25 }, + }, + state: "gas", + hidden: true, + burn: 100, + burnTime: 2, + density: 1.52, +} + + + + + +elements.polyethylene = { + color: "#a7a7a7", + behavior: behaviors.WALL, + properties: { + colored: false + }, + tick: function(pixel) { + if(!pixel.colored) + { + let rgb = elements.polyethylene.colorObject; + + let coloroffset = Math.floor(Math.random() * (Math.random() > 0.5 ? -1 : 1) * Math.random() * 2); + let r = rgb.r + coloroffset; + let g = rgb.g + coloroffset; + let b = rgb.b + coloroffset; + pixel.color = "rgb("+r+","+g+","+b+")"; + pixel.colored = true; + pixel.origColor = pixel.color; + } + }, + state: "solid", + category: "solids", + density: 1450, + tempHigh: 125, +} + + +elements.ethane = { + color: "#afafaf", + behavior: behaviors.GAS, + reactions: { + "steam": { "elem1":null, "elem2":"ethylene", "chance":0.25 } + }, + category: "gases", + tempHigh: 400, + stateHigh: "fire", + tempLow: -88.5, + burn: 85, + burnTime: 5, + fireColor: ["#00ffff","#00ffdd"], + state: "gas", + density: 1.356, +}; + +elements.ethylene = { + color: "#a7a7a7", + behavior: behaviors.GAS, + reactions: { + "titanium_trichloride": { "elem1":"polyethylene", "elem2":"titanium_trichloride", "chance":0.25 }, + }, + category: "gases", + tempHigh: 400, + stateHigh: "fire", + tempLow: -88.5, + burn: 85, + burnTime: 5, + fireColor: ["#00ffff","#00ffdd"], + state: "gas", + density: 1.356, +}; + + + +elements.titanium = { + color: "#e3e5e6", + category: "solids", + state: "solid", + behavior: behaviors.WALL, + reactions: { + "hydrochloric_acid": { "elem1": "titanium_trichloride", "elem2":null }, + }, + stateHigh: "molten_titanium", + tempHigh: 1668, + conduct: 0.5, +}; +elements.molten_titanium = { + color: ["#e0921d", "#e89e2e", "#f7b24a", "#fce168", "#fceca2", "#fffcf0"], + hidden: true, + state: "liquid", + behavior: behaviors.LIQUID, + stateLow: "titanium", + tempLow: 1668, + temp: 2000, + viscosity: 10000 +}; + +elements.rutile = { + color: "#522614", + behavior: behaviors.POWDER, + category: "land", + density: 4240, + state: "solid", + tempHigh: 1843, + stateHigh: "molten_rutile", +}; +elements.molten_rutile = { + color: ["#e3907f", "#e68f3e"], + behavior: behaviors.LIQUID, + hidden: true, + reactions: { + "chlorine": { "elem1": "titanium_tetrachloride", "elem2":null }, + }, + density: 4230, + state: "liquid", + temp: 2000, + tempLow: 1843, + stateLow: "rutile", + viscosity: 10000 + }; +elements.titanium_tetrachloride = { + color: "#d9d7b2", + behavior: behaviors.LIQUID, + category: "liquids", + density: 1728, + state: "liquid", + tempHigh: 136.4, + stateHigh: "titanium_tetrachloride_gas", + tempLow: -24, + stateLow: "titanium_tetrachloride_crystal", +}; +elements.titanium_tetrachloride_gas = { + color: "#e8edd5", + behavior: behaviors.GAS, + hidden: true, + density: 500, + state: "gas", + temp: 200, + tempLow: 136.4, + stateLow: "titanium_tetrachloride" +}; +elements.titanium_tetrachloride_crystal = { + color: "#f5fffe", + behavior: behaviors.WALL, + hidden: true, + density: 1728, + state: "solid", + temp: -50, + tempHigh: -24, + stateHigh: "titanium_tetrachloride" +}; + + +elements.titanium_trichloride = { + color: "#c71585", + behavior: behaviors.SOLID, + category: "solids", + density: 2640, + state: "solid", +}; + +//todo: magnesium for titanium production \ No newline at end of file From 7ce635aef1448c025fae9ad9c0acb61300d2e330 Mon Sep 17 00:00:00 2001 From: lllllllllwith10ls <38187754+lllllllllwith10ls@users.noreply.github.com> Date: Mon, 12 Dec 2022 20:39:20 -0600 Subject: [PATCH 44/49] hide things that are in hidden category --- mods/chem.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mods/chem.js b/mods/chem.js index 17375dfc..506bd6c8 100644 --- a/mods/chem.js +++ b/mods/chem.js @@ -383,6 +383,7 @@ function createAcid(name,reactions, gasReactions, color, colorGas, category, cat ignore: elements.acid.ignore.concat(ignoreAcid), reactions: reactions, category: category, + hidden: categoryGas === "hidden", tempHigh: tempHigh, stateHigh: name + "_gas", tempLow: tempLow, @@ -401,6 +402,7 @@ function createAcid(name,reactions, gasReactions, color, colorGas, category, cat ignore: elements.acid_gas.ignore.concat(ignoreAcid), reactions: gasReactions, category: categoryGas, + hidden: categoryGas === "hidden", tempHigh: tempHighGas, stateHigh: "fire", tempLow: tempLowGas, From 5dd6c1f3c64fc5b0b902d150b83311457164eda5 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Tue, 13 Dec 2022 09:29:26 -0500 Subject: [PATCH 45/49] buff jinsoulite, bug fixes --- mods/haseulite.js | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/mods/haseulite.js b/mods/haseulite.js index f89e7bb6..3c44da09 100644 --- a/mods/haseulite.js +++ b/mods/haseulite.js @@ -17,7 +17,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod pixel.temp -= 2*damage*radius*power; }; - function reactionStealerImmutableElem2(pixel,newPixel,reactionTarget,ignoreSelf=true) { + function reactionStealerImmutableElem2(pixel,newPixel,reactionTarget,ignoreSelf=true,_chanceMultMeantForJinsoulites=1) { if(!elements[reactionTarget]) { throw new Error(`No such element ${reactionTarget}!`); }; @@ -54,7 +54,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod if (r.charged && !pixel.charge) { return false; } - if (r.chance !== undefined && Math.random() > r.chance) { + if (r.chance !== undefined && Math.random() < (r.chance * _chanceMultMeantForJinsoulites)) { return false; } if (r.y !== undefined && (pixel1.y < r.y[0] || pixel1.y > r.y[1])) { @@ -689,7 +689,6 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod var did = false; for(i = 0; i < 2; i++) { var randomNeighborOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; - if(Math.random() < 0.6) { randomNeighborOffset = [0,-1] }; //bias upwards var rfX = pixel.x+randomNeighborOffset[0]; var rfY = pixel.y+randomNeighborOffset[1]; if(!isEmpty(rfX,rfY,true)) { @@ -714,7 +713,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod if(!outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1])) { newPixel = pixelMap[pixel.x+randomMove1[0]][pixel.y+randomMove1[1]]; //newPixel is AAA }; - if(outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1]) || !reactionStealerImmutableElem2(pixel,newPixel,"water")) { + if(outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1]) || !reactionStealerImmutableElem2(pixel,newPixel,"water",true,2)) { if(move2Spots.length > 0) { var randomMove2 = move2Spots[Math.floor(Math.random() * move2Spots.length)]; if(!tryMove(pixel, pixel.x+randomMove2[0], pixel.y+randomMove2[1])) { @@ -722,7 +721,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod if(!outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1])) { newPixel = pixelMap[pixel.x+randomMove1[0]][pixel.y+randomMove1[1]]; //newPixel is AAA }; - if(newPixel !== null) { reactionStealerImmutableElem2(pixel,newPixel,"water") }; + if(newPixel !== null) { reactionStealerImmutableElem2(pixel,newPixel,"water",true,2) }; }; }; }; @@ -740,7 +739,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod if(typeof(rOtherPixel) === "undefined" || isEmpty(rfX,rfY,true)) { return false; }; - reactionStealerImmutableElem2(pixel,rOtherPixel,"water"); + reactionStealerImmutableElem2(pixel,rOtherPixel,"water",true,2); }; return true; }; @@ -774,7 +773,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod if (r.charged && !pixel.charge) { return false; } - if (r.chance !== undefined && Math.random() > r.chance) { + if (r.chance !== undefined && Math.random() < (r.chance * 2)) { return false; } if (r.y !== undefined && (pixel1.y < r.y[0] || pixel1.y > r.y[1])) { @@ -852,14 +851,14 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod color: ["#0e51b0", "#2129ff", "#3b3dbf"], fireColor: ["#121978", "#6a9fe6", "#5963d9"], behavior: [ - "XX|CR:water%0.03|XX", - "CR:water%0.03|XX|CR:water%0.03", - "XX|CR:water%0.03|XX" + "XX|CR:water%0.05|XX", + "CR:water%0.05|XX|CR:water%0.05", + "XX|CR:water%0.05|XX" ], behaviorOn: [ - "XX|CR:water%0.1|XX", - "CR:water%0.1|XX|CR:water%0.1", - "XX|CR:water%0.1|XX" + "XX|CR:water%0.15|XX", + "CR:water%0.15|XX|CR:water%0.15", + "XX|CR:water%0.15|XX" ], properties: { value: 0, @@ -884,9 +883,9 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod fireColor: ["#121978", "#6a9fe6", "#5963d9"], tempHigh: 2606, behavior: [ - "XX|CR:water%0.03|XX", - "CR:water%0.03|XX|CR:water%0.03", - "XX|CR:water%0.03|XX" + "XX|CR:water%0.05|XX", + "CR:water%0.05|XX|CR:water%0.05", + "XX|CR:water%0.05|XX" ], properties: { value: 0, @@ -894,9 +893,9 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod }, category: "powders", behaviorOn: [ - "XX|CR:water%0.1|XX", - "CR:water%0.1|XX|CR:water%0.1", - "XX|CR:water%0.1|XX" + "XX|CR:water%0.15|XX", + "CR:water%0.15|XX|CR:water%0.15", + "XX|CR:water%0.15|XX" ], tick: function(pixel) { jinsoulitoidTick(pixel,[[0,1]],[[-1,1],[1,1]]) }, stateHigh: "molten_jinsoulite", @@ -962,6 +961,9 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod runAfterLoad(function() { for(key in elements.water.reactions) { var value = JSON.parse(JSON.stringify(elements.water.reactions[key])); + if(typeof(value.chance) === "number") { + value.chance = Math.min(1,value.chance * 2); + }; if(value.elem2 === null && value.elem1 !== null) { value.elem2 = value.elem1; }; From eee1aedb0f46ebd7aa15d4ccbfc9d0c99161875f Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Tue, 13 Dec 2022 10:07:13 -0500 Subject: [PATCH 46/49] more reaction logic copying radiation reactions was easy but copying *water* reactions, while *simultaneously* keeping the "water" immutable, is a doozy --- mods/haseulite.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/mods/haseulite.js b/mods/haseulite.js index 3c44da09..37e9ff20 100644 --- a/mods/haseulite.js +++ b/mods/haseulite.js @@ -37,7 +37,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod }; var pixel2 = pixel; var pixel1 = newPixel; - var r = newInfo.reactions[reactionTarget]; + var r = JSON.parse(JSON.stringify(newInfo.reactions[reactionTarget])); if (r.setting && settings[r.setting]===0) { return false; @@ -60,6 +60,11 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod if (r.y !== undefined && (pixel1.y < r.y[0] || pixel1.y > r.y[1])) { return false; } + if(r.elem1 !== undefined && r.elem2 !== undefined) { + if(r.elem1 !== null && r.elem2 !== null) { + r.elem1 = [r.elem1,r.elem2].flat(); + }; + }; if (r.elem1 !== undefined) { // if r.elem1 is an array, set elem1 to a random element from the array, otherwise set it to r.elem1 if (Array.isArray(r.elem1)) { @@ -695,7 +700,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod var rOtherPixel = pixelMap[rfX][rfY]; if(!rOtherPixel) { return false }; var rOtherElement = rOtherPixel.element; - if(rOtherElement.includes("water") || (Math.random() < 0.3 && jinsouliteReducedSwapWhitelist.includes(rOtherElement))) { + if(rOtherElement.endsWith("water") || (Math.random() < 0.3 && jinsouliteReducedSwapWhitelist.includes(rOtherElement))) { swapPixels(pixel,rOtherPixel); did = true; }; @@ -753,10 +758,13 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod if(typeof(pixel2) === "undefined" || isEmpty(rfX,rfY,true)) { return false; }; + if(typeof(pixel1) === "undefined" || isEmpty(pixel.x,pixel.y,true)) { + return false; + }; var rOtherElement = pixel2.element; var waterReactions = elements.water.reactions; if(waterReactions[rOtherElement]) { - var r = waterReactions[rOtherElement]; + var r = waterReactions[rOtherElement]; if (r.setting && settings[r.setting]===0) { return false; @@ -789,6 +797,11 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod pixel1[key] = r.attr1[key]; } } + var elem1 = r.elem1 + if (elem1 !== undefined && elem1 instanceof Array) { + elem1 = elem1[Math.floor(Math.random() * elem1.length)]; + }; + if (r.elem2 !== undefined) { // if r.elem2 is an array, set elem2 to a random element from the array, otherwise set it to r.elem2 if (Array.isArray(r.elem2)) { @@ -796,7 +809,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod } else { var elem2 = r.elem2; } if (elem2 == null) { - deletePixel(pixel2.x,pixel2.y); + if(elem1 !== undefined) { changePixel(pixel2,elem1) }; } else { changePixel(pixel2,elem2); From b2d8748bcb63351a06aa00e6072e9f935d2b871a Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Tue, 13 Dec 2022 10:17:12 -0500 Subject: [PATCH 47/49] more code --- mods/haseulite.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mods/haseulite.js b/mods/haseulite.js index 37e9ff20..acdcc88a 100644 --- a/mods/haseulite.js +++ b/mods/haseulite.js @@ -755,6 +755,7 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod var rfY = pixel.y+randomNeighborOffset[1]; if(!isEmpty(rfX,rfY,true)) { var pixel2 = pixelMap[rfX][rfY]; + var pixel1 = pixel; if(typeof(pixel2) === "undefined" || isEmpty(rfX,rfY,true)) { return false; }; @@ -763,6 +764,10 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod }; var rOtherElement = pixel2.element; var waterReactions = elements.water.reactions; + + if(rOtherElement === pixel.element) { + return false; + }; if(waterReactions[rOtherElement]) { var r = waterReactions[rOtherElement]; From d9d9a79f669104eca740ee869467186ff99d0fe3 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Tue, 13 Dec 2022 18:29:30 -0500 Subject: [PATCH 48/49] fix chem.js incompatibility with reactionless chlorine overwriting newer vanilla chlorine by adding reactions --- mods/Neutronium Mod.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mods/Neutronium Mod.js b/mods/Neutronium Mod.js index 7468bcd3..65993299 100644 --- a/mods/Neutronium Mod.js +++ b/mods/Neutronium Mod.js @@ -470,6 +470,11 @@ elements.chlorine = { color: "#89b87b", behavior: behaviors.GAS, category: "gases", +reactions: { + "water": { "elem1": "pool_water", "elem2":null }, + "hydrogen": { "elem1": "acid_gas", "elem2":null },//hydrochloric acid + "dirty_water": { "elem2":"water" }, +}, density:3.2, state: "gas", tempLow: -101.5, From 43d69b9ca324f533e8fc7d81413c9fc2ef3e23c6 Mon Sep 17 00:00:00 2001 From: epsolon eridani <110356853+Its-Epsilon-Eridani@users.noreply.github.com> Date: Wed, 14 Dec 2022 15:07:04 -0600 Subject: [PATCH 49/49] real cool test mod epsolon eridani's first mod!!!! --- mods/testmod.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 mods/testmod.js diff --git a/mods/testmod.js b/mods/testmod.js new file mode 100644 index 00000000..7689a183 --- /dev/null +++ b/mods/testmod.js @@ -0,0 +1,7 @@ +elements.HelloWorld = { + color: "#100D5E", + behavior: behaviors.WALL, + category: "land", + state: "solid" + density: 720, +};