From 79fb0a234dc7b2b30b3ba7e0bee02f8723515192 Mon Sep 17 00:00:00 2001 From: Till Affeldt Date: Mon, 13 Apr 2020 16:52:45 +0200 Subject: [PATCH] Enable dynamic cloud size --- ca_effects/leave_color.lua | 0 ca_weathers/ambient.lua | 28 ++++++++++++++++++++++++++++ ca_weathers/wind.lua | 24 ------------------------ init.lua | 7 ++++--- mod.conf | 6 ++++-- 5 files changed, 36 insertions(+), 29 deletions(-) create mode 100644 ca_effects/leave_color.lua create mode 100644 ca_weathers/ambient.lua delete mode 100644 ca_weathers/wind.lua diff --git a/ca_effects/leave_color.lua b/ca_effects/leave_color.lua new file mode 100644 index 0000000..e69de29 diff --git a/ca_weathers/ambient.lua b/ca_weathers/ambient.lua new file mode 100644 index 0000000..61a5d8f --- /dev/null +++ b/ca_weathers/ambient.lua @@ -0,0 +1,28 @@ +local name = "regional_weather:wind" + +local CLOUD_SPEED = 1.8 + +local conditions = {} + +local function generate_effects(params) + local override = {} + + override["climate_api:clouds"] = { + size = climate_api.utility.rangelim(params.humidity, 0.25, 0.9), + speed = vector.multiply(params.wind, CLOUD_SPEED) + } + + local movement = params.player:get_player_velocity() + local movement_direction + if (vector.length(movement) < 0.1) then + movement_direction = vector.new(0, 0, 0) + else + movement_direction = vector.normalize(movement) + end + local vector_product = vector.dot(movement_direction, params.wind) + local movement_penalty = climate_api.utility.sigmoid(vector_product, 1.6, 0.2, 0.8) + 0.2 + override["regional_weather:speed_buff"] = movement_penalty + return override +end + +climate_api.register_weather(name, conditions, generate_effects) diff --git a/ca_weathers/wind.lua b/ca_weathers/wind.lua deleted file mode 100644 index 08f503b..0000000 --- a/ca_weathers/wind.lua +++ /dev/null @@ -1,24 +0,0 @@ -local name = "regional_weather:wind" - -local CLOUD_SPEED_MULTIPLICATOR = 1.8 - -local conditions = {} - -local function generate_effects(params) - local override = {} - - override["climate_api:skybox"] = { - clouds_data = { - speed = params.wind * CLOUD_SPEED_MULTIPLICATOR - } - } - - local movement_direction = vector.normalize(params.player:get_player_velocity()) - local vector_product = vector.dot(movement_direction, params.wind) - local movement_penalty = climate_api.utility.logistic_growth(vector_product, 1.6, 0.15, 0.8) + 0.1 - override["regional_weather:speed_buff"] = movement_penalty - - return override -end - -climate_api.register_weather(name, conditions, generate_effects) diff --git a/init.lua b/init.lua index 5988cba..4c696de 100644 --- a/init.lua +++ b/init.lua @@ -19,14 +19,15 @@ regional_weather.settings.max_height = get_setting_number("max_height", 120) regional_weather.settings.min_height = get_setting_number("min_height", -50) -- import individual weather types +dofile(modpath.."/ca_weathers/ambient.lua") +dofile(modpath.."/ca_weathers/hail.lua") +dofile(modpath.."/ca_weathers/pollen.lua") dofile(modpath.."/ca_weathers/rain.lua") dofile(modpath.."/ca_weathers/rain_heavy.lua") +dofile(modpath.."/ca_weathers/sandstorm.lua") dofile(modpath.."/ca_weathers/snow.lua") dofile(modpath.."/ca_weathers/snow_heavy.lua") dofile(modpath.."/ca_weathers/storm.lua") -dofile(modpath.."/ca_weathers/sandstorm.lua") -dofile(modpath.."/ca_weathers/hail.lua") -dofile(modpath.."/ca_weathers/pollen.lua") -- register environment effects dofile(modpath.."/ca_effects/lightning.lua") diff --git a/mod.conf b/mod.conf index d00f929..fd50cdc 100644 --- a/mod.conf +++ b/mod.conf @@ -5,6 +5,8 @@ release = 1 depends = climate_api optional_depends = lightning description = """ - The ultimate weather mod with support not only for rain, snow, and hail, - but also seasons, dynamic puddles and snow layers, wind, regrowing fruit and much more. + Not every biome is the same and neither should their weather be. + Regional Weather controls it's effects with the local climate in mind. + + Experience the humid air of the rain forest and harsh desert sandstorms. """ \ No newline at end of file