From caeff69f27e1e693365265e7200e871dbf29c66d Mon Sep 17 00:00:00 2001 From: sys4 Date: Wed, 20 Dec 2023 23:31:34 +0100 Subject: [PATCH] Change map_range behavior --- ca_weathers/ambient.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ca_weathers/ambient.lua b/ca_weathers/ambient.lua index 98522c2..56908cb 100644 --- a/ca_weathers/ambient.lua +++ b/ca_weathers/ambient.lua @@ -14,7 +14,9 @@ end -- maps range of 0 to 1 to any other range local function map_range(val, low, high) - return (val + low) * (high - low) + local cal_val = math.min(math.max(val, 0), 1) + local range = high - low + return low + (cal_val * range) end local function generate_effects(params)