Merge pull request #501 from JustAGenericUsername/main

10kelements.js can now do any element count
This commit is contained in:
slweeb 2024-04-06 19:17:56 -04:00 committed by GitHub
commit d2a7adcba1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 1 deletions

View File

@ -1,3 +1,19 @@
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){alert("You have either put a decimal, zero, or a negative number. 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"
}
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 total = 0
@ -13,7 +29,7 @@ var randomProperty = function (obj) {
var keys = Object.keys(obj);
return obj[keys[ keys.length* Math.random() << 0]];
};
for (var i = 1; i <= 10000; i++){
for (var i = 1; i <= settings.randomcount; i++){
var f = Math.random() < 0.2
var co = Math.random() < 0.2
elements["element_"+i] = {