From e0b8d6d835af078548483cb67f3a5cb5ea721d4b Mon Sep 17 00:00:00 2001 From: Till Affeldt Date: Sat, 18 Apr 2020 17:26:01 +0200 Subject: [PATCH] Update to new influences, improve rain skybox --- abms/fire.lua | 2 +- abms/puddle.lua | 4 ++-- abms/snow_cover.lua | 16 ++++++++++------ ca_weathers/ambient.lua | 32 ++++++++++++++++++++++++-------- ca_weathers/deep_cave.lua | 9 ++++++--- ca_weathers/hail.lua | 2 +- ca_weathers/pollen.lua | 23 ++++++++++++++++++++++- ca_weathers/rain.lua | 2 +- ca_weathers/rain_heavy.lua | 10 +--------- ca_weathers/sandstorm.lua | 7 +++++-- ca_weathers/snow.lua | 2 +- ca_weathers/snow_heavy.lua | 10 +--------- ca_weathers/storm.lua | 2 +- init.lua | 4 +++- 14 files changed, 79 insertions(+), 46 deletions(-) diff --git a/abms/fire.lua b/abms/fire.lua index 61dd193..35ce30d 100644 --- a/abms/fire.lua +++ b/abms/fire.lua @@ -12,7 +12,7 @@ climate_api.register_abm({ max_height = regional_weather.settings.max_height, min_humidity = 55, max_heat = 85, - min_light = 15 + daylight = 15 }, action = function (pos, node, env) diff --git a/abms/puddle.lua b/abms/puddle.lua index 7fd5901..b671da6 100644 --- a/abms/puddle.lua +++ b/abms/puddle.lua @@ -37,7 +37,7 @@ minetest.register_node(BLOCK_NAME, { crumbly = 3, attached_node = 1, slippery = 1, - replaceable_by_snow = 1 + flora = 1 }, drop = "", }) @@ -55,7 +55,7 @@ climate_api.register_abm({ max_height = regional_weather.settings.max_height, min_humidity = 55, min_heat = 30, - min_light = 15 + daylight = 15 }, pos_override = function(pos) diff --git a/abms/snow_cover.lua b/abms/snow_cover.lua index b7d2d03..c09d5a2 100644 --- a/abms/snow_cover.lua +++ b/abms/snow_cover.lua @@ -6,6 +6,7 @@ local BLOCK_PREFIX = "regional_weather:snow_cover_" if not minetest.get_modpath("default") +or default.node_sound_snow_defaults == nil or not regional_weather.settings.snow then for i = 1,5 do minetest.register_alias(BLOCK_PREFIX .. i, "air") @@ -41,6 +42,12 @@ for i = 1,5 do if minetest.get_node(pos).name == "default:dirt_with_grass" then minetest.set_node(pos, {name = "default:dirt_with_snow"}) end + end, + on_destruct = function(pos) + pos.y = pos.y - 1 + if minetest.get_node(pos).name == "default:dirt_with_snow" then + minetest.set_node(pos, {name = "default:dirt_with_grass"}) + end end }) end @@ -63,7 +70,7 @@ climate_api.register_abm({ max_height = regional_weather.settings.max_height, min_humidity = 55, max_heat = 30, - min_light = 15 + daylight = 15 }, pos_override = function(pos) @@ -87,7 +94,6 @@ climate_api.register_abm({ "group:flora", "group:grass", "group:plant", - "group:replaceable_by_snow", "group:regional_weather_snow_cover" }, interval = 15, @@ -98,7 +104,7 @@ climate_api.register_abm({ max_height = regional_weather.settings.max_height, min_humidity = 55, max_heat = 30, - min_light = 15 + daylight = 15 }, action = function (pos, node, env) @@ -118,9 +124,7 @@ climate_api.register_abm({ chance = 10, conditions = { - min_height = regional_weather.settings.min_height, - max_height = regional_weather.settings.max_height, - min_heat = 30 + min_heat = 30 }, action = function (pos, node, env) diff --git a/ca_weathers/ambient.lua b/ca_weathers/ambient.lua index fc1cdb5..85ed569 100644 --- a/ca_weathers/ambient.lua +++ b/ca_weathers/ambient.lua @@ -2,21 +2,37 @@ local name = "regional_weather:ambient" local CLOUD_SPEED = 1.8 -local conditions = { - min_daylight = 15 -} +local conditions = {} local function generate_effects(params) local override = {} local wind = climate_api.environment.get_wind() - 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 skybox = {} + skybox.cloud_data = { + size = climate_api.utility.rangelim(params.humidity / 100, 0.25, 0.98), + speed = vector.multiply(wind, CLOUD_SPEED), + thickness = climate_api.utility.rangelim(params.base_humidity * 0.2, 1, 18) } + if params.height > -100 and params.humidity > 65 then + skybox.sky_data = { + type = "regular", + --base_color = { r = 106, g = 130, b = 142 }, + clouds = true, + sky_color = { + day_sky = "#6a828e", + day_horizon = "#5c7a8a", + dawn_sky = "#b2b5d7", + dawn_horizon = "#b7bce1", + night_sky = "#2373e1", + night_horizon = "#315d9b" + } + } + end + + override["climate_api:skybox"] = skybox + local movement = params.player:get_player_velocity() local movement_direction if (vector.length(movement) < 0.1) then diff --git a/ca_weathers/deep_cave.lua b/ca_weathers/deep_cave.lua index 2aef7ed..25bff79 100644 --- a/ca_weathers/deep_cave.lua +++ b/ca_weathers/deep_cave.lua @@ -1,8 +1,8 @@ local name = "regional_weather:deep_cave" local conditions = { - max_daylight = 14, - max_height = -100 + max_daylight = minetest.LIGHT_MAX, + max_height = -100 } local effects = {} @@ -12,7 +12,10 @@ effects["climate_api:skybox"] = { base_color = { r = 0, g = 0, b = 0 }, clouds = false }, - sun_data = { visible = false }, + sun_data = { + visible = false, + sunrise_visible = false + }, moon_data = { visible = false }, stars_data = { visible = false } } diff --git a/ca_weathers/hail.lua b/ca_weathers/hail.lua index bdf877a..8631f32 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_daylight = 15 + daylight = 15 } local effects = {} diff --git a/ca_weathers/pollen.lua b/ca_weathers/pollen.lua index 8ae78bd..0255880 100644 --- a/ca_weathers/pollen.lua +++ b/ca_weathers/pollen.lua @@ -7,7 +7,28 @@ local conditions = { min_humidity = 30, max_humidity = 40, max_windspeed = 2, - min_daylight = 15 + daylight = 15, + has_biome = { + "default", + "deciduous_forest", + "deciduous_forest_ocean", + "deciduous_forest_shore", + "grassland", + "grassland_dunes", + "grassland_ocean", + "snowy_grassland", + "snowy_grassland_ocean", + "grassy", + "grassy_ocean", + "grassytwo", + "grassytwo_ocean", + "mushroom", + "mushroom_ocean", + "plains", + "plains_ocean", + "sakura", + "sakura_ocean" + } } local effects = {} diff --git a/ca_weathers/rain.lua b/ca_weathers/rain.lua index 5c9bdc3..60162d7 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_daylight = 15 + daylight = 15 } local effects = {} diff --git a/ca_weathers/rain_heavy.lua b/ca_weathers/rain_heavy.lua index f75ebcb..2ce2652 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_daylight = 15 + daylight = 15 } local effects = {} @@ -15,14 +15,6 @@ effects["climate_api:sound"] = { gain = 1 } -effects["climate_api:skybox"] = { - sky_data = { - type = "plain", - base_color = {r = 125, g = 142, b = 145}, - clouds = true - } -} - effects["climate_api:particles"] = { min_pos = {x=-9, y=7, z=-9}, max_pos = {x= 9, y=7, z= 9}, diff --git a/ca_weathers/sandstorm.lua b/ca_weathers/sandstorm.lua index d8097f2..084f148 100644 --- a/ca_weathers/sandstorm.lua +++ b/ca_weathers/sandstorm.lua @@ -6,11 +6,14 @@ local conditions = { min_heat = 50, max_humidity = 25, min_windspeed = 6, - min_daylight = 15, + daylight = 15, has_biome = { + "cold_desert", + "cold_desert_ocean", "desert", + "desert_ocean", "sandstone_desert", - "cold_desert" + "sandstone_desert_ocean" } } diff --git a/ca_weathers/snow.lua b/ca_weathers/snow.lua index 9d83d1e..63dbb15 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_daylight = 15 + daylight = 15 } local effects = {} diff --git a/ca_weathers/snow_heavy.lua b/ca_weathers/snow_heavy.lua index 8fb2879..358d78f 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_daylight = 15 + daylight = 15 } local effects = {} @@ -23,14 +23,6 @@ effects["climate_api:particles"] = { texture="weather_snow.png" } -effects["climate_api:skybox"] = { - sky_data = { - type = "plain", - base_color = {r=106, g=130, b=142}, - clouds = true - } -} - local function generate_effects(params) local avg_humidity = 55 local intensity = params.humidity / avg_humidity diff --git a/ca_weathers/storm.lua b/ca_weathers/storm.lua index f403a4b..77f0265 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_daylight = 15 + daylight = 15 } local effects = {} diff --git a/init.lua b/init.lua index 6df5d3d..faf3e28 100644 --- a/init.lua +++ b/init.lua @@ -44,4 +44,6 @@ dofile(modpath.."/ca_effects/speed_buff.lua") dofile(modpath .. "/abms/puddle.lua") dofile(modpath .. "/abms/snow_cover.lua") dofile(modpath .. "/abms/fire.lua") -dofile(modpath .. "/abms/soil.lua") \ No newline at end of file +dofile(modpath .. "/abms/soil.lua") + +minetest.log(minetest.LIGHT_MAX) \ No newline at end of file