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] [Version 0.6 - Thermal Conductivity - Dec. 23, 2021]
+ Thermal Conductivity / Heat Transfer + Thermal Conductivity / Heat Transfer
+ Insulation
+ Walls insulate
+ Bees now drop pollen which turns into flower seeds + Bees now drop pollen which turns into flower seeds
[Version 0.5.2 - Dec. 22, 2021] [Version 0.5.2 - Dec. 22, 2021]

View File

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