forked from mtcontrib/regional_weather
Change map_range behavior
This commit is contained in:
parent
6c150faaaf
commit
caeff69f27
@ -14,7 +14,9 @@ end
|
|||||||
|
|
||||||
-- maps range of 0 to 1 to any other range
|
-- maps range of 0 to 1 to any other range
|
||||||
local function map_range(val, low, high)
|
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
|
end
|
||||||
|
|
||||||
local function generate_effects(params)
|
local function generate_effects(params)
|
||||||
|
Loading…
Reference in New Issue
Block a user