diff --git a/mods/Neutronium Mod.js b/mods/Neutronium Mod.js index 7468bcd3..65993299 100644 --- a/mods/Neutronium Mod.js +++ b/mods/Neutronium Mod.js @@ -470,6 +470,11 @@ elements.chlorine = { color: "#89b87b", behavior: behaviors.GAS, category: "gases", +reactions: { + "water": { "elem1": "pool_water", "elem2":null }, + "hydrogen": { "elem1": "acid_gas", "elem2":null },//hydrochloric acid + "dirty_water": { "elem2":"water" }, +}, density:3.2, state: "gas", tempLow: -101.5, diff --git a/mods/a_bundle_of_tests.js b/mods/a_bundle_of_tests.js index 0b5b0778..f95a2cef 100644 --- a/mods/a_bundle_of_tests.js +++ b/mods/a_bundle_of_tests.js @@ -8,7 +8,7 @@ if(urlParams.get('loadTheModList') !== null || urlParams.get('ltml') !== null) { } if(loadTheModList) { - enabledMods = ["mods/code_library.js", "mods/adjustablepixelsize.js", "mods/boiling_rock.js", "mods/chalcopyrite.js", "mods/clone_liquid.js", "mods/conveyance.js", "mods/CrashTestDummy.js", "mods/crimson.js", "mods/delete_all_of_element.js", "mods/evenmoretemptools.js", "mods/extra_element_info.js", "mods/fairy_chain.js", "mods/fantastic_creatures.js", "mods/fey_and_more.js", "mods/glenn_gases.js", "mods/grav_mudstones.js", "mods/icb.js", "mods/ketchup_mod.js", "mods/laetium.js", "mods/liquid_energy.js", "mods/metals.js", "mods/minecraft.js", "mods/minesweeper.js", "mods/more_breaking.js", "mods/moreliquids.js", "mods/moretools.js", "mods/move_tools.js", "mods/nested_for_reaction_example.js", "mods/Neutronium Mod.js", "mods/portal.js", "mods/pushers.js", "mods/rainbow_tests.js", "mods/random_elems.js", "mods/random_liquids.js", "mods/random_rocks.js", "mods/randomness.js", "mods/randomness_but_tick.js", "mods/randomness_but_tool.js", "mods/slag_fix.js", "mods/some_tf_liquids.js", "mods/structure_test.js", "mods/test.js", "mods/ticking_temp_stuff.js", "mods/time.js", "mods/toothpaste.js", "mods/troll.js", "mods/unhide.js", "mods/worldgen_test.js", "mods/page_color.js", "mods/invisible_wall.js", "mods/replace_all.js", "mods/bacteria_mod.js", "mods/controllable_pixel_test.js", "mods/fire_slime.js", "mods/bioooze.js", "mods/color_tools.js", "mods/cells.js", "mods/triggerable_random_powders.js", "mods/replace.js", "mods/change.js", "mods/prompt.js", "mods/miscible_psoup_and_birthpool.js", "mods/primordial_birthpool.js", "mods/liquid_void.js", "mods/solid_rock.js", "mods/invisible_dye.js", "mods/alcohol.js", "mods/a_bundle_of_tests.js", "mods/paint_event.js", "mods/amogus.js", "mods/chem.js", "mods/roseyiede.js", "mods/state_voids.js", "mods/the_ground.js", "mods/lone_urea.js", "mods/fwibblen.js", "mods/velocity.js", "mods/prop and prompt variables.js", "mods/prop.js", "mods/x_dependent_change_test.js", "mods/alkahest.js", "mods/tool_pixel_behavior.js", "mods/onTryMoveInto.js", "mods/human_edit.js", "mods/runAfterAutogen and onload restructure.js", "mods/explodeAtPlus.js", "mods/note_block.js", "mods/wirelike_test.js", "mods/no_random_grbs.js", "mods/bananas.js", "mods/iean.js", "mods/cpt_alt.js", "mods/code_library.js", "mods/cold fire revamp and doBurning edits.js", "mods/spouts.js", "mods/funny elements 2022-11-15.js", "mods/spouts.js", "mods/mobs.js", "mods/more_fairies.js", "mods/more_clouds.js", "mods/more_bombs.js", "https://cdn.jsdelivr.net/gh/DimpyRed/cancermod@c2c4fe40d0049c8b56bbbdb7203387778b55b05d/cancermelt.js"]; + enabledMods = ["mods/code_library.js","mods/adjustablepixelsize.js","mods/boiling_rock.js","mods/chalcopyrite.js","mods/clone_liquid.js","mods/conveyance.js","mods/CrashTestDummy.js","mods/crimson.js","mods/delete_all_of_element.js","mods/evenmoretemptools.js","mods/extra_element_info.js","mods/fairy_chain.js","mods/fantastic_creatures.js","mods/fey_and_more.js","mods/glenn_gases.js","mods/iocalfaeus_clones.js","mods/grav_mudstones.js","mods/icb.js","mods/iean.js","mods/ketchup_mod.js","mods/laetium.js","mods/liquid_energy.js","mods/metals.js","mods/minecraft.js","mods/minesweeper.js","mods/more_breaking.js","mods/moreliquids.js","mods/moretools.js","mods/move_tools.js","mods/nested_for_reaction_example.js","mods/Neutronium Mod.js","mods/portal.js","mods/pushers.js","mods/rainbow_tests.js","mods/random_elems.js","mods/random_liquids.js","mods/random_rocks.js","mods/randomness.js","mods/randomness_but_tick.js","mods/randomness_but_tool.js","mods/slag_fix.js","mods/some_tf_liquids.js","mods/structure_test.js","mods/test.js","mods/ticking_temp_stuff.js","mods/time.js","mods/toothpaste.js","mods/troll.js","mods/unhide.js","mods/worldgen_test.js","mods/page_color.js","mods/color_tools.js","mods/invisible_wall.js","mods/replace_all.js","mods/bacteria_mod.js","mods/controllable_pixel_test.js","mods/fire_slime.js","mods/bioooze.js","mods/color_tools.js","mods/cells.js","mods/triggerable_random_powders.js","mods/replace.js","mods/change.js","mods/prompt.js","mods/miscible_psoup_and_birthpool.js","mods/primordial_birthpool.js","mods/liquid_void.js","mods/solid_rock.js","mods/invisible_dye.js","mods/alcohol.js","mods/a_bundle_of_tests.js","mods/paint_event.js","mods/amogus.js","mods/chem.js","mods/clf3.js","mods/roseyiede.js","mods/state_voids.js","mods/the_ground.js","mods/lone_urea.js","mods/fwibblen.js","mods/velocity.js","mods/prop and prompt variables.js","mods/prop.js","mods/x_dependent_change_test.js","mods/alkahest.js","mods/tool_pixel_behavior.js","mods/onTryMoveInto.js","mods/human_edit.js","mods/runAfterAutogen and onload restructure.js","mods/explodeAtPlus.js","mods/more_bombs.js","mods/note_block.js","mods/wirelike_test.js","mods/no_random_grbs.js","mods/bananas.js","mods/trapdoor.js","mods/apioforms.js","mods/cpt_alt.js","mods/more_fairies.js","mods/spouts.js","mods/mobs.js","mods/more_clouds.js","mods/funny elements 2022-11-15.js","mods/haseulite.js","mods/generator_prompt.js","mods/fire_mod.js","mods/test_4.js","mods/save_loading.js","mods/apioforms_pre.js","mods/cover_yourself_in.js","mods/fill_script.js","mods/find.js","mods/place_all_elements.js"]; localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); alert("Mod list loaded. Refresh the page without the loadTheModList query parameter."); console.log("Mod list loaded. Refresh the page without the loadTheModList query parameter."); @@ -312,6 +312,35 @@ elements.distance_display_anchor = { desc: `Distance display pixels get blue in its distance.`, }; +/* +blackObject = {r: 0, g: 0, b: 0}; +pinkObject = {r: 255, g: 148, b: 255}; + +elements.black_pink_test = { + color: ["#000000","#FF94FF"], + behavior: behaviors.WALL, + properties: { + offset: Math.floor(Math.random() * (Math.random() > 0.5 ? -1 : 1) * Math.random() * 15) + }, + tick: function(pixel) { + if(typeof(pixel.offset) !== "number") { + pixel.offset = Math.floor(Math.random() * (Math.random() > 0.5 ? -1 : 1) * Math.random() * 15); + }; + + var fraction = Math.min(1.0,Math.max(0.0,scale(pixel.y,1,height-1,0.0,1.0))); + + var color = averageColorObjects(pinkObject,blackObject,fraction); + + var offsettedColor = lightenColor(color,pixel.offset,"rgb"); + + pixel.color = offsettedColor; + }, + category: "machines", + state: "solid", + desc: "blackpink in your area", +}; +*/ + function updateDistanceDisplayDescription() { elements.distance_display.desc = `It gets more blue the closer it gets to a distance display anchor. The current scale factor is ${distanceScale} (bigger number = smaller blue radius). Click here to open the scale prompt.
Note: Info pages do not update automatically and must be closed and reopened to show the changed scale.`; }; diff --git a/mods/chem.js b/mods/chem.js index 6abe3339..506bd6c8 100644 --- a/mods/chem.js +++ b/mods/chem.js @@ -1,7 +1,7 @@ elements.fluorine = { color: "#FFFFBF", behavior: behaviors.GAS, - ignore: ["FOOF","solid_FOOF","oxygen","liquid_oxygen","oxygen_ice","chlorine","liquid_chlorine","liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","smoke","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","hydrogen"], + ignore: ["FOOF","solid_FOOF","oxygen","liquid_oxygen","oxygen_ice","chlorine","liquid_chlorine","liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","smoke","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","hydrogen","polytetrafluoroethylene","molten_polytetrafluoroethylene"], tick: function(pixel) { let change = false; for (let i = -1; i <= 1; i++) { @@ -37,12 +37,12 @@ elements.fluorine = { category:"gases", density: 1.7, stain: 0.005, -} +}; elements.liquid_fluorine = { color: "#ffff3b", behavior: behaviors.LIQUID, - ignore: ["FOOF","solid_FOOF","oxygen","liquid_oxygen","oxygen_ice","chlorine","liquid_chlorine","liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","smoke","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","hydrogen"], + ignore: ["FOOF","solid_FOOF","oxygen","liquid_oxygen","oxygen_ice","chlorine","liquid_chlorine","liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","smoke","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","hydrogen","polytetrafluoroethylene","molten_polytetrafluoroethylene"], tick: function(pixel) { let change = false; for (let i = -1; i <= 1; i++) { @@ -77,13 +77,13 @@ elements.liquid_fluorine = { tempLow: -219.7, state: "liquid", category:"liquids", - density: 1.7, + density: 1505, stain: 0.005, -} +}; elements.hydrofluoric_acid = { color: ["#c8cf91","#efff5e","#a0cc39"], - ignore: ["fire","liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold"], + ignore: ["fire","liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","polytetrafluoroethylene","molten_polytetrafluoroethylene","chloroform","chloroform_gas","chloroform_ice","tetrafluoroethylene"], tick: function(pixel) { let change = false; for (let i = -1; i <= 1; i++) { @@ -117,15 +117,15 @@ elements.hydrofluoric_acid = { category:"liquids", density: 1150, stain: 0.005, - tempHigh: 400, - stateHigh: "fire", + tempHigh: 100, + stateHigh: "hydrofluoric_acid_gas", tempLow: -58.88, -} +}; elements.hydrofluoric_acid_gas = { color: ["#acb37d","#bfcc4b","#668224"], - ignore: ["liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold"], + ignore: ["liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","polytetrafluoroethylene","molten_polytetrafluoroethylene","chloroform","chloroform_gas","chloroform_ice","tetrafluoroethylene"], tick: function(pixel) { let change = false; for (let i = -1; i <= 1; i++) { @@ -162,12 +162,12 @@ elements.hydrofluoric_acid_gas = { tempLow: -10, stateLow: "hydrofluoric_acid", category:"gases", -} +}; elements.hydrogen_fluoride = { color: "#f2f28d", behavior: behaviors.GAS, - ignore: ["liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","smoke","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","hydrogen"], + ignore: ["liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","smoke","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","hydrogen","polytetrafluoroethylene","molten_polytetrafluoroethylene","chloroform","chloroform_gas","chloroform_ice","tetrafluoroethylene"], tick: function(pixel) { let change = false; for (let i = -1; i <= 1; i++) { @@ -201,12 +201,12 @@ elements.hydrogen_fluoride = { stain: 0.005, tempLow: -19.5, stateLow: "liquid_hydrogen_fluoride", -} +}; elements.liquid_hydrogen_fluoride = { color: "#e2e28d", behavior: behaviors.LIQUID, - ignore: ["liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","smoke","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","hydrogen"], + ignore: ["liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","smoke","acid_gas","neutral_acid","acid","acid_cloud","water","salt_water","sugar_water","dirty_water","steam","gold","hydrogen","polytetrafluoroethylene","molten_polytetrafluoroethylene","chloroform","chloroform_gas","chloroform_ice","tetrafluoroethylene"], tick: function(pixel) { let change = false; for (let i = -1; i <= 1; i++) { @@ -242,12 +242,12 @@ elements.liquid_hydrogen_fluoride = { tempHigh: -19.5, stateHigh: "hydrogen_fluoride", tempLow: -83.6, -} +}; elements.FOOF = { color: "#fa1e1e", behavior: behaviors.LIQUID, - ignore: ["FOOF","solid_FOOF","fluorine","liquid_fluorine","fluorine_ice","liquid_oxygen","oxygen_ice","oxygen","fire"], + ignore: ["FOOF","solid_FOOF","fluorine","liquid_fluorine","fluorine_ice","liquid_oxygen","oxygen_ice","oxygen","fire","polytetrafluoroethylene","molten_polytetrafluoroethylene"], tick: function(pixel) { let change = false; for (let i = -1; i <= 1; i++) { @@ -280,12 +280,12 @@ elements.FOOF = { stateHigh: ["oxygen","fluorine","explosion"], tempLow: -154, stateLow: "solid_FOOF", -} +}; elements.solid_FOOF = { color: "#fa4a1e", behavior: behaviors.WALL, - ignore: ["FOOF","solid_FOOF","fluorine","liquid_fluorine","fluorine_ice","liquid_oxygen","oxygen_ice","oxygen","fire"], + ignore: ["FOOF","solid_FOOF","fluorine","liquid_fluorine","fluorine_ice","liquid_oxygen","oxygen_ice","oxygen","fire","polytetrafluoroethylene","molten_polytetrafluoroethylene"], tick: function(pixel) { let change = false; for (let i = -1; i <= 1; i++) { @@ -316,19 +316,134 @@ elements.solid_FOOF = { temp: -160, tempHigh: -154, stateHigh: "FOOF", -} +}; if (!elements.acid.ignore) { acid.ignore = []; -} +}; if (!elements.acid_gas.ignore) { acid_gas.ignore = []; -} +}; elements.acid.ignore.push("liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas"); elements.acid_gas.ignore.push("liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas"); +let defaultAcidReactions = { + "ash": { "elem1":"neutral_acid", "elem2":null }, + "limestone": { "elem1":"neutral_acid", "elem2":null }, + "quicklime": { "elem1":"neutral_acid", "elem2":null }, + "slaked_lime": { "elem1":"neutral_acid", "elem2":null }, + "borax": { "elem1":"neutral_acid", "elem2":null }, + "ammonia": { "elem1":"neutral_acid", "elem2":null }, + "bleach": { "elem1":"neutral_acid", "elem2":null }, + "water": { "elem1":null, "elem2":"dirty_water" }, + "salt_water": { "elem1":null, "elem2":"water" }, + "sugar_water": { "elem1":null, "elem2":"water" }, + "charcoal": { "elem1":null, "elem2":"carbon_dioxide" }, + "grape": { "elem2":"juice", "color1":"#291824" }, + "soap": { "elem1": "hydrogen" }, + "sodium": { "elem1":"explosion" }, + "meat": { "elem2":"rotten_meat", "elem1":null, "chance":0.5 }, +} + +let defaultAcidGasReactions = { + "acid_gas": { "elem1": null, "elem2": "acid_cloud", "chance":0.3, "y":[0,12], "setting":"clouds" }, + "rain_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, + "cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, + "snow_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, + "hail_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, + "pyrocumulus": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, + "fire_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, + "ash": { "elem1":"hydrogen", "elem2":null, "chance":0.05 }, + "limestone": { "elem1":"hydrogen", "elem2":null, "chance":0.05 }, + "quicklime": { "elem1":"hydrogen", "elem2":null, "chance":0.05 }, + "slaked_lime": { "elem1":"hydrogen", "elem2":null, "chance":0.05 }, + "borax": { "elem1":"hydrogen", "elem2":null, "chance":0.05 }, + "ammonia": { "elem1":"hydrogen", "elem2":null, "chance":0.05 }, + "bleach": { "elem1":"hydrogen", "elem2":null, "chance":0.05 }, + "grape": { "elem2":"juice", "color1":"#291824" }, + "soap": { "elem1": "hydrogen" }, + "sodium": { "elem1":"explosion" }, + "meat": { "elem2":"rotten_meat", "elem1":null, "chance":0.4 }, +} + +acids = [elements.acid, elements.acid_gas]; +ignoreAcid = []; + +function createAcid(name,reactions, gasReactions, color, colorGas, category, categoryGas, tempHigh, tempLowGas, tempLow, tempHighGas, density, densityGas) +{ + elements[name] = { + color: color, + behavior: [ + "XX|DB%5|XX", + "DB%5 AND M2|XX|DB%5 AND M2", + "DB%5 AND M2|DB%10 AND M1|DB%5 AND M2", + ], + ignore: elements.acid.ignore.concat(ignoreAcid), + reactions: reactions, + category: category, + hidden: categoryGas === "hidden", + tempHigh: tempHigh, + stateHigh: name + "_gas", + tempLow: tempLow, + burn: 30, + burnTime: 1, + state: "liquid", + density: density, + } + elements[name+"_gas"] = { + color: colorGas, + behavior: [ + "M1|DB%5 AND M1|M1", + "DB%5 AND M1|XX|DB%5 AND M1", + "DB%5 AND M1|DB%10 AND M1|DB%5 AND M1", + ], + ignore: elements.acid_gas.ignore.concat(ignoreAcid), + reactions: gasReactions, + category: categoryGas, + hidden: categoryGas === "hidden", + tempHigh: tempHighGas, + stateHigh: "fire", + tempLow: tempLowGas, + stateLow: name, + temp: tempLowGas + 20, + burn: 30, + burnTime: 1, + state: "gas", + density: densityGas, + } + acids.push(elements[name], elements[name+"_gas"]); + acidIgnore([name, name + "_gas"]); +} + +function acidIgnore(ignore) +{ + for(let i = 0; i < acids.length; i++) + { + acids[i].ignore = acids[i].ignore.concat(ignore); + } + ignoreAcid = ignoreAcid.concat(ignore); +} + +acidIgnore(["acid", "acid_gas"]); +elements.acid.name = "hydrochloric acid"; +elements.acid_gas.name = "hydrochloric acid gas"; + + +createAcid("generic_acid",defaultAcidReactions,defaultAcidGasReactions,"#80d488","#9bf4a4","hidden","hidden",110,100,-10,400,1020,1) +elements.generic_acid.name = "acid"; +elements.generic_acid_gas.name = "acid_gas"; + +elements.acid_cloud.behavior = [ + "XX|XX|XX", + "XX|CH:generic_acid%0.05|M1%2.5 AND BO", + "XX|XX|XX", + ]; + +createAcid("nitric_acid",defaultAcidReactions,defaultAcidGasReactions,["#5ee9c7","#7ac2b1","#7c9f96"],["#78edd2","#8eccbe","#8aa8a1"],"liquids","gases",83,70,-42,400,1500,1.5) + +elements.nitric_acid.reactions["ammonia"] = { "elem1": "fertilizer", "elem2": null}; elements.nitric_oxide = { color: "#b8926c", @@ -341,21 +456,20 @@ elements.nitric_oxide = { category: "gases", state: "gas", density: 1.34, -} +}; elements.liquid_nitric_oxide = { tempLow: -164, hidden: true, -} +}; elements.nitrogen_dioxide = { color: "#964B00", behavior: behaviors.GAS, reactions: { "steam": { "elem1": "smog", "elem2": null, "chance":0.01 }, - "ammonia": { "elem1": "fertilizer", "elem2": null}, "blood": { "elem1":null, "elem2":"infection", "chance":0.01 }, - "water": { "elem1":null, "elem2":"dirty_water", "chance":0.01 }, + "water": { "elem1":null, "elem2":"acid", "chance":0.01 }, "plant": { "elem1":null, "elem2":"dead_plant", "chance":0.01 }, "grass": { "elem1":null, "elem2":"dead_plant", "chance":0.01 }, "algae": { "elem1":null, "elem2":null, "chance":0.01 }, @@ -380,19 +494,29 @@ elements.nitrogen_dioxide = { "petal": { "elem1":null, "elem2":"dead_plant", "chance":0.01 }, "grass_seed": { "elem1":null, "elem2":"dead_plant", "chance":0.01 }, "meat": { "elem1":null, "elem2":"rotten_meat", "chance":0.01 }, + //clouds + "rain_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, + "cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, + "snow_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, + "hail_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, + "pyrocumulus": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, + "fire_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, }, temp: 30, tempLow: 21.15, category: "gases", state: "gas", density: 1.88, -} +}; elements.liquid_nitrogen_dioxide = { tempLow: -9.3, hidden: true, -} + reactions: structuredClone(elements.nitrogen_dioxide.reactions), +}; +elements.acid.ignore.push("nitric_oxide","liquid_nitric_oxide","nitric_oxide_ice","nitrogen_dioxide","liquid_nitrogen_dioxide","nitrogen_dioxide_ice"); +elements.acid_gas.ignore.push("nitric_oxide","liquid_nitric_oxide","nitric_oxide_ice","nitrogen_dioxide","liquid_nitrogen_dioxide","nitrogen_dioxide_ice"); elements.fertilizer = { color: "#e6c3a1", @@ -420,15 +544,15 @@ elements.fertilizer = { category: "powders", state: "solid", density: 1725, -} +}; -elements.ammonia.reactions["oxygen"] = { "elem1": "steam", "elem2": "nitric_oxide" } +elements.ammonia.reactions["oxygen"] = { "elem1": "steam", "elem2": "nitric_oxide" }; elements.supernova.behavior = [ "XX|XX|XX", "XX|EX:80>plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,plasma,molten_iron,molten_uranium,molten_lead AND CH:neutronium,neutronium,neutronium,liquid_neutronium,quark_matter,void|XX", "XX|XX|XX", -] +]; elements.gamma_ray_burst = { @@ -446,7 +570,7 @@ elements.gamma_ray_burst = { hidden: true, excludeRandom: true, maxSize: 1, -} +}; elements.neutronium = { @@ -459,12 +583,14 @@ elements.neutronium = { temp: 1e6, tempHigh: 1e7, stateHigh: "liquid_neutronium", + tempLow: 1e5, + stateLow: ["molten_uranium","molten_gold","molten_tungsten","molten_lead"], breakInto: "gamma_ray_burst", category: "special", state: "solid", density: 4e17, excludeRandom: true, -} +}; @@ -500,7 +626,7 @@ elements.liquid_neutronium = { state: "liquid", density: 2e17, excludeRandom: true, -} +}; elements.liquid_helium.behavior2 = [ "XX|XX|XX".split("|"), @@ -524,7 +650,7 @@ elements.liquid_helium.tick = function(pixel) { { pixelTick(pixel,elements.liquid_helium.behavior2); } -} +}; elements.quark_matter = { @@ -545,4 +671,400 @@ elements.quark_matter = { state: "liquid", density: 4e18, excludeRandom: true, +}; + +elements.sulfur.burnInto = ["sulfur_dioxide"]; +elements.molten_sulfur.burnInto = ["sulfur_dioxide"]; +elements.sulfur_gas.burnInto = ["sulfur_dioxide"]; + + +elements.sulfur_dioxide = { + color: "#FFF700", + behavior: behaviors.GAS, + reactions: { + "water": { "elem1": "sulfuric_acid", "elem2": null }, + "salt_water": { "elem1": "sulfuric_acid", "elem2": null }, + "sugar_water": { "elem1": "sulfuric_acid", "elem2": null }, + "dirty_water": { "elem1": "sulfuric_acid", "elem2": null }, + "steam": { "elem1": "sulfuric_acid_gas", "elem2": null }, + "acid_gas": { "elem1": "sulfuric_acid_gas", "elem2": null }, + "neutral_acid": { "elem1": "sulfuric_acid", "elem2": null }, + //poison + "blood": { "elem1":null, "elem2":"infection" }, + "soap": { "elem1":null, "chance":0.02 }, + "plant": { "elem1":null, "elem2":"dead_plant" }, + "grass": { "elem1":null, "elem2":"dead_plant" }, + "vine": { "elem1":null, "elem2":"dead_plant" }, + "algae": { "elem1":null, "elem2":null }, + "mushroom_spore": { "elem1":null, "elem2":null }, + "lichen": { "elem1":null, "elem2":null }, + "yeast": { "elem1":null, "elem2":null }, + "rat": { "elem1":null, "elem2":"rotten_meat" }, + "frog": { "elem1":null, "elem2":"rotten_meat" }, + "tadpole": { "elem2":null }, + "fish": { "elem1":null, "elem2":"rotten_meat" }, + "bird": { "elem1":null, "elem2":"rotten_meat" }, + "head": { "elem1":null, "elem2":"rotten_meat" }, + "body": { "elem1":null, "elem2":"rotten_meat" }, + "ant": { "elem1":null, "elem2":"dead_bug" }, + "worm": { "elem1":null, "elem2":"dead_bug" }, + "fly": { "elem1":null, "elem2":"dead_bug" }, + "firefly": { "elem1":null, "elem2":"dead_bug" }, + "bee": { "elem1":null, "elem2":"dead_bug" }, + "stink_bug": { "elem1":null, "elem2":"dead_bug" }, + "termite": { "elem1":null, "elem2":"dead_bug" }, + "flea": { "elem1":null, "elem2":"dead_bug" }, + "slug": { "elem1":null, "elem2":"slime" }, + "snail": { "elem1":null, "elem2":"calcium" }, + "sapling": { "elem1":null, "elem2":"dead_plant" }, + "root": { "elem1":null, "elem2":"dead_plant" }, + "flower_seed": { "elem1":null, "elem2":"dead_plant" }, + "pistil": { "elem1":null, "elem2":"dead_plant" }, + "petal": { "elem1":null, "elem2":"dead_plant" }, + "grass_seed": { "elem1":null, "elem2":"dead_plant" }, + "meat": { "elem1":null, "elem2":"rotten_meat" }, + //clouds + "rain_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, + "cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, + "snow_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, + "hail_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, + "pyrocumulus": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, + "fire_cloud": { "elem1": null, "elem2": "acid_cloud", "chance":0.4, "y":[0,12], "setting":"clouds" }, + }, + tempLow: -10, + stateLow: "liquid_sulfur_dioxide", + state: "gas", + category:"gases", + density: 2.6, +}; + +elements.liquid_sulfur_dioxide = { + color: "#d1cb17", + behavior: behaviors.LIQUID, + reactions: elements.sulfur_dioxide.reactions, + tempLow: -72, + state: "liquid", + hidden: true, + density: 1435, +}; + +acidIgnore(["sulfur_dioxide","liquid_sulfur_dioxide","sulfur_dioxide_ice"]); + +createAcid("sulfuric_acid",defaultAcidReactions,defaultAcidGasReactions,["#e9e05e","#c2bd7a","#9e9c7b"],["#ede579","#ccc88f","#a8a68a"],"liquids","gases",337,337,10,500,1830,1.26) + +elements.sulfuric_acid.ignore.push("charcoal"); +elements.sulfuric_acid_gas.ignore.push("charcoal"); +elements.sulfuric_acid.reactions["chocolate"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["grape"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["juice"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["corn"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["popcorn"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["potato"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["bread"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["toast"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["wheat"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["flour"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["dough"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["sugar"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid.reactions["candy"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +delete elements.sulfuric_acid.reactions["charcoal"]; +elements.sulfuric_acid_gas.reactions["chocolate"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["grape"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["juice"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["corn"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["popcorn"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["potato"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["bread"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["toast"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["wheat"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["flour"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["dough"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["sugar"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +elements.sulfuric_acid_gas.reactions["candy"] = { "elem1": "charcoal", "elem2": "steam", "temp2": 200}; +delete elements.sulfuric_acid_gas.reactions["charcoal"]; + +elements.polytetrafluoroethylene = { + color: "#efefef", + behavior: behaviors.WALL, + properties: { + colored: false + }, + tick: function(pixel) { + if(!pixel.colored) + { + let rgb = elements.polytetrafluoroethylene.colorObject; + + let coloroffset = Math.floor(Math.random() * (Math.random() > 0.5 ? -1 : 1) * Math.random() * 2); + let r = rgb.r + coloroffset; + let g = rgb.g + coloroffset; + let b = rgb.b + coloroffset; + pixel.color = "rgb("+r+","+g+","+b+")"; + pixel.colored = true; + pixel.origColor = pixel.color; + } + if (pixel.origColor != pixel.color) { + pixel.color = pixel.origColor; + } + }, + state: "solid", + category: "solids", + density: 1450, + tempHigh: 327, } +acidIgnore(["polytetrafluoroethylene", "molten_polytetrafluoroethylene", "tetrafluoroethylene"]); + + +function doStaining(pixel) { + if (settings["stainoff"]) { return } + var stain = elements[pixel.element].stain; + if (stain > 0) { + var newColor = pixel.color.match(/\d+/g); + } + else { + var newColor = null; + } + + for (var i = 0; i < adjacentCoords.length; i++) { + var x = pixel.x+adjacentCoords[i][0]; + var y = pixel.y+adjacentCoords[i][1]; + if (!isEmpty(x,y,true)) { + var newPixel = pixelMap[x][y]; + if ((elements[pixel.element].ignore && elements[pixel.element].ignore.indexOf(newPixel.element) !== -1) || newPixel.element == "polytetrafluoroethylene") { + continue; + } + if ((elements[newPixel.element].id !== elements[pixel.element].id || elements[newPixel.element].stainSelf) && (solidStates[elements[newPixel.element].state] || elements[newPixel.element].id === elements[pixel.element].id)) { + if (Math.random() < Math.abs(stain)) { + if (stain < 0) { + if (newPixel.origColor) { + newColor = newPixel.origColor; + } + else { continue; } + } + else if (!newPixel.origColor) { + newPixel.origColor = newPixel.color.match(/\d+/g); + } + // if newPixel.color doesn't start with rgb, continue + if (!newPixel.color.match(/^rgb/)) { continue; } + // parse rgb color string of newPixel rgb(r,g,b) + var rgb = newPixel.color.match(/\d+/g); + if (elements[pixel.element].stainSelf && elements[newPixel.element].id === elements[pixel.element].id) { + // if rgb and newColor are the same, continue + if (rgb[0] === newColor[0] && rgb[1] === newColor[1] && rgb[2] === newColor[2]) { continue; } + var avg = []; + for (var j = 0; j < rgb.length; j++) { + avg[j] = Math.round((rgb[j]*(1-Math.abs(stain))) + (newColor[j]*Math.abs(stain))); + } + } + else { + // get the average of rgb and newColor, more intense as stain reaches 1 + var avg = []; + for (var j = 0; j < rgb.length; j++) { + avg[j] = Math.floor((rgb[j]*(1-Math.abs(stain))) + (newColor[j]*Math.abs(stain))); + } + } + // set newPixel color to avg + newPixel.color = "rgb("+avg.join(",")+")"; + } + } + } + } + } +elements["bleach"].reactions.vinegar = { "elem1":"chlorine", "elem2":null }; +elements["bleach"].reactions.alchohol = { "elem1":"chloroform", "elem2":null }; +elements["chlorine"].reactions.methane = { "elem1":"chloroform", "elem2":null }; + +elements.chloroform = { + color: "#7f7f7f", + behavior: behaviors.LIQUID, + reactions: elements.poison.reactions, + state: "liquid", + category: "liquids", + density: 1564, + tempLow: -63, + tempHigh: 61, +} + +elements.chloroform_gas = { + color: "#8f8f8f", + behavior: behaviors.GAS, + reactions: elements.poison.reactions, + state: "gas", + hidden: true, + density: 4.12, + tempLow: 61, + stateLow: "chloroform" +} + +elements["chloroform_gas"].reactions.hydrogen_fluoride = { "elem1":"tetrafluoroethylene", "elem2": null, tempMin: 550 }; + + +elements.tetrafluoroethylene = { + color: "#8f8f8f", + behavior: behaviors.GAS, + reactions: { + "oxygen": { "elem1":"fire", "elem2":"fire" }, + "sulfuric_acid": { "elem1":"polytetrafluoroethylene", "elem2":"sulfuric_acid", "chance":0.25 }, + "sulfuric_acid_gas": { "elem1":"polytetrafluoroethylene", "elem2":"sulfuric_acid_gas", "chance":0.25 }, + }, + state: "gas", + hidden: true, + burn: 100, + burnTime: 2, + density: 1.52, +} + + + + + +elements.polyethylene = { + color: "#a7a7a7", + behavior: behaviors.WALL, + properties: { + colored: false + }, + tick: function(pixel) { + if(!pixel.colored) + { + let rgb = elements.polyethylene.colorObject; + + let coloroffset = Math.floor(Math.random() * (Math.random() > 0.5 ? -1 : 1) * Math.random() * 2); + let r = rgb.r + coloroffset; + let g = rgb.g + coloroffset; + let b = rgb.b + coloroffset; + pixel.color = "rgb("+r+","+g+","+b+")"; + pixel.colored = true; + pixel.origColor = pixel.color; + } + }, + state: "solid", + category: "solids", + density: 1450, + tempHigh: 125, +} + + +elements.ethane = { + color: "#afafaf", + behavior: behaviors.GAS, + reactions: { + "steam": { "elem1":null, "elem2":"ethylene", "chance":0.25 } + }, + category: "gases", + tempHigh: 400, + stateHigh: "fire", + tempLow: -88.5, + burn: 85, + burnTime: 5, + fireColor: ["#00ffff","#00ffdd"], + state: "gas", + density: 1.356, +}; + +elements.ethylene = { + color: "#a7a7a7", + behavior: behaviors.GAS, + reactions: { + "titanium_trichloride": { "elem1":"polyethylene", "elem2":"titanium_trichloride", "chance":0.25 }, + }, + category: "gases", + tempHigh: 400, + stateHigh: "fire", + tempLow: -88.5, + burn: 85, + burnTime: 5, + fireColor: ["#00ffff","#00ffdd"], + state: "gas", + density: 1.356, +}; + + + +elements.titanium = { + color: "#e3e5e6", + category: "solids", + state: "solid", + behavior: behaviors.WALL, + reactions: { + "hydrochloric_acid": { "elem1": "titanium_trichloride", "elem2":null }, + }, + stateHigh: "molten_titanium", + tempHigh: 1668, + conduct: 0.5, +}; +elements.molten_titanium = { + color: ["#e0921d", "#e89e2e", "#f7b24a", "#fce168", "#fceca2", "#fffcf0"], + hidden: true, + state: "liquid", + behavior: behaviors.LIQUID, + stateLow: "titanium", + tempLow: 1668, + temp: 2000, + viscosity: 10000 +}; + +elements.rutile = { + color: "#522614", + behavior: behaviors.POWDER, + category: "land", + density: 4240, + state: "solid", + tempHigh: 1843, + stateHigh: "molten_rutile", +}; +elements.molten_rutile = { + color: ["#e3907f", "#e68f3e"], + behavior: behaviors.LIQUID, + hidden: true, + reactions: { + "chlorine": { "elem1": "titanium_tetrachloride", "elem2":null }, + }, + density: 4230, + state: "liquid", + temp: 2000, + tempLow: 1843, + stateLow: "rutile", + viscosity: 10000 + }; +elements.titanium_tetrachloride = { + color: "#d9d7b2", + behavior: behaviors.LIQUID, + category: "liquids", + density: 1728, + state: "liquid", + tempHigh: 136.4, + stateHigh: "titanium_tetrachloride_gas", + tempLow: -24, + stateLow: "titanium_tetrachloride_crystal", +}; +elements.titanium_tetrachloride_gas = { + color: "#e8edd5", + behavior: behaviors.GAS, + hidden: true, + density: 500, + state: "gas", + temp: 200, + tempLow: 136.4, + stateLow: "titanium_tetrachloride" +}; +elements.titanium_tetrachloride_crystal = { + color: "#f5fffe", + behavior: behaviors.WALL, + hidden: true, + density: 1728, + state: "solid", + temp: -50, + tempHigh: -24, + stateHigh: "titanium_tetrachloride" +}; + + +elements.titanium_trichloride = { + color: "#c71585", + behavior: behaviors.SOLID, + category: "solids", + density: 2640, + state: "solid", +}; + +//todo: magnesium for titanium production diff --git a/mods/clf3.js b/mods/clf3.js new file mode 100644 index 00000000..8eb57d9d --- /dev/null +++ b/mods/clf3.js @@ -0,0 +1,86 @@ +var modName = "mods/clf3.js"; +var chemMod = "mods/chem.js"; + +if(enabledMods.includes(chemMod)) { + function finishBurn(pixel) { + var info = elements[pixel.element]; + + var burnInto = info.burnInto; + if (burnInto == undefined) { + burnInto = 'fire'; + } + else if (burnInto instanceof Array) { + burnInto = burnInto[Math.floor(Math.random()*burnInto.length)]; + } + changePixel(pixel,burnInto,(burnInto !== "smoke")); + if (info.fireColor != undefined && burnInto == "fire") { + pixel.color = pixelColorPick(pixel,info.fireColor); + } + else { + pixel.color = pixelColorPick(pixel) + } + }; + + function clf3Tick(pixel) { + for(i = 0; i < adjacentCoords.length; i++) { + var oX = adjacentCoords[i][0]; + var oY = adjacentCoords[i][1]; + var fX = pixel.x+oX; + var fY = pixel.y+oY; + if(!isEmpty(fX,fY,true)) { + var otherPixel = pixelMap[fX][fY]; + var otherElement = otherPixel.element; + if(otherElement === "water") { + explodeAt(otherPixel.x,otherPixel.y,7,"fire,hydrofluoric_acid,oxygen,acid,chlorine") + }; + if(!elements.chlorine_trifluoride.ignore.includes(otherElement)) { + if(!otherPixel.burning) { otherPixel.burning = true }; + if(!otherPixel.burnStart) { otherPixel.burnStart = pixelTicks }; + var instaburnChance = 0.05 + (pixelTicks - otherPixel.burnStart) / 1000 + if(Math.random() < instaburnChance) { + finishBurn(otherPixel); + }; + }; + }; + }; + }; + + var clf3IgnoreList = ["FOOF","solid_FOOF","oxygen","liquid_oxygen","oxygen_ice","chlorine","liquid_chlorine","liquid_hydrogen_fluoride","liquid_fluorine","fluorine","fluorine_ice","hydrogen_fluoride","hydrofluoric_acid","hydrofluoric_acid_gas","fire","acid_gas","neutral_acid","acid","acid_cloud","nitrogen","helium","liquid_helium","tralphium","liquid_tralphium","neon","liquid_neon","solid_neon","neon_ice","neon_snow","argon","liquid_argon","solid_argon","argon_ice","argon_snow", "krypton","liquid_krypton","solid_krypton","krypton_ice","krypton_snow", "xenon","liquid_xenon","solid_xenon","xenon_ice","xenon_snow", "radon","liquid_radon","solid_radon","radon_ice","radon_snow","ionized_helium","ionized_tralphium","wall","chlorine_trifluoride","chlorine_trifluoride_ice","chlorine_trifluoride_gas","quartz"]; + + //todo: PTFE, passivation + + elements.chlorine_trifluoride = { + color: "#8aa65b", + behavior: behaviors.LIQUID, + //ignore list copied from chem.js + ignore: clf3IgnoreList, //the elements that don't exist won't trigger any error here becuase the code's just checking pixels' elements against this list + tick: function(pixel) { + clf3Tick(pixel); + }, + category:"liquids", + state: "liquid", + density: 1770, + tempLow: -76.34, + tempHigh: 11.75, + temp: 5, + }; + + elements.chlorine_trifluoride_gas = { + tick: function(pixel) { + clf3Tick(pixel); + }, + density: 3.78, //variously or 3.18, + //tempHigh: 220, //variously or 180, + //stateHigh: ["chlorine_fluoride","fluorine"], + }; + + elements.chlorine_trifluoride_ice = { + tick: function(pixel) { + clf3Tick(pixel); + }, + }; +} else { + enabledMods.splice(enabledMods.indexOf(modName),0,chemMod); + localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); + alert(`The ${chemMod} mod is required and has been automatically inserted (reload for this to take effect).`); +}; diff --git a/mods/code_library.js b/mods/code_library.js index 183e0fb4..b9f5a178 100644 --- a/mods/code_library.js +++ b/mods/code_library.js @@ -410,7 +410,7 @@ }; }; } else if(typeof(color) === "object") { - if(!color.r || !color.g || !color.b) { + if(typeof(color.r) === "undefined" || typeof(color.g) === "undefined" || typeof(color.b) === "undefined") { throw new Error("Color must be of the form {r: red, g: green, b: blue}"); }; @@ -1094,6 +1094,38 @@ }; }; +//World + + function breakCircle(x,y,radius,respectHardness=false,changeTemp=false,defaultBreakIntoDust=false) { + var coords = circleCoords(x,y,radius); + for(i = 0; i < coords.length; i++) { + coordX = coords[i].x; + coordY = coords[i].y; + if(!isEmpty(coordX,coordY,true)) { + var pixel = pixelMap[coordX][coordY]; + respectHardness ? tryBreak(pixel,changeTemp,defaultBreakIntoDust) : breakPixel(pixel,changeTemp,defaultBreakIntoDust); + }; + }; + }; + + function fillCircle(element,x,y,radius,overwrite=false) { + var coords = circleCoords(x,y,radius); + var newElement = element; + if(Array.isArray(newElement)) { + newElement = newElement[Math.floor(Math.random() * newElement.length)]; + }; + for(i = 0; i < coords.length; i++) { + coordX = coords[i].x; + coordY = coords[i].y; + if(overwrite && !isEmpty(coordX,coordY,true)) { + changePixel(pixelMap[coordX][coordY],element); + }; + if(isEmpty(coordX,coordY,false)) { + createPixel(element,coordX,coordY); + }; + }; + }; + //Logic function xor(c1,c2) { diff --git a/mods/cold fire revamp and doBurning edits.js b/mods/cold fire revamp and doBurning edits.js deleted file mode 100644 index ac90dbf0..00000000 --- a/mods/cold fire revamp and doBurning edits.js +++ /dev/null @@ -1,225 +0,0 @@ -//Variable -fireSpawnBlacklist = ["fire","cold_fire"]; - -//doBurning -function doBurning(pixel) { - if (pixel.burning) { // Burning - var info = elements[pixel.element]; - var burnTempChange = info.burnTempChange - if (burnTempChange == undefined) { - burnTempChange = 1; - }; - //move fire ahead so that cold burners don't light hot burners - var fireIsCold; - //Fire getter block - var fire = info.fireElement; - if (fire == undefined) { - fire = 'fire'; - } - else if(fire instanceof Array) { - fire = fire[Math.floor(Math.random()*fire.length)]; - } - //End fire getter block - fireIsCold = (fire === "cold_fire"); - - pixel.temp += burnTempChange; - pixelTempCheck(pixel); - for (var i = 0; i < adjacentCoords.length; i++) { // Burn adjacent pixels - var x = pixel.x+adjacentCoords[i][0]; - var y = pixel.y+adjacentCoords[i][1]; - if (!isEmpty(x,y,true)) { - var newPixel = pixelMap[x][y]; - var newInfo = elements[newPixel.element]; - var newFireIsCold; - //Fire getter block - var newFire = newInfo.fireElement; - if (newFire == undefined) { - newFire = 'fire'; - } - else if(newFire instanceof Array) { - newFire = newFire[Math.floor(Math.random()*newFire.length)]; - } - //End fire getter block - newFireIsCold = (newFire === "cold_fire"); - - - //console.log(`burning pixel ${pixel.element}: ${fire} (${fireIsCold}) / burned element ${newPixel.element}: ${newFire} (${newFireIsCold})`); - if((!fireIsCold && !newFireIsCold) || (fireIsCold && newFireIsCold)) { - if (elements[newPixel.element].burn && !newPixel.burning) { - if (Math.floor(Math.random()*100) < elements[newPixel.element].burn) { - newPixel.burning = true; - newPixel.burnStart = pixelTicks; - } - } - } - } - } - - if ((pixelTicks - pixel.burnStart > (info.burnTime || 200)) && Math.floor(Math.random()*100)<(info.burn || 10)) { - var burnInto = info.burnInto; - if (burnInto == undefined) { - burnInto = 'fire'; - } - else if (burnInto instanceof Array) { - burnInto = burnInto[Math.floor(Math.random()*burnInto.length)]; - } - changePixel(pixel,burnInto,(burnInto !== "smoke")); - if (info.fireColor != undefined && burnInto == "fire") { - pixel.color = pixelColorPick(pixel,info.fireColor); - } - else { - pixel.color = pixelColorPick(pixel) - } - } - else if (Math.floor(Math.random()*100)<10 && !fireSpawnBlacklist.includes(pixel.element)) { // Spawn fire - if (isEmpty(pixel.x,pixel.y-1)) { - createPixel(fire,pixel.x,pixel.y-1); - pixelMap[pixel.x][pixel.y-1].temp = pixel.temp//+(pixelTicks - (pixel.burnStart || 0)); - if (info.fireColor != undefined) { - pixelMap[pixel.x][pixel.y-1].color = pixelColorPick(pixelMap[pixel.x][pixel.y-1],info.fireColor); - } - } - // same for below if top is blocked - else if (isEmpty(pixel.x,pixel.y+1)) { - createPixel(fire,pixel.x,pixel.y+1); - pixelMap[pixel.x][pixel.y+1].temp = pixel.temp//+(pixelTicks - (pixel.burnStart || 0)); - if (info.fireColor != undefined) { - pixelMap[pixel.x][pixel.y+1].color = pixelColorPick(pixelMap[pixel.x][pixel.y+1],info.fireColor); - } - } - } - } -} - -//New elements - -elements.cold_fire.burning = true; -elements.cold_fire.burnTempChange = -1; -elements.cold_fire.burnTime = 25; -elements.cold_fire.burnInto = "cold_smoke"; -elements.cold_fire.fireElement = "cold_fire"; -elements.cold_fire.behavior = [ - "M1|M1|M1", - "M2|XX|M2", - "XX|M2|XX" -], - -elements.cold_smoke = { - color: "#282848", - behavior: behaviors.DGAS, - reactions: { - "steam": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, - "rain_cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, - "cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, - "snow_cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, - "hail_cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, - "acid_cloud": { "elem1": "pyrocumulus", "chance":0.05, "y":[0,12], "setting":"clouds" }, - "fire_cloud": { "elem1": "pyrocumulus", "chance":0.05, "y":[0,12], "setting":"clouds" }, - "pyrocumulus": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, - }, - temp: -100, - tempHigh: 0, - stateHigh: "smoke", - tempLow: -114, - stateLow: "cold_fire", - category: "gases", - state: "gas", - density: 1280, - stain: 0.075, -}; - -elements.cold_torch = { - "color": "#4394d6", - "behavior": [ - "XX|CR:cold_fire|XX", - "XX|XX|XX", - "XX|XX|XX" - ], - "reactions": { - "water": { "elem1": "wood" }, - "sugar_water": { "elem1": "wood" }, - "salt_water": { "elem1": "wood" }, - "seltzer": { "elem1": "wood" }, - "dirty_water": { "elem1": "wood" }, - "pool_water": { "elem1": "wood" }, - "steam": { "elem1": "wood" }, - "smog": { "elem1": "wood" }, - "rain_cloud": { "elem1": "wood" }, - "cloud": { "elem1": "wood" }, - "snow_cloud": { "elem1": "wood" }, - "hail_cloud": { "elem1": "wood" }, - "black_damp": { "elem1": "wood" } - }, - "temp": -200, - "category": "special", - "breakInto": "sawdust", - "tempHigh": 600, - "stateHigh": "wood", -}; - -runAfterLoad(function() { - if(eLists.spout) { - eLists.spout.push("cold_torch"); - }; - - if(enabledMods.includes("mods/liquid_energy.js")) { - elements.liquid_fire = { - color: ["#ff6b21","#ffa600","#ff4000"], - behavior: [ - "XX|M2|XX", - "M2|XX|M2", - "M1|M1|M1", - ], - reactions: { - "water": { "elem1": "liquid_smoke" }, - }, - temp:600, - tempLow:100, - stateLow: "liquid_smoke", - tempHigh: 7000, - stateHigh: "liquid_plasma", - category: "energy liquids", - burning: true, - burnTime: 500, - burnTempChange: 2, - burnInto: "liquid_smoke", - state: "liquid", - density: 21, - }; - - elements.liquid_cold_fire = { - color: ["#21cbff","#006aff","#00ffff"], - behavior: [ - "XX|M2|XX", - "M2|XX|M2", - "M1|M1|M1", - ], - reactions: { - "fire": { "elem1": "liquid_smoke", "elem2": "liquid_smoke" }, - "plasma": { "elem1": "le_liquid_light", "elem2": "le_liquid_light" }, //prefixed to avoid conflict with F&M liquid_light - }, - temp:-200, - tempHigh:0, - stateHigh: "liquid_smoke", - burning: true, - burnTempChange: -2, - burnTime: 500, - burnInto: "liquid_smoke", - fireElement: "cold_fire", - category: "energy liquids", - state: "liquid", - density: 42, - }; - }; - - if(enabledMods.includes("mods/randomness.js")) { - elements.unnamed_gas.burnTempChange = 10; - elements.unnamed_gas.fireElement = "plasma"; - elements.unnamed_powder.burnTempChange = 20; - elements.unnamed_powder.fireElement = "plasma"; - elements.burning_unnamed_gas.burnTempChange = 15; - elements.burning_unnamed_gas.fireElement = "plasma"; - elements.burning_unnamed_powder.burnTempChange = 30; - elements.burning_unnamed_powder.fireElement = "plasma"; - }; -}); diff --git a/mods/cpt_alt.js b/mods/cpt_alt.js index 0e398a29..59ce90ad 100644 --- a/mods/cpt_alt.js +++ b/mods/cpt_alt.js @@ -5,36 +5,6 @@ var libraryMod = "mods/code_library.js"; if(enabledMods.includes(explodeAtPlusMod) && enabledMods.includes(libraryMod)) { actExcludedElements = ["wall","alt_controllable_pixel"]; - function breakCircle(x,y,radius,respectHardness=false,changeTemp=false,defaultBreakIntoDust=false) { - var coords = circleCoords(x,y,radius); - for(i = 0; i < coords.length; i++) { - coordX = coords[i].x; - coordY = coords[i].y; - if(!isEmpty(coordX,coordY,true)) { - var pixel = pixelMap[coordX][coordY]; - respectHardness ? tryBreak(pixel,changeTemp,defaultBreakIntoDust) : breakPixel(pixel,changeTemp,defaultBreakIntoDust); - }; - }; - }; - - function fillCircle(element,x,y,radius,overwrite=false) { - var coords = circleCoords(x,y,radius); - var newElement = element; - if(Array.isArray(newElement)) { - newElement = newElement[Math.floor(Math.random() * newElement.length)]; - }; - for(i = 0; i < coords.length; i++) { - coordX = coords[i].x; - coordY = coords[i].y; - if(overwrite && !isEmpty(coordX,coordY,true)) { - changePixel(pixelMap[coordX][coordY],element); - }; - if(isEmpty(coordX,coordY,false)) { - createPixel(element,coordX,coordY); - }; - }; - }; - function actTryMove(pixel,x,y) { if(!tryMove(pixel,x,y)) { if(outOfBounds(x,y)) { diff --git a/mods/explodeAtPlus.js b/mods/explodeAtPlus.js index 4167ab67..34252672 100644 --- a/mods/explodeAtPlus.js +++ b/mods/explodeAtPlus.js @@ -1,3 +1,5 @@ +velocityBlacklist = []; + function explodeAtPlus(x,y,radius,fire="fire",smoke="smoke",beforeFunction=null,afterFunction=null,changeTemp=true) { // if fire contains , split it into an array if(fire !== null) { @@ -84,6 +86,9 @@ function explodeAtPlus(x,y,radius,fire="fire",smoke="smoke",beforeFunction=null, } // change the pixel to the result changePixel(pixel,result,changeTemp); + if(info.onExplosionBreakOrSurvive) { + info.onExplosionBreakOrSurvive(pixel,x,y,radius,fire,smoke,power,damage); + }; continue; } else { @@ -100,6 +105,10 @@ function explodeAtPlus(x,y,radius,fire="fire",smoke="smoke",beforeFunction=null, } continue; } + } else { + if(info.onExplosionBreakOrSurvive) { + info.onExplosionBreakOrSurvive(pixel,x,y,radius,fire,smoke,power,damage); + }; } if (damage > 0.75 && info.burn) { pixel.burning = true; @@ -107,6 +116,14 @@ function explodeAtPlus(x,y,radius,fire="fire",smoke="smoke",beforeFunction=null, } pixel.temp += damage*radius*power; pixelTempCheck(pixel); + if(enabledMods.includes("mods/velocity.js")) { + // set the pixel.vx and pixel.vy depending on the angle and power + if (!elements[pixel.element].excludeRandom && !elements[pixel.element].excludeVelocity) { + var angle = Math.atan2(pixel.y-y,pixel.x-x); + pixel.vx = Math.round((pixel.vx|0) + Math.cos(angle) * (radius * power/10)); + pixel.vy = Math.round((pixel.vy|0) + Math.sin(angle) * (radius * power/10)); + } + }; if(typeof(afterFunction) === "function") { //console.log(`running afterFunction ${afterFunction}`) //console.log(`arguments: ${pixel}, ${x}, ${y}, ${radius}, ${fire}, ${smoke}, ${power}, ${damage}`) @@ -115,4 +132,3 @@ function explodeAtPlus(x,y,radius,fire="fire",smoke="smoke",beforeFunction=null, }; }; }; - diff --git a/mods/fire_mod.js b/mods/fire_mod.js new file mode 100644 index 00000000..28471b3b --- /dev/null +++ b/mods/fire_mod.js @@ -0,0 +1,666 @@ +/* elements.iron.reactions.radiation = + {elem1: 'dirty_water', elem2: null} + when radiation touches iron, + the iron turns into dirty_water (elem1) + and the radiation deletes itself (elem2) + + elements.AAA.reactions.BBB: + {elem1: CCC, elem2: DDD} + when BBB touches AAA, + the AAA becomes CCC + and the BBB becomes DDD +*/ + +// imaginary reaction elements.iron.reactions.test + +//Variable +fireSpawnBlacklist = ["fire","cold_fire","rad_fire"]; + +//doBurning +function doBurning(pixel) { + if (pixel.burning) { // Burning + var info = elements[pixel.element]; + var burnTempChange = info.burnTempChange + if (burnTempChange == undefined) { + burnTempChange = 1; + }; + //move fire ahead so that cold burners don't light hot burners + var fireIsCold; + //Fire getter block + var fire = info.fireElement; + if (fire == undefined) { + fire = 'fire'; + } + else if(fire instanceof Array) { + fire = fire[Math.floor(Math.random()*fire.length)]; + } + //End fire getter block + //Fire temp getter block + var fireTemp = info.fireSpawnTemp; + if (fireTemp == undefined) { + fireTemp = pixel.temp; + }; + //End fire temp getter block + //Fire chance getter block + var fireChance = info.fireSpawnChance; + if (fireChance == undefined) { + fireChance = 10; + }; + //End fire chance getter block + var fireIsCold = (fire === "cold_fire"); + var fireInfo = elements[fire]; + + pixel.temp += burnTempChange; + pixelTempCheck(pixel); + + for (var i = 0; i < adjacentCoords.length; i++) { // Burn adjacent pixels + var x = pixel.x+adjacentCoords[i][0]; + var y = pixel.y+adjacentCoords[i][1]; + if (!isEmpty(x,y,true)) { + var newPixel = pixelMap[x][y]; + var newInfo = elements[newPixel.element]; + var newFireIsCold; + //Fire getter block + var newFire = newInfo.fireElement; + if (newFire == undefined) { + newFire = 'fire'; + } + else if(newFire instanceof Array) { + newFire = newFire[Math.floor(Math.random()*newFire.length)]; + } + //End fire getter block + newFireIsCold = (newFire === "cold_fire"); + + //console.log(`burning pixel ${pixel.element}: ${fire} (${fireIsCold}) / burned element ${newPixel.element}: ${newFire} (${newFireIsCold})`); + if((!fireIsCold && !newFireIsCold) || (fireIsCold && newFireIsCold)) { + if (elements[newPixel.element].burn && !newPixel.burning) { + if (Math.floor(Math.random()*100) < elements[newPixel.element].burn) { + newPixel.burning = true; + newPixel.burnStart = pixelTicks; + } + } + } + } + } + + if ((pixelTicks - pixel.burnStart > (info.burnTime || 200)) && Math.floor(Math.random()*100)<(info.burn || 10)) { + var burnInto = info.burnInto; + if (burnInto == undefined) { + burnInto = 'fire'; + } + else if (burnInto instanceof Array) { + burnInto = burnInto[Math.floor(Math.random()*burnInto.length)]; + } + changePixel(pixel,burnInto,(burnInto !== "smoke")); + if (info.fireColor != undefined && burnInto == "fire") { + pixel.color = pixelColorPick(pixel,info.fireColor); + } + else { + pixel.color = pixelColorPick(pixel) + } + } + else if (Math.floor(Math.random()*100) r.tempMax) { + return false; + } + if (r.charged && !pixel.charge) { + return false; + } + if (r.chance !== undefined && Math.random() > r.chance) { + return false; + } + if (r.y !== undefined && (pixel1.y < r.y[0] || pixel1.y > r.y[1])) { + return false; + } + if (r.elem1 !== undefined) { + // if r.elem1 is an array, set elem1 to a random element from the array, otherwise set it to r.elem1 + if (Array.isArray(r.elem1)) { + var elem1 = r.elem1[Math.floor(Math.random() * r.elem1.length)]; + } else { var elem1 = r.elem1; } + + if (elem1 == null) { + deletePixel(pixel1.x,pixel1.y); + } + else { + changePixel(pixel1,elem1); + } + } + if (r.charge1) { pixel1.charge = r.charge1; } + if (r.temp1) { pixel1.temp += r.temp1; pixelTempCheck(pixel1); } + if (r.color1) { // if it's a list, use a random color from the list, else use the color1 attribute + pixel1.color = pixelColorPick(pixel1, Array.isArray(r.color1) ? r.color1[Math.floor(Math.random() * r.color1.length)] : r.color1); + } + if (r.attr1) { // add each attribute to pixel1 + for (var key in r.attr1) { + pixel1[key] = r.attr1[key]; + } + } + if (r.elem2 !== undefined) { + // if r.elem2 is an array, set elem2 to a random element from the array, otherwise set it to r.elem2 + if (Array.isArray(r.elem2)) { + var elem2 = r.elem2[Math.floor(Math.random() * r.elem2.length)]; + } else { var elem2 = r.elem2; } + + if (elem2 == null) { + deletePixel(pixel2.x,pixel2.y); + } + else { + changePixel(pixel2,elem2); + } + } + if (r.charge2) { pixel2.charge = r.charge2; } + if (r.temp2) { pixel2.temp += r.temp2; pixelTempCheck(pixel2); } + if (r.color2) { // if it's a list, use a random color from the list, else use the color2 attribute + pixel2.color = pixelColorPick(pixel2, Array.isArray(r.color2) ? r.color2[Math.floor(Math.random() * r.color2.length)] : r.color2); + } + if (r.attr2) { // add each attribute to pixel2 + for (var key in r.attr2) { + pixel2[key] = r.attr2[key]; + } + } + if (r.func) { r.func(pixel1,pixel2); } + return r.elem1!==undefined || r.elem2!==undefined; +}; + +//New elements + +elements.cold_fire.burning = true; +elements.cold_fire.burnTempChange = -1; +elements.cold_fire.burnTime = 25; +elements.cold_fire.burnInto = "cold_smoke"; +elements.cold_fire.fireElement = "cold_fire"; +elements.cold_fire.behavior = [ + "M1|M1|M1", + "M2|XX|M2", + "XX|M2|XX" +], + +elements.cold_smoke = { + color: "#282848", + behavior: behaviors.DGAS, + reactions: { + "steam": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "rain_cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "snow_cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "hail_cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "acid_cloud": { "elem1": "pyrocumulus", "chance":0.05, "y":[0,12], "setting":"clouds" }, + "fire_cloud": { "elem1": "pyrocumulus", "chance":0.05, "y":[0,12], "setting":"clouds" }, + "pyrocumulus": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + }, + temp: -100, + tempHigh: 0, + stateHigh: "smoke", + tempLow: -114, + stateLow: "cold_fire", + category: "gases", + state: "gas", + density: 1280, + stain: 0.075, +}; + +elements.rad_fire = { //this is BBB + color: ["#daff21","#a6ff00","#ffff00"], + behavior: [ + "XX|CR:radiation%0.1|XX", + "CR:radiation%0.1|XX|CR:radiation%0.1", + "XX|CR:radiation%0.1|XX", + ], + tick: function(pixel) { + if(Math.random() < 0.4) { + pixel.temp++; + }; + + if(Math.random() < 0.05) { //5%/t to radify + if(typeof(transformAdjacent) === "function" && typeof(radioactiveObject) === "object") { + transformAdjacent(pixel,radioactiveObject); + }; + }; + + var move1Spots = [[-1,-1],[0,-1],[1,-1]]; + var move2Spots = [[-1,0],[0,1],[1,0]]; + + var randomMove1 = move1Spots[Math.floor(Math.random() * move1Spots.length)]; + + if(!tryMove(pixel, pixel.x+randomMove1[0], pixel.y+randomMove1[1])) { + //console.log((pixel.x+randomMove1[0]) + " " + (pixel.y+randomMove1[1])) + var newPixel = null; + if(!outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1])) { + newPixel = pixelMap[pixel.x+randomMove1[0]][pixel.y+randomMove1[1]]; //newPixel is AAA + }; + if(outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1]) || !reactionStealer(pixel,newPixel,"radiation")) { + var randomMove2 = move2Spots[Math.floor(Math.random() * move2Spots.length)]; + if(!tryMove(pixel, pixel.x+randomMove2[0], pixel.y+randomMove2[1])) { + var newPixel = null; + if(!outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1])) { + newPixel = pixelMap[pixel.x+randomMove1[0]][pixel.y+randomMove1[1]]; //newPixel is AAA + }; + if(newPixel !== null) { reactionStealer(pixel,newPixel,"radiation") }; + }; + }; + }; + doDefaults(pixel); + }, + reactions: { //fire + radiation reacts + //Merged water-radiation reactions, plus altered seltzer + "water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "steam": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "carbon_dioxide": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "dirty_water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "salt_water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "sugar_water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "seltzer": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + //Radiation reactions added programatically + }, + temp:800, + tempLow:150, + stateLow: "rad_smoke", + //tempHigh: 7000, + //stateHigh: "rad_plasma", + category: "energy", + burning: true, + fireElement: "radiation", + state: "gas", + density: 0.1, + ignoreAir: true, +}; + +elements.rad_smoke = { + color: "#415c25", + behavior: behaviors.DGAS, + behavior: [ + "XX|CR:radiation%0.05|XX", + "CR:radiation%0.05|XX|CR:radiation%0.05", + "XX|CR:radiation%0.05|XX", + ], + tick: function(pixel) { + if(Math.random() < 0.05) { + deletePixel(pixel.x,pixel.y); + return; + }; + + if(Math.random() < 0.2) { + pixel.temp++; + }; + + if(Math.random() < 0.04) { //4%/t to radify + if(typeof(transformAdjacent) === "function" && typeof(radioactiveObject) === "object") { + transformAdjacent(pixel,radioactiveObject); + }; + }; + + var move1Spots = [[0,-1],[1,0],[0,1],[-1,0]]; + var move2Spots = [[-1,-1],[1,-1],[1,1],[-1,1]]; + + var randomMove1 = move1Spots[Math.floor(Math.random() * move1Spots.length)]; + if(!tryMove(pixel, pixel.x+randomMove1[0], pixel.y+randomMove1[1])) { + //console.log((pixel.x+randomMove1[0]) + " " + (pixel.y+randomMove1[1])) + var newPixel = null; + if(!outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1])) { + newPixel = pixelMap[pixel.x+randomMove1[0]][pixel.y+randomMove1[1]]; //newPixel is AAA + }; + if(outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1]) || !reactionStealer(pixel,newPixel,"radiation")) { + var randomMove2 = move2Spots[Math.floor(Math.random() * move2Spots.length)]; + if(!tryMove(pixel, pixel.x+randomMove2[0], pixel.y+randomMove2[1])) { + var newPixel = null; + if(!outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1])) { + newPixel = pixelMap[pixel.x+randomMove1[0]][pixel.y+randomMove1[1]]; //newPixel is AAA + }; + if(newPixel !== null) { reactionStealer(pixel,newPixel,"radiation") }; + }; + }; + }; + doDefaults(pixel); + }, + reactions: { + //Spreading + "liquid_fire": { "elem2":"liquid_rad_fire", "chance":0.2 }, + "fire": { "elem2":"rad_fire", "chance":0.2 }, + "smoke": { "elem2":"rad_smoke", "chance":0.2 }, + /*"steam": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "rain_cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "snow_cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "hail_cloud": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" }, + "acid_cloud": { "elem1": "pyrocumulus", "chance":0.05, "y":[0,12], "setting":"clouds" }, + "fire_cloud": { "elem1": "pyrocumulus", "chance":0.05, "y":[0,12], "setting":"clouds" }, + "pyrocumulus": { "elem1": "pyrocumulus", "chance":0.08, "y":[0,12], "setting":"clouds" },*/ + //Radiation reactions added programatically + }, + temp: 134, + tempHigh: 595, + stateHigh: "rad_fire", + category: "gases", + state: "gas", + density: 1340, + stain: 0.075, +}; + +elements.cold_torch = { + "color": "#4394d6", + "behavior": [ + "XX|CR:cold_fire|XX", + "XX|XX|XX", + "XX|XX|XX" + ], + "reactions": { + "water": { "elem1": "wood" }, + "sugar_water": { "elem1": "wood" }, + "salt_water": { "elem1": "wood" }, + "seltzer": { "elem1": "wood" }, + "dirty_water": { "elem1": "wood" }, + "pool_water": { "elem1": "wood" }, + "steam": { "elem1": "wood" }, + "smog": { "elem1": "wood" }, + "rain_cloud": { "elem1": "wood" }, + "cloud": { "elem1": "wood" }, + "snow_cloud": { "elem1": "wood" }, + "hail_cloud": { "elem1": "wood" }, + "black_damp": { "elem1": "wood" } + }, + "temp": -200, + "category": "special", + "breakInto": "sawdust", + "tempHigh": 600, + "stateHigh": "wood", +}; + +elements.rad_torch = { + "color": "#85d643", + "behavior": [ + "XX|CR:rad_fire|XX", + "XX|XX|XX", + "XX|XX|XX" + ], + "reactions": { + "water": { "elem1": "wood" }, + "sugar_water": { "elem1": "wood" }, + "salt_water": { "elem1": "wood" }, + "seltzer": { "elem1": "wood" }, + "dirty_water": { "elem1": "wood" }, + "pool_water": { "elem1": "wood" }, + "steam": { "elem1": "wood" }, + "smog": { "elem1": "wood" }, + "rain_cloud": { "elem1": "wood" }, + "cloud": { "elem1": "wood" }, + "snow_cloud": { "elem1": "wood" }, + "hail_cloud": { "elem1": "wood" }, + "black_damp": { "elem1": "wood" } + }, + "temp": 800, + "category": "special", + "breakInto": "sawdust", + "tempLow": -273, + "stateHigh": "wood", +}; + +elements.napalm = { + color: "#e0873e", + behavior: [ + "XX|SA%40 AND ST|XX", + "M2%10 AND SA%40 AND ST|XX|M2%10 AND SA%40 AND ST", + "M2%50 AND M1%10|M1 AND SA%40 AND ST|M2%50 AND M1%10" + ], + category: "weapons", + state: "liquid", + viscosity: 1000, + density: 1200, //google was f***ing useless and i'm not searching that again, so arbitrary 1.2 it is + burnTempChange: 2, + burn: 300, + burnTime: 500, + temp: airTemp, +}, + +elements.hypernapalm = { + name: "h y p e r n a p a l m", //HYPERNAPALM + color: "#bd34eb", + behavior: [ + "XX|SA%40 AND ST|XX", + "M2%10 AND SA%40 AND ST|XX|M2%10 AND SA%40 AND ST", + "M2%50 AND M1%10|M1 AND SA%40 AND ST|M2%50 AND M1%10" + ], + category: "weapons", + state: "liquid", + viscosity: 1000, + density: 1200, + fireElement: "plasma", + fireSpawnChance: 33, + fireSpawnTemp: 7200, + burnTempChange: 30, + burn: 300, + burnTime: 500, +}, + +elements.cold_napalm = { + color: "#3e87e0", + behavior: [ + "XX|SA%40 AND ST|XX", + "M2%10 AND SA%40 AND ST|XX|M2%10 AND SA%40 AND ST", + "M2%50 AND M1%10|M1 AND SA%40 AND ST|M2%50 AND M1%10" + ], + category: "weapons", + state: "liquid", + viscosity: 1000, + density: 1200, + burn: 300, + burnTime: 500, + fireElement: "cold_fire", + burnTempChange: -1, + burnInto: "cold_fire", +} + +elements.rad_napalm = { + color: "#cdf760", + behavior: [ + "XX|SA%40 AND ST AND CR:radiation%1|XX", + "M2%10 AND SA%40 AND ST AND CR:radiation%1|HT%2.5|M2%10 AND SA%40 AND ST AND CR:radiation%1", + "M2%50 AND M1%10|M1 AND SA%40 AND ST AND CR:radiation%1|M2%50 AND M1%10" + ], + category: "weapons", + state: "liquid", + viscosity: 1000, + density: 1300, + burnTempChange: 2, + burn: 300, + burnTime: 500, + fireElement: "rad_fire", + temp: airTemp, + burnInto: "rad_fire", +}, + +runAfterLoad(function() { + if(eLists.spout) { + eLists.spout.push("cold_torch"); + eLists.spout.push("rad_torch"); + }; + + if(enabledMods.includes("mods/liquid_energy.js")) { + elements.liquid_fire = { + color: ["#ff6b21","#ffa600","#ff4000"], + behavior: [ + "XX|M2|XX", + "M2|XX|M2", + "M1|M1|M1", + ], + reactions: { + "water": { "elem1": "liquid_smoke" }, + }, + temp:600, + tempLow:100, + stateLow: "liquid_smoke", + tempHigh: 7000, + stateHigh: "liquid_plasma", + category: "energy liquids", + burning: true, + burnTime: Infinity, + burnTempChange: 2, + fireSpawnChance: 5, + state: "liquid", + density: 21, + }; + + elements.liquid_cold_fire = { + color: ["#21cbff","#006aff","#00ffff"], + behavior: [ + "XX|M2|XX", + "M2|XX|M2", + "M1|M1|M1", + ], + reactions: { + "fire": { "elem1": "liquid_smoke", "elem2": "liquid_smoke" }, + "plasma": { "elem1": "le_liquid_light", "elem2": "le_liquid_light" }, //prefixed to avoid conflict with F&M liquid_light + }, + temp:-200, + tempHigh:0, + stateHigh: "liquid_smoke", + burning: true, + burnTempChange: -2, + fireSpawnChance: 5, + burnTime: Infinity, + fireElement: "cold_fire", + category: "energy liquids", + state: "liquid", + density: 42, + }; + + elements.liquid_rad_fire = { + color: ["#daff21","#a6ff00","#ffff00"], + behavior: [ + "XX|CR:radiation%0.1|XX", + "CR:radiation%0.1|XX|CR:radiation%0.1", + "XX|CR:radiation%0.1|XX", + ], + tick: function(pixel) { + if(Math.random() < 0.4) { + pixel.temp++; + }; + + if(Math.random() < 0.06) { //6%/t to radify + if(typeof(transformAdjacent) === "function" && typeof(radioactiveObject) === "object") { + transformAdjacent(pixel,radioactiveObject); + }; + }; + + var move1Spots = [[-1,1],[0,1],[1,1]]; + var move2Spots = [[-1,0],[0,-1],[1,0]]; + + var randomMove1 = move1Spots[Math.floor(Math.random() * move1Spots.length)]; + if(!tryMove(pixel, pixel.x+randomMove1[0], pixel.y+randomMove1[1])) { + //console.log((pixel.x+randomMove1[0]) + " " + (pixel.y+randomMove1[1])) + var newPixel = null; + if(!outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1])) { + newPixel = pixelMap[pixel.x+randomMove1[0]][pixel.y+randomMove1[1]]; //newPixel is AAA + }; + if(outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1]) || !reactionStealer(pixel,newPixel,"radiation")) { + var randomMove2 = move2Spots[Math.floor(Math.random() * move2Spots.length)]; + if(!tryMove(pixel, pixel.x+randomMove2[0], pixel.y+randomMove2[1])) { + var newPixel = null; + if(!outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1])) { + newPixel = pixelMap[pixel.x+randomMove1[0]][pixel.y+randomMove1[1]]; //newPixel is AAA + }; + if(newPixel !== null) { reactionStealer(pixel,newPixel,"radiation") }; + }; + }; + }; + doDefaults(pixel); + }, + reactions: { //fire + radiation reacts + //Merged water-radiation reactions, plus altered seltzer + "water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "steam": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "carbon_dioxide": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "dirty_water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "salt_water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "sugar_water": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + "seltzer": { "elem1": "rad_smoke", "elem2":"rad_steam", "chance":0.4 }, + //Radiation reactions added programatically + }, + temp:800, + //tempLow:100, + //stateLow: "liquid_smoke", + //tempHigh: 7000, + //stateHigh: "liquid_plasma", + category: "energy liquids", + burning: true, + burnTime: Infinity, + burnTempChange: 3, + fireSpawnChance: 5, + fireElement: "rad_fire", + state: "liquid", + density: 21, + }; + }; + + elements.radiation.reactions.liquid_fire = { "elem2":"liquid_rad_fire", "chance":0.4 }; + elements.radiation.reactions.fire = { "elem2":"rad_fire", "chance":0.4 }; + elements.radiation.reactions.smoke = { "elem2":"rad_smoke", "chance":0.4 }; + + runAfterLoad(function() { + for(key in elements.radiation.reactions) { + var value = elements.radiation.reactions[key]; + + if(typeof(elements.rad_fire.reactions[key]) === "undefined") { + elements.rad_fire.reactions[key] = value; + }; + }; + }); + + if(enabledMods.includes("mods/randomness.js")) { + elements.unnamed_gas.burnTempChange = 10; + elements.unnamed_gas.fireElement = "plasma"; + elements.unnamed_powder.burnTempChange = 20; + elements.unnamed_powder.fireElement = "plasma"; + elements.burning_unnamed_gas.burnTempChange = 15; + elements.burning_unnamed_gas.fireElement = "plasma"; + elements.burning_unnamed_powder.burnTempChange = 30; + elements.burning_unnamed_powder.fireElement = "plasma"; + }; +}); diff --git a/mods/generator_prompt.js b/mods/generator_prompt.js index 61f88835..180f201c 100644 --- a/mods/generator_prompt.js +++ b/mods/generator_prompt.js @@ -65,7 +65,10 @@ function generatorPrompt() { generateCloud(elements,true); break; case "bomb": - generateBomb(elements,true); + var number = prompt(`Enter a bomb number (default: 1) + 1 corresponds to radius 10, 2 corresponds to radius 15, etc.`); + if(isNaN(parseFloat(number))) { number = 1 }; + generateBomb(elements,true,number); break; default: alert("An invalid type made it past the if statement. You shouldn't ever see this error."); @@ -82,20 +85,22 @@ elements.generator_prompt = { }; function parseForLateGenerationParameter(input) { - if(typeof(input) === "string") { //it should be an array, so string check - //console.log("String detected"); - if(input.includes(",")) { //comma-separated string? - //console.log("Splitting string to array"); - input = input.split(","); //,SS to array - } else { - //console.log("Wrapping string in array"); - input = [input]; //single string to array - }; - }; - for(i = 0; i < input.length; i++) { - if(input[i].includes("+")) { - input[i] = input[i].split("+") - }; - }; - return input; + if(typeof(input) === "string") { //it should be an array, so string check + input = input.replace(/ /g,"_"); + //console.log("String detected"); + if(input.includes(",")) { //comma-separated string? + //console.log("Splitting string to array"); + input = input.split(","); //,SS to array + } else { + //console.log("Wrapping string in array"); + input = [input]; //single string to array + }; + }; + for(i = 0; i < input.length; i++) { + input[i] = input[i].replace(/ /g,"_"); + if(input[i].includes("+")) { + input[i] = input[i].split("+") + }; + }; + return input; }; diff --git a/mods/glenn_gases.js b/mods/glenn_gases.js index 4bc05b93..da1dd6d9 100644 --- a/mods/glenn_gases.js +++ b/mods/glenn_gases.js @@ -385,27 +385,27 @@ runAfterLoad(function() { elements.coal.breakInto = "coal_dust" } if(enabledMods.includes("mods/the_ground.js")) { - elements.irradiated_rock_dust = { + elements.radioactive_rock_dust = { color: "#839e78", behavior: behaviors.RAD_GAS, reactions: { - "water": {"elem1": "irradiated_water", "elem2": null } + "water": {"elem1": "radioactive_water", "elem2": null } }, category: "gases", density: 2.45, state: "gas", tempHigh: 950, - stateHigh: [null,null,null,null,"irradiated_magma"], + stateHigh: [null,null,null,null,"radioactive_magma"], } - elements.irradiated_rock.breakInto.push("irradiated_rock_dust") + elements.radioactive_rock.breakInto.push("radioactive_rock_dust") } if(enabledMods.includes("mods/boiling_rock.js")) { elements.rock_dust.tempHigh = 3000 elements.rock_dust.stateHigh = "vaporized_rock" if(enabledMods.includes("mods/the_ground.js")) { - elements.irradiated_rock_dust.tempHigh = 3000 - elements.irradiated_rock_dust.stateHigh = "vaporized_rock" + elements.radioactive_rock_dust.tempHigh = 3000 + elements.radioactive_rock_dust.stateHigh = "vaporized_rock" } } }); diff --git a/mods/haseulite.js b/mods/haseulite.js new file mode 100644 index 00000000..acdcc88a --- /dev/null +++ b/mods/haseulite.js @@ -0,0 +1,1010 @@ +var modName = "mods/haseulite.js"; +var loonaMod = "mods/funny elements 2022-11-15.js"; +var fireMod = "mods/fire_mod.js"; +var runAfterAutogenMod = "mods/runAfterAutogen and onload restructure.js"; +var explodeAtPlusMod = "mods/explodeAtPlus.js"; +var libraryMod = "mods/code_library.js"; + +if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(explodeAtPlusMod) && enabledMods.includes(libraryMod)) { + //move explodeAt to YG Entertainment's dungeon + + oldExplodeAt = explodeAt; + explodeAt = explodeAtPlus; + haseuliteSpreadWhitelist = ["haseulite","haseulite_powder","molten_haseulite"]; + jinsouliteSpreadWhitelist = ["jinsoulite","jinsoulite_powder","molten_jinsoulite"]; + + function coldExplosionAfterCooling(pixel,x,y,radius,fire,smoke,power,damage) { + pixel.temp -= 2*damage*radius*power; + }; + + function reactionStealerImmutableElem2(pixel,newPixel,reactionTarget,ignoreSelf=true,_chanceMultMeantForJinsoulites=1) { + if(!elements[reactionTarget]) { + throw new Error(`No such element ${reactionTarget}!`); + }; + if(typeof(newPixel) === "undefined") { //timing issue? + return false; + }; + var newElement = newPixel.element; + if(ignoreSelf && newElement === pixel.element) { + return false; + }; + var newInfo = elements[newElement]; + if(typeof(newInfo.reactions) === "undefined") { + return false; + }; + if(typeof(newInfo.reactions[reactionTarget]) === "undefined") { + return false; + }; + var pixel2 = pixel; + var pixel1 = newPixel; + var r = JSON.parse(JSON.stringify(newInfo.reactions[reactionTarget])); + + if (r.setting && settings[r.setting]===0) { + return false; + } + // r has the attribute "y" which is a range between two y values + // r.y example: [10,30] + // return false if y is defined and pixel1's y is not in the range + if (r.tempMin !== undefined && pixel1.temp < r.tempMin) { + return false; + } + if (r.tempMax !== undefined && pixel1.temp > r.tempMax) { + return false; + } + if (r.charged && !pixel.charge) { + return false; + } + if (r.chance !== undefined && Math.random() < (r.chance * _chanceMultMeantForJinsoulites)) { + return false; + } + if (r.y !== undefined && (pixel1.y < r.y[0] || pixel1.y > r.y[1])) { + return false; + } + if(r.elem1 !== undefined && r.elem2 !== undefined) { + if(r.elem1 !== null && r.elem2 !== null) { + r.elem1 = [r.elem1,r.elem2].flat(); + }; + }; + if (r.elem1 !== undefined) { + // if r.elem1 is an array, set elem1 to a random element from the array, otherwise set it to r.elem1 + if (Array.isArray(r.elem1)) { + var elem1 = r.elem1[Math.floor(Math.random() * r.elem1.length)]; + } else { var elem1 = r.elem1; } + + if (elem1 == null) { + deletePixel(pixel1.x,pixel1.y); + } + else { + changePixel(pixel1,elem1); + } + } + if (r.charge1) { pixel1.charge = r.charge1; } + if (r.temp1) { pixel1.temp += r.temp1; pixelTempCheck(pixel1); } + if (r.color1) { // if it's a list, use a random color from the list, else use the color1 attribute + pixel1.color = pixelColorPick(pixel1, Array.isArray(r.color1) ? r.color1[Math.floor(Math.random() * r.color1.length)] : r.color1); + } + if (r.attr1) { // add each attribute to pixel1 + for (var key in r.attr1) { + pixel1[key] = r.attr1[key]; + } + } + if (r.charge2) { pixel2.charge = r.charge2; } + if (r.temp2) { pixel2.temp += r.temp2; pixelTempCheck(pixel2); } + if (r.color2) { // if it's a list, use a random color from the list, else use the color2 attribute + pixel2.color = pixelColorPick(pixel2, Array.isArray(r.color2) ? r.color2[Math.floor(Math.random() * r.color2.length)] : r.color2); + } + if (r.attr2) { // add each attribute to pixel2 + for (var key in r.attr2) { + pixel2[key] = r.attr2[key]; + } + } + if (r.func) { r.func(pixel1,pixel2); } + return r.elem1!==undefined; + }; + + elements.loona = { + color: ["#6f7d54","#4f5d34","#7c8a61"], + behavior: behaviors.POWDER, + tempHigh: 1031, + category: "random rocks", + state: "solid", + density: 2466.73, + hardness: 0.56, + breakInto: ["rock","sulfur","loona_gravel","loona_gravel","loona_gravel","haseulite_powder", "rock","sulfur","loona_gravel","loona_gravel","loona_gravel","haseulite_powder", "rock","sulfur","loona_gravel","loona_gravel","loona_gravel","heejinite_powder"], + }; + + var backupCategoryWhitelist = ["land","powders","weapons","food","life","corruption","states","fey","Fantastic Creatures","dyes","energy liquids","random liquids","random gases","random rocks"]; + var backupElementWhitelist = ["mercury", "chalcopyrite_ore", "chalcopyrite_dust", "copper_concentrate", "fluxed_copper_concentrate", "unignited_pyrestone", "ignited_pyrestone", "everfire_dust", "extinguished_everfire_dust", "mistake", "polusium_oxide", "vaporized_polusium_oxide", "glowstone_dust", "redstone_dust", "soul_mud", "wet_soul_sand", "nitrogen_snow", "fusion_catalyst", "coal", "coal_coke", "blast_furnace_fuel", "molten_mythril"]; + + function spoutCriteria(name) { + if(typeof(elements[name]) !== "object") { + throw new Error(`Nonexistent element ${name}`); + }; + var info = elements[name]; + //console.log(`${name} (${JSON.stringify(elements[name])})`); + if(typeof(info.state) === "undefined") { + var state = null; + } else { + var state = info.state; + }; + if(typeof(info.category) === "undefined") { + var category = "other"; + } else { + var category = info.category; + }; + if(excludedSpoutElements.includes(name)) { + return false + }; + var include = false; + if(["liquid","gas"].includes(state)) { + include = true; + }; + if(info.movable) { + include = true; + }; + if(backupCategoryWhitelist.includes(category)) { + include = true; + }; + if(backupElementWhitelist.includes(name)) { + include = true; + }; + if(category.includes("mudstone")) { + include = true; + }; + //console.log(include); + return include; + }; + + function heejiniteHeatCriteria(name) { + if(typeof(elements[name]) !== "object") { + throw new Error(`Nonexistent element ${name}`); + }; + var info = elements[name]; + //console.log(`${name} (${JSON.stringify(elements[name])})`); + if(typeof(info.tempLow) === "undefined") { + return false; + }; + if(typeof(info.tempHigh) !== "undefined" && info.tempHigh < elements.heejinite.tempHigh) { + return false; + }; + return (info.tempLow < elements.heejinite.tempHigh) || ((typeof(info.state) !== "undefined") && (info.state === "gas")); + }; + + spoutCriteria = function(name) { + if(typeof(elements[name]) !== "object") { + throw new Error(`Nonexistent element ${name}`); + }; + var info = elements[name]; + //console.log(`${name} (${JSON.stringify(elements[name])})`); + if(typeof(info.state) === "undefined") { + var state = null; + } else { + var state = info.state; + }; + if(typeof(info.category) === "undefined") { + var category = "other"; + } else { + var category = info.category; + }; + var include = false; + if(["liquid","gas"].includes(state)) { + include = true; + }; + if(info.movable) { + include = true; + }; + if(backupCategoryWhitelist.includes(category)) { + include = true; + }; + if(backupElementWhitelist.includes(name)) { + include = true; + }; + if(category.includes("mudstone")) { + include = true; + }; + //console.log(include); + return include; + }; + + //it doesn't want to acknowledge spoutCriteria, so... + + runAfterAutogen(function() { + elements.loona.stateHigh = ["molten_loona","rock","rock","rock","sulfur_gas","sulfur_gas","molten_haseulite","molten_loona","rock","rock","rock","sulfur_gas","sulfur_gas","molten_haseulite","molten_loona","rock","rock","rock","sulfur_gas","sulfur_gas","molten_heejinite"]; + hotHeejiniteElements = Object.keys(elements).filter(function(e) { + return spoutCriteria(e) && heejiniteHeatCriteria(e) && !elements[e].excludeRandom && !e.startsWith("rad"); + }); + }); + + elements.loona_gravel = { + color: ["#b3be98","#919a6f","#68744b","#515931"], + behavior: behaviors.POWDER, + tempHigh: 1031, + stateHigh: ["molten_loona","rock","rock","rock","sulfur_gas","sulfur_gas","molten_haseulite","molten_loona","rock","rock","rock","sulfur_gas","sulfur_gas","molten_haseulite","molten_loona","rock","rock","rock","sulfur_gas","sulfur_gas","molten_heejinite"], + category: "random rocks", + state: "solid", + density: 1625.14, + hardness: 0.97, + breakInto: ["rock","sulfur","rock","haseulite_powder","rock","sulfur","rock","haseulite_powder","rock","sulfur","rock","heejinite_powder"], + }; + + haseuliteValueObject = { + light: 1, + radiation: 4, + fire: [6, "smoke"], + rad_fire: [10, "rad_smoke"], + liquid_fire: [12, ["fire","liquid_smoke","smoke"]], + plasma: [15, "fire"], + liquid_rad_fire: [20, [null,"rad_fire","rad_fire","rad_smoke","rad_smoke"]], + liquid_plasma: [30, ["plasma","liquid_fire","fire"]], + liquid_irradium: [4, null] + }; + + jinsouliteValueObject = { + steam: [1, ["steam",null]], + cloud: [1, ["cloud",null]], + snow_cloud: [1, ["snow_cloud",null]], + hail_cloud: [1, ["hail_cloud",null]], + rain_cloud: [3, ["rain_cloud","rain_cloud",null]] + }; + + /*function customStaining(pixel,customColorRgb,stainOverride=null) { + if (settings["stainoff"]) { return } + var stain = (stainOverride !== null ? stainOverride : elements[pixel.element].stain); + if (stain > 0) { + var newColor = customColorRgb.match(/\d+/g); + } + else { + var newColor = null; + } + + for (var i = 0; i < adjacentCoords.length; i++) { + var x = pixel.x+adjacentCoords[i][0]; + var y = pixel.y+adjacentCoords[i][1]; + if (!isEmpty(x,y,true)) { + var newPixel = pixelMap[x][y]; + if (elements[pixel.element].ignore && elements[pixel.element].ignore.indexOf(newPixel.element) !== -1) { + continue; + } + if ((elements[newPixel.element].id !== elements[pixel.element].id || elements[newPixel.element].stainSelf) && (solidStates[elements[newPixel.element].state] || elements[newPixel.element].id === elements[pixel.element].id)) { + if (Math.random() < Math.abs(stain)) { + if (stain < 0) { + if (newPixel.origColor) { + newColor = newPixel.origColor; + } + else { continue; } + } + else if (!newPixel.origColor) { + newPixel.origColor = newPixel.color.match(/\d+/g); + } + // if newPixel.color doesn't start with rgb, continue + if (!newPixel.color.match(/^rgb/)) { continue; } + // parse rgb color string of newPixel rgb(r,g,b) + var rgb = newPixel.color.match(/\d+/g); + if (elements[pixel.element].stainSelf && elements[newPixel.element].id === elements[pixel.element].id) { + // if rgb and newColor are the same, continue + if (rgb[0] === newColor[0] && rgb[1] === newColor[1] && rgb[2] === newColor[2]) { continue; } + var avg = []; + for (var j = 0; j < rgb.length; j++) { + avg[j] = Math.round((rgb[j]*(1-Math.abs(stain))) + (newColor[j]*Math.abs(stain))); + } + } + else { + // get the average of rgb and newColor, more intense as stain reaches 1 + var avg = []; + for (var j = 0; j < rgb.length; j++) { + avg[j] = Math.floor((rgb[j]*(1-Math.abs(stain))) + (newColor[j]*Math.abs(stain))); + } + } + // set newPixel color to avg + newPixel.color = "rgb("+avg.join(",")+")"; + } + } + } + } + }*/ + + function valueSpreading(pixel,whitelist=null) { + var randomNeighborOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; + var rX = randomNeighborOffset[0]; + var rY = randomNeighborOffset[1]; + var rfX = pixel.x+rX; + var rfY = pixel.y+rY; + if(!isEmpty(rfX,rfY,true)) { + var rOtherPixel = pixelMap[rfX][rfY]; + var rOtherElement = rOtherPixel.element; + if(whitelist === null || (whitelist !== null && whitelist.includes(rOtherElement))) { + if(typeof(rOtherPixel.value) !== "number") { + rOtherPixel.value = 0; + }; + if(typeof(rOtherPixel) === "undefined" || isEmpty(rfX,rfY,true)) { + return false; + }; + var averageValue = (pixel.value + rOtherPixel.value) / 2; + pixel.value = averageValue; + rOtherPixel.value = averageValue; + }; + }; + return true; + }; + + function valueAbsorbency(pixel,valueObject) { + for(i = 0; i < adjacentCoords.length; i++) { + var oX = adjacentCoords[i][0]; + var oY = adjacentCoords[i][1]; + var fX = pixel.x+oX; + var fY = pixel.y+oY; + if(!isEmpty(fX,fY,true)) { + var otherPixel = pixelMap[fX][fY]; + var otherElement = otherPixel.element; + var otherInfo = elements[otherElement]; + if(valueObject[otherElement]) { + if(typeof(otherPixel) === "undefined" || isEmpty(fX,fY,true)) { + return false; + }; + var ValueData = valueObject[otherElement]; + if(ValueData instanceof Array) { + var finalElement = ValueData[1]; + if(finalElement instanceof Array) { + finalElement = finalElement[Math.floor(Math.random() * finalElement.length)]; + }; + if(finalElement !== null) { + if(finalElement === -1) { + deletePixel(otherPixel.x,otherPixel.y); + } else { + changePixel(otherPixel,finalElement); + }; + }; + pixel.value += ValueData[0]; + } else if(typeof(ValueData) === "number") { + deletePixel(otherPixel.x,otherPixel.y); + pixel.value += ValueData[0]; + }; + }; + }; + }; + return true; + }; + + function valueFunction(pixel,valueObject,elementWhitelist=null) { + if(typeof(pixel.value) === "undefined") { + pixel.value = 0; + }; + + var oldValue = pixel.value; + if(!valueAbsorbency(pixel,valueObject) || isNaN(pixel.value)) { + pixel.value = oldValue; + }; + + var oldValue = pixel.value; + if(!valueSpreading(pixel,elementWhitelist) || isNaN(pixel.value)) { + pixel.value = oldValue; + }; + } + + function haseulitoidTick(pixel) { + valueFunction(pixel,haseuliteValueObject,haseuliteSpreadWhitelist); + if(pixel.oldColor === null) { pixel.oldColor = pixel.color }; + pixel.color = lightenColor(pixel.oldColor,pixel.value / 3); + + if(pixel.value >= 350) { + var coldBoomChance = Math.max(0.008 * ((pixel.value - 350) / 100), 0.001); + if(Math.random() < coldBoomChance) { + var coldBoomRadius = Math.min(30,Math.floor(7 + ((pixel.value - 350) / 100))); + explodeAtPlus(pixel.x,pixel.y,coldBoomRadius,"cold_fire","cold_smoke",null,coldExplosionAfterCooling); + }; + }; + } + + elements.haseulite = { + color: ["#3cb00e", "#25d119", "#79f553"], + fireColor: ["#08a953", "#2ea332", "#d1e0d3"], + properties: { + value: 0, + oldColor: null + }, + behavior: behaviors.WALL, + tick: function(pixel) { haseulitoidTick(pixel) }, + excludeVelocity: true, //wall shouldn't move + tempHigh: 1757, + onExplosionBreakOrSurvive: function(pixel,x,y,radius) { + /*power is always radius/10 + r 5: value 7 + r 10: value 14 + r 15: value 28 + r 20: value 56 + r 25: value 112 + r 30: value 224 + */ + pixel.value += (2**(((radius) / 5) - 1) * 7); + }, + category: "solids", + state: "solid", + density: 7550, + hardness: 0.93, + breakInto: "haseulite_powder", + conduct: 0.84, + }; + + if(!elements.steel.reactions) { + elements.steel.reactions = {}; + }; + + elements.steel.reactions.haseulite_powder = { + elem1: "haseulite_vent", + elem2: null, + chance: 0.01, + tempMin: 1200, + }; + + adjacentCoordsInverted = [[0,-1],[0,1],[-1,0],[1,0]]; + + elements.haseulite_vent = { + color: "#88b058", + fireColor: ["#08a953", "#2ea332", "#d1e0d3"], + behavior: behaviors.WALL, + rotatable: true, + desc: "This uses rotation, so just use debug to see the r value. r 0 means it vents haseulite below it upwards, r 1 means it vents haseulite above it downwards, r 2 means it vents left, and r 3 means it vents right.", + tick: function(pixel) { + if(isNaN(pixel.r)) { + pixel.r = 0; + }; + pixel.r = pixel.r % 4; + var coord = adjacentCoords[pixel.r]; + var invertCoord = adjacentCoordsInverted[pixel.r]; + + var fX = pixel.x+coord[0]; + var fY = pixel.y+coord[1]; + + if(!isEmpty(fX,fY,true)) { + var otherPixel = pixelMap[fX][fY]; + var otherElement = otherPixel.element; + var otherInfo = elements[otherElement]; + if(typeof(otherPixel) === "undefined" || isEmpty(fX,fY,true)) { + return false; + }; + if(haseuliteSpreadWhitelist.includes(otherElement)) { + var ventLimit = Math.min(10,Math.floor(1 + (Math.sqrt(Math.max(otherPixel.value,1)) / 2))); + for(i = 1; i <= ventLimit; i++) { + if(otherPixel.value >= 3) { + var fIX = pixel.x+(invertCoord[0] * i); + var fIY = pixel.y+(invertCoord[1] * i); + if(isEmpty(fIX,fIY,false)) { + createPixel("cold_fire",fIX,fIY); + otherPixel.value -= 3; + } else { //if the pixel to place isn't empty + if(!outOfBounds(fIX,fIY)) { //if it isn't OoB + if(pixelMap[fIX][fIY].element !== "cold_fire") { //if it isn't cold fire + break; + }; + } else { //if it is OoB + break; + }; + }; + } else { + break; + }; + }; + }; + }; + return true; + }, + excludeVelocity: true, //wall shouldn't move + tempHigh: elements.steel.tempHigh, + stateHigh: ["molten_steel","haseulite_powder"], + breakInto: ["metal_scrap","haseulite_powder"], + category: "machines", + state: "solid", + density: 7550, + hardness: 0.93, + breakInto: "haseulite_powder", + conduct: 0.84, + } + + elements.haseulite_powder = { + color: ["#5fb33e", "#32ba29", "#63d141"], + properties: { + value: 0, + oldColor: null + }, + category: "powders", + fireColor: ["#08a953", "#2ea332", "#d1e0d3"], + tempHigh: 1757, + behavior: behaviors.POWDER, + tick: function(pixel) { haseulitoidTick(pixel) }, + onExplosionBreakOrSurvive: function(pixel,x,y,radius) { + /*power is always radius/10 + r 5: value 7 + r 10: value 14 + r 15: value 28 + r 20: value 56 + r 25: value 112 + r 30: value 224 + */ + pixel.value += (2**(((radius) / 5) - 1) * 7); + }, + stateHigh: "molten_haseulite", + category: "powders", + state: "solid", + hidden: true, + density: 4512, + hardness: 0.7, + conduct: 0.43, + }; + + elements.molten_haseulite = { + color: ["#cbf569","#f1ffd6","#fdffb5", "#fffa99"], + fireColor: ["#08a953", "#2ea332", "#d1e0d3"], + properties: { + value: 0, + oldColor: null + }, + tick: function(pixel) { haseulitoidTick(pixel) }, + onExplosionBreakOrSurvive: function(pixel,x,y,radius) { + /*power is always radius/10 + r 5: value 7 + r 10: value 14 + r 15: value 28 + r 20: value 56 + r 25: value 112 + r 30: value 224 + */ + pixel.value += (2**(((radius) / 5) - 1) * 7); + }, + density: 7214, + hardness: 0.52, + breakInto: "haseulite_gas", + temp: 1957, + tempHigh: 3100, + conduct: 0.23, + }; + + elements.haseulite_gas = { + color: ["#ffff9d", "#ffffff", "#e9ffe6", "#ffffe5"], + fireColor: ["#08a953", "#2ea332", "#d1e0d3"], + properties: { + value: 0, + oldColor: null + }, + tick: function(pixel) { haseulitoidTick(pixel) }, + onExplosionBreakOrSurvive: function(pixel,x,y,radius) { + /*power is always radius/10 + r 5: value 7 + r 10: value 14 + r 15: value 28 + r 20: value 56 + r 25: value 112 + r 30: value 224 + */ + pixel.value += (2**(((radius) / 5) - 1) * 7); + }, + density: 0.289, + temp: 3700, + hardness: 1, + conduct: 0.13, + }; + + /* + var shimmeringColor = convertHslObjects(hslColorStringToObject(`hsl(${(pixelTicks / 2) % 360},100%,50%)`,"rgb")); + customStaining(pixel,shimmeringColor,0.2); + */ + + function heejinitoidTick(pixel) { + if(pixel.oldColor === null) { pixel.oldColor = pixel.color }; + var color = rgbStringToHSL(convertColorFormats(pixel.oldColor,"rgb"),"json"); + var heejiniteHueSpread = 30 + (pixel.temp/9.25) + var hueOffset = (Math.sin(pixelTicks / 11) * heejiniteHueSpread) + 15; color.h += hueOffset; + var color = convertHslObjects(color,"rgb"); + pixel.color = color; + }; + + function hotHeejinitoidTick(pixel) { + if(Math.random() < (pixel.temp >= 1500 ? 0.02 : 0.01)) { + if(pixel.temp >= 1387.5) { + var randomNeighborOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; + var rX = randomNeighborOffset[0]; + var rY = randomNeighborOffset[1]; + var rfX = pixel.x+rX; + var rfY = pixel.y+rY; + if(isEmpty(rfX,rfY,false)) { + var randomEligibleHotElement = hotHeejiniteElements[Math.floor(Math.random() * hotHeejiniteElements.length)]; + createPixel(randomEligibleHotElement,rfX,rfY); + pixelMap[rfX][rfY].temp = pixel.temp; + }; + }; + }; + } + + elements.heejinite = { + color: ["#cf1172", "#fa1977", "#ff619e"], + fireColor: ["#a9085e", "#a32e61", "#fca7c6"], + properties: { + oldColor: null + }, + behavior: behaviors.WALL, + tick: function(pixel) { heejinitoidTick(pixel) }, + excludeVelocity: true, //wall shouldn't move + tempHigh: 837, + category: "solids", + state: "solid", + density: 3773, + stain: 0.1, + hardness: 0.79, + breakInto: "heejinite_powder", + conduct: 0.86, + }; + + elements.heejinite_powder = { + color: ["#d64790", "#e63e84", "#f054ac"], + fireColor: ["#a9085e", "#a32e61", "#fca7c6"], + properties: { + oldColor: null + }, + behavior: behaviors.POWDER, + tick: function(pixel) { heejinitoidTick(pixel) }, + excludeVelocity: true, //wall shouldn't move + tempHigh: 837, + hidden: true, + stateHigh: "molten_heejinite", + category: "powders", + state: "solid", + density: 1412, + stain: 0.1, + hardness: 0.66, + breakInto: "heejinite_powder", + conduct: 0.42, + }; + + elements.molten_heejinite = { + color: ["#ff0f77","#ff59c2","#ff405c", "#fa5a48"], + fireColor: ["#a9085e", "#a32e61", "#fca7c6"], + properties: { + oldColor: null + }, + tick: function(pixel) { + heejinitoidTick(pixel); + hotHeejinitoidTick(pixel); + }, + density: 3121, + hardness: 0.5, + breakInto: "heejinite_gas", + temp: 1000, + tempHigh: 1501, + conduct: 0.22, + }; + + elements.heejinite_gas = { + color: ["#fffab8", "#ffdab3", "#ffd1d1", "#ffc4df", "#ffb0eb"], + fireColor: ["#a9085e", "#a32e61", "#fca7c6"], + properties: { + oldColor: null + }, + tick: function(pixel) { + heejinitoidTick(pixel); + hotHeejinitoidTick(pixel); + }, + density: 0.117, + temp: 1800, + hardness: 1, + conduct: 0.12, + }; + + jinsouliteReducedSwapWhitelist = ["slime","glue","soda","milk","chocolate_milk","fruit_milk","ink","blood","vaccine","antibody","infection","sap","ketchup","spirit_tear","enchanted_ketchup","lean","poisoned_ketchup","dirty_ketchup","zombie_blood"]; + + function jinsouliteDissolution(pixel) { + var did = false; + for(i = 0; i < 2; i++) { + var randomNeighborOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; + var rfX = pixel.x+randomNeighborOffset[0]; + var rfY = pixel.y+randomNeighborOffset[1]; + if(!isEmpty(rfX,rfY,true)) { + var rOtherPixel = pixelMap[rfX][rfY]; + if(!rOtherPixel) { return false }; + var rOtherElement = rOtherPixel.element; + if(rOtherElement.endsWith("water") || (Math.random() < 0.3 && jinsouliteReducedSwapWhitelist.includes(rOtherElement))) { + swapPixels(pixel,rOtherPixel); + did = true; + }; + }; + }; + return did; + }; + + function jinsouliteMovement(pixel,move1Spots,move2Spots) { + if(move1Spots.length > 0) { + var randomMove1 = move1Spots[Math.floor(Math.random() * move1Spots.length)]; + if(!tryMove(pixel, pixel.x+randomMove1[0], pixel.y+randomMove1[1])) { + //console.log((pixel.x+randomMove1[0]) + " " + (pixel.y+randomMove1[1])) + var newPixel = null; + if(!outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1])) { + newPixel = pixelMap[pixel.x+randomMove1[0]][pixel.y+randomMove1[1]]; //newPixel is AAA + }; + if(outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1]) || !reactionStealerImmutableElem2(pixel,newPixel,"water",true,2)) { + if(move2Spots.length > 0) { + var randomMove2 = move2Spots[Math.floor(Math.random() * move2Spots.length)]; + if(!tryMove(pixel, pixel.x+randomMove2[0], pixel.y+randomMove2[1])) { + var newPixel = null; + if(!outOfBounds(pixel.x+randomMove1[0],pixel.y+randomMove1[1])) { + newPixel = pixelMap[pixel.x+randomMove1[0]][pixel.y+randomMove1[1]]; //newPixel is AAA + }; + if(newPixel !== null) { reactionStealerImmutableElem2(pixel,newPixel,"water",true,2) }; + }; + }; + }; + }; + }; + doDefaults(pixel); + }; + + function jinsouliteSolidNonWaterSideReactions(pixel) { + var randomNeighborOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; + var rfX = pixel.x+randomNeighborOffset[0]; + var rfY = pixel.y+randomNeighborOffset[1]; + if(!isEmpty(rfX,rfY,true)) { + var rOtherPixel = pixelMap[rfX][rfY]; + if(typeof(rOtherPixel) === "undefined" || isEmpty(rfX,rfY,true)) { + return false; + }; + reactionStealerImmutableElem2(pixel,rOtherPixel,"water",true,2); + }; + return true; + }; + + function jinsouliteSolidWaterSideReactions(pixel) { + var randomNeighborOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; + var rfX = pixel.x+randomNeighborOffset[0]; + var rfY = pixel.y+randomNeighborOffset[1]; + if(!isEmpty(rfX,rfY,true)) { + var pixel2 = pixelMap[rfX][rfY]; + var pixel1 = pixel; + if(typeof(pixel2) === "undefined" || isEmpty(rfX,rfY,true)) { + return false; + }; + if(typeof(pixel1) === "undefined" || isEmpty(pixel.x,pixel.y,true)) { + return false; + }; + var rOtherElement = pixel2.element; + var waterReactions = elements.water.reactions; + + if(rOtherElement === pixel.element) { + return false; + }; + if(waterReactions[rOtherElement]) { + var r = waterReactions[rOtherElement]; + + if (r.setting && settings[r.setting]===0) { + return false; + } + // r has the attribute "y" which is a range between two y values + // r.y example: [10,30] + // return false if y is defined and pixel1's y is not in the range + if (r.tempMin !== undefined && pixel1.temp < r.tempMin) { + return false; + } + if (r.tempMax !== undefined && pixel1.temp > r.tempMax) { + return false; + } + if (r.charged && !pixel.charge) { + return false; + } + if (r.chance !== undefined && Math.random() < (r.chance * 2)) { + return false; + } + if (r.y !== undefined && (pixel1.y < r.y[0] || pixel1.y > r.y[1])) { + return false; + } + if (r.charge1) { pixel1.charge = r.charge1; } + if (r.temp1) { pixel1.temp += r.temp1; pixelTempCheck(pixel1); } + if (r.color1) { // if it's a list, use a random color from the list, else use the color1 attribute + pixel1.color = pixelColorPick(pixel1, Array.isArray(r.color1) ? r.color1[Math.floor(Math.random() * r.color1.length)] : r.color1); + } + if (r.attr1) { // add each attribute to pixel1 + for (var key in r.attr1) { + pixel1[key] = r.attr1[key]; + } + } + var elem1 = r.elem1 + if (elem1 !== undefined && elem1 instanceof Array) { + elem1 = elem1[Math.floor(Math.random() * elem1.length)]; + }; + + if (r.elem2 !== undefined) { + // if r.elem2 is an array, set elem2 to a random element from the array, otherwise set it to r.elem2 + if (Array.isArray(r.elem2)) { + var elem2 = r.elem2[Math.floor(Math.random() * r.elem2.length)]; + } else { var elem2 = r.elem2; } + + if (elem2 == null) { + if(elem1 !== undefined) { changePixel(pixel2,elem1) }; + } + else { + changePixel(pixel2,elem2); + } + } + if (r.charge2) { pixel2.charge = r.charge2; } + if (r.temp2) { pixel2.temp += r.temp2; pixelTempCheck(pixel2); } + if (r.color2) { // if it's a list, use a random color from the list, else use the color2 attribute + pixel2.color = pixelColorPick(pixel2, Array.isArray(r.color2) ? r.color2[Math.floor(Math.random() * r.color2.length)] : r.color2); + } + if (r.attr2) { // add each attribute to pixel2 + for (var key in r.attr2) { + pixel2[key] = r.attr2[key]; + } + } + if (r.func) { r.func(pixel1,pixel2); } + return r.elem1!==undefined || r.elem2!==undefined; + }; + }; + return true; + }; + + function jinsouliteValue(pixel) { + valueFunction(pixel,jinsouliteValueObject,jinsouliteSpreadWhitelist); + if(pixel.oldColor === null) { pixel.oldColor = pixel.color }; + pixel.color = changeSaturation(pixel.oldColor,pixel.value / 3,"subtract","rgb") + + if(pixel.value > 1) { + if(Math.random() < Math.min((pixel.value / 200),0.5)) { + var randomNeighborOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; + var rX = randomNeighborOffset[0]; + var rY = randomNeighborOffset[1]; + var rfX = pixel.x+rX; + var rfY = pixel.y+rY; + if(isEmpty(rfX,rfY,false)) { + createPixel("water",rfX,rfY); + pixel.value--; + }; + }; + }; + } + + function jinsoulitoidTick(pixel,move1Spots=[],move2Spots=[]) { + if(jinsouliteDissolution(pixel)) { + return; + }; + jinsouliteValue(pixel); + jinsouliteMovement(pixel,move1Spots,move2Spots); + }; + + elements.jinsoulite = { + color: ["#0e51b0", "#2129ff", "#3b3dbf"], + fireColor: ["#121978", "#6a9fe6", "#5963d9"], + behavior: [ + "XX|CR:water%0.05|XX", + "CR:water%0.05|XX|CR:water%0.05", + "XX|CR:water%0.05|XX" + ], + behaviorOn: [ + "XX|CR:water%0.15|XX", + "CR:water%0.15|XX|CR:water%0.15", + "XX|CR:water%0.15|XX" + ], + properties: { + value: 0, + oldColor: null + }, + tick: function(pixel) { + jinsouliteValue(pixel); + jinsouliteSolidNonWaterSideReactions(pixel); + jinsouliteSolidWaterSideReactions(pixel); + }, + tempHigh: 2606, + category: "solids", + state: "solid", + density: 8331, + hardness: 0.82, + breakInto: "jinsoulite_powder", + conduct: 0.93, + }; + + elements.jinsoulite_powder = { + color: ["#4580ba", "#355eb0", "#2d6fc4"], + fireColor: ["#121978", "#6a9fe6", "#5963d9"], + tempHigh: 2606, + behavior: [ + "XX|CR:water%0.05|XX", + "CR:water%0.05|XX|CR:water%0.05", + "XX|CR:water%0.05|XX" + ], + properties: { + value: 0, + oldColor: null + }, + category: "powders", + behaviorOn: [ + "XX|CR:water%0.15|XX", + "CR:water%0.15|XX|CR:water%0.15", + "XX|CR:water%0.15|XX" + ], + tick: function(pixel) { jinsoulitoidTick(pixel,[[0,1]],[[-1,1],[1,1]]) }, + stateHigh: "molten_jinsoulite", + category: "powders", + state: "solid", + hidden: true, + density: 5801, + hardness: 0.7, + conduct: 0.43, + }; + + elements.molten_jinsoulite = { + behavior: [ + "XX|CR:fire,fire,steam%0.5|XX", + "XX|XX|XX", + "XX|XX|XX" + ], + behaviorOn: [ + "XX|CR:fire,steam,steam%0.7|XX", + "CR:steam%0.1|XX|CR:steam%0.1", + "XX|CR:steam%0.1|XX" + ], + properties: { + value: 0, + oldColor: null + }, + color: ["#4e35db","#7767eb","#a876f5", "#78acff"], + fireColor: ["#121978", "#6a9fe6", "#5963d9"], + fireElement: ["fire","fire","steam"], + tick: function(pixel) { jinsoulitoidTick(pixel,[[-1,1],[0,1],[1,1]],[[-1,0],[1,0]]); }, + density: 6448, + hardness: 0.61, + breakInto: "jinsoulite_gas", + temp: 3000, + tempHigh: 5532.8509, + conduct: 0.34, + }; + + elements.jinsoulite_gas = { + color: ["#c0f0ef", "#c2c1db", "#c0bff5", "#cdcce6"], + behavior: [ + "XX|CR:steam%0.5|XX", + "CR:steam%0.5|XX|CR:steam%0.5", + "XX|CR:steam%0.5|XX", + ], + behaviorOn: [ + "XX|CR:steam%1|XX", + "CR:steam%1|XX|CR:steam%1", + "XX|CR:steam%1|XX", + ], + fireColor: ["#08a953", "#2ea332", "#d1e0d3"], + properties: { + value: 0, + oldColor: null + }, + tick: function(pixel) { jinsoulitoidTick(pixel,adjacentCoords,[[-1,-1],[1,-1],[1,1],[-1,1]]) }, + density: 0.5833, + temp: 6000, + hardness: 1, + conduct: 0.19, + }; + + runAfterLoad(function() { + for(key in elements.water.reactions) { + var value = JSON.parse(JSON.stringify(elements.water.reactions[key])); + if(typeof(value.chance) === "number") { + value.chance = Math.min(1,value.chance * 2); + }; + if(value.elem2 === null && value.elem1 !== null) { + value.elem2 = value.elem1; + }; + delete value.elem1; + + var movableJinsoulitoids = ["jinsoulite_powder","molten_jinsoulite","jinsoulite_gas"]; + for(j = 0; j < movableJinsoulitoids.length; j++) { + var jinsoulitoid = movableJinsoulitoids[j]; + if(typeof(elements[jinsoulitoid].reactions) === "undefined") { + elements[jinsoulitoid].reactions = {}; + }; + if(typeof(elements[jinsoulitoid].reactions[key]) === "undefined") { + elements[jinsoulitoid].reactions[key] = value; + }; + }; + }; + }); +} else { + if(!enabledMods.includes(loonaMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,loonaMod) }; + if(!enabledMods.includes(fireMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,fireMod) }; + if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,runAfterAutogenMod) }; + if(!enabledMods.includes(explodeAtPlusMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,explodeAtPlusMod) }; + if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) }; + localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); + alert(`The "${runAfterAutogenMod}", "${loonaMod}", "${fireMod}", "${libraryMod}", and "${explodeAtPlusMod}" mods are all required; any missing mods in this list have been automatically inserted (reload for this to take effect).`) +}; diff --git a/mods/iocalfaeus_clones.js b/mods/iocalfaeus_clones.js new file mode 100644 index 00000000..d6e03c78 --- /dev/null +++ b/mods/iocalfaeus_clones.js @@ -0,0 +1,100 @@ +elements.iorefrius_gas = { + color: ["#217349", "#1b5f3c"], + behavior: behaviors.GAS, + tick: function(pixel) { + if(!pixel.cold) { + pixel.cold = false + } + for (let i = -2; i < 3; i++) { + for (let j = -2; j < 3; j++) { + if (!isEmpty(pixel.x+j,pixel.y+i,true)) { + var newPixel = pixelMap[pixel.x+j][pixel.y+i]; + if ((lightArray.includes(newPixel.element)) || (newPixel.temp >= 525) || (ledArray.includes(newPixel.element) && newPixel.charge) || (newPixel.cold && Math.random() < 0.04)) { + pixel.cold = true; + }; + }; + }; + }; + if(pixel.cold == true) { + pixel.temp -= 16; + }; + if(pixel.cold == true && Math.random() < 0.02) { + pixel.cold = false; + }; + }, + category: "gases", + density: 0.97, + state: "gas", +}; + +elements.iolucius_gas = { + color: ["#e9c5ed", "#e2b0e8"], + behavior: behaviors.GAS, + tick: function(pixel) { + if(!pixel.lit) { + pixel.lit = false + } + for (let i = -2; i < 3; i++) { + for (let j = -2; j < 3; j++) { + if (!isEmpty(pixel.x+j,pixel.y+i,true)) { + var newPixel = pixelMap[pixel.x+j][pixel.y+i]; + if ((lightArray.includes(newPixel.element)) || (newPixel.temp >= 525) || (ledArray.includes(newPixel.element) && newPixel.charge) || (newPixel.lit && Math.random() < 0.04)) { + pixel.lit = true; + }; + }; + }; + }; + if(Math.random() < 0.05) { + if(pixel.lit == true) { + var randomLightOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; + var lightX = pixel.x + randomLightOffset[0]; + var lightY = pixel.y + randomLightOffset[1]; + if(isEmpty(lightX,lightY,false)) { + createPixel("light",lightX,lightY); + }; + }; + }; + if(pixel.lit == true && Math.random() < 0.02) { + pixel.lit = false; + }; + }, + category: "gases", + density: 0.97, + state: "gas", +}; + +elements.ioradius_gas = { + color: ["#a6a258", "#97944e"], + behavior: behaviors.GAS, + tick: function(pixel) { + if(!pixel.rlit) { + pixel.rlit = false + } + for (let i = -2; i < 3; i++) { + for (let j = -2; j < 3; j++) { + if (!isEmpty(pixel.x+j,pixel.y+i,true)) { + var newPixel = pixelMap[pixel.x+j][pixel.y+i]; + if ((lightArray.includes(newPixel.element)) || newPixel.element === "radiation" || (newPixel.temp >= 525) || (ledArray.includes(newPixel.element) && newPixel.charge) || (newPixel.rlit && Math.random() < 0.04)) { + pixel.rlit = true; + }; + }; + }; + }; + if(Math.random() < 0.05) { + if(pixel.rlit == true) { + var randomRadiationOffset = adjacentCoords[Math.floor(Math.random() * adjacentCoords.length)]; + var radiationX = pixel.x + randomRadiationOffset[0]; + var radiationY = pixel.y + randomRadiationOffset[1]; + if(isEmpty(radiationX,radiationY,false)) { + createPixel("radiation",radiationX,radiationY); + }; + }; + }; + if(pixel.rlit == true && Math.random() < 0.02) { + pixel.rlit = false; + }; + }, + category: "gases", + density: 0.97, + state: "gas", +}; \ No newline at end of file diff --git a/mods/more_bombs.js b/mods/more_bombs.js index 309086c3..1ef6f9f5 100644 --- a/mods/more_bombs.js +++ b/mods/more_bombs.js @@ -1,4 +1,5 @@ var modName = "mods/more_bombs.js"; +var explodeAtPlusMod = "mods/explodeAtPlus.js"; var runAfterAutogenMod = "mods/runAfterAutogen and onload restructure.js"; var libraryMod = "mods/code_library.js"; @@ -26,6 +27,38 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) }; }; + function firebombFire(pixel,x,y,radius,fire,smoke,power,damage) { + var coords = circleCoords(pixel.x,pixel.y,radius); + for (var i = 0; i < coords.length; i++) { + var x = coords[i].x; + var y = coords[i].y; + if(!isEmpty(x,y,true)) { + var pixel = pixelMap[x][y]; + var info = elements[pixel.element]; + var cursedFireChance = 0.15 + power; + if (info.burn) { //Light everything on fire + pixel.burning = true; + pixel.burnStart = pixelTicks; + pixel.temp += 10; //smoke prevention + } else if(Math.random() < cursedFireChance) { //(15+power)%/px cursed burning + pixel.burning = true; + pixel.burnStart = pixelTicks; + pixel.temp += 10; + }; + } else if(isEmpty(x,y)) { //if there's space for fire + if (Array.isArray(fire)) { //this should remain "fire" + var newfire = fire[Math.floor(Math.random() * fire.length)]; + } else { + var newfire = fire; + }; + createPixel(newfire,x,y); //add fire + var firePixel = pixelMap[x][y]; + firePixel.temp = Math.max(elements[newfire].temp,firePixel.temp); + firePixel.burning = true; + }; + }; + }; + if(urlParams.get('bombAmount') != null) { //null check bombAmount = urlParams.get('bombAmount') if(isNaN(bombAmount) || bombAmount === "" || bombAmount === null) { //NaN check @@ -48,6 +81,39 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) pixel.temp += (800 * ((1 + (7 * damage)) ** 2) * ((power ** 2) * 1.5)); }; + elements.firebomb = { + color: "#ee7e3e", + tick: function(pixel) { + if(!isEmpty(pixel.x,pixel.y-1,true)) { //[0][1] EX (ignore bounds) + var newPixel = pixelMap[pixel.x][pixel.y-1]; + var newElement = newPixel.element; + var newInfo = elements[newElement]; + if(newInfo.state !== "gas" && newElement !== pixel.element) { + explodeAtPlus(pixel.x,pixel.y,10,"fire,fire,fire,fire,fire,greek_fire","fire",null,firebombFire); + }; + }; + if(!isEmpty(pixel.x,pixel.y+1,true)) { //[2][1] EX (don't ignore bounds, non-bound case) + var newPixel = pixelMap[pixel.x][pixel.y+1]; + var newElement = newPixel.element; + var newInfo = elements[newElement]; + if(newInfo.state !== "gas" && newElement !== pixel.element) { + explodeAtPlus(pixel.x,pixel.y,10,"fire,fire,fire,fire,fire,greek_fire","fire",null,firebombFire); + }; + }; + if(outOfBounds(pixel.x,pixel.y+1)) { //[2][1] EX (don't ignore bounds, bound case) + explodeAtPlus(pixel.x,pixel.y,10,"fire,fire,fire,fire,fire,greek_fire","fire",null,firebombFire); + }; + if(!tryMove(pixel,pixel.x,pixel.y+1)) { //behaviors.POWDER + Math.random() < 0.5 ? tryMove(pixel,pixel.x-1,pixel.y+1) : tryMove(pixel,pixel.x+1,pixel.y+1); + }; + }, + category: "weapons", + state: "solid", + density: 1500, + excludeRandom: true, + desc: "An advanced incendiary weapon.
To enable automatic bomb generation, set the generateBombs query parameter.", + }; + elements.cluster_nuke = { color: "#e3f636", behavior: [ @@ -59,8 +125,9 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) state: "solid", density: 1500, excludeRandom: true, + desc: "It's a nuke that drops more nukes.
To enable automatic bomb generation, set the generateBombs query parameter.", }; - + elements.anti_bomb = { color: "#525c61", behavior: [ @@ -72,7 +139,6 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) state: "solid", density: 1300, excludeRandom: true, - desc: "It's a nuke that drops more nukes.
To enable automatic bomb generation, set the generateBombs query parameter.", }; elements.electric_bomblet = { @@ -260,7 +326,9 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) }; //genfunc - function generateBomb(bombElements,isAfterScriptLoading=false) {//it can be a single element, though + function generateBomb(bombElements,isAfterScriptLoading=false,bombNumber=1) {//it can be a single element, though + bombNumber = Math.max(0,bombNumber); + //To specify an array bomb, have the array be inside another array. /*For reasons related to how element colors are loaded, if this function is being run from a JS mod file, isAfterScriptLoading should be false. Otherwise, you'll get TypeErrors for some reason when trying to place your bomb. If this is being run after the game has loaded (e.g. in the console), @@ -337,9 +405,14 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) }; elementOfBomb = tryJoin(elementOfBomb,","); + descElement = tryJoin(elementOfBomb,", "); //console.log(elementOfBomb); + if(bombNumber !== 1) { + bombName += `_${bombNumber}`; + }; + if(!elementExists(bombName)) { elements[bombName] = { color: startColor, @@ -347,11 +420,12 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) flippableX: true, colorObject: newColorObject, behavior: [ - ["XX",`EX:10>${elementOfBomb}`,"XX"], + ["XX",`EX:${5*(bombNumber+1)}>${elementOfBomb}`,"XX"], ["XX","XX","XX"], - ["M2",`M1 AND EX:10>${elementOfBomb}`,"M2"] + ["M2",`M1 AND EX:${5*(bombNumber+1)}>${elementOfBomb}`,"M2"] ], category: "auto_bombs", + desc: `Explodes into ${descElement}
Radius: ${5*(bombNumber+1)}`, temp: firstTemp, excludeRandom: true, }; @@ -439,7 +513,8 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) }); } else { if(!enabledMods.includes(runAfterAutogenMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,runAfterAutogenMod) }; + if(!enabledMods.includes(explodeAtPlusMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,explodeAtPlusMod) }; if(!enabledMods.includes(libraryMod)) { enabledMods.splice(enabledMods.indexOf(modName),0,libraryMod) }; - alert(`The "${runAfterAutogenMod}" and "${libraryMod}" mods are all required; any missing mods in this list have been automatically inserted (reload for this to take effect).`) localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); + alert(`The "${runAfterAutogenMod}", "${explodeAtPlusMod}", and "${libraryMod}" mods are all required; any missing mods in this list have been automatically inserted (reload for this to take effect).`) }; diff --git a/mods/randomness_but_tick.js b/mods/randomness_but_tick.js index 1e600736..87a95e3f 100644 --- a/mods/randomness_but_tick.js +++ b/mods/randomness_but_tick.js @@ -588,17 +588,17 @@ elements.void_first = { delete pixel.dc4; } } - - for(i = 0; i < adjacentCoords.length; i++) { + + for(i = 0; i < adjacentCoords.length; i++) { var pX = pixel.x; var pY = pixel.y; var oX = adjacentCoords[i][0]; var oY = adjacentCoords[i][1]; var nX = pX+oX; var nY = pY+oY; - if(!isEmpty(nX,nY,true)) { + if(!isEmpty(nX,nY,true)) { var newPixel = pixelMap[nX][nY] var newElement = newPixel.element; - if(newElement != pixel.element) { + if(newElement != pixel.element) { deletePixel(nX,nY); - }; - }; - }; + }; + }; + }; }, category:"special", hardness: 1, @@ -783,17 +783,17 @@ elements.converter = { delete pixel.dc4; } } - - for(i = 0; i < adjacentCoords.length; i++) { + + for(i = 0; i < adjacentCoords.length; i++) { var pX = pixel.x; var pY = pixel.y; var oX = adjacentCoords[i][0]; var oY = adjacentCoords[i][1]; var nX = pX+oX; var nY = pY+oY; - if(!isEmpty(nX,nY,true)) { + if(!isEmpty(nX,nY,true)) { var newPixel = pixelMap[nX][nY] var newElement = newPixel.element; - if(newElement != pixel.element) { + if(newElement != pixel.element) { changePixel(newPixel,pixel.changeTo) - }; - }; - }; + }; + }; + }; }, category:"special", hardness: 1, @@ -1213,131 +1213,21 @@ function randIntR(min,max) { return Math.floor(Math.random() * (max - min + 1)) + min }; -elements.test293 = { - color: "#f0e7e0", - behavior: [ - "XX|SA%40 AND ST|XX", - "M2%10 AND SA%40 AND ST|XX|M2%10 AND SA%40 AND ST", - "M2 AND M1%10|M1 AND SA%40 AND ST|M2 AND M1%10" - ], - category: "weapons", - state: "solid", - density: 2222.22, - tick: function(pixel) { - if(pixel.burning) { - if(pixel.burning == true) { - if(isEmpty(pixel.x,pixel.y-1)) { - if(Math.random() < 0.04) { createPixel("fire",pixel.x,pixel.y-1) } - if(Math.random() < 0.04) { pixel.temp++ } - } - if(isEmpty(pixel.x,pixel.y+1)) { - if(Math.random() < 0.04) { createPixel("fire",pixel.x,pixel.y+1) } - if(Math.random() < 0.04) { pixel.temp++ } - } - if(isEmpty(pixel.x-1,pixel.y)) { - if(Math.random() < 0.04) { createPixel("fire",pixel.x-1,pixel.y) } - if(Math.random() < 0.04) { pixel.temp++ } - } - if(isEmpty(pixel.x+1,pixel.y)) { - if(Math.random() < 0.04) { createPixel("fire",pixel.x+1,pixel.y) } - if(Math.random() < 0.04) { pixel.temp++ } - } - if(Math.random() < 0.0001) { explodeAt(pixel.x,pixel.y,randIntR(7,10),("fire,fire,fire,fire,smoke,"+pixel.element+","+pixel.element)) } - } - } - doHeat(pixel); - }, - burn: 300, - burnTime: 500, -}, - -elements.test293b = { - color: "#e0e7f0", - behavior: [ - "XX|SA%40 AND ST|XX", - "M2%10 AND SA%40 AND ST|XX|M2%10 AND SA%40 AND ST", - "M2 AND M1%10|M1 AND SA%40 AND ST|M2 AND M1%10" - ], - category: "weapons", - state: "solid", - density: 2222.22, - tick: function(pixel) { - for(i = -1; i < 2; i++) { - for(j = -1; j < 2; j++) { - if(!isEmpty(pixel.x + i, pixel.y + j) && !outOfBounds(pixel.x + i, pixel.y + j)) { - if(pixelMap[pixel.x + i][pixel.y + j].element == "cold_fire" && !pixel.burning) { - pixel.burning = true - pixel.burnStart = pixelTicks - } - } - } - } - if(pixel.burning) { - if(pixel.burning == true) { - for(i = -1; i < 2; i++) { - for(j = -1; j < 2; j++) { - if(!isEmpty(pixel.x + i, pixel.y + j) && !outOfBounds(pixel.x + i, pixel.y + j)) { - if(pixelMap[pixel.x + i][pixel.y + j].element == "fire") { - deletePixel(pixel.x + i, pixel.y + j) - createPixel("cold_fire", pixel.x + i,pixel.y + j) - } - pixelMap[pixel.x + i][pixel.y + j].temp -= randIntR(1,2) - } - } - } - if(isEmpty(pixel.x,pixel.y-1)) { - if(Math.random() < 0.04) { createPixel("cold_fire",pixel.x,pixel.y-1) } - if(Math.random() < 0.04) { pixel.temp-- } - } - if(isEmpty(pixel.x,pixel.y+1)) { - if(Math.random() < 0.04) { createPixel("cold_fire",pixel.x,pixel.y+1) } - if(Math.random() < 0.04) { pixel.temp-- } - } - if(isEmpty(pixel.x-1,pixel.y)) { - if(Math.random() < 0.04) { createPixel("cold_fire",pixel.x-1,pixel.y) } - if(Math.random() < 0.04) { pixel.temp-- } - } - if(isEmpty(pixel.x+1,pixel.y)) { - if(Math.random() < 0.04) { createPixel("cold_fire",pixel.x+1,pixel.y) } - if(Math.random() < 0.04) { pixel.temp-- } - } - if(Math.random() < 0.0001) { - var amogus = randIntR(8,11) - var amog1 = (Math.ceil(amogus/2))*-1 - var amog2 = (Math.ceil(amogus/2))+1 - explodeAt(pixel.x,pixel.y,amogus,("cold_fire,cold_fire,cold_fire,cold_fire,cold_fire,"+pixel.element+","+pixel.element)) - for(i = amog1; i < amog2; i++) { - for(j = amog1; j < amog2; j++) { - if(!isEmpty(pixel.x + i, pixel.y + j) && !outOfBounds(pixel.x + i, pixel.y + j)) { - pixelMap[pixel.x + i][pixel.y + j].temp -= randIntR(160,240) - } - } - } - } - } - } - doHeat(pixel); - }, - burn: 300, - burnTime: 500, - burnInto: "cold_fire", -} - elements.lower_color_copy = { - behavior: behaviors.POWDER, - tick: function(pixel) { - if(!isEmpty(pixel.x,pixel.y+1,true)) { - pixel.color = pixelMap[pixel.x][pixel.y+1].color; - } else { - if(settings.bg) { - pixel.color = settings.bg; - } else { - pixel.color = "#000000"; - } - } - }, - color: ["#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#FF0000", "#FF7F00", "#FFFF00", "#00FF00", "#007FFF", "#0000FF", "#7F00FF"], - density: 1250, - breakInto: ["metal_scrap", "glass_shard"], - hardness: 0.7, + behavior: behaviors.POWDER, + tick: function(pixel) { + if(!isEmpty(pixel.x,pixel.y+1,true)) { + pixel.color = pixelMap[pixel.x][pixel.y+1].color; + } else { + if(settings.bg) { + pixel.color = settings.bg; + } else { + pixel.color = "#000000"; + } + } + }, + color: ["#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#000000", "#FF0000", "#FF7F00", "#FFFF00", "#00FF00", "#007FFF", "#0000FF", "#7F00FF"], + density: 1250, + breakInto: ["metal_scrap", "glass_shard"], + hardness: 0.7, } diff --git a/mods/save_loading.js b/mods/save_loading.js index b31c28c2..fc3892c3 100644 --- a/mods/save_loading.js +++ b/mods/save_loading.js @@ -14,6 +14,20 @@ function getSimulationState() { return simulationState; }; +//https://stackoverflow.com/a/46118025 +function copyToClipboard(text) { + var dummy = document.createElement("textarea"); + // to avoid breaking orgain page when copying more words + // cant copy when adding below this code + // dummy.style.display = 'none' + document.body.appendChild(dummy); + //Be careful if you use textarea. setAttribute('value', value), which works with "input" does not work with "textarea". – Eduard + dummy.value = text; + dummy.select(); + document.execCommand("copy"); + document.body.removeChild(dummy); +} + const saveTemplateAsFile = (filename, dataObjToWrite) => { //from https://stackoverflow.com/a/65939108 const blob = new Blob([JSON.stringify(dataObjToWrite)], { type: "text/json" }); const link = document.createElement("a"); @@ -74,6 +88,11 @@ function downloadSave(filename=null) { saveTemplateAsFile(filename, getSimulationState()); }; +function copySaveJSON(doAlert=true) { + copyToClipboard(JSON.stringify(getSimulationState())); + if(doAlert) { alert("Save copied as JSON") }; +}; + function loadFile() { //Initialize var json; @@ -114,6 +133,40 @@ function loadFile() { }; }; +function loadText() { + //Initialize + var json; + + //load JSON + var json = document.getElementById('mytext').value; + if(json === "") { + if(document.getElementById("textFormStatus") !== "null") { + document.getElementById("textFormStatus").style.color = "red"; + document.getElementById("textFormStatus").innerHTML = "No text was present!"; + }; + throw new Error("No text was present"); + }; + + //validate + try { + json = JSON.parse(json); + } catch (error) { + if(document.getElementById("textFormStatus") !== "null") { + document.getElementById("textFormStatus").style.color = "red"; + document.getElementById("textFormStatus").innerHTML = "The text wasn't valid JSON!"; + }; + throw error; + }; + + if(document.getElementById("textFormStatus") !== "null") { + document.getElementById("textFormStatus").style.color = "yellow"; + document.getElementById("textFormStatus").innerHTML = "JSON was parsed successfully"; + }; + + //return json; + return importJsonState(json); +}; + function importJsonState(json) { //check keys var jsonKeys = Object.keys(json); @@ -214,10 +267,15 @@ function setPixelSize(size=null) { var saveLoaderDescription = `
Download simulation +Alternatively, copy simulation JSON No file loader status -One file, please: +One file, please: +Or paste JSON +No text loader status + + No size setter status Pixel size (rendering only): (Use if the save looks cut off) diff --git a/mods/structure_test.js b/mods/structure_test.js index 69685eb8..9728ec26 100644 --- a/mods/structure_test.js +++ b/mods/structure_test.js @@ -44,6 +44,20 @@ altRoom= [["brick", "brick", "brick", "brick", "brick", "brick", "brick", return Math.floor(Math.random() * 256); };*/ +canSupportWithEdge = function(x,y) { + if(outOfBounds(x,y)) { //count edges + return true; + } else { + if(!isEmpty(x,y,true)) { //if there is a pixel + if(elements[pixelMap[x][y].element].state === "solid") { + return true; + } else { + return false; + }; + }; + }; +}; + function loadPixelRowFromArray(pixelArray,centerX,centerY,evenLengthBiasedLeft=true,doOverwrite=true) { var arrayLength = pixelArray.length; var leftmostOffset = (evenLengthBiasedLeft ? Math.floor(0 - ((arrayLength - 1) / 2)) : Math.ceil(0 - ((arrayLength - 1) / 2))) //floor and ceil have no effect on the integer values produced by odd lengths @@ -89,6 +103,42 @@ elements.glass.hardness = 0.25, elements.rad_glass.hardness = 0.25, //Prereq elements +elements.crumbling_concrete = { + color: "#ababab", + tick: function(pixel) { + var px = pixel.x; + var py = pixel.y; + + if (pixel.start === pixelTicks) {return} + + var supportCondition1 = (canSupportWithEdge(px-1,py-1) && canSupportWithEdge(px+1,py-1)) // V shape + var supportCondition2 = (canSupportWithEdge(px-1,py) && canSupportWithEdge(px+1,py)) // - shape + var supportCondition3 = (canSupportWithEdge(px-1,py+1) && canSupportWithEdge(px+1,py+1)) // Λ shape + var supportCondition4 = (canSupportWithEdge(px-1,py+1) && canSupportWithEdge(px+1,py-1)) // / shape + var supportCondition5 = (canSupportWithEdge(px-1,py-1) && canSupportWithEdge(px+1,py+1)) // \ shape + var supportCondition6 = (canSupportWithEdge(px-1,py-1) && canSupportWithEdge(px+1,py)) // '- shape + var supportCondition7 = (canSupportWithEdge(px-1,py+1) && canSupportWithEdge(px+1,py)) // ,- shape + var supportCondition8 = (canSupportWithEdge(px+1,py-1) && canSupportWithEdge(px-1,py)) // -' shape + var supportCondition9 = (canSupportWithEdge(px+1,py+1) && canSupportWithEdge(px-1,py)) // -, shape + var supportCondition10 = (canSupportWithEdge(px,py+1) && canSupportWithEdge(px,py-1)) // | shape + var supports = (supportCondition1 || supportCondition2 || supportCondition3 || supportCondition4 || supportCondition5 || supportCondition6 || supportCondition7 || supportCondition8 || supportCondition9 || supportCondition10); + + if(!supports) { + behaviors.POWDER(pixel); + }; + + doDefaults(pixel); + }, + tempHigh: 1500, + stateHigh: "magma", + category: "powders", + state: "solid", + density: 2400, + hardness: 0.5, + breakInto: "dust", +}; + + elements.glass_pane = { color: ["#5e807d","#679e99"], behavior: behaviors.SUPPORT, @@ -96,11 +146,13 @@ elements.glass_pane = { "radiation": { "elem1":"rad_glass_pane", "chance":0.33 }, }, tempHigh: 1500, + stateHigh: "molten_glass", hardness: 0.2, category: "solids", state: "solid", density: 2500, breakInto: "glass_shard", + hidden: true, }; elements.rad_glass_pane = { @@ -117,7 +169,7 @@ elements.rad_glass_pane = { state: "solid", density: 2500, breakInto: "rad_glass_shard", - hidden: true + hidden: true, }; elements.wood.hardness = 0.2; @@ -136,6 +188,90 @@ elements.wood_plank = { breakInto: "sawdust", }; +elements.hanging_concrete = { + color: "#ababab", + behavior: [ + "XX|SP|XX", + "XX|XX|XX", + "M2|M1|M2" //crumbling from the top down is acceptable + ], + tempHigh: 1500, + stateHigh: "magma", + category: "powders", + state: "solid", + density: 2400, + hardness: 0.5, + breakInto: "dust", + hidden: true, +}; + +elements.support_copper = { + color: ["#A95232","#BE4322","#C76035"], + behavior: behaviors.SUPPORT, + reactions: { + "water": { "elem1":"oxidized_copper", chance:0.0025 }, + "salt_water": { "elem1":"oxidized_copper", chance:0.005 }, + "dirty_water": { "elem1":"oxidized_copper", chance:0.04 }, + "sugar_water": { "elem1":"oxidized_copper", chance:0.0035 }, + "seltzer": { "elem1":"oxidized_copper", chance:0.006 }, + }, + category: "solids", + tempHigh: 1085, + stateHigh: "molten_copper", + density: 8960, + conduct: 0.95, + hardness: 0.3, + hidden: true, +}; + +elements.support_bulb = { + color: "#a8a897", + behavior: behaviors.SUPPORTPOWDER, + behaviorOn: [ + "XX|CR:light|XX", + "CR:light AND SP|XX|CR:light AND SP", + "M2|CR:light AND M1|M2" + ], + colorOn: "#ebebc3", + category: "machines", + tempHigh: 1500, + stateHigh: ["molten_glass","molten_glass","molten_copper"], + conduct: 1, + breakInto: "glass_shard", + hidden: true, +}; + +elements.support_plastic = { + color: "#c5dede", + behavior: behaviors.SUPPORT, + tempHigh: 250, + stateHigh: "molten_plastic", + burn: 10, + burnTime: 200, + burnInto: ["dioxin","smoke","dioxin","smoke","stench"], + category: "solids", + state: "solid", + density: 1052, + hidden: true, +}; + +elements.support_steel = { + color: "#71797E", + behavior: behaviors.SUPPORT, + tempHigh: 1455.5, + stateHigh: "molten_steel", + category: "solids", + density: 7850, + conduct: 0.42, + hardness: 0.8, +}; + +var newAcidIgnores = ["glass_pane", "rad_glass_pane", "rad_glass_shard", "hanging_plastic"]; +for(i = 0; i < newAcidIgnores.length; i++) { + elements.acid.ignore.push(newAcidIgnores[i]); + elements.acid_gas.ignore.push(newAcidIgnores[i]); +}; + elements.rad_glass.breakInto = "rad_glass_shard"; if(!elements.glass_shard.reactions) { @@ -170,6 +306,38 @@ elements.molten_rad_glass = { ], }; +elements.steel_plate_ledge = { + color: "#F2F2F2", + tick: function(pixel) { + if(pixel.attached) { + if(pixel.attachOffsets === null) { + pixel.attached = false; + } else if(pixel.attachOffsets.includes(null)) { + pixel.attached = false; + } else { + var attachCoords = [pixel.x + pixel.attachOffsets[0], pixel.y + pixel.attachOffsets[1]]; + if(isEmpty(attachCoords[0],attachCoords[1],false)) { //consider OOB full + pixel.attached = false; + }; + }; + } else { //Move if not attached + tryMove(pixel,pixel.x,pixel.y+1); + }; + doDefaults(pixel); + }, + properties: { + "attached": false, + "attachOffsets": [null, null], + }, + tempHigh: 1455.5, + stateHigh: "molten_steel", + category: "solids", + density: 785, + conduct: 0.32, + hardness: 0.7, + breakInto: "metal_scrap", +}; + //Seeds elements.building_1_seed = { tick: function(pixel) { diff --git a/mods/testmod.js b/mods/testmod.js new file mode 100644 index 00000000..7689a183 --- /dev/null +++ b/mods/testmod.js @@ -0,0 +1,7 @@ +elements.HelloWorld = { + color: "#100D5E", + behavior: behaviors.WALL, + category: "land", + state: "solid" + density: 720, +}; diff --git a/mods/the_ground.js b/mods/the_ground.js index 0ad8e7a9..87a9f83e 100644 --- a/mods/the_ground.js +++ b/mods/the_ground.js @@ -1,3 +1,5 @@ +//This mod is on indefinite hiatus + /* TODO: Fill in remaining IRs (if they exist, and i might make some up if they don't) @@ -53,8 +55,8 @@ Proper classification of limestone within these code comments if (!isEmpty(pixel.x+j,pixel.y+i) && !outOfBounds(pixel.x+j,pixel.y+i)) { var destPixel = pixelMap[pixel.x+j][pixel.y+i]; var elementToCheck = destPixel.element; - if(getKeyByValue(irradiatedObject,elementToCheck)) { - changePixel(destPixel,getKeyByValue(irradiatedObject,elementToCheck)); + if(getKeyByValue(radioactiveObject,elementToCheck)) { + changePixel(destPixel,getKeyByValue(radioactiveObject,elementToCheck)); }; }; } else { @@ -80,8 +82,8 @@ Proper classification of limestone within these code comments if (!isEmpty(pixel.x+j,pixel.y+i) && !outOfBounds(pixel.x+j,pixel.y+i)) { var destPixel = pixelMap[pixel.x+j][pixel.y+i]; var elementToCheck = destPixel.element; - if(getKeyByValue(irradiatedObject,elementToCheck)) { - changePixel(destPixel,getKeyByValue(irradiatedObject,elementToCheck)); + if(getKeyByValue(radioactiveObject,elementToCheck)) { + changePixel(destPixel,getKeyByValue(radioactiveObject,elementToCheck)); }; }; } else { @@ -262,155 +264,155 @@ Proper classification of limestone within these code comments //TODO - //Irradiated (unmoved/TODO) + //Radioactive (unmoved/TODO) //Dry - //Irradiated Clay + //Radioactive Clay //Clay exists - //Irradiated Silty clay + //Radioactive Silty clay //TODO - //Irradiated Silty Clay Loam + //Radioactive Silty Clay Loam //TODO - //Irradiated Silty Loam + //Radioactive Silty Loam //TODO - //Irradiated Silt + //Radioactive Silt //TODO - //Irradiated Clay Loam + //Radioactive Clay Loam //Clay Soil exists - //Irradiated Medium Loam + //Radioactive Medium Loam //Dirt exists - //Irradiated Sandy Clay + //Radioactive Sandy Clay //TODO - //Irradiated Sandy Clay Loam + //Radioactive Sandy Clay Loam //TODO - //Irradiated Sandy Loam + //Radioactive Sandy Loam //TODO - //Irradiated Loamy Sand + //Radioactive Loamy Sand //TODO - //Irradiated Sand + //Radioactive Sand //Sand exists //Wet - //Irradiated Wet Clay + //Radioactive Wet Clay //TODO - //Irradiated Wet Silty clay + //Radioactive Wet Silty clay //TODO - //Irradiated Wet Silty Clay Loam + //Radioactive Wet Silty Clay Loam //TODO - //Irradiated Wet Silty Loam + //Radioactive Wet Silty Loam //TODO - //Irradiated Wet Silt + //Radioactive Wet Silt //TODO - //Irradiated Wet Clay Loam + //Radioactive Wet Clay Loam //TODO - //Irradiated Wet Medium Loam + //Radioactive Wet Medium Loam //Mud exists - //Irradiated Wet Sandy Clay + //Radioactive Wet Sandy Clay //TODO - //Irradiated Wet Sandy Clay Loam + //Radioactive Wet Sandy Clay Loam //TODO - //Irradiated Wet Sandy Loam + //Radioactive Wet Sandy Loam //TODO - //Irradiated Wet Loamy Sand + //Radioactive Wet Loamy Sand //TODO - //Irradiated Wet Sand + //Radioactive Wet Sand //Wet Sand exists //Permafrost - //Irradiated Clay Permafrost + //Radioactive Clay Permafrost //TODO - //Irradiated Silty clay Permafrost + //Radioactive Silty clay Permafrost //TODO - //Irradiated Silty Clay Loam Permafrost + //Radioactive Silty Clay Loam Permafrost //TODO - //Irradiated Silty Loam Permafrost + //Radioactive Silty Loam Permafrost //TODO - //Irradiated Silt Permafrost + //Radioactive Silt Permafrost //TODO - //Irradiated Clay Loam Permafrost + //Radioactive Clay Loam Permafrost //TODO - //Irradiated Medium Loam Permafrost + //Radioactive Medium Loam Permafrost //Permafrost exists - //Irradiated Sandy Clay Permafrost + //Radioactive Sandy Clay Permafrost //TODO - //Irradiated Sandy Clay Loam Permafrost + //Radioactive Sandy Clay Loam Permafrost //TODO - //Irradiated Sandy Loam Permafrost + //Radioactive Sandy Loam Permafrost //TODO - //Irradiated Loamy Sand Permafrost + //Radioactive Loamy Sand Permafrost //TODO - //Irradiated Sand Permafrost + //Radioactive Sand Permafrost //TODO @@ -753,7 +755,7 @@ Proper classification of limestone within these code comments //Elements from which simplified lithification can spread - sandstoneLithificationElements = ["sand_sediment", "sandstone", "irradiated_sand_sediment", "irradiated_sandstone"/*, "crimson_sandstone", "crimson_sand_sediment"*/] + sandstoneLithificationElements = ["sand_sediment", "sandstone", "radioactive_sand_sediment", "radioactive_sandstone"/*, "crimson_sandstone", "crimson_sand_sediment"*/] //Water reaction to pick up the fine material (this is very simplified) @@ -763,9 +765,9 @@ Proper classification of limestone within these code comments chance: 0.01 }; - elements.water.reactions.irradiated_wet_sand = { - "elem1": "irradiated_sandy_water", - "elem2": ["irradiated_wet_sand","irradiated_wet_sand","irradiated_wet_sand","irradiated_wet_sand","irradiated_wet_sand",null], + elements.water.reactions.radioactive_wet_sand = { + "elem1": "radioactive_sandy_water", + "elem2": ["radioactive_wet_sand","radioactive_wet_sand","radioactive_wet_sand","radioactive_wet_sand","radioactive_wet_sand",null], chance: 0.01 }; @@ -1135,11 +1137,13 @@ Proper classification of limestone within these code comments elements.dirt.stateHigh = "dry_dirt"; elements.water.reactions.dry_dirt = { elem1: null, elem2: "dirt", chance: 0.1 } + elements.water.reactions.radioactive_dry_dirt = { elem1: null, elem2: "radioactive_dirt", chance: 0.1 } if(!elements.mud.reactions) { elements.mud.reactions = {}; }; elements.mud.reactions.dry_dirt = { elem1: "dirt", elem2: "dirt", chance: 0.06 } + elements.mud.reactions.radioactive_dry_dirt = { elem1: "radioactive_dirt", elem2: "radioactive_dirt", chance: 0.06 } //Land Element Cults /* @@ -1147,48 +1151,48 @@ Proper classification of limestone within these code comments In this case, they replicate some land elements; a "yellow" cult, for example, would have yellow_dirt, yellow_mud, yellow_mudstone, yellow_permafrost, yellow_sand... */ - //Irradiated land + //Radioactive land - //Irradiated behavior cult (see above) + //Radioactive behavior cult (see above) behaviors.RAD_POWDER = [ "XX|CR:radiation%2|XX", - "CR:radiation%2|XX|CR:radiation%2", + "CR:radiation%2|HT%1.5|CR:radiation%2", "M2|M1 AND CR:radiation%2|M2", ], behaviors.RAD_STURDYPOWDER = [ "XX|CR:radiation%2|XX", - "CR:radiation%2|XX|CR:radiation%2", + "CR:radiation%2|HT%1.5|CR:radiation%2", "XX|M1 AND CR:radiation%2|XX", ], behaviors.RAD_SUPPORT = [ "CR:radiation%1|CR:radiation%2|CR:radiation%1", - "SP AND CR:radiation%2|XX|SP AND CR:radiation%2", + "SP AND CR:radiation%2|HT%1.5|SP AND CR:radiation%2", "XX|M1 AND CR:radiation%2|XX", ], behaviors.RAD_SUPPORTPOWDER = [ "CR:radiation%1|CR:radiation%2|CR:radiation%1", - "SP AND CR:radiation%2|XX|SP AND CR:radiation%2", + "SP AND CR:radiation%2|HT%1.5|SP AND CR:radiation%2", "M2|M1 AND CR:radiation%2|M2", ], behaviors.RAD_LIQUID = [ "XX|CR:radiation%2|XX", - "M2 AND CR:radiation%2|XX|M2 AND CR:radiation%2", + "M2 AND CR:radiation%2|HT%1.5|M2 AND CR:radiation%2", "M1|M1 AND CR:radiation%2|M1", ], behaviors.RAD_WALL = [ "CR:radiation%0.7|CR:radiation%1.4|CR:radiation%0.7", - "CR:radiation%1.4|XX%0000000000000|CR:radiation%1.4", + "CR:radiation%1.4|HT%1.50000000000|CR:radiation%1.4", "CR:radiation%0.7|CR:radiation%1.4|CR:radiation%0.7", ], behaviors.RAD_GAS = [ - "M2 AND CR:radiation%1|M1 AND CR:radiation%2|M2 AND CR:radiation%1", - "M1 AND CR:radiation%2|XX AND CR:radiation%2|M1 AND CR:radiation%2", - "M2 AND CR:radiation%1|M1 AND CR:radiation%2|M2 AND CR:radiation%1", + "M2 AND CR:radiation%1.0|M1 AND CR:radiation%2|M2 AND CR:radiation%1", + "M1 AND CR:radiation%2|HT%1 AND CR:radiation%2|M1 AND CR:radiation%2", + "M2 AND CR:radiation%1.0|M1 AND CR:radiation%2|M2 AND CR:radiation%1", ], behaviors.RAD_MOLTEN = [ "XX|CR:radiation%2.5 AND CR:fire%2.5|XX", - "M2 AND CR:radiation%1|XX|M2 AND CR:radiation%1", + "M2 AND CR:radiation%1|HT%2|M2 AND CR:radiation%1", "M1|M1 AND CR:radiation%1|M1", ] @@ -1204,44 +1208,61 @@ Proper classification of limestone within these code comments }; }; - elements.water.reactions.radiation = { elem1: "irradiated_water", elem2: null, chance:0.25 }, - elements.radiation.reactions.water = { elem2: "irradiated_water", elem1: null, chance:0.25 }, - elements.dirt.reactions.radiation = { elem1: "irradiated_dirt", elem2: null, chance:0.25 }, - elements.radiation.reactions.dirt = { elem2: "irradiated_dirt", elem1: null, chance:0.25 }, - elements.sand.reactions.radiation = { elem1: "irradiated_sand", elem2: null, chance:0.25 }, - elements.radiation.reactions.sand = { elem2: "irradiated_sand", elem1: null, chance:0.25 }, - elements.mud.reactions.radiation = { elem1: "irradiated_mud", elem2: null, chance:0.25 }, - elements.radiation.reactions.mud = { elem2: "irradiated_mud", elem1: null, chance:0.25 }, - elements.wet_sand.reactions.radiation = { elem1: "irradiated_wet_sand", elem2: null, chance:0.25 }, - elements.radiation.reactions.wet_sand = { elem2: "irradiated_wet_sand", elem1: null, chance:0.25 }, + elements.water.reactions.radiation = { elem1: "radioactive_water", elem2: null, chance:0.25 }, + elements.radiation.reactions.water = { elem2: "radioactive_water", elem1: null, chance:0.25 }, + elements.dirt.reactions.radiation = { elem1: "radioactive_dirt", elem2: null, chance:0.25 }, + elements.radiation.reactions.dirt = { elem2: "radioactive_dirt", elem1: null, chance:0.25 }, + elements.sand.reactions.radiation = { elem1: "radioactive_sand", elem2: null, chance:0.25 }, + elements.radiation.reactions.sand = { elem2: "radioactive_sand", elem1: null, chance:0.25 }, + elements.mud.reactions.radiation = { elem1: "radioactive_mud", elem2: null, chance:0.25 }, + elements.radiation.reactions.mud = { elem2: "radioactive_mud", elem1: null, chance:0.25 }, + elements.wet_sand.reactions.radiation = { elem1: "radioactive_wet_sand", elem2: null, chance:0.25 }, + elements.radiation.reactions.wet_sand = { elem2: "radioactive_wet_sand", elem1: null, chance:0.25 }, //Substitution table - irradiatedObject = { - dirt: "irradiated_dirt", - molten_dirt: "molten_irradiated_dirt", - glass: "irradiated_glass", - molten_glass: "molten_irradiated_glass", - glass_shard: "irradiated_glass_shard", - sand: "irradiated_sand", - mud: "irradiated_mud", - wet_sand: "irradiated_wet_sand", - water: "irradiated_water", - permafrost: "irradiated_permafrost", - mudstone: "irradiated_mudstone", - packed_sand: "irradiated_packed_sand", - ice: "irradiated_ice", - snow: "irradiated_snow", - packed_snow: "irradiated_packed_snow", + radioactiveObject = { + dirt: "radioactive_dirt", + dry_dirt: "radioactive_dry_dirt", + molten_dirt: "molten_radioactive_dirt", + glass: "radioactive_glass", + molten_glass: "molten_radioactive_glass", + glass_shard: "radioactive_glass_shard", + sand: "radioactive_sand", + mud: "radioactive_mud", + wet_sand: "radioactive_wet_sand", + water: "radioactive_water", + permafrost: "radioactive_permafrost", + dry_permafrost: "radioactive_dry_permafrost", + mudstone: "radioactive_mudstone", + packed_sand: "radioactive_packed_sand", + ice: "radioactive_ice", + snow: "radioactive_snow", + packed_snow: "radioactive_packed_snow", rain_cloud: "rad_cloud", snow_cloud: "rad_snow_cloud", snow_cloud_floater: "rad_snow_cloud_floater", - rock: "irradiated_rock", - gravel: "irradiated_gravel", - basalt: "irradiated_basalt", - magma: "irradiated_magma", - sandstone: "irradiated_sandstone", - sand_sediment: "irradiated_sand_sediment" + rock: "radioactive_rock", + gravel: "radioactive_gravel", + basalt: "radioactive_basalt", + magma: "radioactive_magma", + sandstone: "radioactive_sandstone", + sand_sediment: "radioactive_sand_sediment" + }; + + if(enabledMods.includes("mods/glenn_gases.js")) { + radioactiveObject.rock_dust = "radioactive_rock_dust"; + }; + + if(enabledMods.includes("mods/fire_mod.js")) { + radioactiveObject.fire = "rad_fire"; + radioactiveObject.torch = "rad_torch"; + }; + + if(enabledMods.includes("mods/structure_test.js")) { + radioactiveObject.glass = "rad_glass"; + radioactiveObject.glass_pane = "rad_glass_pane"; + radioactiveObject.glass_shard = "rad_glass_shard"; }; //Reverse lookup function @@ -1253,35 +1274,53 @@ Proper classification of limestone within these code comments //Main elements - elements.irradiated_dirt = { + elements.radioactive_dirt = { color: ["#70762b","#4c5c21","#50571a","#4c6b1e"], behavior: behaviors.RAD_POWDER, - tempHigh:1200, - stateHigh: "molten_irradiated_dirt", + tempHigh:110, + stateHigh: "radioactive_dry_dirt", reactions: { - "dirt": { "elem1":"dirt", "elem2":"irradiated_dirt", "chance":0.0005, "oneway":true }, + "dirt": { "elem1":"dirt", "elem2":"radioactive_dirt", "chance":0.0005, "oneway":true }, + "dry_dirt": { "elem1":"radioactive_dry_dirt", "elem2":"radioactive_dirt", "chance":0.0005, "oneway":true }, + "radioactive_dry_dirt": { "elem1":"radioactive_dry_dirt", "elem2":"radioactive_dirt", "chance":0.0005, "oneway":true }, }, tempLow: -50, - stateLow: "irradiated_permafrost", - category: "Irradiated", + stateLow: "radioactive_permafrost", + category: "Radioactive", state: "solid", density: 1220, }; - elements.molten_irradiated_dirt = { + elements.radioactive_dry_dirt = { + color: ["#8aa85e","#999c5d","#7f8a45","#b5ad59"], + behavior: [ + "XX|SW:radioactive_dirt%3 AND SW:radioactive_mud%6 AND CR:radiation%2|XX", + "AND CR:radiation%2|HT%1.5|CR:radiation%2", + "M2|M1 AND CR:radiation%2|M2", + ], + tempHigh:1200, + stateHigh: "molten_radioactive_dirt", + tempLow: -50, + stateLow: "radioactive_dry_permafrost", + category:"land", + state: "solid", + density: 1100, + }, + + elements.molten_radioactive_dirt = { "behavior": behaviors.RAD_MOLTEN, "hidden": true, "state": "liquid", - "category": "Irradiated", + "category": "Radioactive", "color": ["#e09315", "#e07615", "#e05800", "#987310", "#985c10", "#984500", "#a06c0d", "#a0570d", "#a04100", "#98850f", "#986b0f", "#985000"], "temp": 1250, "tempLow": 1100, - "stateLow": "irradiated_dirt", + "stateLow": "radioactive_dirt", "density": 1098, "viscosity": 10000 } - elements.irradiated_glass = { + elements.radioactive_glass = { color: ["#597a58","#719171"], colorOn: ["#6dab67","#88b567"], behavior: behaviors.RAD_WALL, @@ -1289,102 +1328,103 @@ Proper classification of limestone within these code comments category: "solids", state: "solid", density: 2500, - breakInto: "irradiated_glass_shard", + breakInto: "radioactive_glass_shard", conduct: 0.01, }; - elements.molten_irradiated_glass = { + elements.molten_radioactive_glass = { behavior: behaviors.RAD_MOLTEN, - category: "Irradiated", + category: "Radioactive", }; - elements.irradiated_glass_shard = { + elements.radioactive_glass_shard = { color: ["#597a58","#719171", "#628263"], colorOn: ["#6dab67","#88b567", "#7bad6f"], behavior: behaviors.RAD_POWDER, tempHigh: 1500, - stateHigh: "molten_irradiated_glass", + stateHigh: "molten_radioactive_glass", category: "powders", state: "solid", density: 2500, conduct: 0.01, }; - elements.irradiated_sand = { + elements.radioactive_sand = { color: "#cbdb7b", behavior: behaviors.RAD_POWDER, tempHigh: 1700, - stateHigh: "molten_irradiated_glass", - category: "Irradiated", + stateHigh: "molten_radioactive_glass", + category: "Radioactive", state: "solid", density: 1602 }; - elements.irradiated_mud = { + elements.radioactive_mud = { color: "#3c401c", behavior: behaviors.RAD_STURDYPOWDER, reactions: { - "irradiated_dirt": { "elem1":"irradiated_dirt", "elem2":"irradiated_mud", "chance":0.0005, "oneway":true }, - "irradiated_sand": { "elem1":"irradiated_dirt", "elem2":"irradiated_wet_sand", "chance":0.0005, "oneway":true }, - "sand": { "elem1":"irradiated_dirt", "elem2":"irradiated_wet_sand", "chance":0.0005, "oneway":true }, - "dirt": { "elem1":"irradiated_dirt", "elem2":"irradiated_mud", "chance":0.0005, "oneway":true }, + "dry_dirt": { "elem1": "radioactive_dirt", "elem2": "radioactive_dirt", chance: 0.06 }, + "radioactive_dirt": { "elem1":"radioactive_dirt", "elem2":"radioactive_mud", "chance":0.0005, "oneway":true }, + "radioactive_sand": { "elem1":"radioactive_dirt", "elem2":"radioactive_wet_sand", "chance":0.0005, "oneway":true }, + "sand": { "elem1":"radioactive_dirt", "elem2":"radioactive_wet_sand", "chance":0.0005, "oneway":true }, + "dirt": { "elem1":"radioactive_dirt", "elem2":"radioactive_mud", "chance":0.0005, "oneway":true }, }, tempHigh: 100, - stateHigh: "irradiated_mudstone", + stateHigh: "radioactive_mudstone", tempLow: -50, - stateLow: "irradiated_permafrost", - category: "Irradiated", + stateLow: "radioactive_permafrost", + category: "Radioactive", state: "solid", density: 1730, stain: 0.02, }; - elements.irradiated_wet_sand = { + elements.radioactive_wet_sand = { color: ["#848c3a","#969e4c"], behavior: behaviors.RAD_STURDYPOWDER, reactions: { - "irradiated_sand": { "elem1":"irradiated_sand", "elem2":"irradiated_wet_sand", "chance":0.0005, "oneway":true }, - "irradiated_dirt": { "elem1":"irradiated_sand", "elem2":"irradiated_mud", "chance":0.0005, "oneway":true }, - "sand": { "elem1":"irradiated_sand", "elem2":"irradiated_wet_sand", "chance":0.0005, "oneway":true }, - "dirt": { "elem1":"irradiated_sand", "elem2":"irradiated_mud", "chance":0.0005, "oneway":true }, - "wet_sand": { "elem1":"irradiated_sand", "elem2":"irradiated_sand_sediment", "chance":0.0005, "oneway":true }, - "sand_sediment": { "elem1":"irradiated_sand", "elem2":"irradiated_sand_sediment", "chance":0.0005, "oneway":true }, - "irradiated_wet_sand": { "elem1":"irradiated_sand", "elem2":"irradiated_sand_sediment", "chance":0.0005, "oneway":true }, - "irradiated_sand_sediment": { "elem1":"irradiated_sand", "elem2":"irradiated_sand_sediment", "chance":0.0005, "oneway":true }, + "radioactive_sand": { "elem1":"radioactive_sand", "elem2":"radioactive_wet_sand", "chance":0.0005, "oneway":true }, + "radioactive_dirt": { "elem1":"radioactive_sand", "elem2":"radioactive_mud", "chance":0.0005, "oneway":true }, + "sand": { "elem1":"radioactive_sand", "elem2":"radioactive_wet_sand", "chance":0.0005, "oneway":true }, + "dirt": { "elem1":"radioactive_sand", "elem2":"radioactive_mud", "chance":0.0005, "oneway":true }, + "wet_sand": { "elem1":"radioactive_sand", "elem2":"radioactive_sand_sediment", "chance":0.0005, "oneway":true }, + "sand_sediment": { "elem1":"radioactive_sand", "elem2":"radioactive_sand_sediment", "chance":0.0005, "oneway":true }, + "radioactive_wet_sand": { "elem1":"radioactive_sand", "elem2":"radioactive_sand_sediment", "chance":0.0005, "oneway":true }, + "radioactive_sand_sediment": { "elem1":"radioactive_sand", "elem2":"radioactive_sand_sediment", "chance":0.0005, "oneway":true }, }, tempHigh: 100, - stateHigh: "irradiated_packed_sand", - category: "Irradiated", + stateHigh: "radioactive_packed_sand", + category: "Radioactive", state: "solid", density: 1905, }; - elements.irradiated_sandy_water = { + elements.radioactive_sandy_water = { color: ["#84A244", "#90AE50"], behavior: behaviors.RAD_LIQUID, tempHigh: 100, - stateHigh: ["rad_steam","rad_steam","irradiated_sand"], + stateHigh: ["rad_steam","rad_steam","radioactive_sand"], //tempLow: 0, - //stateLow: "irradiated_sandy_ice", - category: "Irradiated", + //stateLow: "radioactive_sandy_ice", + category: "Radioactive", heatCapacity: 4.184, //unimplemented reactions: { "dirt": { // React with (water reacts with dirt to make mud) - "elem1": [null,null,"irradiated_wet_sand"], // First element transforms into; in this case, water deletes itself - "elem2": "irradiated_mud", // Second element transforms into; in this case, dirt turns to mud + "elem1": [null,null,"radioactive_wet_sand"], // First element transforms into; in this case, water deletes itself + "elem2": "radioactive_mud", // Second element transforms into; in this case, dirt turns to mud }, - "irradiated_dirt": { // React with (water reacts with dirt to make mud) - "elem1": [null,null,"irradiated_wet_sand"], // First element transforms into; in this case, water deletes itself - "elem2": "irradiated_mud", // Second element transforms into; in this case, dirt turns to mud + "radioactive_dirt": { // React with (water reacts with dirt to make mud) + "elem1": [null,null,"radioactive_wet_sand"], // First element transforms into; in this case, water deletes itself + "elem2": "radioactive_mud", // Second element transforms into; in this case, dirt turns to mud }, - "water": { "elem1":"irradiated_water", "elem2":"irradiated_sandy_water", "chance":0.025 }, - "irradiated_water": { "elem1":"irradiated_water", "elem2":"irradiated_sandy_water", "chance":0.025 }, - "sand": { "elem1": [null,null,"irradiated_wet_sand"], "elem2": "irradiated_wet_sand", }, - "irradiated_sand": { "elem1": [null,null,"irradiated_wet_sand"], "elem2": "irradiated_wet_sand", }, - "sandy_water": { "elem1":"irradiated_wet_sand", "elem2":"irradiated_sand_sediment", "chance": 0.001 }, - "irradiated_sandy_water": { "elem1":"irradiated_wet_sand", "elem2":"irradiated_sand_sediment", "chance": 0.001 }, - "wet_sand": { "elem1": "irradiated_water", "elem2":"irradiated_sand_sediment", "chance": 0.0005 }, - "irradiated_wet_sand": { "elem1": "irradiated_water", "elem2":"irradiated_sand_sediment", "chance": 0.0005 }, + "water": { "elem1":"radioactive_water", "elem2":"radioactive_sandy_water", "chance":0.025 }, + "radioactive_water": { "elem1":"radioactive_water", "elem2":"radioactive_sandy_water", "chance":0.025 }, + "sand": { "elem1": [null,null,"radioactive_wet_sand"], "elem2": "radioactive_wet_sand", }, + "radioactive_sand": { "elem1": [null,null,"radioactive_wet_sand"], "elem2": "radioactive_wet_sand", }, + "sandy_water": { "elem1":"radioactive_wet_sand", "elem2":"radioactive_sand_sediment", "chance": 0.001 }, + "radioactive_sandy_water": { "elem1":"radioactive_wet_sand", "elem2":"radioactive_sand_sediment", "chance": 0.001 }, + "wet_sand": { "elem1": "radioactive_water", "elem2":"radioactive_sand_sediment", "chance": 0.0005 }, + "radioactive_wet_sand": { "elem1": "radioactive_water", "elem2":"radioactive_sand_sediment", "chance": 0.0005 }, /*"salt": { "elem1": "salt_water", "elem2": null }, "sugar": { "elem1": "sugar_water", "elem2": null, }, "dust": { "elem1": "dirty_water", "elem2": null, }, @@ -1402,8 +1442,8 @@ Proper classification of limestone within these code comments "quicklime": { "elem1": [null,null,"wet_sand"], "elem2": "slaked_lime", }, "rock": { "elem2": "wet_sand", "chance": 0.00035 }, "ruins": { "elem2": "rock", "chance": 0.00035 },*/ - "mudstone": { "elem2": "irradiated_mud", "chance": 0.00035 }, - "irradiated_mudstone": { "elem2": "irradiated_mud", "chance": 0.00035 }, + "mudstone": { "elem2": "radioactive_mud", "chance": 0.00035 }, + "radioactive_mudstone": { "elem2": "radioactive_mud", "chance": 0.00035 }, //"methane": { "elem1":"primordial_soup", "elem2":"primordial_soup", tempMin:60, charged:true }, //"ammonia": { "elem1":"primordial_soup", "elem2":"primordial_soup", tempMin:60, charged:true }, "fly": { "elem2":"dead_bug", "chance":0.1, "oneway":true }, @@ -1417,75 +1457,77 @@ Proper classification of limestone within these code comments stain: 0.01, } - elements.irradiated_sand_sediment = { + elements.radioactive_sand_sediment = { hidden: true, color: "#afd182", hardness: 0.2, behavior: [ "XX|XX|XX", "XX|XX|XX", - "SW:wet_sand,irradiated_wet_sand%1.5 AND M2|SW:wet_sand,irradiated_wet_sand%2.5 AND M1|SW:wet_sand,irradiated_wet_sand%1.5 AND M2" + "SW:wet_sand,radioactive_wet_sand%1.5 AND M2|SW:wet_sand,radioactive_wet_sand%2.5 AND M1|SW:wet_sand,radioactive_wet_sand%1.5 AND M2" ], reactions: { - "water": { "elem1":"irradiated_sandy_water", "elem2":"irradiated_sandy_water", "chance":0.025 }, - "irradiated_water": { "elem1":"irradiated_sandy_water", "elem2":"irradiated_sandy_water", "chance":0.025 }, - "sand": { "elem1": [null,null,"irradiated_wet_sand"], "elem2": "irradiated_wet_sand", }, - "irradiated_sand": { "elem1": [null,null,"irradiated_wet_sand"], "elem2": "irradiated_wet_sand", }, - "sandy_water": { "elem1":["irradiated_water","irradiated_water","irradiated_sand_sediment"], "chance":0.001 }, - "irradiated_sandy_water": { "elem1":["irradiated_water","irradiated_water","irradiated_sand_sediment"], "chance":0.001 }, - "wet_sand": { "elem2": "irradiated_sand_sediment", "chance": 0.0005 }, - "irradiated_wet_sand": { "elem2": "irradiated_sand_sediment", "chance": 0.0005 }, + "water": { "elem1":"radioactive_sandy_water", "elem2":"radioactive_sandy_water", "chance":0.025 }, + "radioactive_water": { "elem1":"radioactive_sandy_water", "elem2":"radioactive_sandy_water", "chance":0.025 }, + "sand": { "elem1": [null,null,"radioactive_wet_sand"], "elem2": "radioactive_wet_sand", }, + "radioactive_sand": { "elem1": [null,null,"radioactive_wet_sand"], "elem2": "radioactive_wet_sand", }, + "sandy_water": { "elem1":["radioactive_water","radioactive_water","radioactive_sand_sediment"], "chance":0.001 }, + "radioactive_sandy_water": { "elem1":["radioactive_water","radioactive_water","radioactive_sand_sediment"], "chance":0.001 }, + "wet_sand": { "elem2": "radioactive_sand_sediment", "chance": 0.0005 }, + "radioactive_wet_sand": { "elem2": "radioactive_sand_sediment", "chance": 0.0005 }, }, tempHigh: 1700, - stateHigh: "molten_irradiated_glass", - category: "Irradiated", + stateHigh: "molten_radioactive_glass", + category: "Radioactive", state: "solid", density: 1602, - breakInto: "irradiated_sand", + breakInto: "radioactive_sand", tick: function(pixel) { - sedimentation(pixel,sandstoneLithificationElements,"irradiated_sandstone") + sedimentation(pixel,sandstoneLithificationElements,"radioactive_sandstone") }, } - elements.irradiated_sandstone = { + elements.radioactive_sandstone = { color: ["#85b357", "#b5d177", "#9cd184", "#7bc25f"], behavior: behaviors.RAD_WALL, tempHigh: 1500, - stateHigh: "molten_irradiated_glass", - category: "Irradiated", + stateHigh: "molten_radioactive_glass", + category: "Radioactive", state: "solid", density: 2323, //wide range hardness: 0.5, - breakInto: "irradiated_sand", + breakInto: "radioactive_sand", } - elements.irradiated_water = { + elements.radioactive_water = { color: "#85cf57", behavior: behaviors.RAD_LIQUID, tempHigh: 100, stateHigh: ["rad_steam","rad_steam","fallout"], tempLow: -5, - stateLow: "irradiated_ice", - category: "Irradiated", + stateLow: "radioactive_ice", + category: "Radioactive", heatCapacity: 4.184, reactions: { - "water": { elem1: "water", elem2: "irradiated_water", chance:0.05 }, //swap + "water": { elem1: "water", elem2: "radioactive_water", chance:0.05 }, //swap "dirt": { // React with (water reacts with dirt to make mud) "elem1": null, // First element transforms into; in this case, water deletes itself - "elem2": "irradiated_dirt", // Second element transforms into; in this case, dirt turns to mud + "elem2": "radioactive_dirt", // Second element transforms into; in this case, dirt turns to mud }, - "sand": { "elem1": null, "elem2": "irradiated_wet_sand", }, - "wet_sand": { "elem1": "irradiated_sandy_water", "elem2": ["irradiated_wet_sand","irradiated_wet_sand","irradiated_wet_sand","irradiated_wet_sand","irradiated_wet_sand",null], chance: 0.01 }, - "irradiated_wet_sand": { "elem1": "irradiated_sandy_water", "elem2": ["irradiated_wet_sand","irradiated_wet_sand","irradiated_wet_sand","irradiated_wet_sand","irradiated_wet_sand",null], chance: 0.01 }, + "dry_dirt": { "elem1": null, "elem2": "radioactive_dirt", }, + "radioactive_dirt": { "elem1": null, "elem2": "radioactive_dirt", }, + "sand": { "elem1": null, "elem2": "radioactive_wet_sand", }, + "wet_sand": { "elem1": "radioactive_sandy_water", "elem2": ["radioactive_wet_sand","radioactive_wet_sand","radioactive_wet_sand","radioactive_wet_sand","radioactive_wet_sand",null], chance: 0.01 }, + "radioactive_wet_sand": { "elem1": "radioactive_sandy_water", "elem2": ["radioactive_wet_sand","radioactive_wet_sand","radioactive_wet_sand","radioactive_wet_sand","radioactive_wet_sand",null], chance: 0.01 }, "rat": { "elem2": "rotten_meat", chance:0.005 }, "plague": { "elem2": null, chance: 0.3, }, //"quicklime": { "elem1": null, "elem2": "slaked_lime", }, - "rock": { "elem2": "irradiated_wet_sand", "chance": 0.00035 }, + "rock": { "elem2": "radioactive_wet_sand", "chance": 0.00035 }, //"ruins": { "elem2": "rock", "chance": 0.00035 }, - "mudstone": { "elem2": "irradiated_mud", "chance": 0.00035 }, - "irradiated_mudstone": { "elem2": "irradiated_mud", "chance": 0.00035 }, - "packed_sand": { "elem2": "irradiated_wet_sand", "chance": 0.00035 }, - "irradiated_packed_sand": { "elem2": "irradiated_wet_sand", "chance": 0.00035 }, + "mudstone": { "elem2": "radioactive_mud", "chance": 0.00035 }, + "radioactive_mudstone": { "elem2": "radioactive_mud", "chance": 0.00035 }, + "packed_sand": { "elem2": "radioactive_wet_sand", "chance": 0.00035 }, + "radioactive_packed_sand": { "elem2": "radioactive_wet_sand", "chance": 0.00035 }, "fly": { "elem2":"dead_bug", "chance":0.1, "oneway":true }, "firefly": { "elem2":"dead_bug", "chance":0.1, "oneway":true }, "bee": { "elem2":"dead_bug", "chance":0.05, "oneway":true }, @@ -1498,85 +1540,96 @@ Proper classification of limestone within these code comments } elements.rad_steam.behavior = behaviors.RAD_GAS; - elements.rad_steam.stateLow = "irradiated_water"; + elements.rad_steam.stateLow = "radioactive_water"; elements.rad_cloud.behavior = [ "XX|XX|XX", - "XX|CH:fallout,radiation,irradiated_water%0.025|M1%2.5 AND BO", + "XX|CH:fallout,radiation,radioactive_water%0.025|M1%2.5 AND BO", "CR:radiation%0.05|CR:radiation%0.05|CR:radiation%0.05", ]; elements.rad_cloud.tempLow = 0; elements.rad_cloud.stateLow = "rad_snow_cloud"; elements.fallout.behavior = behaviors.RAD_POWDER; - elements.irradiated_permafrost = { + elements.radioactive_permafrost = { color: ["#51613d","#495234","#3b4a30","#4a4f35"], behavior: behaviors.RAD_SUPPORT, temp: -50, tempHigh: 10, - stateHigh: "irradiated_mudstone", - category: "Irradiated", + stateHigh: "radioactive_mudstone", + category: "Radioactive", state: "solid", density: 700, }; - elements.irradiated_mudstone = { + elements.radioactive_dry_permafrost = { + color: ["#6e9970","#64756a","#4e7864", "#5f8a78"], + behavior: behaviors.POWDER, //not enough water for cementing + temp: -50, + tempHigh: 10, + stateHigh: "radioactive_dry_dirt", + category: "land", + state: "solid", + density: 1200, + } + + elements.radioactive_mudstone = { color: "#4f5e25", behavior: behaviors.RAD_SUPPORT, tempHigh:1200, - stateHigh: "molten_irradiated_dirt", + stateHigh: "molten_radioactive_dirt", tempLow: -50, - stateLow: "irradiated_permafrost", - category: "Irradiated", + stateLow: "radioactive_permafrost", + category: "Radioactive", state: "solid", density: 1250, - breakInto: "irradiated_dirt", + breakInto: "radioactive_dirt", }; - elements.irradiated_packed_sand = { + elements.radioactive_packed_sand = { color: "#79945c", behavior: behaviors.RAD_SUPPORT, tempHigh: 1700, - stateHigh: "molten_irradiated_glass", - category: "Irradiated", + stateHigh: "molten_radioactive_glass", + category: "Radioactive", state: "solid", density: 1682, - breakInto: "irradiated_sand", + breakInto: "radioactive_sand", }; - elements.irradiated_ice = { + elements.radioactive_ice = { color: "#b7e0b4", behavior: behaviors.RAD_WALL, temp: 0, tempHigh: 5, - stateHigh: "irradiated_water", + stateHigh: "radioactive_water", category: "solids", state: "solid", density: 917, - breakInto: "irradiated_snow", + breakInto: "radioactive_snow", }; - elements.irradiated_snow = { + elements.radioactive_snow = { color: "#d5f2d3", behavior: behaviors.RAD_POWDER, temp: 0, tempHigh: 5, tempLow: -100, - stateLow: "irradiated_packed_snow", - stateHigh: "irradiated_water", - category: "Irradiated", + stateLow: "radioactive_packed_snow", + stateHigh: "radioactive_water", + category: "Radioactive", state: "solid", density: 100, }; - elements.irradiated_packed_snow = { + elements.radioactive_packed_snow = { color: "#a7d4a3", behavior: behaviors.RAD_SUPPORTPOWDER, temp: 0, tempHigh: 20, tempLow: -200, - stateLow: "irradiated_ice", - stateHigh: "irradiated_water", - category: "Irradiated", + stateLow: "radioactive_ice", + stateHigh: "radioactive_water", + category: "Radioactive", state: "solid", density: 400, hidden: true, @@ -1586,10 +1639,10 @@ Proper classification of limestone within these code comments color: ["#2d6e31","#416e21"], behavior: [ "XX|XX|XX", - "XX|CH:fallout,radiation,irradiated_snow%0.025|M1%2.5 AND BO", + "XX|CH:fallout,radiation,radioactive_snow%0.025|M1%2.5 AND BO", "CR:radiation%0.05|CR:radiation%0.05|CR:radiation%0.05", ], - category:"Irradiated", + category:"Radioactive", hidden: true, state: "gas", density: 0.5, @@ -1610,7 +1663,7 @@ Proper classification of limestone within these code comments "rad_snow_cloud_floater": { elem1: "rad_snow_cloud", elem2: "rad_snow_cloud", chance: 0.003 }, "rad_snow_cloud": { elem1: "rad_snow_cloud", elem2: "rad_snow_cloud", chance: 0.01 } }, - category:"Irradiated", + category:"Radioactive", hidden: true, state: "gas", density: 0.5, @@ -1619,55 +1672,55 @@ Proper classification of limestone within these code comments stateHigh: "rad_cloud", }; - elements.irradiated_rock = { + elements.radioactive_rock = { color: ["#768063","#444f3f","#7a9476"], behavior: behaviors.RAD_POWDER, tempHigh: 950, - stateHigh: "irradiated_magma", - category: "Irradiated", + stateHigh: "radioactive_magma", + category: "Radioactive", state: "solid", density: 2550, hardness: 0.5, - breakInto: ["irradiated_sand","irradiated_gravel"], + breakInto: ["radioactive_sand","radioactive_gravel"], }; - elements.irradiated_gravel = { + elements.radioactive_gravel = { color: ["#d1e3c8","#a6b090","#657360","#4d523f"], behavior: behaviors.RAD_POWDER, - category: "Irradiated", + category: "Radioactive", tempHigh: 950, - stateHigh: "irradiated_magma", + stateHigh: "radioactive_magma", state: "solid", density: 1680, hardness: 0.2, - breakInto: "irradiated_sand", + breakInto: "radioactive_sand", }; - elements.irradiated_basalt = { + elements.radioactive_basalt = { color: ["#262e20","#23331f","#3f4235"], behavior: behaviors.RAD_STURDYPOWDER, tempHigh: 1262.5, - stateHigh: "irradiated_magma", - category: "Irradiated", + stateHigh: "radioactive_magma", + category: "Radioactive", state: "solid", density: 3000, hardness: 0.65, - breakInto: "irradiated_gravel", + breakInto: "radioactive_gravel", }; - elements.irradiated_magma = { + elements.radioactive_magma = { color: ["#ff9100","#ffae00","#ff8400"], behavior: behaviors.RAD_MOLTEN, reactions: { - "ice": { "elem1": "irradiated_basalt" }, - "irradiated_ice": { "elem1": "irradiated_basalt" }, - "magma": { "elem1":"magma", "elem2":"irradiated_magma", "chance":0.0005, "oneway":true }, + "ice": { "elem1": "radioactive_basalt" }, + "radioactive_ice": { "elem1": "radioactive_basalt" }, + "magma": { "elem1":"magma", "elem2":"radioactive_magma", "chance":0.0005, "oneway":true }, }, temp: 1500, tempLow: 850, - stateLow: ["irradiated_basalt","irradiated_basalt","irradiated_basalt","irradiated_rock"], + stateLow: ["radioactive_basalt","radioactive_basalt","radioactive_basalt","radioactive_rock"], viscosity: 5000, - category: "Irradiated", + category: "Radioactive", state: "liquid", density: 2725, }; @@ -1680,7 +1733,7 @@ Proper classification of limestone within these code comments var twentiethOfTemp = pixel.temp / 20; var roundOf20th = Math.round(twentiethOfTemp); var boundedR20 = Math.max(1,Math.min(roundOf20th,11)); - transformAround(pixel,boundedR20,irradiatedObject) + transformAround(pixel,boundedR20,radioactiveObject) }, category:"machines", insulate: true, @@ -1693,7 +1746,7 @@ Proper classification of limestone within these code comments var twentiethOfTemp = pixel.temp / 20; var roundOf20th = Math.round(twentiethOfTemp); var boundedR20 = Math.max(1,Math.min(roundOf20th,11)); - transformAround(pixel,boundedR20,irradiatedObject,reverse=true) + transformAround(pixel,boundedR20,radioactiveObject,reverse=true) }, category:"machines", insulate: true, @@ -1705,7 +1758,7 @@ Proper classification of limestone within these code comments behavior: behaviors.RAD_LIQUID, tick: function(pixel) { for(i = 0; i < adjacentCoords.length; i++) { - transformAdjacent(pixel,irradiatedObject) + transformAdjacent(pixel,radioactiveObject) } }, //Becomes rainbow sand by water or poison, as well as by protocite, or bio-ooze @@ -1726,47 +1779,47 @@ Proper classification of limestone within these code comments //Inter-mod compatibility if(enabledMods.includes("mods/some_tf_liquids.js")) { - elements.irradiated_basalt_gravel = { + elements.radioactive_basalt_gravel = { color: ["#394d37", "#3b452f", "#3f452a", "#2d3d2c"], behavior: behaviors.RAD_POWDER, tempHigh: 1262.5, - stateHigh: "irradiated_magma", - category: "Irradiated", + stateHigh: "radioactive_magma", + category: "Radioactive", state: "solid", density: 1975, hardness: 0.26, } - elements.irradiated_basalt.breakInto = "irradiated_basalt_gravel"; + elements.radioactive_basalt.breakInto = "radioactive_basalt_gravel"; }; //Worldgen preset for testing - worldgentypes.irradiated_sandstone_test_ocean = { + worldgentypes.radioactive_sandstone_test_ocean = { layers: [ - [0.9, "irradiated_wet_sand", 0.2], - [0.9, "irradiated_sand", 0.2], - [0.8, "irradiated_sandy_water", 0.7], - [0.25, "irradiated_water"], - [0.1, "irradiated_sand", 0.1], + [0.9, "radioactive_wet_sand", 0.2], + [0.9, "radioactive_sand", 0.2], + [0.8, "radioactive_sandy_water", 0.7], + [0.25, "radioactive_water"], + [0.1, "radioactive_sand", 0.1], [0.1, "clay", 0.1], - [0.1, "irradiated_gravel", 0.2], - [0.1, "irradiated_wet_sand"], - [0.03, "irradiated_gravel", 0.5], - [0.03, "irradiated_rock"], - [0, "irradiated_basalt"], + [0.1, "radioactive_gravel", 0.2], + [0.1, "radioactive_wet_sand"], + [0.03, "radioactive_gravel", 0.5], + [0.03, "radioactive_rock"], + [0, "radioactive_basalt"], ] }; /*/Water irradiation reactions (must be done last) - waterIrradiationExclusionArray = ["irradiated_water", "irradiated_wet_sand"] + waterIrradiationExclusionArray = ["radioactive_water", "radioactive_wet_sand"] filteredWaterIrradiationArray = Object.keys(elements).filter(function(e) { - return elements[e].category === "Irradiated" && (!waterIrradiationExclusionArray.includes(e)); + return elements[e].category === "Radioactive" && (!waterIrradiationExclusionArray.includes(e)); }); for(i = 0; i < filteredWaterIrradiationArray.length; i++) { - elements.water.reactions[filteredWaterIrradiationArray[i]] = { "elem1":"irradiated_water", chance: 0.01 } + elements.water.reactions[filteredWaterIrradiationArray[i]] = { "elem1":"radioactive_water", chance: 0.01 } };*/ //Generation @@ -1895,11 +1948,11 @@ Proper classification of limestone within these code comments [0.82, "fallout", 0.4], [0.7, "liquid_irradium", 0.05], [0.7, "dead_plant", 0.12], - [0.55, "irradiated_dirt"], - [0.45, "irradiated_rock"], + [0.55, "radioactive_dirt"], + [0.45, "radioactive_rock"], [0.25, "uranium", 0.4], - [0.35, "irradiated_rock", 0.5], - [0.3, "irradiated_gravel", 0.5], + [0.35, "radioactive_rock", 0.5], + [0.3, "radioactive_gravel", 0.5], [0.2, "uranium", 0.2], [0.05, "rock"], [0, "basalt"], @@ -1933,23 +1986,23 @@ Proper classification of limestone within these code comments ] }; - //Irradiated Desert + //Radioactive Desert //Main preset worldgentypes.nuclear_wasteland_desert = { layers: [ [0.97, "fallout", 0.4], - [0.95, "irradiated_gravel", 0.6], + [0.95, "radioactive_gravel", 0.6], [0.65, "liquid_irradium", 0.01], [0.65, "cancer", 0.02], [0.65, "bone", 0.02], - [0.65, "irradiated_sand"], + [0.65, "radioactive_sand"], [0.55, "cancer", 0.01], [0.55, "bone", 0.01], - [0.3, "irradiated_sandstone"], - [0.05, "irradiated_rock"], - [-0.78, "irradiated_basalt"] + [0.3, "radioactive_sandstone"], + [0.05, "radioactive_rock"], + [-0.78, "radioactive_basalt"] ], temperature: -13 };