mod hotfixes

This commit is contained in:
slweeb 2026-01-12 18:29:34 -05:00
parent ef24ae9c23
commit bbdc0e5cf6
2 changed files with 54 additions and 53 deletions

View File

@ -1,54 +1,55 @@
//console.log("doElectricity should be changed"); //console.log("doElectricity should be changed");
function doElectricity(pixel) { // [DEPRECATED - BREAKS GAME as of 2026-01]
if(isNaN(pixel.charge)) { // function doElectricity(pixel) {
pixel.charge = 0; // if(isNaN(pixel.charge)) {
}; // pixel.charge = 0;
if (pixel.charge) { // };
// Check each adjacent pixel, if that pixel's charge is false, set it to the same charge // if (pixel.charge) {
for (var i = 0; i < adjacentCoords.length; i++) { // // Check each adjacent pixel, if that pixel's charge is false, set it to the same charge
var x = pixel.x+adjacentCoords[i][0]; // for (var i = 0; i < adjacentCoords.length; i++) {
var y = pixel.y+adjacentCoords[i][1]; // var x = pixel.x+adjacentCoords[i][0];
if (!isEmpty(x,y,true)) { // var y = pixel.y+adjacentCoords[i][1];
var newPixel = pixelMap[x][y]; // if (!isEmpty(x,y,true)) {
var con = elements[newPixel.element].conduct; // var newPixel = pixelMap[x][y];
if (con == undefined) {continue} // var con = elements[newPixel.element].conduct;
if (elements[pixel.element].noConduct?.length && elements[pixel.element].noConduct.includes(newPixel.element)) {continue}; // if (con == undefined) {continue}
if (Math.random() < con) { // If random number is less than conductivity // if (elements[pixel.element].noConduct?.length && elements[pixel.element].noConduct.includes(newPixel.element)) {continue};
if (!newPixel.charge && !newPixel.chargeCD) { // if (Math.random() < con) { // If random number is less than conductivity
newPixel.charge = isNaN(pixel.charge) ? 0 : pixel.charge; //Actually set it to the same charge // if (!newPixel.charge && !newPixel.chargeCD) {
if (elements[newPixel.element].colorOn) { // newPixel.charge = isNaN(pixel.charge) ? 0 : pixel.charge; //Actually set it to the same charge
newPixel.color = pixelColorPick(newPixel); // if (elements[newPixel.element].colorOn) {
} // newPixel.color = pixelColorPick(newPixel);
if(elements[newPixel.element].onCharge) { // }
pixel.charge ??= 0; // if(elements[newPixel.element].onCharge) {
if(isNaN(pixel.charge)) { pixel.charge = 0 }; // pixel.charge ??= 0;
elements[newPixel.element].onCharge(pixel); // if(isNaN(pixel.charge)) { pixel.charge = 0 };
}; // elements[newPixel.element].onCharge(pixel);
} // };
} // }
else if (elements[newPixel.element].insulate != true && !elements[newPixel.element].noResistance) { // Otherwise heat the pixel (Resistance simulation) // }
newPixel.temp += isNaN(pixel.charge) ? 0.25 : pixel.charge/4; // else if (elements[newPixel.element].insulate != true && !elements[newPixel.element].noResistance) { // Otherwise heat the pixel (Resistance simulation)
pixelTempCheck(newPixel); // newPixel.temp += isNaN(pixel.charge) ? 0.25 : pixel.charge/4;
} // pixelTempCheck(newPixel);
} // }
} // }
pixel.charge -= 0.25; // }
if (pixel.charge <= 0) { // pixel.charge -= 0.25;
delete pixel.charge; // if (pixel.charge <= 0) {
//console.log(elements[pixel.element].chargeCD); // delete pixel.charge;
var chargeCd = elements[pixel.element].chargeCD ?? 4; // //console.log(elements[pixel.element].chargeCD);
pixel.chargeCD = chargeCd; //Customizable chargeCD // var chargeCd = elements[pixel.element].chargeCD ?? 4;
} // pixel.chargeCD = chargeCd; //Customizable chargeCD
} // }
// Lower charge cooldown // }
else if (pixel.chargeCD) { // // Lower charge cooldown
pixel.chargeCD -= 1; // else if (pixel.chargeCD) {
if (pixel.chargeCD <= 0) { // pixel.chargeCD -= 1;
delete pixel.chargeCD; // if (pixel.chargeCD <= 0) {
if (elements[pixel.element].colorOn) { // delete pixel.chargeCD;
pixel.color = pixelColorPick(pixel); // if (elements[pixel.element].colorOn) {
} // pixel.color = pixelColorPick(pixel);
} // }
} // }
} // }
// }

View File

@ -2531,7 +2531,7 @@ Proper classification of limestone within these code comments
] ]
}; };
elements.plasma.noConduct = ["stellar_plasma","liquid_stellar_plasma","liquid_degenerate_neutronium","gaseous_degenerate_neutronium","neutron_star"]; //I can't suppress the charge overlay and keep the tick color, only effective with noConduct.js but not strictly required elements.plasma.ignoreConduct = ["stellar_plasma","liquid_stellar_plasma","liquid_degenerate_neutronium","gaseous_degenerate_neutronium","neutron_star"]; //I can't suppress the charge overlay and keep the tick color, only effective with noConduct.js but not strictly required
//Main preset //Main preset