From f6c3f4bd1601c5fe497a966b603d1c91e2efbff8 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 29 Sep 2024 18:33:04 -0500 Subject: [PATCH] Correct value clamping --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index 19cec9eac..fdf7c33c8 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -190,8 +190,8 @@ end function skycolor_utils.convert_to_rgb(minval, maxval, current_val, colors) -- Clamp current_val to valid range - current_val = math.min(minval, current_val) - current_val = math.max(maxval, current_val) + current_val = math.max(minval, current_val) + current_val = math.min(maxval, current_val) -- Rescale current_val from a number between minval and maxval to a number between 1 and #colors local scaled_value = (current_val - minval) / (maxval - minval) * (#colors - 1) + 1.0