Wet concrete color change, less water use

This commit is contained in:
Laetitia (O-01-67) 2023-03-08 13:23:12 -05:00 committed by GitHub
parent 7dd1e9dbd2
commit 0513aade3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -2414,6 +2414,7 @@ if(!enabledMods.includes(libraryMod)) {
elements.concrete.tick = function(pixel) {
pixel.composition ??= "mafic";
pixel.wet ??= (Math.random() < 0.03);
pixel.didWetColorChange ??= false;
pixel.didColorChange ??= 0;
pixel.lastTemperatures ??= [];
@ -2428,6 +2429,12 @@ if(!enabledMods.includes(libraryMod)) {
var magmaName = (pixel.composition == "mafic") ? "magma" : pixel.composition + "_magma";
var magmaTempHigh = Math.max(...Object.values(elements[magmaName]._magmaCoolingPassToElement.meltingPoints));
if(pixel.wet && !pixel.didWetColorChange) {
var colorWasHSL = pixel.color.startsWith("hsl");
pixel.color = changeLuminance(pixel.color,11,"-",colorWasHSL ? "hsl" : "rgb");
pixel.didWetColorChange = true;
};
//console.log(pixel.temp,pixel.didColorChange);
if(pixel.temp > 300 && pixel.didColorChange < 1) {
if(Math.random() < 0.02) { breakPixel(pixel) };
@ -2527,7 +2534,7 @@ if(!enabledMods.includes(libraryMod)) {
if(newPixel?.element) {
if(newPixel.element == "water") {
pixel.wet = true;
deletePixel(newPixel.x,newPixel.y);
if(Math.random() < 1/4) { deletePixel(newPixel.x,newPixel.y) };
};
};
};