param gate generateClouds
This commit is contained in:
parent
599c39171a
commit
57192f1dac
|
|
@ -3,6 +3,14 @@ var runAfterAutogenMod = "mods/runAfterAutogen and onload restructure.js";
|
||||||
var libraryMod = "mods/code_library.js";
|
var libraryMod = "mods/code_library.js";
|
||||||
|
|
||||||
if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) {
|
if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod)) {
|
||||||
|
|
||||||
|
//Generate clouds
|
||||||
|
if(urlParams.get('generateClouds') !== null) { //if the variable exists at all
|
||||||
|
generateClouds = true
|
||||||
|
} else { //if it doesn't (and it returns null)
|
||||||
|
generateClouds = false
|
||||||
|
}
|
||||||
|
|
||||||
if(urlParams.get('cloudIncludeRandom') !== null) { //if the variable exists at all
|
if(urlParams.get('cloudIncludeRandom') !== null) { //if the variable exists at all
|
||||||
cloudIncludeRandom = true
|
cloudIncludeRandom = true
|
||||||
} else { //if it doesn't (and it returns null)
|
} else { //if it doesn't (and it returns null)
|
||||||
|
|
@ -56,19 +64,6 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod))
|
||||||
|
|
||||||
//Generator function
|
//Generator function
|
||||||
|
|
||||||
function tryJoin(stringOrArray,joiner) {
|
|
||||||
//console.log(`tryJoin: ${stringOrArray}`);
|
|
||||||
if(typeof(stringOrArray) === "string") {
|
|
||||||
//console.log("tryJoin: String");
|
|
||||||
return stringOrArray;
|
|
||||||
} else if(Array.isArray(stringOrArray)) {
|
|
||||||
//console.log("tryJoin: Array");
|
|
||||||
return stringOrArray.join(joiner);
|
|
||||||
} else {
|
|
||||||
throw new TypeError(`Unexpected type: ${typeof(stringOrArray)}`);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
//Standalone generator
|
//Standalone generator
|
||||||
function generateCloud(cloudElements,isAfterScriptLoading=false) {//it can be a single element, though
|
function generateCloud(cloudElements,isAfterScriptLoading=false) {//it can be a single element, though
|
||||||
//To specify an array cloud, have the array be inside another array.
|
//To specify an array cloud, have the array be inside another array.
|
||||||
|
|
@ -228,11 +223,13 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod))
|
||||||
};
|
};
|
||||||
|
|
||||||
runAfterAutogen(function() {
|
runAfterAutogen(function() {
|
||||||
liquidArray = Object.keys(elements).filter(function(e) {
|
if(generateClouds) {
|
||||||
return (defaultCloudCondition(e));
|
liquidArray = Object.keys(elements).filter(function(e) {
|
||||||
});
|
return (defaultCloudCondition(e));
|
||||||
liquidArray.push(["rock","sand"]);
|
});
|
||||||
generateCloud(liquidArray,false);
|
liquidArray.push(["rock","sand"]);
|
||||||
|
generateCloud(liquidArray,false);
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
elements.random_cloud = {
|
elements.random_cloud = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue