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)