Added some fixes to mine and Orbit's mods

This commit is contained in:
lllllllllwith10ls 2023-06-28 13:37:03 -05:00
parent e39b0b96a8
commit 11ead5ac9e
4 changed files with 20 additions and 10 deletions

View File

@ -976,10 +976,10 @@ elements.polytetrafluoroethylene = {
let b = rgb.b + coloroffset; let b = rgb.b + coloroffset;
pixel.color = "rgb("+r+","+g+","+b+")"; pixel.color = "rgb("+r+","+g+","+b+")";
pixel.colored = true; pixel.colored = true;
pixel.origColor = pixel.color; pixel.origColor = pixel.color.match(/\d+/g);
} }
if (pixel.origColor != pixel.color) { if (pixel.origColor != pixel.color) {
pixel.color = pixel.origColor; pixel.color = "rgb("+pixel.origColor.join(",")+")";
} }
}, },
state: "solid", state: "solid",
@ -1038,6 +1038,7 @@ function doStaining(pixel) {
avg[j] = Math.floor((rgb[j]*(1-Math.abs(stain))) + (newColor[j]*Math.abs(stain))); avg[j] = Math.floor((rgb[j]*(1-Math.abs(stain))) + (newColor[j]*Math.abs(stain)));
} }
} }
console.log(avg);
// set newPixel color to avg // set newPixel color to avg
newPixel.color = "rgb("+avg.join(",")+")"; newPixel.color = "rgb("+avg.join(",")+")";
} }
@ -1110,7 +1111,7 @@ elements.polyethylene = {
let b = rgb.b + coloroffset; let b = rgb.b + coloroffset;
pixel.color = "rgb("+r+","+g+","+b+")"; pixel.color = "rgb("+r+","+g+","+b+")";
pixel.colored = true; pixel.colored = true;
pixel.origColor = pixel.color; pixel.origColor = pixel.color.match(/\d+/g);
} }
}, },
state: "solid", state: "solid",
@ -1499,7 +1500,7 @@ elements.polonium = {
density: 9196, density: 9196,
}; };
elements.molten_polonium = { elements.molten_polonium = {
color: ["#ace638","#acb838","ac8a00"], color: ["#ace638","#acb838","#ac8a00"],
behavior: [ behavior: [
"XX|CR:fire,CR:radiation%12.5|XX", "XX|CR:fire,CR:radiation%12.5|XX",
"M2 AND CR:radiation%10|CH:lead%0.1|M2 AND CR:radiation%10", "M2 AND CR:radiation%10|CH:lead%0.1|M2 AND CR:radiation%10",
@ -1941,7 +1942,7 @@ elements.bromine = {
behavior: behaviors.LIQUID, behavior: behaviors.LIQUID,
tick: function(pixel) { tick: function(pixel) {
if(pixel.temp > 0 && Math.random() < 0.001) { 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: { reactions: {
@ -1961,7 +1962,7 @@ elements.bromine_gas = {
behavior: behaviors.GAS, behavior: behaviors.GAS,
tick: function(pixel) { tick: function(pixel) {
if(pixel.temp < 58.8 && pixel.temp > 0 && Math.random() < 0.01) { 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: { reactions: {
@ -2163,7 +2164,7 @@ elements.iodine = {
behavior: behaviors.POWDER, behavior: behaviors.POWDER,
tick: function(pixel) { tick: function(pixel) {
if(pixel.temp > 25 && Math.random() < 0.001) { 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: { reactions: {
@ -2199,7 +2200,7 @@ elements.iodine_gas = {
behavior: behaviors.GAS, behavior: behaviors.GAS,
tick: function(pixel) { tick: function(pixel) {
if(pixel.temp < 113 && pixel.temp > 25 && Math.random() < 0.01) { 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, tempLow: 25,

View File

@ -84,6 +84,10 @@ function explodeAtPlus(x,y,radius,fire="fire",smoke="smoke",beforeFunction=null,
else { else {
var result = info.breakInto; var result = info.breakInto;
} }
if(typeof(breakIntoElement) === "undefined") {
deletePixel(pixel.x,pixel.y);
continue
};
// change the pixel to the result // change the pixel to the result
changePixel(pixel,result,changeTemp); changePixel(pixel,result,changeTemp);
if(info.onExplosionBreakOrSurvive) { if(info.onExplosionBreakOrSurvive) {

View File

@ -197,6 +197,10 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu
if(Array.isArray(breakIntoElement)) { if(Array.isArray(breakIntoElement)) {
breakIntoElement = breakIntoElement[Math.floor(Math.random() * breakIntoElement.length)] breakIntoElement = breakIntoElement[Math.floor(Math.random() * breakIntoElement.length)]
}; };
if(typeof(breakIntoElement) === "undefined") {
deletePixel(pixel.x,pixel.y);
return true;
};
changePixel(pixel,breakIntoElement,changetemp) changePixel(pixel,breakIntoElement,changetemp)
return true; return true;
}; };
@ -5060,7 +5064,7 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlu
//console.log(`Human part found at (${nX},${nY})`) //console.log(`Human part found at (${nX},${nY})`)
if(!newPixel.dead) { if(!newPixel.dead) {
pixel.following = true; pixel.following = true;
body.shooting = true; if(body) body.shooting = true;
}; };
} else { } else {
//console.log(`Stopping row look at pixel (${nX},${nY}) due to non-human pixel in the way`) //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})`) //console.log(`Human part found at (${nX},${nY})`)
if(!newPixel.dead) { if(!newPixel.dead) {
pixel.following = true; pixel.following = true;
body.shooting = true; if(body) body.shooting = true;
}; };
} else { } else {
//console.log(`Stopping row look at pixel (${nX},${nY}) due to non-human pixel in the way`) //console.log(`Stopping row look at pixel (${nX},${nY}) due to non-human pixel in the way`)

View File

@ -67,6 +67,7 @@ function newHeightMap(pixelType, pixelType2, offset, amplitude1, amplitude2, sca
scale2: scale2, scale2: scale2,
generator: new Simple1DNoise(), generator: new Simple1DNoise(),
generator2: new Simple1DNoise(), generator2: new Simple1DNoise(),
excludeRandom: true,
tick: function(pixel) { tick: function(pixel) {
generator = this.generator; generator = this.generator;
generator2 = this.generator2; generator2 = this.generator2;