diff --git a/mods/chem.js b/mods/chem.js index c0034d23..9378aa16 100644 --- a/mods/chem.js +++ b/mods/chem.js @@ -976,10 +976,10 @@ elements.polytetrafluoroethylene = { let b = rgb.b + coloroffset; pixel.color = "rgb("+r+","+g+","+b+")"; pixel.colored = true; - pixel.origColor = pixel.color; + pixel.origColor = pixel.color.match(/\d+/g); } if (pixel.origColor != pixel.color) { - pixel.color = pixel.origColor; + pixel.color = "rgb("+pixel.origColor.join(",")+")"; } }, state: "solid", @@ -1038,6 +1038,7 @@ function doStaining(pixel) { avg[j] = Math.floor((rgb[j]*(1-Math.abs(stain))) + (newColor[j]*Math.abs(stain))); } } + console.log(avg); // set newPixel color to avg newPixel.color = "rgb("+avg.join(",")+")"; } @@ -1110,7 +1111,7 @@ elements.polyethylene = { let b = rgb.b + coloroffset; pixel.color = "rgb("+r+","+g+","+b+")"; pixel.colored = true; - pixel.origColor = pixel.color; + pixel.origColor = pixel.color.match(/\d+/g); } }, state: "solid", @@ -1499,7 +1500,7 @@ elements.polonium = { density: 9196, }; elements.molten_polonium = { - color: ["#ace638","#acb838","ac8a00"], + color: ["#ace638","#acb838","#ac8a00"], behavior: [ "XX|CR:fire,CR:radiation%12.5|XX", "M2 AND CR:radiation%10|CH:lead%0.1|M2 AND CR:radiation%10", @@ -1941,7 +1942,7 @@ elements.bromine = { behavior: behaviors.LIQUID, tick: function(pixel) { if(pixel.temp > 0 && Math.random() < 0.001) { - changePixel(pixelMap[pixel.x][pixel.y],"bromine_gas"); + changePixel(pixelMap[pixel.x][pixel.y],"bromine_gas",false); } }, reactions: { @@ -1961,7 +1962,7 @@ elements.bromine_gas = { behavior: behaviors.GAS, tick: function(pixel) { if(pixel.temp < 58.8 && pixel.temp > 0 && Math.random() < 0.01) { - changePixel(pixelMap[pixel.x][pixel.y],"bromine"); + changePixel(pixelMap[pixel.x][pixel.y],"bromine",false); } }, reactions: { @@ -2163,7 +2164,7 @@ elements.iodine = { behavior: behaviors.POWDER, tick: function(pixel) { if(pixel.temp > 25 && Math.random() < 0.001) { - changePixel(pixelMap[pixel.x][pixel.y],"iodine_gas"); + changePixel(pixelMap[pixel.x][pixel.y],"iodine_gas",false); } }, reactions: { @@ -2199,7 +2200,7 @@ elements.iodine_gas = { behavior: behaviors.GAS, tick: function(pixel) { if(pixel.temp < 113 && pixel.temp > 25 && Math.random() < 0.01) { - changePixel(pixelMap[pixel.x][pixel.y],"iodine"); + changePixel(pixelMap[pixel.x][pixel.y],"iodine",false); } }, tempLow: 25, diff --git a/mods/explodeAtPlus.js b/mods/explodeAtPlus.js index 34252672..48e36470 100644 --- a/mods/explodeAtPlus.js +++ b/mods/explodeAtPlus.js @@ -84,6 +84,10 @@ function explodeAtPlus(x,y,radius,fire="fire",smoke="smoke",beforeFunction=null, else { var result = info.breakInto; } + if(typeof(breakIntoElement) === "undefined") { + deletePixel(pixel.x,pixel.y); + continue + }; // change the pixel to the result changePixel(pixel,result,changeTemp); if(info.onExplosionBreakOrSurvive) { diff --git a/mods/mobs.js b/mods/mobs.js index 66c79a35..d1ae8033 100644 --- a/mods/mobs.js +++ b/mods/mobs.js @@ -197,6 +197,10 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu if(Array.isArray(breakIntoElement)) { breakIntoElement = breakIntoElement[Math.floor(Math.random() * breakIntoElement.length)] }; + if(typeof(breakIntoElement) === "undefined") { + deletePixel(pixel.x,pixel.y); + return true; + }; changePixel(pixel,breakIntoElement,changetemp) return true; }; @@ -5060,7 +5064,7 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu //console.log(`Human part found at (${nX},${nY})`) if(!newPixel.dead) { pixel.following = true; - body.shooting = true; + if(body) body.shooting = true; }; } else { //console.log(`Stopping row look at pixel (${nX},${nY}) due to non-human pixel in the way`) @@ -5092,7 +5096,7 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu //console.log(`Human part found at (${nX},${nY})`) if(!newPixel.dead) { pixel.following = true; - body.shooting = true; + if(body) body.shooting = true; }; } else { //console.log(`Stopping row look at pixel (${nX},${nY}) due to non-human pixel in the way`) diff --git a/mods/world_gen_test.js b/mods/world_gen_test.js index fbcead11..af279f17 100644 --- a/mods/world_gen_test.js +++ b/mods/world_gen_test.js @@ -67,6 +67,7 @@ function newHeightMap(pixelType, pixelType2, offset, amplitude1, amplitude2, sca scale2: scale2, generator: new Simple1DNoise(), generator2: new Simple1DNoise(), + excludeRandom: true, tick: function(pixel) { generator = this.generator; generator2 = this.generator2;