if (!settings.heatglowMode){settings.heatglowMode = 1; saveSettings();} if (!eLists.metals) { eLists.metals = [] } eLists.metals = eLists.metals.concat(["iron", "glass", "copper", "gold", "brass","steel","nickel","zinc","silver","aluminum","bronze","metal_scrap","oxidized_copper","tin","lead", "rose_gold", "tungsten"]) if (!eLists.heatBlacklist) {eLists.heatBlacklist = []} eLists.heatBlacklist = eLists.heatBlacklist.concat(["void", "sun", "light", "plasma", "fire", "border", "heater", "superheater"]) function tempToRGB(temp){ if (temp <= 6500){ return{ r: 255, g: Math.max(-325.757*Math.pow(0.999581, temp)+272.879, 0), b: Math.max(-571.403*Math.pow(0.999675, temp)+321.955, 0) } } else { return { r: Math.max(604.879*Math.pow(0.999697, temp)+169.618, 0), g: Math.max(719.488*Math.pow(0.999599, temp)+201.788, 0), b: 255 } } } function oldtempToRgb(temp, pixel){ let halftemp = ((20+elements[pixel.element].tempHigh)/2) let fulltemp = elements[pixel.element].tempHigh let ctemp = 0; if (pixel.temp <= fulltemp - halftemp){ ctemp = 0; } else { ctemp = temp/(fulltemp-halftemp)-halftemp/(fulltemp-halftemp); } if (ctemp <= 0.5){ return{ r: (510*ctemp), g: 0, b: 0, opacity: (ctemp/1.3) } } else { return { r: 255, g: ((510*ctemp)-255), b: ((280*ctemp)-140), opacity: (ctemp/1.3) } } } renderPresets.HEATGLOW = function(pixel,ctx) { drawDefault(ctx,pixel) } renderEachPixel(function(pixel,ctx) { // run any code when each individual pixel is rendered if (!eLists.heatBlacklist.includes(pixel.element)){ let color, opacity; if (settings.heatglowMode == 1){ color = tempToRGB(pixel.temp) opacity = Math.max(0, Math.min(1, -3.5486801*Math.pow(0.9960659, pixel.temp)+0.73333)) } else { color = oldtempToRgb(pixel.temp, pixel) opacity = color.opacity if (!eLists.metals.includes(pixel.element)){ return; } } if (elements[pixel.element].glow || elements[pixel.element].isGas){ drawPlus(ctx,"rgba(" + color.r + ", " + color.g + ", " + color.b + ", " + opacity +")",pixel.x,pixel.y) } else { drawSquare(ctx,"rgba(" + color.r + ", " + color.g + ", " + color.b + ", " + opacity +")",pixel.x,pixel.y) }} }) keybinds["KeyH"] = function(){ if (settings.heatglowMode == 1){settings.heatglowMode = 2} else {settings.heatglowMode = 1} saveSettings(); logMessage("Heat glow mode switched.") }