From 57192f1dac94ea1d7597e95b1ad78c7b9aa88cb9 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Wed, 21 Dec 2022 20:58:02 -0500 Subject: [PATCH] param gate generateClouds --- mods/more_clouds.js | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/mods/more_clouds.js b/mods/more_clouds.js index bcbc13c6..ba2d395c 100644 --- a/mods/more_clouds.js +++ b/mods/more_clouds.js @@ -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 = {