diff --git a/mod-list.html b/mod-list.html index ddfd8508..e812157e 100644 --- a/mod-list.html +++ b/mod-list.html @@ -263,6 +263,7 @@ volcanic_expansion.jsAdds Obsidian, Pumice, and Andesite rocksJayd Fun & Games +10kelements.jsInserts a customizable amount of randomly generated elements into the gamenousernamefound all_around_fillers.jsAdds directional Filler variantsidk73248 allliquids.jsMade all elements liquidsAdora amogus.jsAdds a small amogus structureAlice diff --git a/mods/10kelements.js b/mods/10kelements.js index a74a78e7..4f8ab487 100644 --- a/mods/10kelements.js +++ b/mods/10kelements.js @@ -1,11 +1,31 @@ -var color = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "a", "b", "c", "d", "e","f"] -var states = ["solid", "liquid", "gas"] -var total = 0 -var dangerouselements = ["supernova", "n_explosion", "pn_explosion", "armageddon", "nuke", "h_bomb"] var elementslist = [] for (elementi in elements){ elementslist.push(elementi) } +elements.change_count = { + color: "#34eb86", + canPlace: false, + behavior: behaviors.SELFDELETE, + onSelect: function() { + var cans = prompt("Please input how many elements you would like to be generared each time.", 10000); + if (!cans) { return } + if (cans > 2000000){alert("You have put too big of a number! This would surely crash your browser or eat up all your RAM! Element count will remain unchanged."); return} + if (cans < 1 && (parseInt(cans) > -1) ){alert("You have either put a decimal or zero. Why? Element count will remain unchanged."); return} + if (isNaN(parseInt(cans))){alert("Apparently your input isnt even a number. Try again. Element count will remain unchanged."); return} + settings.randomcount = parseInt(cans) + saveSettings() + }, + category: "random" +} +var choosebehaviors = behaviors +delete choosebehaviors.KILLPIXEL2 +delete choosebehaviors.KILLPIXEL1 +if (!settings.randomcount){settings.randomcount = 10000; saveSettings()} +var color = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "a", "b", "c", "d", "e","f"] +var states = ["solid", "liquid", "gas"] +var essentialelements = ["molten_gallium", "gallium", "gallium_gas", "change_count"] +var total = 0 +var dangerouselements = ["supernova", "n_explosion", "pn_explosion", "armageddon", "nuke", "h_bomb"] function randomIntFromInterval(min, max) { // min and max included return Math.floor(Math.random() * (max - min + 1) + min) } @@ -13,41 +33,70 @@ var randomProperty = function (obj) { var keys = Object.keys(obj); return obj[keys[ keys.length* Math.random() << 0]]; }; -for (var i = 1; i <= 10000; i++){ - var f = Math.random() < 0.2 - var co = Math.random() < 0.2 - elements["element_"+i] = { - color: "#" + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)], - category: "random", - behavior: randomProperty(behaviors), - state: states[Math.floor(Math.random()*states.length)], - reactions: {}, - density: randomIntFromInterval(1, 10000) +if (Math.abs(settings.randomcount) == settings.randomcount){ + for (var i = 1; i <= settings.randomcount; i++){ + var f = Math.random() < 0.2 + var co = Math.random() < 0.2 + elements["element_"+i] = { + color: "#" + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)] + color[Math.floor(Math.random()*color.length)], + category: "random", + behavior: randomProperty(choosebehaviors), + state: states[Math.floor(Math.random()*states.length)], + reactions: {}, + density: randomIntFromInterval(1, 10000) + } + total = i + if (f){ + elements["element_"+i].tempHigh = 20 + randomIntFromInterval(10, 6000) + elements["element_"+i].stateHigh = elementslist[Math.floor(Math.random()*elementslist.length)] + } + if (co){ + elements["element_"+i].tempLow = 20 - randomIntFromInterval(10, 270) + elements["element_"+i].stateLow = elementslist[Math.floor(Math.random()*elementslist.length)] + } + for (r = 0; r < 10; r++){ + elements["element_"+i].reactions[elementslist[Math.floor(Math.random()*elementslist.length)]] = { elem1: elementslist[Math.floor(Math.random()*elementslist.length)], elem2: elementslist[Math.floor(Math.random()*elementslist.length)]} + } + // console.log(i + " is done!") + // console.log(i) + // console.log(elements["element_"+i].behavior) + if (elements["element_" + i].density == i){ + console.log(i + "is unique because its density is the same as its id!") } - total = i - if (f){ - elements["element_"+i].tempHigh = 20 + randomIntFromInterval(10, 6000) - elements["element_"+i].stateHigh = elementslist[Math.floor(Math.random()*elementslist.length)] - } - if (co){ - elements["element_"+i].tempLow = 20 - randomIntFromInterval(10, 270) - elements["element_"+i].stateLow = elementslist[Math.floor(Math.random()*elementslist.length)] - } - for (r = 0; r < 10; r++){ - elements["element_"+i].reactions[elementslist[Math.floor(Math.random()*elementslist.length)]] = { elem1: elementslist[Math.floor(Math.random()*elementslist.length)], elem2: elementslist[Math.floor(Math.random()*elementslist.length)]} - } - // console.log(i + " is done!") - // console.log(i) - // console.log(elements["element_"+i].behavior) - if (elements["element_" + i].density == i){ - console.log(i + "is unique because its density is the same as its id!") - } - for (var reaction in elements["element_" + i].reactions){ - if (dangerouselements.includes(elements["element_" + i].reactions[reaction].elem1)|| dangerouselements.includes(elements["element_" + i].reactions[reaction].elem2)){ - console.log(i + " is scary due to its reaction with " + reaction) - if (!elements["element_"+i].desc){ - elements["element_" + i].desc = "This is scary! Don't let it touch " + reaction - }else(elements["element_"+i].desc += (" or " + reaction)) + for (var reaction in elements["element_" + i].reactions){ + if (dangerouselements.includes(elements["element_" + i].reactions[reaction].elem1)|| dangerouselements.includes(elements["element_" + i].reactions[reaction].elem2)){ + console.log(i + " is scary due to its reaction with " + reaction) + if (!elements["element_"+i].desc){ + elements["element_" + i].desc = "This is scary! Don't let it touch " + reaction + }else(elements["element_"+i].desc += (" or " + reaction)) + } } } +} else { + window.addEventListener('load', function() { + elementslist = [] + for (elementi in elements){ + elementslist.push(elementi) + } + var eLen = elementslist.length + const p = document.createElement("p"); +p.innerText = `v${currentversion} • ` +(eLen - Math.abs(settings.randomcount)) +` elements, with 0 hidden`; +document.getElementById("extraInfo").querySelectorAll("small")[1].replaceChildren(p); + if (Math.abs(settings.randomcount) > elementslist.length){ + console.log("mode 1") + for (var elementi in elements){ + if(!essentialelements.includes(elementi)){ + document.getElementById("elementButton-" + elementi)?.remove() + console.log(elementi) + } + } + } else for (var i = 1; i <= Math.abs(settings.randomcount); i++){ + var elementi = elementslist[Math.floor(Math.random()*elementslist.length)] + if(!essentialelements.includes(elementi)){ + elementslist.splice(elementslist.indexOf(elementi), 1) + document.getElementById("elementButton-" + elementi)?.remove() + console.log(elementi) + } + } +}) } \ No newline at end of file diff --git a/mods/Science_mod.js b/mods/Science_mod.js new file mode 100644 index 00000000..df1eab48 --- /dev/null +++ b/mods/Science_mod.js @@ -0,0 +1,1112 @@ +// Science mod for Sandboxels +// (Inspired by survival.js) +// By: Lucifer (@a_british_proto (Discord)) +// If there is anything you want to suggest or there's a bug then just dm me on discord +// Todo: +// - Try to get the mod to work by making different ways to craft all the (116) elements in the mod +// - Make new substances that you can get after mixing different elements +// - Make a way to get the different substances by mixing different elements and different substances +// - Create different proporties for the substances (doing now) + +// How much of the elements you're gonna have when you start: + +if (!settings.Science_mod) { + settings.Science_mod = { + "Hydrogen": 9.223372036854776e+18, + "Helium": 9.223372036854776e+18, + "Lithium": 9.223372036854776e+18, + "Beryllium": 9.223372036854776e+18, + "Boron": 9.223372036854776e+18, + "Carbon": 9.223372036854776e+18, + "Oxygen": 9.223372036854776e+18, + "Flourine": 9.223372036854776e+18, + "Neon": 9.223372036854776e+18, + "Sodium": 9.223372036854776e+18, + "Magnesium": 9.223372036854776e+18, + "Aluminum": 9.223372036854776e+18, + "Silicon": 9.223372036854776e+18, + "Phosphorus": 9.223372036854776e+18, + "Sulphur": 9.223372036854776e+18, + "Chlorine": 9.223372036854776e+18, + "Argon": 9.223372036854776e+18, + "Potassium": 9.223372036854776e+18, + "Calcium": 9.223372036854776e+18, + "Scandium": 9.223372036854776e+18, + "Titanium": 9.223372036854776e+18, + "Vanadium": 9.223372036854776e+18, + "Chromium": 9.223372036854776e+18, + "Manganese": 9.223372036854776e+18, + "Iron": 9.223372036854776e+18, + "Cobalt": 9.223372036854776e+18, + "Nickel": 9.223372036854776e+18, + "Copper": 9.223372036854776e+18, + "Zinc": 9.223372036854776e+18, + "Gallium": 9.223372036854776e+18, + "Germanium": 9.223372036854776e+18, + "Arsenic": 9.223372036854776e+18, + "Selenium": 9.223372036854776e+18, + "Bromine": 9.223372036854776e+18, + "Krypton": 9.223372036854776e+18, + "Rubidium": 9.223372036854776e+18, + "Strontium": 9.223372036854776e+18, + "Yttrium": 9.223372036854776e+18, + "Zirconium": 9.223372036854776e+18, + "Niobium": 9.223372036854776e+18, + "Molybdenum": 9.223372036854776e+18, + "Technetium": 9.223372036854776e+18, + "Ruthenium": 9.223372036854776e+18, + "Rhodium": 9.223372036854776e+18, + "Palladium": 9.223372036854776e+18, + "Silver": 9.223372036854776e+18, + "Cadmium": 9.223372036854776e+18, + "Indium": 9.223372036854776e+18, + "Tin": 9.223372036854776e+18, + "Antimony": 9.223372036854776e+18, + "Tellurium": 9.223372036854776e+18, + "Iodine": 9.223372036854776e+18, + "Xenon": 9.223372036854776e+18, + "Cesium": 9.223372036854776e+18, + "Barium": 9.223372036854776e+18, + "Lanthanum": 9.223372036854776e+18, + "Cerium": 9.223372036854776e+18, + "Praseodymium": 9.223372036854776e+18, + "Neodymium": 9.223372036854776e+18, + "Promethium": 9.223372036854776e+18, + "Samarium": 9.223372036854776e+18, + "Europium": 9.223372036854776e+18, + "Gadolinium": 9.223372036854776e+18, + "Terbium": 9.223372036854776e+18, + "Dysprosium": 9.223372036854776e+18, + "Holmium": 9.223372036854776e+18, + "Erbium": 9.223372036854776e+18, + "Thulium": 9.223372036854776e+18, + "Ytterbium": 9.223372036854776e+18, + "Lutetium": 9.223372036854776e+18, + "Hafnium": 9.223372036854776e+18, + "Tantalum": 9.223372036854776e+18, + "Tungsten": 9.223372036854776e+18, + "Rhenium": 9.223372036854776e+18, + "Osmium": 9.223372036854776e+18, + "Iridium": 9.223372036854776e+18, + "Platinum": 9.223372036854776e+18, + "Gold": 9.223372036854776e+18, + "Mercury": 9.223372036854776e+18, + "Thallium": 9.223372036854776e+18, + "Lead": 9.223372036854776e+18, + "Bismuth": 9.223372036854776e+18, + "Polonium": 9.223372036854776e+18, + "Astatine": 9.223372036854776e+18, + "Radon": 9.223372036854776e+18, + "Francium": 9.223372036854776e+18, + "Radium": 9.223372036854776e+18, + "Actinium": 9.223372036854776e+18, + "Thorium": 9.223372036854776e+18, + "Protactinium": 9.223372036854776e+18, + "Uranium": 9.223372036854776e+18, + "Neptunium": 9.223372036854776e+18, + "Plutonium": 9.223372036854776e+18, + "Americium": 9.223372036854776e+18, + "Curium": 9.223372036854776e+18, + "Berkelium": 9.223372036854776e+18, + "Californium": 9.223372036854776e+18, + "Einsteinium": 9.223372036854776e+18, + "Fermium": 9.223372036854776e+18, + "Mendelevium": 9.223372036854776e+18, + "Nobelium": 9.223372036854776e+18, + "Lawrencium": 9.223372036854776e+18, + "Rutherfordium": 9.223372036854776e+18, + "Dubnium": 9.223372036854776e+18, + "Seaborgium": 9.223372036854776e+18, + "Bohrium": 9.223372036854776e+18, + "Hassium": 9.223372036854776e+18, + "Meitnerium": 9.223372036854776e+18, + "Darmstadtium": 9.223372036854776e+18, + "Roentgenium": 9.223372036854776e+18, + "Copernicium": 9.223372036854776e+18, + "Nihonium": 9.223372036854776e+18, + "Flerovium": 9.223372036854776e+18, + "Moscovium": 9.223372036854776e+18, + "Livermorium": 9.223372036854776e+18, + "Tennessine": 9.223372036854776e+18, + "Oganesson": 9.223372036854776e+18, + } +} + +// Element proporties (all proporties have hidden:false as these are what you start with +// and you don't have to craft them): + +// All of these are before the reaction when you add different stuff to these elements/substances +// happens (same with the substances) + +element.Hydrogen = { + behavior: behaviors.GAS, + color:"D3D3D3", + category:"gases", + state:"gas", + hidden:false +} + +element.Helium = { + behavior: behaviors.GAS, + color:"C0C0C0", + category:"gases", + state:"gas", + hidden:false +} + +element.Lithium = { + behavior: behaviors.WALL, + color:"DADBDD", + category:"land", + state:"solid", + hidden:false +} + +element.Beryllium = { + behavior: behaviors.WALL, + color:"DADBDD", + category:"land", + state:"solid", + hidden:false +} + +element.Boron = { + behavior: behaviors.WALL, + color:"964B00", + category:"land", + state:"solid", + hidden:false +} + +element.Carbon = { + behavior: behaviors.GAS, + color:"000000", + category:"gases", + state:"gas", + hidden:false +} + +element.Nitrogen = { + behavior: behaviors.GAS, + color:"0000FF", + category:"gases", + state:"gas", + hidden:false +} + +element.Oxygen = { + behavior: behaviors.GAS, + color:"000000", + category:"gases", + state:"gas", + hidden:false +} + +element.Fluorine = { + behavior: behaviors.WALL, + color:"FFFF00", + category:"land", + state:"solid", + hidden:false +} + +element.Neon = { + behavior: behaviors.GAS, + color:"FFFFFF", + category:"gases", + state:"gas", + hidden:false +} + +element.Sodium = { + behavior: behaviors.WALL, + color:"A0522D", + category:"land", + state:"solid", + hidden:false +} + +element.Magnesium = { + behavior: behaviors.WALL, + color:"F0C8A0", + category:"land", + state:"solid", + hidden:false +} + +element.Aluminum = { + behavior: behaviors.WALL, + color:"C0C0C0", + category:"land", + state:"solid", + hidden:false +} + +element.Silicon = { + behavior: behaviors.WALL, + color:"C0C0C0", + category:"land", + state:"solid", + hidden:false +} + +element.Phosphorus = { + behavior: behaviors.WALL, + color:"FF0000", + category:"land", + state:"solid", + hidden:false +} + +element.Sulfur = { + behavior: behaviors.WALL, + color:"FFFF00", + category:"land", + state:"solid", + hidden:false +} + +element.Chlorine = { + behavior: behaviors.GAS, + color:"FFFFFF", + category:"gases", + state:"gas", + hidden:false +} + +element.Argon = { + behavior: behaviors.GAS, + color:"FFFFFF", + category:"gases", + state:"gas", + hidden:false +} + +element.Potassium = { + behavior: behaviors.WALL, + color:"00FF00", + category:"land", + state:"solid", + hidden:false +} + +element.Calcium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Scandium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Titanium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Vanadium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Chromium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Manganese = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Iron = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Cobalt = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Nickel = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Copper = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Zinc = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Gallium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Germanium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Arsenic = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Selenium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Bromine = { + behavior: behaviors.LIQUID, + color:"FFFFFF", + category:"liquids", + state:"liquid", + hidden:false +} + +element.Krypton = { + behavior: behaviors.GAS, + color:"FFFFFF", + category:"gases", + state:"gas", + hidden:false +} + +element.Rubidium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Strontium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Yttrium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Zirconium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Niobium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Molybdenum = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Technetium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Ruthenium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Rhodium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Palladium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Silver = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Cadmium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Indium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Tin = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Antimony = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Tellurium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Iodine = { + behavior: behaviors.GAS, + color:"FFFFFF", + category:"gases", + state:"gas", + hidden:false +} + +element.Xenon = { + behavior: behaviors.GAS, + color:"FFFFFF", + category:"gases", + state:"gas", + hidden:false +} + +element.Caesium = { + behavior: behaviors.GAS, + color:"FFFFFF", + category:"gases", + state:"gas", + hidden:false +} + +element.Barium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Lanthanum = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Cerium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Praseodymium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Neodymium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Promethium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Samarium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Europium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Gadolinium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Terbium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Dysprosium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Holmium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Erbium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Thulium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Ytterbium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Lutetium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Hafnium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Tantalum = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Tungsten = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Rhenium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Osmium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Iridium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Platinum = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Gold = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Mercury = { + behavior: behaviors.LIQUID, + color:"00FFFF", + category:"liquids", + state:"liquid", + hidden:false +} + +element.Thallium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Lead = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Bismuth = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Polonium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Astatine = { + behavior: behaviors.GAS, + color:"FFFFFF", + category:"gases", + state:"gas", + hidden:false +} + +element.Radon = { + behavior: behaviors.GAS, + color:"FFFFFF", + category:"gases", + state:"gas", + hidden:false +} + +element.Francium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Radium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Actinium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Thorium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Protactinium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Uranium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Neptunium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Plutonium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Americium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Curium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Berkelium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Californium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Einsteinium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Fermium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Mendelevium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Nobelium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Lawrencium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Rutherfordium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Dubnium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Seaborgium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Bohrium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Hassium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Meitnerium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Darmstadtium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Roentgenium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Copernicium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Nihonium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Flerovium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Moscovium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Livermorium = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Tennessine = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +element.Oganesson = { + behavior: behaviors.WALL, + color:"00FFFF", + category:"land", + state:"solid", + hidden:false +} + +// Substance proporties (These are the properties of the substances, not the elements These properties +// use hidden:true as you don't start with these but instead have to craft them): + +substance.Polystyrene = { + behavior: behaviors.WALL, + color:"FFFFFF", + category:"land", + state:"solid", + hidden:true +} + +substance.Styrene = { + behavior: behaviors.LIQUID, + color:"FFFFED", + category:"liquids", + state:"liquid", + hidden:true +} + +substance.Cinnamaldehyde = { + behavior: behaviors.LIQUID, + color:"FDFD96", + category:"liquids", + state:"liquid", + hidden:true +} + +// Doing more tmrw diff --git a/mods/Thread.js b/mods/Thread.js index 1d04fa7e..03c22ff4 100644 --- a/mods/Thread.js +++ b/mods/Thread.js @@ -1,23 +1,25 @@ elements.thread = { color: "#fff3e6", - behavior: behaviors.STURDYPOWDER, + behavior: behaviors.SUPPORTPOWDER, category: "thread", state: "solid", tempHigh: "50", stateHigh: "ash", hardness: "0.2", - breakInto: "wool" + breakInto: "wool", density: " 1314", burn: "99", - burnTime: "40" + burnTime: "40", burnInto: "ash", reactions: { "weavepowder": { elem1: null, elem2: "rope" }, -}; + + } +} elements.wool = { color: "#e2e1d8", - behavior: behaviors.POWDER, + behavior: behaviors.STURDYPOWDER, category: "thread", state: "solid", tempHigh: "40", @@ -25,11 +27,12 @@ elements.wool = { hardness: "1", density: " 1314", burn: "90", - burnTime: "40" + burnTime: "40", burnInto: "ash", reactions: { "weavepowder": { elem1: null, elem2: "thread" }, -}; + } +} elements.weavepowder = { color: "#494736", behavior: behaviors.POWDER, @@ -40,23 +43,105 @@ elements.weavepowder = { hardness: "1", density: " 1314", burn: "0", - burnTime: "0" + burnTime: "0", burnInto: "dust", reactions: { - "wool": { elem1: thread, elem2: "null" }, - "thread": { elem1: rope, elem2: "null" }, -}; + "wool": { elem1: "thread", elem2: null }, + "thread": { elem1: "rope", elem2: null }, + } + +} elements.rope = { color: "#ffe6cc", - behavior: behaviors.STURDYPOWDER, + behavior: behaviors.SUPPORT, category: "thread", state: "solid", tempHigh: "60", stateHigh: "ash", hardness: "0.4", - breakInto: "thread" + breakInto: "thread", density: " 1314", burn: "85", - burnTime: "50" + burnTime: "50", burnInto: "ash", +} +elements.sheep = { + color: ["#FFFFE8", "#F4FFFF", "#FFF7F2","#796464","#282828"], + behavior: [ + "M2%1|M2%1|M2%1", + "M2%3|XX|M2%3", + "XX|M1|XX", + ], + reactions: { + "grass": { elem2:null, chance:0.04, func:behaviors.FEEDPIXEL }, + "dead_plant": { elem2:null, chance:0.04, func:behaviors.FEEDPIXEL }, + "plant": { elem2:null, chance:0.04, func:behaviors.FEEDPIXEL }, + "oxygen": { elem2:"carbon_dioxide", chance:0.3 }, + "mercury": { elem1:"rotten_meat", chance:0.1 }, + "bleach": { elem1:"rotten_meat", chance:0.1 }, + "infection": { elem1:"rotten_meat", chance:0.025 }, + "uranium": { elem1:"rotten_meat", chance:0.1 }, + "cyanide": { elem1:"rotten_meat", chance:0.1 }, + "chlorine": { elem1:"meat", chance:0.1 }, + "alcohol": { elem1:"meat", chance:0.025 }, + "dirty_water": { elem1:"rotten_meat", chance:0.0001 }, + "pool_water": { elem1:"rotten_meat", chance:0.005 }, + "vinegar": { elem1:"rotten_meat", chance:0.001 }, + "body": { elem1:["wool","sheep"], chance:0.1 }, + }, + egg: "lamb", + foodNeed: 10, + temp: 30, + tempHigh: 100, + stateHigh: "cooked_meat", + tempLow: -18, + stateLow: "frozen_meat", + category:"life", + breakInto: ["meat", "wool"], + burn:15, + burnTime:300, + state: "solid", + density: 1450, + conduct: 0.2 +}; + +elements.lamb = { + color: ["#FFFFE8", "#F4FFFF", "#FFF7F2","#796464","#282828"], + state: "solid", + behavior: [ + "M2%1|M2%2|M2%1", + "M2%4|FX%5 AND CH:sheep%0.1|M2%4", + "XX|M1|XX", + ], + reactions: { + "grass": { elem2:null, chance:0.05, func:behaviors.FEEDPIXEL }, + "dead_plant": { elem2:null, chance:0.05, func:behaviors.FEEDPIXEL }, + "plant": { elem2:null, chance:0.05, func:behaviors.FEEDPIXEL }, + "oxygen": { elem2:"carbon_dioxide", chance:0.3 }, + "mercury": { elem1:"rotten_meat", chance:0.1 }, + "bleach": { elem1:"rotten_meat", chance:0.1 }, + "infection": { elem1:"rotten_meat", chance:0.025 }, + "uranium": { elem1:"rotten_meat", chance:0.1 }, + "cyanide": { elem1:"rotten_meat", chance:0.1 }, + "chlorine": { elem1:"meat", chance:0.1 }, + "alcohol": { elem1:"meat", chance:0.025 }, + "dirty_water": { elem1:"rotten_meat", chance:0.0001 }, + "pool_water": { elem1:"rotten_meat", chance:0.005 }, + "vinegar": { elem1:"rotten_meat", chance:0.001 }, + "body": { elem1:["wool","sheep"], chance:0.1 }, + }, + egg: "lamb", + foodNeed: 20, + temp: 30, + tempHigh: 100, + stateHigh: "cooked_meat", + tempLow: -18, + stateLow: "frozen_meat", + category:"life", + breakInto: ["meat","wool"], + burn:15, + burnTime:300, + state: "solid", + density: 1450, + conduct: 0.2 }; diff --git a/mods/UAMM.js b/mods/UAMM.js new file mode 100644 index 00000000..bb229509 --- /dev/null +++ b/mods/UAMM.js @@ -0,0 +1,156 @@ +console.log("Thanks for using UAMM!") + +elements.rubidium = { + color: ["#b5b5b5", "#c9c9c9", "#d6cccb"], + behavior: behaviors.POWDER, + category: "powders", + state: "solid", + tempHigh: 39.3, + stateHigh: "liquid_rubidium", + density: 1532, + tick: function (pixel){ + var foundelem1 = false + var foundelem2 = false + for (var i = 0; i < squareCoords.length; i++) { + var coord = squareCoords[i]; + var x = pixel.x+coord[0]; + var y = pixel.y+coord[1]; + if(!isEmpty(x, y, true)){ + var otherPixel = pixelMap[x][y] + if (otherPixel.element == "liquid_ammonia"){foundelem1 = true; break} + } + } + for (var i = 0; i < squareCoords.length; i++) { + var coord = squareCoords[i]; + var x = pixel.x+coord[0]; + var y = pixel.y+coord[1]; + if(!isEmpty(x, y, true)){ + var otherPixel = pixelMap[x][y] + if (otherPixel.element == "oxygen"){foundelem2 = true; break} + } + } + if (foundelem1 && foundelem2){changePixel(pixel, "rubidium_peroxide", false)} + }, + reactions: { + "water": {elem1: "pop", elem2: "hydrogen", temp2: 400}, + "oxygen": {elem1: "rubidium_superoxide", elem2: null, chance: 0.3} + } +}; + +elements.liquid_rubidium = { + color: ["#cccccc", "#ebe8e8", "#f2e7e6"], + behavior: behaviors.LIQUID, + hidden: true, + state: "liquid", + tempLow: 38, + stateLow: "rubidium", + density: 1475, + reactions: { + "water": {elem1: "pop", elem2: "hydrogen", temp2: 400} + } +} + +elements.rubidium_superoxide = { + color: ["#eded00", "#ffff26", "#e3e33d"], + behavior: behaviors.POWDER, + hidden: true, + state: "solid", + tempHigh: 340, + stateHigh: "rubidium_peroxide", + density: 1532, + reactions: { + "water": {elem2: null} + } +}; + +elements.rubidium_peroxide = { + color: ["#fffed9", "#ffffe8", "#edede4"], + behavior: behaviors.POWDER, + hidden: true, + state: "solid", + density: 1532, + reactions: { + "water": {elem2: null} + } +}; + +elements.cesium = { + color: ["#e3a814", "#dbab32", "#e8bc4f", "#fabf2d"], + behavior: behaviors.POWDER, + category: "powders", + state: "solid", + fireColor: "#8c21de", + burn: 1, + burnTime: 500, + tempHigh: 29, + stateHigh: "liquid_cesium", + density: 1873, + reactions: { + "water": {func: (pixel1) => {pixel1.burning=true;pixel1.burnStart=pixelTicks}, + elem1: "pop", elem2: ["smoke", "fire"], temp2: 22}, + "fire": {elem1: ["smoke", "pop"]} + } +}; + +elements.liquid_cesium = { + color: ["#ebb121", "#edbd42", "#f5cb62", "#fcd26a"], + behavior: behaviors.LIQUID, + hidden: true, + state: "liquid", + tempLow: 28, + stateLow: "cesium", + density: 1842, + reactions: { + "water": {func: (pixel1) => {pixel1.burning=true;pixel1.burnStart=pixelTicks}, + elem1: "pop", elem2: ["smoke", "fire"], temp2: 22}, + "radiation": {elem1: "liquid_radiocesium", elem2: "smoke", chance: 0.65} + } +}; + +elements.radiocesium = { + color: ["#c7bda5", "#ada287", "#99958b", "#d1ccc0"], + behavior: [ + "XX|CR:radiation%1|XX", + "CR:radiation%1|XX|CR:radiation%1", + "M2|M1|M2", + ], + hidden: true, + state: "solid", + fireColor: "#8c21de", + burn: 1, + burnTime: 500, + tempHigh: 29, + stateHigh: "liquid_radiocesium", + density: 1873, + reactions: { + "water": {func: (pixel1) => {pixel1.burning=true;pixel1.burnStart=pixelTicks}, + elem1: ["rad_steam", "fallout"], elem2: "explosion"} + } +} + +elements.liquid_radiocesium = { + color: ["#e8dcc1", "#d4c6a5", "#bfbaae", "#f5f1e9"], + behavior: behaviors.RADMOLTEN, + hidden: true, + state: "liquid", + tempLow: 28, + stateLow: "radiocesium", + density: 1842, + reactions: { + "water": {func: (pixel1) => {pixel1.burning=true;pixel1.burnStart=pixelTicks}, + elem1: ["rad_steam", "fallout"], elem2: "explosion"} + } +} + +elements.lithium = { + color: ["#e3a814", "#dbab32", "#e8bc4f", "#fabf2d"], + behavior: behaviors.POWDER, + category: "powders", + state: "solid", + fireColor: "#8c21de", + burn: 1, + burnTime: 500, + tempHigh: 29, + stateHigh: "liquid_cesium", + density: 534, +} diff --git a/mods/community_desserts.js b/mods/community_desserts.js index 54307048..b4ae1e81 100644 --- a/mods/community_desserts.js +++ b/mods/community_desserts.js @@ -4,125 +4,185 @@ * Don't see your favorite dessert? Let me know! * * Got questions? Contact tisqbisque on Discord! + * + * This version: 1.1 */ -// Dulce de leche items - BASE COMPLETE + +// Dulce de leche items elements.dulce_de_leche = { + alias: "manjar", color: ["#c56600","#f7a204","#ca6400","#893604"], category: "Community", - behavior: behaviors.STURDYPOWDER, + state: "liquid", + behavior: behaviors.LIQUID, + reactions: { + "cream_cheese": { elem1:"dulce_de_leche", elem2:null, color1:["#DFAB73","#fbcc75","#e2aa73","#be9075"], oneway:true }, // for recipe accuracy :3 + }, + tempLow: -20, + stateLow: "candy", tempHigh: 250, stateHigh: ["fragrance","smoke","smoke"], + viscosity: 500, + stain: 0.02, + density: 1284.93, hidden: true, - desc: "Added in the first version of the mod. From undexconocidox_26419.\n" + isFood: true, + desc: "Added in the first version of the mod.\nMade by heating Sweetened Condensed Milk at 175°C+.\nFrom undexconocidox_26419.\n" } elements.sweetened_condensed_milk = { color: ["#ffe9ba","#fbd396","#fde2a9"], category: "Community", + state: "liquid", behavior: behaviors.LIQUID, + tempLow: 0, + stateLow: ["ice_cream","sugar"], tempHigh: 175, stateHigh: "dulce_de_leche", + viscosity: 5, + stain: 0.015, + density: 1050.83, hidden: true, - desc: "Added in the first version of the mod. Made by mixing Milk and Sugar at 85°C+.\n", + isFood: true, + desc: "Added in the first version of the mod.\nMade by mixing Milk and Sugar at 85°C+.\n", } -// Chocotorta items - BASE COMPLETE +// Chocotorta items elements.cream_cheese = { color: ["#ebe9ea","#e4dfdd","#eeeeee"], category: "Community", - behavior: behaviors.SUPPORTPOWDER, + state: "solid", + behavior: behaviors.STURDYPOWDER, + //reactions: { + // For future use + //}, + tempHigh: 65, + stateHigh: "melted_cheese", + stateHighColor: ["#fbffff","#f6f6f6"], + hardness: 0.01, + density: 980.61, hidden: true, - desc: "Added in the first version of the mod. Made by mixing Acid with Milk or Cream.\n", + isFood: true, + desc: "Added in the first version of the mod.\nMade by mixing Acid with Milk or Cream.\n", } elements.cocoa_bean = { color: ["#e16f51","#e28e67","#e18550","#84574d"], category: "Community", - behavior: behaviors.STURDYPOWDER, + state: "solid", + behavior: behaviors.POWDER, + // Has no reactions breakInto: "cocoa_powder", + density: 593, + tempHigh: 179.4, + stateHigh: "dead_plant", + tempLow: -2, + stateLow: "frozen_plant", + // not hidden by default + // not food don't eat it desc: "Added in the first version of the mod.\n", } elements.cocoa_powder = { color: ["#855344","#6d4c41","#40271d"], + category: "Community", + state: "solid", behavior: behaviors.POWDER, onMix: function(powder, doughcheck) { - if (doughcheck.name == "dough" && shiftDown && Math.random() < 0.01) { - changePixel(powder,"chocolate_biscuit_dough"); + if (elements[doughcheck.element].id == elements.dough.id && shiftDown && Math.random() < 0.25) { + deletePixel(powder.x,powder.y); changePixel(doughcheck,"chocolate_biscuit_dough"); } }, - reactions: { - "dough": { elem1:null, elem2:"chocolate_biscuit_dough" }, - }, - category: "Community", + density: 363.5, + tempHigh: 50, + stateHigh: "smoke", hidden: true, - desc: "Added in the first version of the mod. Made by Smashing Cocoa Bean.\n", + isFood: true, + desc: "Added in the first version of the mod.\nMade by Smashing Cocoa Bean.\n", } elements.chocolate_biscuit_dough = { - name: "choco_Biscuit_Dough", color: "#623727", category: "Community", + state: "solid", behavior: behaviors.STURDYPOWDER, tempHigh: 94, stateHigh: "chocolate_biscuit", burn: 40, burnTime: 25, burnInto: "ash", - state: "solid", density: 526.9, isFood: true, hidden: true, - desc: "Added in the first version of the mod. Made by mixing Cocoa Powder with Dough.\n", + desc: "Added in the first version of the mod.\nMade by hard mixing Cocoa Powder with Dough.\n", } elements.chocolate_biscuit = { - name: "choco_Biscuit", color: "#864B36", - behavior: behaviors.STURDYPOWDER, - tempHigh: 550, - stateHigh: ["smoke","smoke","smoke","ash"], - breakInto: "crumb", + category: "Community", state: "solid", + behavior: behaviors.STURDYPOWDER, + breakInto: "crumb", + breakIntoColor: ["#af8264","#b28461","#aa7852","#a8744b"], + tempHigh: 232.2, + stateHigh: ["smoke","smoke","smoke","ash"], density: 233.96, isFood: true, - category: "Community", hidden: true, - desc: "Added in the first version of the mod. Made by cooking Choco Biscuit Dough at 94°C+. Can be layered with other items to make chocotorta, from undexconocidox_26419.\n", + desc: "Added in the first version of the mod.\nMade by cooking Choco Biscuit Dough at 94°C+.\nCan be layered with other items to make chocotorta, from undexconocidox_26419.\n", } -// Haupia items - BASE COMPLETE +// Haupia items elements.coconut = { color: ["#793b1e","#995c31","#5f3015"], + category: "Community", + state: "solid", behavior: behaviors.POWDER, breakInto: ["coconut_milk","tinder"], - category: "Community", + tempHigh: 225, + stateHigh: ["steam","ash","smoke"], + density: 822, desc: "Added in the first version of the mod.\n", } elements.coconut_milk = { color: ["#f3f3f3","#e4ddcb","#f8f8f8"], - behavior: behaviors.LIQUID, category: "Community", + state: "liquid", + behavior: behaviors.LIQUID, reactions: { "sugar": { elem1:null, elem2:"haupia_mix", tempMin:90 }, }, + tempHigh: 102, + stateHigh: "steam", + tempLow: -0.5, + stateLowName: "coconut_ice", + viscosity: 1.8, density: 1031.33, hidden: true, - desc: "Added in the first version of the mod. Made by smashing Coconut.\n", + isFood: true, + desc: "Added in the first version of the mod.\nMade by smashing Coconut.\n", } elements.haupia_mix = { color: ["#f3f3f3","#e4ddcb","#f8f8f8"], - behavior: behaviors.LIQUID, - tempLow: 3, category: "Community", + state: "liquid", + behavior: behaviors.LIQUID, + tempHigh: 105, + stateHigh: "steam", + tempLow: 3, stateLow: "haupia", + viscosity: 2.3, density: 1242.67, hidden: true, - desc: "Added in the first version of the mod. Made by mixing Coconut Milk and Sugar at 90°C+.\n", + desc: "Added in the first version of the mod.\nMade by mixing Coconut Milk and Sugar at 90°C+.\n", } elements.haupia = { color: ["#ffffff","#f8f8f8","#f7f9f8"], - behavior: behaviors.SUPPORT, - density: 1300, category: "Community", + state: "solid", + behavior: behaviors.SUPPORT, + tempHigh: 105, + stateHigh: ["steam","fragrance"], + density: 1300, hidden: true, - desc: "Added in the first version of the mod. Made by cooling Haupia Mix at 3°C-. From tisqbisque.\n" + isFood: true, + desc: "Added in the first version of the mod.\nMade by cooling Haupia Mix at 3°C-.\nFrom tisqbisque.\n" } // Adjusting existing elements here diff --git a/mods/elementsManager.js b/mods/elementsManager.js index 23ac1dd0..8570c518 100644 --- a/mods/elementsManager.js +++ b/mods/elementsManager.js @@ -256,9 +256,13 @@ if (enabledMods.includes("mods/betterMenuScreens.js")) { } // ugly way of doing it but probably works + // it didnt - me 8 months later const checkType = (key, value) => { - if (key == "behavior" && (typeof value == "function" || (value instanceof Array && value.filter(e => typeof e == "string").length == value.length))) return true; - else if (key == "behavior") return false; + if (key == "behavior") { + const constructed = constructBehavior(value); + if (constructed == undefined || (Array.isArray(constructed) && constructed.some(a => typeof a != "string"))) return false; + return true; + } if (["darkText", "hidden", "insulate", "noMix", "isFood", "forceAutoGen", "customColor", "ignoreAir", "excludeRandom", "burning", "flipX", "flipY", "flippableX", "flippableY"].includes(key) && typeof value != "boolean") return false; if (["name", "category", "desc", "alias", "seed", "baby", "state", "stateHigh", "stateHighName", "stateHighColor", "stateLow", "stateLowNmae", "stateLowColor"].includes(key) && typeof value != "string") return false; if (["id", "burn", "burnTime", "stateHighColorMultiplier", "stateLowColorMutliplier", "temp", "tempHigh", "extraTempHigh", "tempLow", "extraTempLow"].includes(key) && typeof value != "number") return false; @@ -269,24 +273,29 @@ if (enabledMods.includes("mods/betterMenuScreens.js")) { return true; } + const constructBehavior = (behavior) => { + if (typeof behavior == "function" || Array.isArray(behavior)) return behavior; + if (typeof behavior != "string") return undefined; + return behavior.split(";"); + } + const loadChanges = () => { const newElements = Storage.get("elements", []); for (const element of newElements) { - const element_ = element; - if (Object.keys(behaviors).includes(element_["behavior"])) element_["behavior"] = behaviors[element_["behavior"]]; + if (Object.keys(behaviors).includes(element["behavior"])) element["behavior"] = behaviors[element["behavior"]]; elements[element.name] = {}; - // elements[element.name] = element_; - for (const key of Object.keys(element_)) { - const val = element_[key]; - if (checkType(key, val)) elements[element.name][key] = val; + for (const key of Object.keys(element)) { + const val = element[key]; + if (checkType(key, val)) elements[element.name][key] = key == "behavior" ? constructBehavior(val) : val; else if (["name", "category"].includes(key)) elements[element.name][key] = key == "name" ? "NewElement" : "other"; } } const changes = Storage.get("changes", []); for (const change of changes) { for (const key of Object.keys(change.changes)) { - const c = change.changes[key]; - if (checkType(key, c)) elements[change.element][key] = c; + let c = change.changes[key]; + if (key == "behavior" && Object.keys(behaviors).includes(c)) c = behaviors[c]; + if (checkType(key, c)) elements[change.element][key] = key == "behavior" ? constructBehavior(c) : c; } } const deleted = Storage.get("deletedElements", []); @@ -547,7 +556,7 @@ if (enabledMods.includes("mods/betterMenuScreens.js")) { el.style.display = "none"; el.onchange = (ev) => { if (document.getElementById(id).value == "CUSTOM") { - applyChange(prop.name, ev.target.value.split(";").map(e => e.split(","))); + applyChange(prop.name, ev.target.value); } else { ev.target.style.display = "none"; } @@ -658,7 +667,7 @@ if (enabledMods.includes("mods/betterMenuScreens.js")) { el.onchange = (ev) => { if (document.getElementById(id).value == "CUSTOM") { const elementData = Storage.get("newElement", {}); - elementData[prop.name] = ev.target.value.split(";").map(e => e.split(",")); + elementData[prop.name] = ev.target.value.split(";"); Storage.set("newElement", elementData); } else { ev.target.style.display = "none"; @@ -961,22 +970,33 @@ if (enabledMods.includes("mods/betterMenuScreens.js")) { else el.setAttribute("value", "none"); } } else { - if (element[prop.name]) { + if (element[prop.name] || prop.name == "behavior") { if (prop.type == "boolean") { el.setAttribute("value", element[prop.name] ? "ON" : "OFF"); el.setAttribute("state", element[prop.name] ? "1" : "0"); } else if (prop.type == "color") { el.setAttribute("value", parseColor(element[prop.name])); } else if (prop.name == "behavior") { - const behavior = element[prop.name]; - const index = Object.keys(behaviors).map(b => `${behaviors[b] instanceof Array ? behaviors[b].join(";") : behaviors[b]}`).indexOf(behavior instanceof Array ? behavior.join(";") : behavior); - if (index == -1) { - document.getElementById(id + "/option/custom").selected = true; - document.getElementById(id + "/textInput").style.display = ""; - document.getElementById(id + "/textInput").setAttribute("value", behavior.join(";")) - } else { + let behavior = element[prop.name]; + if (!behavior && element.tick) behavior = element.tick; + if (typeof behavior == "function" && behavior.name) { + const name = behavior.name; + const index = Object.keys(behaviors).indexOf(name); document.getElementById(id + "/textInput").style.display = "none"; - document.getElementById(id + "/option/" + index).selected = true; + document.getElementById(id + "/option/" + (index == -1 ? "none" : index)).selected = true; + } else if (typeof behavior == "function") { + document.getElementById(id + "/textInput").style.display = "none"; + document.getElementById(id + "/option/none").selected = true; + } else { + const index = Object.keys(behaviors).map(b => `${behaviors[b] instanceof Array ? behaviors[b].join(";") : behaviors[b]}`).indexOf(behavior instanceof Array ? behavior.join(";") : behavior); + if (index == -1) { + document.getElementById(id + "/option/custom").selected = true; + document.getElementById(id + "/textInput").style.display = ""; + document.getElementById(id + "/textInput").setAttribute("value", behavior.map(b => b.join("|")).join(";")) + } else { + document.getElementById(id + "/textInput").style.display = "none"; + document.getElementById(id + "/option/" + index).selected = true; + } } } else { el.setAttribute("value", element[prop.name] instanceof Function ? element[prop.name].toString() : element[prop.name]); diff --git a/mods/nettysaddon.js b/mods/nettysaddon.js new file mode 100644 index 00000000..2462c8f7 --- /dev/null +++ b/mods/nettysaddon.js @@ -0,0 +1,48 @@ +elements.ultra_uranium = { + color: ["#50C878" , "#4F7942"], + behavior: [ + "XX|XX|XX", + "XX|DL%5|XX", + "M2%25|M1%25|M2%25", +], + category: "weapons", + state: "solid", + temp: 9999999999999999, + hardness: 1, +}; +elements.mega_beam = { + color: ["#DFFF00" , "#00FFFF"], + tick: function(pixel) { + var x = pixel.x; + for (var y = pixel.y; y < height; y++) { + if (outOfBounds(x, y)) { + break; + } + if (isEmpty(x, y)) { + if (Math.random() > 0.05) { continue } + createPixel("flash", x, y); + pixelMap[x][y].color = "#DFFF00"; + pixelMap[x][y].temp = 9800; + } + else { + if (elements[pixelMap[x][y].element].isGas) { continue } + if (elements[pixelMap[x][y].element].id === elements.mega_beam.id) { break } + pixelMap[x][y].temp += 9800; + pixelTempCheck(pixelMap[x][y]); + break; + } + } + deletePixel(pixel.x-1, pixel.y-1); + deletePixel(pixel.x+1, pixel.y+1); + if ( pixelTicks - pixel.start > 1) { + deletePixel(pixel.x, pixel.y) + } + doHeat(pixel); + }, + temp: 9800, + category: "weapons", + state: "gas", + density: 1, + excludeRandom: true, + noMix: true +} \ No newline at end of file diff --git a/mods/nousersthings.js b/mods/nousersthings.js index bc073fd9..4ea7fd55 100644 --- a/mods/nousersthings.js +++ b/mods/nousersthings.js @@ -26,7 +26,7 @@ elements.molten_caesium = { stateLow: "caesium", tempHigh: 671, stateHigh: "caesium_vapor", - density: 1843, + density: 1842, temp: 29, conduct: 0.90, reactions: { @@ -1444,19 +1444,48 @@ elements.blackhole_storage = { conduct: 1, }, elements.plutonium = { - color: ["#616161", "#4b4949", "#353232", "#211c1c"], + color: ["#212121", "#2b1c1c", "#371616", "#430e0e", "#510606", "#212121", "#1e1e1e", "#1b1b1b", "#171717", "#141414", "#212121", "#1e1e1e", "#1b1b1b", "#171717", "#141414"], behavior: behaviors.STURDYPOWDER, category: "powders", tempHigh: 640, stateHigh: "molten_plutonium", state: "solid", tick: function(pixel){ - if (Math.random() < 0.0007) { - changePixel(pixel, "neutron", false); - } else if (Math.random() < 0.0007) { - changePixel(pixel, "uranium", false); - } - }, + if(Math.random() < 0.0007){ + for (var i = 0; i < squareCoords.length; i++) { + var coord = squareCoords[i]; + var x = pixel.x+coord[0]; + var y = pixel.y+coord[1]; + if (isEmpty(x, y)){ + createPixel("helium", x, y) + pixelMap[x][y].temp = pixel.temp + 200 + break; + } + } + if(Math.random() < 0.5){ + for (var i = 0; i < squareCoords.length; i++) { + var coord = squareCoords[i]; + var x = pixel.x+coord[0]; + var y = pixel.y+coord[1]; + if (isEmpty(x, y)){ + createPixel("neutron", x, y) + pixelMap[x][y].temp = pixel.temp + 200 + break; + } + } + } + changePixel(pixel, "uranium", false); + pixelMap[x][y].temp += 200 + for (var i = 0; i < adjacentCoords.length; i++) { + var coord = adjacentCoords[i]; + var x = pixel.x+coord[0]; + var y = pixel.y+coord[1]; + if (!isEmpty(x, y, true)){ + pixelMap[x][y].temp += 175 + } + } + } + }, reactions: { "neutron": { elem1:"pn_explosion", tempMin:400, chance:0.1 }, }, @@ -1470,19 +1499,48 @@ elements.molten_plutonium = { tempLow: 620, stateLow: "plutonium", tick: function(pixel){ - if (Math.random() < 0.0007) { - changePixel(pixel, "neutron", false); - } else if (Math.random() < 0.0007) { - changePixel(pixel, "uranium", false); - } - }, + if(Math.random() < 0.0007){ + for (var i = 0; i < squareCoords.length; i++) { + var coord = squareCoords[i]; + var x = pixel.x+coord[0]; + var y = pixel.y+coord[1]; + if (isEmpty(x, y)){ + createPixel("helium", x, y) + pixelMap[x][y].temp = pixel.temp + 200 + break; + } + } + if(Math.random() < 0.5){ + for (var i = 0; i < squareCoords.length; i++) { + var coord = squareCoords[i]; + var x = pixel.x+coord[0]; + var y = pixel.y+coord[1]; + if (isEmpty(x, y)){ + createPixel("neutron", x, y) + pixelMap[x][y].temp = pixel.temp + 200 + break; + } + } + } + changePixel(pixel, "uranium", false); + pixelMap[x][y].temp += 200 + for (var i = 0; i < adjacentCoords.length; i++) { + var coord = adjacentCoords[i]; + var x = pixel.x+coord[0]; + var y = pixel.y+coord[1]; + if (!isEmpty(x, y, true)){ + pixelMap[x][y].temp += 175 + } + } + } + }, reactions: { "neutron": { elem1:"pn_explosion", tempMin:400, chance:0.1 }, }, density: 16629, }, -elements.neutron.reactions.plutonium = { temp2:100 }; -elements.neutron.reactions.molten_plutonium = { temp2:100 } +elements.neutron.reactions.plutonium = { temp2:200 }; +elements.neutron.reactions.molten_plutonium = { temp2:200 } elements.pn_explosion = { color: ["#ffb48f","#ffd991","#ffad91"], behavior: [ @@ -2431,4 +2489,4 @@ elements.grid_brush = { deletePixel(pixel.x, pixel.y) } } -} \ No newline at end of file +} diff --git a/mods/randomelements.js b/mods/randomelements.js new file mode 100644 index 00000000..3a7b1846 --- /dev/null +++ b/mods/randomelements.js @@ -0,0 +1,200 @@ +const adjectives = ["shiny", "glowing", "dark", "bright", "heavy", "light", "hot", "cold", "hard", "soft", "smooth", "rough", "round", "sharp", "sweet", "sour", "bitter", "salty", "savory"]; + +const nouns = ["metal", "crystal", "stone", "powder", "liquid", "gas", "plasma", "slime", "sand", "dust", "rock", "lava", "ice", "vapor", "ash", "soot", "sludge"]; + +const elementNames = []; + +while (elementNames.length < 300) { + + const adjective = adjectives[Math.floor(Math.random() * adjectives.length)]; + const noun = nouns[Math.floor(Math.random() * nouns.length)]; + + const name = `${adjective}_${noun}`; + + if (!elementNames.includes(name)) { + elementNames.push(name); + } +} + +const nounTemperatures = { + metal: {tempLow: 1000, tempHigh: 1800}, + crystal: {tempLow: 500, tempHigh: 1000}, + stone: {tempLow: 600, tempHigh: 1200}, + powder: {tempLow: 100, tempHigh: 500}, + liquid: {tempLow: -100, tempHigh: 100}, + gas: {tempLow: -200, tempHigh: -100}, + plasma: {tempLow: 8000, tempHigh: 20000}, + slime: {tempLow: -10, tempHigh: 30}, + sand: {tempLow: 100, tempHigh: 500}, + dust: {tempLow: 50, tempHigh: 200}, + rock: {tempLow: 500, tempHigh: 1000}, + lava: {tempLow: 700, tempHigh: 1200}, + ice: {tempLow: -50, tempHigh: 0}, + vapor: {tempLow: -50, tempHigh: 100}, + ash: {tempLow: 200, tempHigh: 500}, + soot: {tempLow: 200, tempHigh: 500}, + sludge: {tempLow: -10, tempHigh: 100} + } + + const nounColors = { + metal: ["#999999", "#bbbbbb", "#cccccc", "#dddddd", "#eeeeee"], + crystal: ["#77ffff", "#88eeff", "#99ddff", "#aaccff", "#bbbbff"], + stone: ["#888888", "#999999", "#aaaaaa", "#bbbbbb", "#cccccc"], + powder: ["#eeeeee", "#ffffff", "#dddddd", "#cccccc", "#bbbbbb"], + liquid: ["#336699", "#4477aa", "#5588bb", "#6699cc", "#77aadd"], + gas: ["#ffffff", "#eeeeee", "#dddddd", "#cccccc", "#bbbbbb"], + plasma: ["#ff9966", "#ffaa77", "#ffbb88", "#ffcc99", "#ffddaa"], + slime: ["#88cc88", "#99dd99", "#aaddaa", "#bbeebb", "#ccffcc"], + sand: ["#D2B48C", "#E8D5A9", "#F0E3C4", "#DCD0BF", "#EBE4D6"], + dust: ["#aaaaaa", "#bbbbbb", "#cccccc", "#dddddd", "#eeeeee"], + rock: ["#777777", "#888888", "#999999", "#aaaaaa", "#bbbbbb"], + lava: ["#ff4400", "#ff5511", "#ff6622", "#ff7733", "#ff8844"], + ice: ["#66cccc", "#77dddd", "#88eeee", "#99ffff", "#aaffff"], + vapor: ["#ffffff", "#eeeeee", "#dddddd", "#cccccc", "#bbbbbb"], + ash: ["#cccccc", "#dddddd", "#eeeeee", "#ffffff", "#eeeeee"], + soot: ["#333333", "#444444", "#555555", "#666666", "#777777"], + sludge: ["#886633", "#997733", "#a98844", "#bb9944", "#ccaa55"] + }; + + + const nounStates = { + metal: "solid", + crystal: "solid", + stone: "solid", + powder: "liquid", + liquid: "liquid", + gas: "gas", + plasma: "gas", + slime: "liquid", + sand: "liquid", + dust: "liquid", + rock: "solid", + lava: "liquid", + ice: "solid", + vapor: "gas", + ash: "liquid", + soot: "liquid", + sludge: "liquid" +}; + +// Map noun to behavior +const nounBehaviors = { + metal: behaviors.WALL, + crystal: behaviors.WALL, + stone: behaviors.WALL, + powder: behaviors.POWDER, + liquid: behaviors.LIQUID, + gas: behaviors.GAS, + plasma: behaviors.GAS, + slime: behaviors.LIQUID, + sand: behaviors.POWDER, + dust: behaviors.POWDER, + rock: behaviors.WALL, + lava: behaviors.LIQUID, + ice: behaviors.WALL, + vapor: behaviors.GAS, + ash: behaviors.POWDER, + soot: behaviors.POWDER, + sludge: behaviors.LIQUID +}; + +const adjectiveBreakInto = { + sweet: "sugar", + salty: "salt", +}; + +const nounBreakInto = { + crystal: "glass_shard", + ice: "snow", + rock: ["sand", "gravel"], +}; + +const adjectiveColorModifiers = { + dark: 0.8, // darker + shiny: 1.2, // brighter + glowing: 1.5 // brightest +}; + +// Generate elements +for (const name of elementNames) { + + const [adjective, noun] = name.split("_"); + + let baseColor = nounColors[noun]; + + const {tempLow, tempHigh} = nounTemperatures[noun]; + + let temp = Math.random() * (tempHigh - tempLow) + tempLow; + + if (adjective === "hot") { + temp *= 1.5; + } else if (adjective === "cold") { + temp /= 2; + } + + if (adjective in adjectiveColorModifiers) { + const modifier = adjectiveColorModifiers[adjective]; + baseColor = modifyColor(baseColor, modifier); + } + + elements[name] = { + color: baseColor, + behavior: nounBehaviors[noun], + category: "random elements", + state: nounStates[noun], + temp: temp, + breakInto: adjectiveBreakInto[adjective] || nounBreakInto[noun], + density: Math.random() * 100, + viscosity: Math.random() * 100 + }; + + function modifyColor(color, modifier) { + if (color[0] === '#') { + color = color.slice(1); + } + + color = String(color); + + // Check for '#' + const match = color.match(/^#?(.*)$/); + if (match) { + color = match[1]; + } + + // Convert to RGB + let [r, g, b] = color.match(/.{1,2}/g).map(x => parseInt(x, 16)); + + // Apply modifier + r = Math.round(r * modifier); + g = Math.round(g * modifier); + b = Math.round(b * modifier); + + // Constrain RGB values to 0-255 + r = Math.max(0, Math.min(255, r)); + g = Math.max(0, Math.min(255, g)); + b = Math.max(0, Math.min(255, b)); + + // Convert back to hex + return '#' + ((1 << 24) + (r << 16) + (g << 8) + b).toString(16).slice(1); + } + +} + +/* +changelog only count importtant stuff and not the small details + +0.1 +added the mod + +0.2 +elements have breakInto's +elements with the adjectives "dark, shiny and glowing" are darker or brighter +elements with the nouns "crystal, ice, rock" can break into other elements like "glass_shard, snow, sand" +fixed some elements having wrong states + +todo: +elements have reactions +gases dont have breakintos + +what a silly little changelog! i made it literally right here!! +*/ diff --git a/mods/sbstuff.js b/mods/sbstuff.js index f768af8e..742e5ac5 100644 --- a/mods/sbstuff.js +++ b/mods/sbstuff.js @@ -1,7 +1,5 @@ elements.cooked_rice = { viscosity: 1000, - tempMin: 20, - stateMin: "rice", tempHigh: 500, stateHigh: "charcoal", density: 699, @@ -1452,7 +1450,7 @@ elements.silver_coin = { state: "solid", }; -elements.uraniumaniumaniumaniumanium_popcornicecream_plutoniumeptunium_238239 = { +elements.lololol_this_crashes_ur_game_lololol_why_would_you_want_to_use_this_lololol_it_crashes = { color: "#238fe8", behavior: [ "XX|XX|XX", @@ -1501,104 +1499,6 @@ elements.oreo = { state: "liquid" }; -elements.uranium_238 = { - tempHigh: 1200, - stateHigh: "molten_uranium", - color: ["#0f400b", "#30522d", "#4d6b4a", "#6f8f6d"], - behavior: [ - "XX|CR:radiation%1|XX", - "CR:radiation%1|CH:lead%0.001|CR:radiation%1", - "M2|M1|M2", - ], - category: "powders", - state: "liquid", - density: 19100, - hardness: 0.6, - conduct: 0.235, - excludeRandom: true, - reactions: { - "neutron": {elem1: "uranium_239",}, - } -}; - -elements.uranium_239 = { - tempHigh: 1300, - stateHigh: "molten_uranium", - color: ["#153816", "#135e14", "#379138", "#567556", "#7bb37b"], - behavior: [ - "XX|CR:radiation%2|XX", - "CR:radiation%2|CH:lead%0.002|CR:radiation%2", - "M2|M1|M2", - ], - category: "powders", - state: "liquid", - hidden: true, - density: 19100, - hardness: 0.6, - conduct: 0.235, - excludeRandom: true, - reactions: { - "electron": {elem1: "neptunium_239"} - } -}; - -elements.neptunium_239 = { - tempHigh: 1500, - stateHigh: "molten_uranium", - color: ["#082e19", "#173b27", "#354a3f", "#4c635a", "#344a41"], - behavior: [ - "XX|CR:radiation%3|XX", - "CR:radiation%3|CH:lead%0.003|CR:radiation%3", - "M2|M1|M2", - ], - category: "powders", - state: "liquid", - hidden: true, - density: 20000, - hardness: 0.7, - conduct: 0.3, - excludeRandom: true, - reactions: { - "electron": {elem1: "plutonium"}, - "neutron": { elem1:"n_explosion", tempMin:500, chance:0.1 } - } -}; - -elements.plutonium = { - tempHigh: 2000, - stateHigh: "molten_uranium", - color: ["#0a4a17", "#194d23", "#263b2a", "#475449"], - behavior: [ - "XX|CR:radiation%4|XX", - "CR:radiation%4|CH:lead%0.004|CR:radiation%4", - "M2|M1|M2", - ], - category: "powders", - state: "liquid", - hidden: true, - density: 22000, - hardness: 0.8, - conduct: 0.4, - excludeRandom: true, - reactions: { - "neutron": { elem1:"n_explosion", tempMin:500, chance:0.2 }, - "electron": { elem1:"n_explosion", tempMin:500, chance:0.00000000000000000000001 } - } -}; - -elements.electron = { - color: "#c99d16", - behavior: behaviors.BOUNCY, - reactions: { - "uranium": { temp2:100 }, - }, - temp: 35, - category: "energy", - state: "gas", - density: 0.00002, - ignoreAir: true -}; - elements.sned = { desc: "slowly expanding...", color: "#dfe0d9", @@ -1757,15 +1657,7 @@ elements.thermal_paste = { state: "liquid", }; -elements.sam = { - name: "sam's sperm i think", - viscosity: 10000, - color: "#0e0e0e", - behavior: behaviors.LIQUID, - category: "joke", - state: "liquid", - desc: "begs the question; did he censor himself?" -}; +// die elements.glitch = { color: ["#ff0000", "#c300ff", "#bbff00", "#1100ff", "#00ffaa"], @@ -1803,11 +1695,20 @@ elements.sound = { } file.click(); }, - onUnselect: function() {}, tool: function() {}, category: "special", }; +elements.vomit = { + viscosity: 170, + tempHigh: 100, + stateHigh: ["dirty_water", "stench"], + behavior: behaviors.LIQUID, + category: "liquids", + state: "liquid", + stain: 0.1 +}; + elements.incinerate.category = "tools", elements.cook.category = "tools", elements.room_temp.category = "tools", @@ -1863,3 +1764,102 @@ if (!elements.coffee.reactions) elements.coffee.reactions = {}; elements.coffee.reactions.milk = {elem1: null, elem2: "coffee_milk",} elements.silver.breakInto = "silver_coin" + +// sb is an idiot and he has alzheimer so here is a property list +/* +== METADATA == +name +alias +category +desc +extraInfo +related +hidden +darkText +canPlace +nocheer +forceAutoGen + +== COLOR == +color +innerColor (dead property) +colorOn +customColor +forceSaveColor +colorPattern +colorKey + +== BEHAVIOR == +behavior +behaviorOn +tool (func) +onMouseUp (func) +onSelect (func) +onUnselect (func) +onMix (func) +tick (func) +perTick (func) +reactions + +== TEMP == +temp +tempLow +stateLow +stateLowName +stateLowColor +stateLowColorMultiplier +tempHigh +stateHigh +stateHighName +stateHighColor +stateHighColorMultiplier +extraTempLow +extraTempHigh +heatCapacity (dead property) + +== PROPERTIES == +state +density +insulate +viscosity +conduct +stain +stainSelf +charge +movable +hardness +foodNeed +properties +maxSize +baby +egg +eggColor +seed +noMix +ignoreAir +excludeRandom +cooldown +isFood +ignore +canContain + +== BURN == +burn +burning +burnTime +burnInto +extinguish +fireColor +fireElement + +== FLIP == +rotatable +flipX +flippableX +flipY +flippableY + +== BREAK == +breakInto +breakIntoColor +*/