diff --git a/abms/ice.lua b/abms/ice.lua index 951c460..6b92caa 100644 --- a/abms/ice.lua +++ b/abms/ice.lua @@ -8,7 +8,14 @@ local BLOCK_NAME = "regional_weather:ice" minetest.register_node(BLOCK_NAME, { tiles = {"(default_ice.png^[colorize:#ffffff:50)^[opacity:200"}, paramtype = "light", - groups = {cracky = 3, cools_lava = 1, slippery = 3, dig_immediate = 2}, + groups = { + cracky = 3, + cools_lava = 1, + slippery = 3, + dig_immediate = 2, + melts = 1 + }, + freezemelt = "default:river_water_source", sounds = default.node_sound_glass_defaults(), use_texture_alpha = true, drop = "", diff --git a/abms/pedology.lua b/abms/pedology.lua new file mode 100644 index 0000000..5efdc0e --- /dev/null +++ b/abms/pedology.lua @@ -0,0 +1,28 @@ +if not regional_weather.settings.pedology +or not minetest.get_modpath("pedology") +then return end + +climate_api.register_abm({ + label = "wetten or dry pedology nodes", + nodenames = { "group:sucky" }, + neighbors = { "air" }, + interval = 25, + chance = 30, + catch_up = false, + + conditions = { + min_height = regional_weather.settings.min_height, + max_height = regional_weather.settings.max_height, + min_heat = 25, + min_light = 15 + }, + + action = function (pos, node, env) + local wetness = minetest.get_item_group(node.name, "wet") or 0 + if wetness < 2 and env.humidity > 55 then + pedology.wetten(pos) + elseif wetness > 0 and wetness < 3 and env.humidity < 40 then + pedology.dry(pos) + end + end +}) \ No newline at end of file diff --git a/abms/snow_cover.lua b/abms/snow_cover.lua index 9838dee..27ebc29 100644 --- a/abms/snow_cover.lua +++ b/abms/snow_cover.lua @@ -77,7 +77,7 @@ climate_api.register_abm({ end, action = function (pos, node, env) - if minetest.get_node(pos).name ~= "air" then return end + if node.name ~= "air" then return end local base = minetest.get_node(vector.add(pos, {x=0, y=-1, z=0})).name local is_soil = minetest.get_item_group(base, "soil") or 0 local is_stone = minetest.get_item_group(base, "stone") or 0 @@ -109,8 +109,7 @@ climate_api.register_abm({ }, action = function (pos, node, env) - local node_name = minetest.get_node(pos).name - local value = minetest.get_item_group(node_name, "regional_weather_snow_cover") + local value = minetest.get_item_group(node.name, "regional_weather_snow_cover") if value == nil then value = 0 end if value < 5 then minetest.set_node(pos, { name = BLOCK_PREFIX .. (value + 1) }) @@ -130,8 +129,7 @@ climate_api.register_abm({ }, action = function (pos, node, env) - local node_name = minetest.get_node(pos).name - local value = minetest.get_item_group(node_name, "regional_weather_snow_cover") + local value = minetest.get_item_group(node.name, "regional_weather_snow_cover") if value == nil then value = 0 end if value > 1 then minetest.set_node(pos, { name = BLOCK_PREFIX .. (value - 1) }) diff --git a/ca_effects/damage.lua b/ca_effects/damage.lua index 748320b..2c93113 100644 --- a/ca_effects/damage.lua +++ b/ca_effects/damage.lua @@ -1,3 +1,11 @@ +--[[ +# Player Damage Effect +Use this effect to damage a player during dangerous weather events. +Expects a table as the parameter containing the following values: +- ``value ``: The amount of damage to be applied per successful roll per cycle +- ``chance ``: Defines a 1/x chance for the player to get damaged. Higher values result in less frequent damage. +]] + if not minetest.is_yes(minetest.settings:get_bool("enable_damage")) or not regional_weather.settings.damage then return end diff --git a/ca_effects/lightning.lua b/ca_effects/lightning.lua index 2d0ec1e..f0416e3 100644 --- a/ca_effects/lightning.lua +++ b/ca_effects/lightning.lua @@ -1,3 +1,10 @@ +--[[ +# Lightning Effect +Use this effect to cause lightning strikes. +Requires lightning mod in order to function. +Uses default lightning configuration. Expects any non-nil parameter. +]] + if not minetest.get_modpath("lightning") then return end local EFFECT_NAME = "regional_weather:lightning" diff --git a/ca_effects/speed_buff.lua b/ca_effects/speed_buff.lua index 5a171af..b8e4565 100644 --- a/ca_effects/speed_buff.lua +++ b/ca_effects/speed_buff.lua @@ -1,3 +1,9 @@ +--[[ +# Player Speed Effect +Use this effect to modify a player's movement speed. +Expects a numeric value that will be multiplied with the current speed physics. +]] + local EFFECT_NAME = "regional_weather:speed_buff" local function handle_effect(player_data) diff --git a/ca_weathers/snow_heavy.lua b/ca_weathers/snow_heavy.lua index fbd3e83..b2082de 100644 --- a/ca_weathers/snow_heavy.lua +++ b/ca_weathers/snow_heavy.lua @@ -17,24 +17,13 @@ effects["climate_api:hud_overlay"] = { } effects["climate_api:particles"] = { - min_pos = {x=-8, y=3, z=-8}, - max_pos = {x= 8, y=6, z= 8}, - exptime=6, - size=10, + min_pos = {x=-7, y=3, z=-7}, + max_pos = {x= 7, y=6, z= 7}, + exptime=7.5, + size=15, + amount=6, + falling_speed = 0.75, texture="weather_snow.png" } -local function generate_effects(params) - local avg_humidity = 55 - local intensity = params.humidity / avg_humidity - local override = {} - - override["climate_api:particles"] = { - amount = 16 * math.min(intensity, 1.5), - falling_speed = 1 / math.min(intensity, 1.3) - } - - return climate_api.utility.merge_tables(effects, override) -end - -climate_api.register_weather(name, conditions, generate_effects) +climate_api.register_weather(name, conditions, effects) diff --git a/init.lua b/init.lua index c9af78b..96b132c 100644 --- a/init.lua +++ b/init.lua @@ -21,6 +21,7 @@ regional_weather.settings.puddles = get_setting_bool("puddles", true) regional_weather.settings.soil = get_setting_bool("soil", true) regional_weather.settings.fire = get_setting_bool("fire", true) regional_weather.settings.ice = get_setting_bool("ice", true) +regional_weather.settings.pedology = get_setting_bool("pedology", true) regional_weather.settings.max_height = get_setting_number("max_height", 120) regional_weather.settings.min_height = get_setting_number("min_height", -50) @@ -55,4 +56,5 @@ dofile(modpath .. "/abms/puddle.lua") dofile(modpath .. "/abms/snow_cover.lua") dofile(modpath .. "/abms/fire.lua") dofile(modpath .. "/abms/ice.lua") +dofile(modpath .. "/abms/pedology.lua") dofile(modpath .. "/abms/soil.lua") diff --git a/mod.conf b/mod.conf index 002b879..c306589 100644 --- a/mod.conf +++ b/mod.conf @@ -3,7 +3,7 @@ title = Regional Weather author = TestificateMods release = 1 depends = climate_api -optional_depends = default, lightning, farming, fire +optional_depends = default, lightning, farming, fire, pedology 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. diff --git a/settingtypes.txt b/settingtypes.txt index 7e369ae..94ec405 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -19,6 +19,8 @@ regional_weather_soil (Hydrate farmland) bool true # If set to true, fires will be extinguished during rain showers. regional_weather_fire (Extinguish fire) bool true +# If set to true, rain will wetten or dry nodes from pedology mod. +regional_weather_pedology (Wetten pedology nodes) bool true [World Configuration]