Merge pull request #501 from JustAGenericUsername/main
10kelements.js can now do any element count
This commit is contained in:
commit
d2a7adcba1
|
|
@ -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 color = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "a", "b", "c", "d", "e","f"]
|
||||||
var states = ["solid", "liquid", "gas"]
|
var states = ["solid", "liquid", "gas"]
|
||||||
var total = 0
|
var total = 0
|
||||||
|
|
@ -13,7 +29,7 @@ var randomProperty = function (obj) {
|
||||||
var keys = Object.keys(obj);
|
var keys = Object.keys(obj);
|
||||||
return obj[keys[ keys.length* Math.random() << 0]];
|
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 f = Math.random() < 0.2
|
||||||
var co = Math.random() < 0.2
|
var co = Math.random() < 0.2
|
||||||
elements["element_"+i] = {
|
elements["element_"+i] = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue