more heat transfer updates

This commit is contained in:
slweeb 2021-12-24 00:10:37 -05:00
parent 01cc070863
commit f0b6db96dd
2 changed files with 56 additions and 36 deletions

View File

@ -5,6 +5,8 @@
[Version 0.6 - Thermal Conductivity - Dec. 23, 2021]
+ Thermal Conductivity / Heat Transfer
+ Insulation
+ Walls insulate
+ Bees now drop pollen which turns into flower seeds
[Version 0.5.2 - Dec. 22, 2021]

View File

@ -333,6 +333,7 @@
"behavior": behaviors.WALL,
"density": 0,
"category": "solids",
"insulate": true,
},
"fire": {
"name": "fire",
@ -681,21 +682,23 @@
"name": "heater",
"color": "#881111",
"behavior": [
"XX|HT|XX",
"HT|XX|HT",
"XX|HT|XX",
"XX|HT:2|XX",
"HT:2|XX|HT:2",
"XX|HT:2|XX",
],
"category":"machines",
"insulate":true,
},
"cooler": {
"name": "cooler",
"color": "#111188",
"behavior": [
"XX|CO|XX",
"CO|XX|CO",
"XX|CO|XX",
"XX|CO:2|XX",
"CO:2|XX|CO:2",
"XX|CO:2|XX",
],
"category":"machines",
"insulate":true,
},
"superheater": {
"name": "superheater",
@ -706,6 +709,7 @@
"XX|HT:10|XX",
],
"category":"machines",
"insulate":true,
},
"freezer": {
"name": "freezer",
@ -716,6 +720,7 @@
"XX|CO:10|XX",
],
"category":"machines",
"insulate":true,
},
"smoke_grenade": {
"name": "smoke grenade",
@ -1563,6 +1568,13 @@
],
"category": "life",
},
"insulation": {
"name": "insulation",
"color": "#b8aea5",
"behavior": behaviors.WALL,
"category": "structure",
"insulate": true,
},
@ -1913,6 +1925,7 @@
else if (b == "HT") {
if (!isEmpty(newCoords.x,newCoords.y) && !outOfBounds(newCoords.x,newCoords.y)) {
var newPixel = pixelMap[newCoords.x][newCoords.y];
if (!(newPixel.element == pixel.element)) {
if (arg != null) {arg = parseFloat(arg)}
else {arg = 1}
if (arg == NaN) {arg = 1}
@ -1920,10 +1933,12 @@
pixelTempCheck(newPixel);
}
}
}
//Cool
else if (b == "CO") {
if (!isEmpty(newCoords.x,newCoords.y) && !outOfBounds(newCoords.x,newCoords.y)) {
var newPixel = pixelMap[newCoords.x][newCoords.y];
if (!(newPixel.element == pixel.element)) {
if (arg != null) {arg = parseFloat(arg)}
else {arg = 1}
if (arg == NaN) {arg = 1}
@ -1931,6 +1946,7 @@
pixelTempCheck(newPixel);
}
}
}
//Change color
else if (b == "CC") {
if (!isEmpty(newCoords.x,newCoords.y) && !outOfBounds(newCoords.x,newCoords.y)) {
@ -2128,6 +2144,7 @@
}
// Heat Transfer
if (!(info.insulate == true)) {
// Check right and bottom adjacent pixels
coordsToCheck = [
{x:pixel.x+1,y:pixel.y},
@ -2138,7 +2155,7 @@
if (!isEmpty(coords.x,coords.y) && !outOfBounds(coords.x,coords.y)) {
var newPixel = pixelMap[coords.x][coords.y];
// Skip if both temperatures are the same
if (pixel.temp == newPixel.temp) {
if (pixel.temp == newPixel.temp || elements[newPixel.element].insulate == true) {
continue;
}
// Set both pixel temperatures to their average
@ -2149,6 +2166,7 @@
pixelTempCheck(newPixel);
}
}
}
}
@ -2374,8 +2392,8 @@
continue;
}
var pixel = pixelMap[x][y];
if (shiftDown) {pixel.temp += element.temp+(Math.random()*element.temp/5)*20;}
else {pixel.temp += element.temp+(Math.random()*element.temp/5);}
if (shiftDown) {pixel.temp += element.temp+(Math.random()*element.temp*1.5)*20;}
else {pixel.temp += element.temp+(Math.random()*element.temp*1.5);}
pixelTempCheck(pixel);
}
}