includeRandom parameter
Include the spouts in random if an includeRandom parameter exists, or exclude them if it doesn't. Also exclude liquid and fire cloners
This commit is contained in:
parent
df923b54e3
commit
eb95a2c1f7
|
|
@ -1,6 +1,22 @@
|
|||
urlParams = new URLSearchParams(window.location.search);
|
||||
|
||||
if(urlParams.get('includeRandom') !== null) { //if the variable exists at all
|
||||
includeRandom = true
|
||||
} else { //if it doesn't (and it returns null)
|
||||
includeRandom = false
|
||||
}
|
||||
|
||||
function _randomInt(max) {
|
||||
if(max >= 0) {
|
||||
return Math.floor(Math.random() * (max + 1))
|
||||
} else {
|
||||
return 0 - Math.floor(Math.random() * (Math.abs(max) + 1))
|
||||
}
|
||||
}
|
||||
|
||||
runAfterLoad(function() {
|
||||
liquidArray = Object.keys(elements).filter(function(e) {
|
||||
return (elements[e].state == "liquid" || elements[e].state == "gas") && elements[e] != "ketchup";
|
||||
return (elements[e].state == "liquid" || elements[e].state == "gas") && elements[e] != "ketchup" && elements[e] != "liquid_cloner" && elements[e] != "fire_cloner";
|
||||
});
|
||||
for(i = 0; i < liquidArray.length; i++) {
|
||||
elements[`${liquidArray[i]}_spout`] = {
|
||||
|
|
@ -13,8 +29,10 @@ runAfterLoad(function() {
|
|||
category: "spouts",
|
||||
temp: elements[liquidArray[i]].temp,
|
||||
hardness: 1,
|
||||
excludeRandom: true,
|
||||
};
|
||||
includeRandom == true ? elements[`${liquidArray[i]}_spout`].excludeRandom = false : elements[`${liquidArray[i]}_spout`].excludeRandom = true;
|
||||
};
|
||||
liquidArray.push("ketchup")
|
||||
if(elements.liquid_cloner) { liquidArray.push("ketchup") };
|
||||
if(elements.fire_cloner) { liquidArray.push("fire") };
|
||||
liquidArray.push("ketchup");
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue