slight optimizations

This commit is contained in:
biglyderv 2025-05-16 21:44:56 -04:00
parent 0fb19d45ad
commit 66d0642006
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5
5 changed files with 77 additions and 71 deletions

View file

@ -16,15 +16,15 @@ function temperature(event, conduct, transfer = 0) {
for (let x = -1; x < 2; x ++) {
for (let y = -1; y < 2; y++) {
let blok = chunks.getBlock(cx + x, cy + y);
let temp = chunks.getBlock(cx, cy, true);
let temp2 = chunks.getBlock(cx + x, cy + y, true);
if (temp2 == undefined || temp == undefined || (x == 0 && y == 0)) {
if (temp != undefined) chunks.setBlock(cx, cy, Math.max(temp,-296.15), true);
if (temp2 == undefined || temp == undefined || (x == 0 && y == 0) || Math.abs(temp2 - temp) < 0.03) {
continue;
};
let blok = chunks.getBlock(cx + x, cy + y);
let conduct2 = (blok != -1) ? (mainTiles.tiles[blok].attributes.conduct || 0) : 0;
let conductSum = Math.min(conduct * conduct2 * 10, 0.5);