From 52f06da30f5e96c2055f44da26970a6a48346434 Mon Sep 17 00:00:00 2001 From: Till Affeldt Date: Sat, 18 Apr 2020 08:03:02 +0200 Subject: [PATCH] Enable snow setting, update presets to renamed lighting condition --- abms/snow_cover.lua | 3 ++- ca_weathers/ambient.lua | 15 +++++++++------ ca_weathers/deep_cave.lua | 2 +- ca_weathers/hail.lua | 2 +- ca_weathers/pollen.lua | 2 +- ca_weathers/rain.lua | 2 +- ca_weathers/rain_heavy.lua | 2 +- ca_weathers/sandstorm.lua | 9 ++++++++- ca_weathers/snow.lua | 2 +- ca_weathers/snow_heavy.lua | 2 +- ca_weathers/storm.lua | 2 +- mod.conf | 4 ++-- 12 files changed, 29 insertions(+), 18 deletions(-) diff --git a/abms/snow_cover.lua b/abms/snow_cover.lua index 7bb2265..b7d2d03 100644 --- a/abms/snow_cover.lua +++ b/abms/snow_cover.lua @@ -5,7 +5,8 @@ local BLOCK_PREFIX = "regional_weather:snow_cover_" -if not regional_weather.settings.puddles then +if not minetest.get_modpath("default") +or not regional_weather.settings.snow then for i = 1,5 do minetest.register_alias(BLOCK_PREFIX .. i, "air") end diff --git a/ca_weathers/ambient.lua b/ca_weathers/ambient.lua index 5206878..9ce0802 100644 --- a/ca_weathers/ambient.lua +++ b/ca_weathers/ambient.lua @@ -3,16 +3,19 @@ local name = "regional_weather:ambient" local CLOUD_SPEED = 1.8 local conditions = { - min_light = 15 + min_daylight = 15 } local function generate_effects(params) local override = {} + local wind = vector.new(params.wind_x, 0, params.wind_z) - --[[override["climate_api:clouds"] = { - size = climate_api.utility.rangelim(params.humidity / 100, 0.25, 0.98), - speed = vector.multiply(params.wind, CLOUD_SPEED) - }]] + override["climate_api:skybox"] = { + cloud_data = { + size = climate_api.utility.rangelim(params.humidity / 100, 0.25, 0.98), + speed = vector.multiply(wind, CLOUD_SPEED) + } + } local movement = params.player:get_player_velocity() local movement_direction @@ -21,7 +24,7 @@ local function generate_effects(params) else movement_direction = vector.normalize(movement) end - local vector_product = vector.dot(movement_direction, params.wind) + local vector_product = vector.dot(movement_direction, 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 diff --git a/ca_weathers/deep_cave.lua b/ca_weathers/deep_cave.lua index a302e16..2aef7ed 100644 --- a/ca_weathers/deep_cave.lua +++ b/ca_weathers/deep_cave.lua @@ -1,7 +1,7 @@ local name = "regional_weather:deep_cave" local conditions = { - max_light = 14, + max_daylight = 14, max_height = -100 } diff --git a/ca_weathers/hail.lua b/ca_weathers/hail.lua index 13ec5b5..bdf877a 100644 --- a/ca_weathers/hail.lua +++ b/ca_weathers/hail.lua @@ -6,7 +6,7 @@ local conditions = { max_heat = 45, min_humidity = 65, min_windspeed = 2.5, - min_light = 15 + min_daylight = 15 } local effects = {} diff --git a/ca_weathers/pollen.lua b/ca_weathers/pollen.lua index 88c7ff0..8ae78bd 100644 --- a/ca_weathers/pollen.lua +++ b/ca_weathers/pollen.lua @@ -7,7 +7,7 @@ local conditions = { min_humidity = 30, max_humidity = 40, max_windspeed = 2, - min_light = 15 + min_daylight = 15 } local effects = {} diff --git a/ca_weathers/rain.lua b/ca_weathers/rain.lua index 2ee9db0..5c9bdc3 100644 --- a/ca_weathers/rain.lua +++ b/ca_weathers/rain.lua @@ -6,7 +6,7 @@ local conditions = { min_heat = 30, min_humidity = 50, max_humidity = 65, - min_light = 15 + min_daylight = 15 } local effects = {} diff --git a/ca_weathers/rain_heavy.lua b/ca_weathers/rain_heavy.lua index 46093ca..4466876 100644 --- a/ca_weathers/rain_heavy.lua +++ b/ca_weathers/rain_heavy.lua @@ -5,7 +5,7 @@ local conditions = { max_height = regional_weather.settings.max_height, min_heat = 40, min_humidity = 65, - min_light = 15 + min_daylight = 15 } local effects = {} diff --git a/ca_weathers/sandstorm.lua b/ca_weathers/sandstorm.lua index 39e4acb..4b5238c 100644 --- a/ca_weathers/sandstorm.lua +++ b/ca_weathers/sandstorm.lua @@ -6,7 +6,14 @@ local conditions = { min_heat = 50, max_humidity = 25, min_windspeed = 6, - min_light = 15 + min_daylight = 15, + has_biome = { + "desert", + "sandstone_desert", + "cold_desert", + "grassland_dunes", + "coniferous_forest_dunes" + } } local effects = {} diff --git a/ca_weathers/snow.lua b/ca_weathers/snow.lua index 1ed309b..9d83d1e 100644 --- a/ca_weathers/snow.lua +++ b/ca_weathers/snow.lua @@ -6,7 +6,7 @@ local conditions = { max_heat = 40, min_humidity = 50, max_humidity = 65, - min_light = 15 + min_daylight = 15 } local effects = {} diff --git a/ca_weathers/snow_heavy.lua b/ca_weathers/snow_heavy.lua index 28c1956..cfd108e 100644 --- a/ca_weathers/snow_heavy.lua +++ b/ca_weathers/snow_heavy.lua @@ -5,7 +5,7 @@ local conditions = { max_height = regional_weather.settings.max_height, max_heat = 30, min_humidity = 65, - min_light = 15 + min_daylight = 15 } local effects = {} diff --git a/ca_weathers/storm.lua b/ca_weathers/storm.lua index d0d55f9..f403a4b 100644 --- a/ca_weathers/storm.lua +++ b/ca_weathers/storm.lua @@ -4,7 +4,7 @@ local conditions = { min_height = regional_weather.settings.min_height, max_height = regional_weather.settings.max_height, min_windspeed = 3, - min_light = 15 + min_daylight = 15 } local effects = {} diff --git a/mod.conf b/mod.conf index 84f27ba..00677fb 100644 --- a/mod.conf +++ b/mod.conf @@ -2,8 +2,8 @@ name = regional_weather title = Regional Weather author = TestificateMods release = 1 -depends = default, climate_api -optional_depends = lightning, farming +depends = climate_api +optional_depends = default, lightning, farming description = """ Not every biome is the same and neither should their weather be. Regional Weather controls it's effects with the local climate in mind.