mirror of
https://github.com/t-affeldt/climate_api.git
synced 2025-06-30 15:30:43 +02:00
Implement dynamic cloud sizes, adjust cycle lengths
This commit is contained in:
@ -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 = {}
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
@ -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
|
||||
|
||||
|
Reference in New Issue
Block a user