neutron star fix

This commit is contained in:
Laetitia (O-01-67) 2023-02-23 09:05:19 -05:00 committed by GitHub
parent c2459fb3e4
commit 40c8b84e62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -72,18 +72,21 @@ Proper classification of limestone within these code comments
}
};
ferromagneticMaterials = ["iron", "cobalt", "nickel", "steel", "hematite"];
function neutronStarLightAndConduction(pixel,c,whitelist=["neutron_star"]) {
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)) {
if (Math.random() <= c) {
createPixel(Math.random() < 0.8 ? "light" : "neutron", x, y);
createPixel(Math.random() < 0.995 ? "light" : "neutron", x, y);
pixelMap[x][y].color = pixel.color;
};
} else if (!outOfBounds(x,y)) {
var newPixel = pixelMap[x][y];
if(Math.random() < 0.1 && newPixel.conduct) { newPixel.charge = 3 }; //no magnetism in sb
//console.log(elements[newPixel.element].conduct);
if(ferromagneticMaterials.includes(newPixel.element) && (Math.random() < 0.1)) { newPixel.charge = 20 }; //no magnetism in sb
//console.log(whitelist,newPixel.element,whitelist.includes(newPixel.element));
if (pixel.temp!==newPixel.temp && whitelist.includes(newPixel.element)) {
var avg = (pixel.temp + newPixel.temp)/2;