From 12d664f4ab41d124a21c3636a042d359558a8759 Mon Sep 17 00:00:00 2001 From: O-01-67 <68935009+O-01-67@users.noreply.github.com> Date: Sat, 8 Oct 2022 23:18:08 -0400 Subject: [PATCH] rewrite exposedToAir --- mods/metals.js | 175 ++----------------------------------------------- 1 file changed, 4 insertions(+), 171 deletions(-) diff --git a/mods/metals.js b/mods/metals.js index 679704ca..5672d5c1 100644 --- a/mods/metals.js +++ b/mods/metals.js @@ -162,183 +162,16 @@ elements.mercury_gas = { //hg d@bp extrapolated from density change with tempera hidden: true, } -elements.iron.hardness = 0.74 -//https://www.engineeringtoolbox.com/bhn-brinell-hardness-number-d_1365.html -//https://en.wikipedia.org/wiki/Hardnesses_of_the_elements_(data_page) -//"Annealed chissel steel" hardness and then divided by iron hardness (Brinell) -//sqrt()ed like IACS-derived conductivities and scaled to the 0.8 hardness of steel -//and because 1 means infinite hardness, the others are derived using -//1-(0.26/(otherThingBHN/200)) -//it doesn't matter much anyway but I'd like to have some semblance/veneer of accuracy - -//Copper exists - -elements.ruthenium = { - color: ["#e8ebca","#eaebd5"], //color pulled from my ass because I don't want another gray metal - behavior: behaviors.WALL, - tempHigh: 2334, - category: "solids", - state: "solid", - density: 12450, - conduct: 0.45, - hardness: 0.97593, -}, - -elements.molten_ruthenium = { - density: 10650, -}, - -elements.rhodium = { - color: ["#f0e4df","#f7eae4"], //it looked slightly reddish on Wikipedia - behavior: behaviors.WALL, - tempHigh: 1964, - category: "solids", - state: "solid", - density: 12410, - conduct: 0.59, - hardness: 0.94694, -}, - -elements.molten_rhodium = { - density: 10700, -}, - -elements.palladium = { - color: ["#fff8ed","#f5e6ce","#faeccf"], //Terraria reference - behavior: behaviors.WALL, - tempHigh: 1555, - category: "solids", - state: "solid", - density: 12023, - conduct: 0.38, - hardness: 0.82667, -}, - -elements.molten_palladium = { - density: 10380, -}, - -//Silver exists - -elements.rhenium = { - color: ["#e5f0d1","#e6edda"], //it looks like almost every other metal but in some pictures the lighting makes it look ever-so-slightly greenish - behavior: behaviors.WALL, - tempHigh: 3186, - category: "solids", - state: "solid", - density: 21020, - conduct: 0.29, - hardness: 0.96061, -}, - -elements.molten_rhenium = { - density: 18900, -}, - -elements.osmium = { - color: ["#d8e1eb","#cee1f0"], //it looks bluish - behavior: behaviors.WALL, - tempHigh: 3033, - category: "solids", - state: "solid", - density: 22590, - conduct: 0.40, - hardness: 0.98673, -}, - -elements.molten_osmium = { - density: 2e4, -}, - -elements.iridium = { - color: ["#dfb9f0","#d6a9eb","#dfd1ed","#eeeeee"], //Minecraft modding/Stardew Valley reference, take your pick - behavior: behaviors.WALL, - tempHigh: 2446, - category: "solids", - state: "solid", - density: 22560, - conduct: 0.54, - hardness: 0.96886, -}, - -elements.molten_iridium = { - density: 19000, -}, - -elements.platinum = { - color: ["#dddddd","#d7d7d7"], - behavior: behaviors.WALL, - tempHigh: 1768, - category: "solids", - state: "solid", - density: 21450, - conduct: 0.38, - hardness: 0.83226, -}, - -elements.molten_platinum = { - density: 19770, -}, - -//Gold exists - -elements.mercury = { - color: ["#d1d1d1", "#bababa"], - behavior: behaviors.LIQUID, - tempHigh: 357, - stateHigh: "mercury_gas", - tempLow: -39, - stateLow: "frozen_mercury", - state: "solid", - category: "liquids", - density: 13534, - conduct: 0.13, - breakInto: "mercury_gas", -}, - -elements.frozen_mercury = { - color: ["#d1d1d1", "#bababa"], - density: 14184, - behavior: behaviors.WALL, - conduct: 0.13, - tempHigh: -39, - temp: -50, - stateHigh: "mercury", - category: "solids", - state: "solid", - state: "solid", - hidden: true, - hardness: 0.2775, //(desperately scaled Mohs hardness) -}, - -elements.mercury_gas = { //hg d@bp extrapolated from density change with temperature: 12743 - density: 8.477, - color: ["#d1d1d1", "#bababa"], - colorOn: ["#96ffbf", "#9cffc2", "#9effe7"], - conduct: 0.13, - behavior: behaviors.GAS, - tempLow: 357, - temp: 400, - stateLow: "mercury", - category: "gases", - state: "gas", - hidden: true, -} - neighbors = [[-1,0],[0,-1],[1,0],[0,1]] -function exposedToAir(pixel) { - if(isEmpty(pixel.x+neighbors[0][0],pixel.y+neighbors[0][1],true) || isEmpty(pixel.x+neighbors[1][0],pixel.y+neighbors[1][1],true) || isEmpty(pixel.x+neighbors[2][0],pixel.y+neighbors[2][1],true) || isEmpty(pixel.x+neighbors[3][0],pixel.y+neighbors[3][1],true)) { - return true - } else { - return false - } -} - function randomChoice(array) { return array[Math.floor(Math.random() * array.length)]; } +function exposedToAir(pixel) { + return (isEmpty(pixel.x+1,pixel.y) || isEmpty(pixel.x-1,pixel.y) || isEmpty(pixel.x,pixel.y+1) || isEmpty(pixel.x,pixel.y-1)); +} + function tryTarnish(pixel,element,chance) { if(exposedToAir(pixel)) { if(Array.isArray(element)) {