diff --git a/README.md b/README.md index bff2f81..ad808fe 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ You can find respective rights and conditions in the attached [LICENSE](https:// The entire source code is available on [Github](https://github.com/t-affeldt/regional_weather). ### Particles -- Hail textures: *CC BY-SA (4.0)* made by me +- Hail textures: *CC BY-SA (3.0)* made by me - Snow flake textures: *CC BY-SA (3.0)* by paramat, found in snowdrift mod at https://github.com/paramat/snowdrift - Snow composite texture: *CC BY-SA (3.0)* by Piet Affeldt, created from aforementioned snow flakes by paramat (please credit original artist as well) - Rain textures: *CC BY-SA (3.0)* by Piet Affeldt (an original design for this mod) @@ -31,11 +31,11 @@ The entire source code is available on [Github](https://github.com/t-affeldt/reg - Hail sound: *CC0* by ikayuka from https://freesound.org/people/ikayuka/sounds/240742/ ### HUD Overlays -- Original texture for frost hud: *CC0* by Simon Matzinger from https://freestocktextures.com/texture/winter-snow-frozen,995.html, edits by me under *CC0* as well -- Original texture for sandstorm hud: *CC0* from https://freestocktextures.com/texture/dirty-baking-paper,1202.html, edits by me under *CC0* as well +- Frost HUD: *CC BY-SA (3.0)* by Piet Affeldt +- Original texture for sand storm HUD: *CC0* from https://freestocktextures.com/texture/dirty-baking-paper,1202.html, edits by me under *CC0* as well ### Assets in screenshots -- All screenshots and editing by me: *CC BY-SA (4.0)* +- All screenshots and editing by me: *CC BY-SA (3.0)* - Lato Font (for the Logo): *OFL* by Ɓukasz Dziedzic from http://www.latofonts.com/lato-free-fonts/ - Liberation Fonts (for the text): *OFL*, see https://github.com/liberationfonts/liberation-fonts - Used texture pack: Polygonia (128px edition) *CC BY-SA (4.0)* by Lokrates. See https://forum.minetest.net/viewtopic.php?f=4&t=19043 diff --git a/abms/fire.lua b/abms/fire.lua index 35ce30d..70d4bab 100644 --- a/abms/fire.lua +++ b/abms/fire.lua @@ -6,6 +6,7 @@ climate_api.register_abm({ nodenames = { "fire:basic_flame" }, interval = 10, chance = 2, + catch_up = false, conditions = { min_height = regional_weather.settings.min_height, diff --git a/abms/ice.lua b/abms/ice.lua index 60589bc..cbc2d75 100644 --- a/abms/ice.lua +++ b/abms/ice.lua @@ -27,6 +27,7 @@ climate_api.register_abm({ neighbors = { "air" }, interval = 10, chance = 2, + catch_up = false, conditions = { min_height = regional_weather.settings.min_height, @@ -46,6 +47,7 @@ climate_api.register_abm({ neighbors = { "air" }, interval = 15, chance = 4, + catch_up = true, conditions = { min_height = regional_weather.settings.min_height, diff --git a/abms/puddle.lua b/abms/puddle.lua index a633fa9..cd96fa1 100644 --- a/abms/puddle.lua +++ b/abms/puddle.lua @@ -1,13 +1,13 @@ --- code of this file is partially taken from and otherwise inspired by --- mymonths on https://github.com/minetest-mods/mymonths (licensed under DWYWPL) --- contributers available at https://github.com/minetest-mods/mymonths/graphs/contributors --- all changes of mine remain under LGPL v3 - -local BLOCK_NAME = "regional_weather:puddle" -local MIN_DISTANCE = 12 +local BLOCK_PREFIX = "regional_weather:puddle_" +local VARIANT_COUNT = 30 +local MIN_DISTANCE = 2 if not regional_weather.settings.puddles then - minetest.register_alias(BLOCK_NAME, "air") + for i=1,VARIANT_COUNT do + for r=0,270,90 do + minetest.register_alias(BLOCK_PREFIX .. i .. "_" .. r, "air") + end + end return end @@ -16,27 +16,59 @@ local node_box = { fixed = {-0.5, -0.5, -0.5, 0.5, -0.49, 0.5} } -minetest.register_node(BLOCK_NAME, { - tiles = { "weather_puddle.png" }, - drawtype = "nodebox", - pointable = false, - buildable_to = true, - floodable = true, - walkable = false, - sunlight_propagates = true, - paramtype = "light", - use_texture_alpha = true, - node_box = node_box, - groups = { - not_in_creative_inventory = 1, - crumbly = 3, - attached_node = 1, - slippery = 1, - flora = 1, - water = 1 - }, - drop = "", -}) +for i = 1,VARIANT_COUNT do + for rotation = 0,270,90 do + for flip = 0,1 do + local name = BLOCK_PREFIX .. i .. "_" .. rotation + local texture = "weather_puddle." .. i .. ".png^[opacity:128" + if flip == 1 or rotation > 0 then + texture = texture .. "^[transform" + end + if flip == 1 then + name = name .. "_flipped" + texture = texture .. "FX" + end + if rotation > 0 then + texture = texture .. "R" .. rotation + end + minetest.register_node(name, { + tiles = { texture }, + drawtype = "nodebox", + pointable = false, + buildable_to = true, + floodable = true, + walkable = false, + sunlight_propagates = true, + paramtype = "light", + use_texture_alpha = true, + node_box = node_box, + groups = { + not_in_creative_inventory = 1, + crumbly = 3, + attached_node = 1, + slippery = 1, + flora = 1, + water = 1, + regional_weather_puddle = 1 + }, + drop = "", + }) + end + end +end + +minetest.register_alias("regional_weather:puddle", BLOCK_PREFIX .. "14_0") + +local function get_random_puddle() + local index = math.random(1, VARIANT_COUNT) + local rotation = math.random(0, 3) * 90 + local flip = math.random(0, 1) + local name = BLOCK_PREFIX .. index .. "_" .. rotation + if flip == 1 then + name = name .. "_flipped" + end + return name +end -- Makes Puddles when raining climate_api.register_abm({ @@ -45,6 +77,7 @@ climate_api.register_abm({ neighbors = { "air" }, interval = 10, chance = 50, + catch_up = false, conditions = { min_height = regional_weather.settings.min_height, @@ -60,17 +93,19 @@ climate_api.register_abm({ action = function (pos, node, env) if minetest.get_node(pos).name ~= "air" then return end - if minetest.find_node_near(pos, MIN_DISTANCE, BLOCK_NAME) then return end - minetest.set_node(pos, {name = BLOCK_NAME}) + if minetest.find_node_near(pos, MIN_DISTANCE, "group:regional_weather_puddle") then return end + local puddle_name = get_random_puddle() + minetest.set_node(pos, {name = puddle_name}) end }) -- Makes puddles dry up when not raining climate_api.register_abm({ label = "remove rain puddles", - nodenames = { BLOCK_NAME }, + nodenames = { "group:regional_weather_puddle" }, interval = 5, chance = 5, + catch_up = true, action = function (pos, node, env) if env.humidity < 55 then @@ -79,4 +114,4 @@ climate_api.register_abm({ minetest.set_node(pos, {name = "regional_weather:snow_cover_1"}) end end -}) \ No newline at end of file +}) diff --git a/abms/snow_cover.lua b/abms/snow_cover.lua index 445b35e..e3fa29e 100644 --- a/abms/snow_cover.lua +++ b/abms/snow_cover.lua @@ -1,8 +1,3 @@ --- code of this file is partially taken from and otherwise inspired by --- mymonths on https://github.com/minetest-mods/mymonths (licensed under DWYWPL) --- contributers available at https://github.com/minetest-mods/mymonths/graphs/contributors --- all changes of mine remain under LGPL v3 - local BLOCK_PREFIX = "regional_weather:snow_cover_" if not minetest.get_modpath("default") @@ -66,7 +61,8 @@ climate_api.register_abm({ }, neighbors = { "air" }, interval = 15, - chance = 20, + chance = 30, + catch_up = false, conditions = { min_height = regional_weather.settings.min_height, @@ -100,7 +96,8 @@ climate_api.register_abm({ "group:regional_weather_snow_cover" }, interval = 15, - chance = 15, + chance = 25, + catch_up = false, conditions = { min_height = regional_weather.settings.min_height, @@ -125,6 +122,7 @@ climate_api.register_abm({ nodenames = { "group:regional_weather_snow_cover" }, interval = 15, chance = 10, + catch_up = true, conditions = { min_heat = 30 diff --git a/abms/soil.lua b/abms/soil.lua index 20d4f0f..93a393f 100644 --- a/abms/soil.lua +++ b/abms/soil.lua @@ -7,6 +7,7 @@ if farming ~= nil and farming.mod == "redo" then nodenames = { "farming:soil" }, interval = 8, chance = 2, + catch_up = false, conditions = { min_height = regional_weather.settings.min_height, @@ -27,6 +28,7 @@ else nodenames = { "group:field" }, interval = 8, chance = 2, + catch_up = false, conditions = { min_height = regional_weather.settings.min_height, diff --git a/ca_weathers/ambient.lua b/ca_weathers/ambient.lua index e16ebd5..6141a68 100644 --- a/ca_weathers/ambient.lua +++ b/ca_weathers/ambient.lua @@ -7,9 +7,9 @@ local function generate_effects(params) local override = {} local wind = climate_api.environment.get_wind() - local skybox = {priority = 0} + local skybox = {priority = 10} skybox.cloud_data = { - density = climate_api.utility.rangelim(params.humidity / 100, 0.25, 0.98), + density = climate_api.utility.rangelim(params.humidity / 100, 0.25, 0.75), speed = vector.multiply(wind, CLOUD_SPEED), thickness = climate_api.utility.rangelim(params.base_humidity * 0.2, 1, 18) } @@ -29,7 +29,7 @@ local function generate_effects(params) } end - --override["climate_api:skybox"] = skybox + override["climate_api:skybox"] = skybox local movement = params.player:get_player_velocity() local movement_direction diff --git a/ca_weathers/fog.lua b/ca_weathers/fog.lua index 0445673..0e903c8 100644 --- a/ca_weathers/fog.lua +++ b/ca_weathers/fog.lua @@ -1,20 +1,24 @@ local name = "regional_weather:fog" local conditions = { - + min_height = regional_weather.settings.min_height, + max_height = regional_weather.settings.max_height, + min_humidity = 40, + max_humidity = 50, + max_windspeed = 2, + min_heat = 40, + max_heat = 50 } local effects = {} -effects["climate_api:hud_overlay"] = { - file = "weather_hud_fog.png", - z_index = -200 -} - effects["climate_api:skybox"] = { + sky_data = { + clouds = true + }, cloud_data = { density = 1, - color = "#ffffffff", + color = "#ffffff00", thickness = 40, speed = {x=0,y=0,z=0} }, @@ -25,7 +29,7 @@ local function generate_effects(params) local override = {} override["climate_api:skybox"] = { cloud_data = { - height = params.player:get_pos().y + height = params.player:get_pos().y - 20 } } return climate_api.utility.merge_tables(effects, override) diff --git a/ca_weathers/fog_heavy.lua b/ca_weathers/fog_heavy.lua new file mode 100644 index 0000000..1ebd0f7 --- /dev/null +++ b/ca_weathers/fog_heavy.lua @@ -0,0 +1,31 @@ +local name = "regional_weather:fog_heavy" + +local conditions = { + min_height = regional_weather.settings.min_height * 0.9, + max_height = regional_weather.settings.max_height * 0.9, + min_humidity = 43, + max_humidity = 47, + max_windspeed = 1.5, + min_heat = 43, + max_heat = 47 +} + +local effects = {} + +effects["climate_api:hud_overlay"] = { + file = "weather_hud_fog.png^[opacity:100", + z_index = -200 +} + +effects["climate_api:skybox"] = { + sky_data = { + type = "plain", + base_color = "#c0c0c08f" + }, + cloud_data = { + color = "#ffffffc0", + }, + priority = 51 +} + +climate_api.register_weather(name, conditions, effects) diff --git a/ca_weathers/pollen.lua b/ca_weathers/pollen.lua index 0255880..52707e9 100644 --- a/ca_weathers/pollen.lua +++ b/ca_weathers/pollen.lua @@ -36,11 +36,12 @@ local effects = {} effects["climate_api:particles"] = { min_pos = {x=-12, y=-4, z=-12}, max_pos = {x= 12, y= 1, z= 12}, - falling_speed=-0.1, - amount=1, - exptime=5, - size=0.8, - texture="weather_pollen.png" + falling_speed = -0.1, + acceleration = {x=0,y=-0.03,z=0}, + amount = 1, + exptime = 5, + size = 0.8, + texture = "weather_pollen.png" } climate_api.register_weather(name, conditions, effects) diff --git a/ca_weathers/sandstorm.lua b/ca_weathers/sandstorm.lua index afd824a..3be9c94 100644 --- a/ca_weathers/sandstorm.lua +++ b/ca_weathers/sandstorm.lua @@ -43,6 +43,11 @@ effects["climate_api:particles"] = { } effects["climate_api:skybox"] = { + sky_data = { + type = "plain", + base_color = "#f7e4bfff", + clouds = true, + }, cloud_data = { density = 1, color = "#f7e4bfc0", @@ -53,12 +58,13 @@ effects["climate_api:skybox"] = { } local function generate_effects(params) - local override = table.copy(effects) + local override = {} override["climate_api:skybox"] = { cloud_data= { - height = params.player:get_pos().y + height = params.player:get_pos().y - 20 } } + override = climate_api.utility.merge_tables(effects, override) if params.daylight < 15 then local result = {} result["climate_api:skybox"] = override["climate_api:skybox"] diff --git a/ca_weathers/snow_heavy.lua b/ca_weathers/snow_heavy.lua index 2973970..7783124 100644 --- a/ca_weathers/snow_heavy.lua +++ b/ca_weathers/snow_heavy.lua @@ -11,7 +11,7 @@ local conditions = { local effects = {} effects["climate_api:hud_overlay"] = { - file = "weather_hud_ice.png", + file = "weather_hud_frost.png", z_index = -100 } diff --git a/init.lua b/init.lua index e4e268f..c9af78b 100644 --- a/init.lua +++ b/init.lua @@ -34,7 +34,8 @@ end -- import individual weather types dofile(modpath.."/ca_weathers/ambient.lua") dofile(modpath.."/ca_weathers/deep_cave.lua") ---dofile(modpath.."/ca_weathers/fog.lua") +dofile(modpath.."/ca_weathers/fog.lua") +dofile(modpath.."/ca_weathers/fog_heavy.lua") dofile(modpath.."/ca_weathers/hail.lua") dofile(modpath.."/ca_weathers/pollen.lua") dofile(modpath.."/ca_weathers/rain.lua") diff --git a/screenshot.2.png b/screenshot.2.png new file mode 100644 index 0000000..f58aa32 Binary files /dev/null and b/screenshot.2.png differ diff --git a/screenshot.3.png b/screenshot.3.png new file mode 100644 index 0000000..d8dfa75 Binary files /dev/null and b/screenshot.3.png differ diff --git a/screenshot.4.png b/screenshot.4.png new file mode 100644 index 0000000..5603695 Binary files /dev/null and b/screenshot.4.png differ diff --git a/settingtypes.txt b/settingtypes.txt index 19ba612..7e369ae 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -1,7 +1,31 @@ -regional_weather_damage (Storms and hail cause damage to players) bool true -regional_weather_snow_layers (Place snow layers on ground) bool true -regional_weather_puddles (Place rain puddles on ground) bool true -regional_weather_soil (Turn farmland wet during rain) bool true -regional_weather_fire (Extinguish fire during rain) bool true +[Features] + +# If set to true, sand storms and hail will damage affected players over time. +regional_weather_damage (Cause player damage) bool true + +# If set to true, snow layers will stack up during snowy weather. +regional_weather_snow_layers (Place snow layers) bool true + +# If set to true, river water sources will freeze at low temperatures and melt when it gets warmer again. +# This process does not affect regular ice blocks because it adds its own temporary ones. +regional_weather_ice (Freeze river water) bool true + +# If set to true, water puddles will form during rain or when snow layers have melted. +regional_weather_puddles (Place rain puddles) bool true + +# If set to true, rain will cause dry farmland to turn wet. +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 + + +[World Configuration] + +# No visual effects will be applied above this height. +# This value defaults to normal cloud height (120 nodes above sea level). regional_weather_max_height (Maximum height of weather effects) int 120 + +# No visual effects will be applied below this height. +# This will prevent unwanted visuals within large underground caves. regional_weather_min_height (Minimum height of weather effects) int -50 \ No newline at end of file diff --git a/textures/weather_hud_frost.png b/textures/weather_hud_frost.png new file mode 100644 index 0000000..4e6bc24 Binary files /dev/null and b/textures/weather_hud_frost.png differ diff --git a/textures/weather_hud_ice.png b/textures/weather_hud_ice.png deleted file mode 100644 index e5ae6b9..0000000 Binary files a/textures/weather_hud_ice.png and /dev/null differ diff --git a/textures/weather_puddle.1.png b/textures/weather_puddle.1.png new file mode 100644 index 0000000..f0ff637 Binary files /dev/null and b/textures/weather_puddle.1.png differ diff --git a/textures/weather_puddle.10.png b/textures/weather_puddle.10.png new file mode 100644 index 0000000..3a2b6b5 Binary files /dev/null and b/textures/weather_puddle.10.png differ diff --git a/textures/weather_puddle.11.png b/textures/weather_puddle.11.png new file mode 100644 index 0000000..55c2232 Binary files /dev/null and b/textures/weather_puddle.11.png differ diff --git a/textures/weather_puddle.12.png b/textures/weather_puddle.12.png new file mode 100644 index 0000000..16a7b1e Binary files /dev/null and b/textures/weather_puddle.12.png differ diff --git a/textures/weather_puddle.13.png b/textures/weather_puddle.13.png new file mode 100644 index 0000000..ebc6d8e Binary files /dev/null and b/textures/weather_puddle.13.png differ diff --git a/textures/weather_puddle.14.png b/textures/weather_puddle.14.png new file mode 100644 index 0000000..c42f0a8 Binary files /dev/null and b/textures/weather_puddle.14.png differ diff --git a/textures/weather_puddle.15.png b/textures/weather_puddle.15.png new file mode 100644 index 0000000..f02d56c Binary files /dev/null and b/textures/weather_puddle.15.png differ diff --git a/textures/weather_puddle.16.png b/textures/weather_puddle.16.png new file mode 100644 index 0000000..daa2cf2 Binary files /dev/null and b/textures/weather_puddle.16.png differ diff --git a/textures/weather_puddle.17.png b/textures/weather_puddle.17.png new file mode 100644 index 0000000..c595a60 Binary files /dev/null and b/textures/weather_puddle.17.png differ diff --git a/textures/weather_puddle.18.png b/textures/weather_puddle.18.png new file mode 100644 index 0000000..647d01e Binary files /dev/null and b/textures/weather_puddle.18.png differ diff --git a/textures/weather_puddle.19.png b/textures/weather_puddle.19.png new file mode 100644 index 0000000..e7107e1 Binary files /dev/null and b/textures/weather_puddle.19.png differ diff --git a/textures/weather_puddle.2.png b/textures/weather_puddle.2.png new file mode 100644 index 0000000..1a1632e Binary files /dev/null and b/textures/weather_puddle.2.png differ diff --git a/textures/weather_puddle.20.png b/textures/weather_puddle.20.png new file mode 100644 index 0000000..2588c2b Binary files /dev/null and b/textures/weather_puddle.20.png differ diff --git a/textures/weather_puddle.21.png b/textures/weather_puddle.21.png new file mode 100644 index 0000000..4cd63df Binary files /dev/null and b/textures/weather_puddle.21.png differ diff --git a/textures/weather_puddle.22.png b/textures/weather_puddle.22.png new file mode 100644 index 0000000..6dc1850 Binary files /dev/null and b/textures/weather_puddle.22.png differ diff --git a/textures/weather_puddle.23.png b/textures/weather_puddle.23.png new file mode 100644 index 0000000..43fb112 Binary files /dev/null and b/textures/weather_puddle.23.png differ diff --git a/textures/weather_puddle.24.png b/textures/weather_puddle.24.png new file mode 100644 index 0000000..b7742a6 Binary files /dev/null and b/textures/weather_puddle.24.png differ diff --git a/textures/weather_puddle.25.png b/textures/weather_puddle.25.png new file mode 100644 index 0000000..400514f Binary files /dev/null and b/textures/weather_puddle.25.png differ diff --git a/textures/weather_puddle.26.png b/textures/weather_puddle.26.png new file mode 100644 index 0000000..1f11faa Binary files /dev/null and b/textures/weather_puddle.26.png differ diff --git a/textures/weather_puddle.27.png b/textures/weather_puddle.27.png new file mode 100644 index 0000000..76f98e6 Binary files /dev/null and b/textures/weather_puddle.27.png differ diff --git a/textures/weather_puddle.28.png b/textures/weather_puddle.28.png new file mode 100644 index 0000000..0068891 Binary files /dev/null and b/textures/weather_puddle.28.png differ diff --git a/textures/weather_puddle.29.png b/textures/weather_puddle.29.png new file mode 100644 index 0000000..cd80857 Binary files /dev/null and b/textures/weather_puddle.29.png differ diff --git a/textures/weather_puddle.3.png b/textures/weather_puddle.3.png new file mode 100644 index 0000000..3b1027d Binary files /dev/null and b/textures/weather_puddle.3.png differ diff --git a/textures/weather_puddle.30.png b/textures/weather_puddle.30.png new file mode 100644 index 0000000..da9b96d Binary files /dev/null and b/textures/weather_puddle.30.png differ diff --git a/textures/weather_puddle.4.png b/textures/weather_puddle.4.png new file mode 100644 index 0000000..9374d13 Binary files /dev/null and b/textures/weather_puddle.4.png differ diff --git a/textures/weather_puddle.5.png b/textures/weather_puddle.5.png new file mode 100644 index 0000000..1a9f3aa Binary files /dev/null and b/textures/weather_puddle.5.png differ diff --git a/textures/weather_puddle.6.png b/textures/weather_puddle.6.png new file mode 100644 index 0000000..9d295f6 Binary files /dev/null and b/textures/weather_puddle.6.png differ diff --git a/textures/weather_puddle.7.png b/textures/weather_puddle.7.png new file mode 100644 index 0000000..cfbfe42 Binary files /dev/null and b/textures/weather_puddle.7.png differ diff --git a/textures/weather_puddle.8.png b/textures/weather_puddle.8.png new file mode 100644 index 0000000..7550a33 Binary files /dev/null and b/textures/weather_puddle.8.png differ diff --git a/textures/weather_puddle.9.png b/textures/weather_puddle.9.png new file mode 100644 index 0000000..fb56e23 Binary files /dev/null and b/textures/weather_puddle.9.png differ diff --git a/textures/weather_puddle.png b/textures/weather_puddle.png deleted file mode 100644 index ecacbc4..0000000 Binary files a/textures/weather_puddle.png and /dev/null differ