From d3ef7dd90dfae40bab41247d7eb6090fcfebdf42 Mon Sep 17 00:00:00 2001 From: Lily-129 <68935009+Lily-129@users.noreply.github.com> Date: Sat, 30 Apr 2022 16:45:18 -0400 Subject: [PATCH] Changed liquidString toggle to query string instead of a dummy file also alert()ed bounds --- mods/random_liquids.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/mods/random_liquids.js b/mods/random_liquids.js index 0d813d89..34ed76f7 100644 --- a/mods/random_liquids.js +++ b/mods/random_liquids.js @@ -11,6 +11,12 @@ if(urlParams.get('liquidAmount') != null) { //null check liquidAmount = 10 } +if(urlParams.get('makeLiquidString') !== null) { //if the variable exists at all + makeLiquidString = true +} else { //if it doesn't (and it returns null) + makeLiquidString = false +} + function _randomInt(max) { if(max >= 0) { return Math.floor(Math.random() * (max + 1)) @@ -29,9 +35,6 @@ function _randomArrayChoice(array) { const medialArrayL = ["m","n","p","t","k","b","d","g","f","th","s","sh","h","l","r","y","z","sp","st","sk","sl","spl","stl","skl","sr","spr","str","skr","sl","fl","fr","pl","pr","tl","tr","kl","kr","shr","fl","fr","thr"] //:eggTF: const finalArrayL = ["m","n","p","t","k","b","d","g","f","th","s","sh","l","r","y","z","sp","st","sk","sl","spl","stl","skl","sr","spr","str","skr","pl","pr","tl","tr","bl","vr"] //:eggTF: -enabledMods.includes("mods/log_liquids.js") ? logLiquids = true : logLiquids = false -//This is intended for people who want to copy their liquids from the console to a file for some reason. Technically, the empty enabler script doesn't even have to exist, but I'll make it just so that index.html doesn't spit out an ERR_FILE_NOT_FOUND. - function generateName() { //these are picked arbitrarily @@ -205,7 +208,7 @@ function avgRndToMult() { } -if(logLiquids == true) { +if(makeLiquidString == true) { liquidString = "" } @@ -302,7 +305,7 @@ for(i = 0; i < liquidAmount; i++) { elements[`${name}_ice`].conduct = conductivity } - if(logLiquids == true) { + if(makeLiquidString == true) { //Append moddable code for the liquid state to liquidString liquidString = liquidString + `elements.${name} = {\n name: \"${name}\",\n color: \"${colors[0]}\",\n behavior: behaviors.LIQUID,\n tempLow: ${freezingPoint},\n temp: ${freezingPoint + 20},\n tempHigh: ${boilingPoint},\n stateLow: \"${name}_ice\",\n stateHigh: \"${name}_gas\",\n category: \"random liquids\",\n state: \"liquid\",\n density: ${1000 * densityAdjustment},\n ` if(conducts == true) { liquidString = liquidString + `conduct: ${conductivity * liquidConductivityAdjust},\n ` } @@ -323,6 +326,6 @@ for(i = 0; i < liquidAmount; i++) { } -if(logLiquids == true) { +if(makeLiquidString == true) { console.log(`Liquids added to liquidString (length ${liquidString.length})`) }