From 359c93ba7182261ce4db2a9e6f3d6e1c808a2e5c Mon Sep 17 00:00:00 2001 From: majou <42233-majou@users.noreply.gitgud.io> Date: Fri, 6 Sep 2024 12:38:52 +0000 Subject: [PATCH] random fixes - fixed bad cat tf eyes updater - fixed this is undefined error --- game/03-JavaScript/math.js | 4 ++-- game/04-Variables/variables-versionUpdate.twee | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/game/03-JavaScript/math.js b/game/03-JavaScript/math.js index 68a94a4bb8..132d1c3212 100644 --- a/game/03-JavaScript/math.js +++ b/game/03-JavaScript/math.js @@ -217,8 +217,8 @@ window.categorise = categorise; * @returns {number} A random number between `num - min` and `num + max`. */ function boundedRandom(num, min, max = min, rngInstance) { - const randomFunc = rngInstance ? rngInstance.randomFloat : randomFloat; - return round(randomFunc(num - min, num + max), 2); + const result = rngInstance ? rngInstance.randomFloat(num - min, num + max) : randomFloat(num - min, num + max); + return round(result, 2); } window.boundedRandom = boundedRandom; diff --git a/game/04-Variables/variables-versionUpdate.twee b/game/04-Variables/variables-versionUpdate.twee index 2129fd535c..b232632ef9 100644 --- a/game/04-Variables/variables-versionUpdate.twee +++ b/game/04-Variables/variables-versionUpdate.twee @@ -5358,7 +5358,9 @@ <!-- Fix for older instance of 'cat_tf_stage_' not being cleared, leading to exceeded loop iterations --> <<if $custom_eyecolours.filter(obj => obj.variable.includes("cat_tf_stage_")).length gt 8>> - <<run determineCatEyeStages()>> + <!-- filter out cat_tf_stages, then append only the first instances of them found in the original array --> + <<set _newEyecolours to V.custom_eyecolours.filter(i => !i.variable.startsWith("cat_tf_stage_")).concat(["cat_tf_stage_0_left", "cat_tf_stage_0_right", "cat_tf_stage_1_left", "cat_tf_stage_1_right", "cat_tf_stage_2_left", "cat_tf_stage_2_right", "cat_tf_stage_3_left", "cat_tf_stage_3_right"].map(o => V.custom_eyecolours.find(c => c.variable === o)));>> + <<set $custom_eyecolours to _newEyecolours>> <</if>> <!-- 0.5.2.0, converting NPC seen variables to arrays --> -- GitLab