Merge branch 'main' of https://github.com/slweeb/sandboxels
This commit is contained in:
commit
8638179e4c
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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). <span onclick=distanceScalePrompt() style=\"color: #ff00ff;\";>Click here</span> to open the scale prompt.<br/><em>Note: Info pages do not update automatically and must be closed and reopened to show the changed scale.</em>`;
|
||||
};
|
||||
|
|
|
|||
590
mods/chem.js
590
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
|
||||
|
|
|
|||
|
|
@ -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).`);
|
||||
};
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
};
|
||||
});
|
||||
|
|
@ -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)) {
|
||||
|
|
|
|||
|
|
@ -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,
|
|||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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)<fireChance && !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 = fireTemp;
|
||||
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 = fireTemp;
|
||||
if (info.fireColor != undefined) {
|
||||
pixelMap[pixel.x][pixel.y+1].color = pixelColorPick(pixelMap[pixel.x][pixel.y+1],info.fireColor);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Use other pixels' reactions as if they were meant for the calling pixel
|
||||
function reactionStealer(pixel,newPixel,reactionTarget) {
|
||||
if(!elements[reactionTarget]) {
|
||||
throw new Error(`No such element ${reactionTarget}!`);
|
||||
};
|
||||
if(typeof(newPixel) === "undefined") { //timing issue?
|
||||
return false;
|
||||
};
|
||||
var newElement = newPixel.element;
|
||||
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 = 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) {
|
||||
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";
|
||||
};
|
||||
});
|
||||
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -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",
|
||||
};
|
||||
|
|
@ -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. <br/>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. <br/>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. <br/>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}<br/>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).`)
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 = `<div>
|
||||
<span id="downloadButton" onclick=savePrompt() style="color: #FF00FF;">Download simulation</span>
|
||||
<span id="copyButton" onClick=copySaveJSON() style="color: #FF66FF;">Alternatively, copy simulation JSON</span>
|
||||
|
||||
<span id="fileFormStatus">No file loader status</span>
|
||||
One file, please: <input type="file" name="" id="myfile">
|
||||
One file, please: <input type="file" name="Save upload button" id="myfile">
|
||||
<button id="loadButton" onclick=loadFile() style="color: #FF00FF;">Load File</button>
|
||||
<span>Or paste JSON</span>
|
||||
<span id="textFormStatus">No text loader status</span>
|
||||
<input name="Text load field" id="mytext">
|
||||
<button id="textLoadButton" onclick=loadText() style="color: #FF66FF;">Load Text</button>
|
||||
|
||||
<span id="pixelSizeStatus">No size setter status</span>
|
||||
Pixel size (rendering only): <input id="pixelSize"> (Use if the save looks cut off)
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
elements.HelloWorld = {
|
||||
color: "#100D5E",
|
||||
behavior: behaviors.WALL,
|
||||
category: "land",
|
||||
state: "solid"
|
||||
density: 720,
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue