param gate generateClouds

This commit is contained in:
Laetitia (O-01-67) 2022-12-21 20:58:02 -05:00 committed by GitHub
parent 599c39171a
commit 57192f1dac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 18 deletions

View File

@ -3,6 +3,14 @@ var runAfterAutogenMod = "mods/runAfterAutogen and onload restructure.js";
var libraryMod = "mods/code_library.js";
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
cloudIncludeRandom = true
} else { //if it doesn't (and it returns null)
@ -56,19 +64,6 @@ if(enabledMods.includes(runAfterAutogenMod) && enabledMods.includes(libraryMod))
//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
function generateCloud(cloudElements,isAfterScriptLoading=false) {//it can be a single element, though
//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() {
liquidArray = Object.keys(elements).filter(function(e) {
return (defaultCloudCondition(e));
});
liquidArray.push(["rock","sand"]);
generateCloud(liquidArray,false);
if(generateClouds) {
liquidArray = Object.keys(elements).filter(function(e) {
return (defaultCloudCondition(e));
});
liquidArray.push(["rock","sand"]);
generateCloud(liquidArray,false);
};
});
elements.random_cloud = {