Implement dynamic cloud sizes, adjust cycle lengths

This commit is contained in:
Till Affeldt
2020-04-13 16:53:32 +02:00
parent 47530bb07e
commit fdc457bd09
9 changed files with 86 additions and 24 deletions

View File

@ -1,8 +1,9 @@
local api = {}
api.SHORT_CYCLE = 0.03 -- for particles and fast animations
api.DEFAULT_CYCLE = 0.1 -- for most effect types
api.LONG_CYCLE = 0.5 -- for write operations and skybox changes
api.DEFAULT_CYCLE = 0.1 -- for most effect types
api.MEDIUM_CYCKE = 2.0 -- for ressource intensive tasks
api.LONG_CYCLE = 5.0 -- for write operations and skybox changes
climate_mod.weathers = {}
climate_mod.effects = {}

View File

@ -22,7 +22,7 @@ function utility.merge_tables(a, b)
end
-- see https://en.wikipedia.org/wiki/Logistic_function
function utility.logistic_growth(value, max, growth, midpoint)
function utility.sigmoid(value, max, growth, midpoint)
return max / (1 + math.exp(-growth * (value - midpoint)))
end

View File

@ -1,16 +1,14 @@
local default_state = {
heat = 1,
humidity = 1,
wind_x = 0.5,
wind_z = 0.5,
time_last_check = 0,
time_current_day = 1
}
local state = minetest.get_mod_storage()
if not state:contains("time_last_check") then
state:from_table({ fields = default_state })
if not state:contains("noise_timer") then
state:from_table({
heat_random = 1,
humidity_random = 1,
humidity_base = 50,
wind_x = 0.5,
wind_z = 0.5,
noise_timer = math.random(0, 300000)
})
end
return state

View File

@ -8,7 +8,7 @@ end
local function get_heat_calendar()
-- European heat center in August instead of June
local day = minetest.get_day_count()
local progression = (day + 61) / 365
local progression = ((day + 61) % 365) / 365
return climate_api.utility.normalized_cycle(progression) * 0.6 + 0.7
end