1
0
mirror of https://github.com/t-affeldt/regional_weather.git synced 2024-11-11 04:50:34 +01:00

Improve snow and rain performance, nerf block update speed

This commit is contained in:
Till Affeldt 2020-04-25 15:50:45 +02:00
parent 084ee8c9f5
commit acab95402a
76 changed files with 89 additions and 58 deletions

View File

@ -7,6 +7,58 @@ Not every biome is the same and neither should their weather be.
Regional Weather controls its effects with the local climate in mind. Regional Weather controls its effects with the local climate in mind.
Experience the humid air of the rain forest and harsh desert sandstorms. Experience the humid air of the rain forest and harsh desert sandstorms.
## Troubleshooting
Regional Weather depends on [Climate API](https://github.com/t-affeldt/climate_api) in order to function. Generally speaking, most mods should be compatible to it.
If you notice __odd movement speeds__ or jump heights of players, you should check for mods that also modify player physics. Use a compatibility mod like [player_monoids](https://github.com/minetest-mods/player_monoids) or [playerphysics](https://forum.minetest.net/viewtopic.php?t=22172) to get rid of this problem. This requires the conflicting mod to also support the chosen compatibility layer.
Mods that __modify the sky__ (including skybox, moon, sun, stars and clouds) are sadly not fully compatible because they conflict with Climate API's sky system. You should deactivate the sky features in either mod. You can do this in Climate API's settings using the ``Override the skybox`` option. If you're a mod maker then you can also optionally depend on climate_api and use ``climate_api.skybox.add_layer(playername, layer_name, options)`` to register your skybox change in a compatible way. Note that you need __at least Minetest v5.2.0__ for skybox changes to have any effect.
Conflicting skybox changes include the ``weather`` mod included in vanilla __Minetest Game__. You will want to disable that mod in order to use the more advanced cloud system introduced by Climate API. Head to ``Settings → All Settings → Games → Minetest Game`` and set ``Enable weather`` to ``Disabled``. This setting will only exist if you are using Minetest Game v5.2.0 or higher.
If you experience __performance issues__, the *Performance* section of Climate API's configuration section is a great place to start looking for a solution.
The following mods are recommended to be installed alongside Regional Weather:
- [Climate API](https://github.com/t-affeldt/climate_api) (required): The necessary weather engine that this mod is built upon
- [Moon Phases](https://github.com/t-affeldt/minetest_moon_phase): Complements weather effects with dynamic sky changes and a full moon cycle
- [Sailing Kit](https://github.com/t-affeldt/sailing_kit) (Fork): Uses Climate API's new wind system to sail across the sea.
- [Lightning](https://github.com/minetest-mods/lightning): Adds to heavy rain by enabling additional lightning effects
- [Farming](https://github.com/minetest/minetest_game/tree/master/mods/farming) (as part of MTG) or [Farming Redo](https://forum.minetest.net/viewtopic.php?t=9019): Add farmland and crops to grow food. Farmland wil turn wet during rain effects.
- [Fire](https://github.com/minetest/minetest_game/tree/master/mods/fire) (as part of MTG): Adds fires that can be caused by lightning strikes and other effects and will be extinguished during rain effects.
- [Ambience](https://notabug.org/TenPlus1/ambience): Plays some nice ambient sound effects based on where you are.
For easier installation, you can get a lot of these mods as part of my [Climate Modpack](https://github.com/t-affeldt/climate).
## Configuration Options
You can find all mod configuration options in your Minetest launcher.
Go to ``Settings → All Settings → Mods → regional_weather`` to change them.
Also check out the options inside the ``climate_api`` section for additional configuration options, including performance tweaks and feature switches.
### Features
- ``Cause player damage`` (default true):
If set to true, sand storms and hail will damage affected players over time.
- ``Place snow layers`` (default true):
If set to true, snow layers will stack up during snowy weather.
- ``Freeze river water`` (default 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.
- ``Place rain puddles`` (default true):
If set to true, water puddles will form during rain or when snow layers have melted.
- ``Hydrate farmland`` (default true):
If set to true, rain will cause dry farmland to turn wet.
Requires *farming* or *farming_redo* mod.
- ``Extinguish fire`` (bool true):
If set to true, fires will be extinguished during rain showers.
Requires *fire* mod.
### World Configuration
- ``Maximum height of weather effects`` (default 120):
No visual effects will be applied above this height.
This value defaults to normal cloud height (120 nodes above sea level).
- ``Minimum height of weather effects`` (default -50):
No visual effects will be applied below this height.
This will prevent unwanted visuals within large underground caves.
## License information ## License information
### Source Code ### Source Code
Unless otherwise stated, this source code is written entirely by myself. Unless otherwise stated, this source code is written entirely by myself.
@ -39,7 +91,7 @@ The entire source code is available on [Github](https://github.com/t-affeldt/reg
- Screenshots and editing: *CC BY-SA (3.0)* by me - Screenshots and editing: *CC BY-SA (3.0)* by me
- Logos and artwork: *CC BY-SA (3.0)* by Cap - Logos and artwork: *CC BY-SA (3.0)* by Cap
- Lato Font (for the Logo): *OFL* by Łukasz Dziedzic from http://www.latofonts.com/lato-free-fonts/ - 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 - Source Sans Pro (for the subtitles): *OFL*, see https://fonts.google.com/specimen/Source+Sans+Pro
- Used texture pack: Polygonia (128px edition) *CC BY-SA (4.0)* by Lokrates. See https://forum.minetest.net/viewtopic.php?f=4&t=19043 - Used texture pack: Polygonia (128px edition) *CC BY-SA (4.0)* by Lokrates. See https://forum.minetest.net/viewtopic.php?f=4&t=19043
### Full License Conditions ### Full License Conditions

View File

@ -4,6 +4,7 @@ if not minetest.get_modpath("fire") then return end
climate_api.register_abm({ climate_api.register_abm({
label = "extinguish fire at high humidity", label = "extinguish fire at high humidity",
nodenames = { "fire:basic_flame" }, nodenames = { "fire:basic_flame" },
neighbors = { "air" },
interval = 10, interval = 10,
chance = 2, chance = 2,
catch_up = false, catch_up = false,

View File

@ -25,8 +25,8 @@ climate_api.register_abm({
label = "freeze river water", label = "freeze river water",
nodenames = { "default:river_water_source" }, nodenames = { "default:river_water_source" },
neighbors = { "air" }, neighbors = { "air" },
interval = 10, interval = 25,
chance = 2, chance = 3,
catch_up = false, catch_up = false,
conditions = { conditions = {
@ -44,8 +44,7 @@ climate_api.register_abm({
climate_api.register_abm({ climate_api.register_abm({
label = "unfreeze river water", label = "unfreeze river water",
nodenames = { BLOCK_NAME }, nodenames = { BLOCK_NAME },
neighbors = { "air" }, interval = 25,
interval = 15,
chance = 4, chance = 4,
catch_up = true, catch_up = true,

View File

@ -1,6 +1,6 @@
local BLOCK_PREFIX = "regional_weather:puddle_" local BLOCK_PREFIX = "regional_weather:puddle_"
local VARIANT_COUNT = 30 local VARIANT_COUNT = 39
local MIN_DISTANCE = 2 local MIN_DISTANCE = 4
if not regional_weather.settings.puddles then if not regional_weather.settings.puddles then
for i=1,VARIANT_COUNT do for i=1,VARIANT_COUNT do
@ -20,7 +20,9 @@ for i = 1,VARIANT_COUNT do
for rotation = 0,270,90 do for rotation = 0,270,90 do
for flip = 0,1 do for flip = 0,1 do
local name = BLOCK_PREFIX .. i .. "_" .. rotation local name = BLOCK_PREFIX .. i .. "_" .. rotation
local texture = "weather_puddle." .. i .. ".png^[opacity:128" local index = i
if i < 10 then index = "0" .. i end
local texture = "weather_puddle_" .. index .. ".png^[opacity:128"
if flip == 1 or rotation > 0 then if flip == 1 or rotation > 0 then
texture = texture .. "^[transform" texture = texture .. "^[transform"
end end
@ -81,7 +83,7 @@ climate_api.register_abm({
label = "create rain puddles", label = "create rain puddles",
nodenames = { "group:soil", "group:stone" }, nodenames = { "group:soil", "group:stone" },
neighbors = { "air" }, neighbors = { "air" },
interval = 10, interval = 15,
chance = 50, chance = 50,
catch_up = false, catch_up = false,
@ -109,8 +111,8 @@ climate_api.register_abm({
climate_api.register_abm({ climate_api.register_abm({
label = "remove rain puddles", label = "remove rain puddles",
nodenames = { "group:regional_weather_puddle" }, nodenames = { "group:regional_weather_puddle" },
interval = 5, interval = 10,
chance = 5, chance = 3,
catch_up = true, catch_up = true,
action = function (pos, node, env) action = function (pos, node, env)

View File

@ -60,8 +60,8 @@ climate_api.register_abm({
"group:coverable_by_snow" "group:coverable_by_snow"
}, },
neighbors = { "air" }, neighbors = { "air" },
interval = 15, interval = 25,
chance = 30, chance = 40,
catch_up = false, catch_up = false,
conditions = { conditions = {
@ -95,8 +95,9 @@ climate_api.register_abm({
"group:plant", "group:plant",
"group:regional_weather_snow_cover" "group:regional_weather_snow_cover"
}, },
interval = 15, neighbors = { "air" },
chance = 25, interval = 25,
chance = 30,
catch_up = false, catch_up = false,
conditions = { conditions = {
@ -120,7 +121,7 @@ climate_api.register_abm({
climate_api.register_abm({ climate_api.register_abm({
label = "melt snow covers", label = "melt snow covers",
nodenames = { "group:regional_weather_snow_cover" }, nodenames = { "group:regional_weather_snow_cover" },
interval = 15, interval = 25,
chance = 10, chance = 10,
catch_up = true, catch_up = true,

View File

@ -3,7 +3,7 @@ local name = "regional_weather:rain"
local conditions = { local conditions = {
min_height = regional_weather.settings.min_height, min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height, max_height = regional_weather.settings.max_height,
min_heat = 30, min_heat = 35,
min_humidity = 50, min_humidity = 50,
max_humidity = 65, max_humidity = 65,
daylight = 15 daylight = 15
@ -17,28 +17,14 @@ effects["climate_api:sound"] = {
} }
effects["climate_api:particles"] = { effects["climate_api:particles"] = {
min_pos = {x=-9, y=7, z=-9}, min_pos = {x=-9, y=8, z=-9},
max_pos = {x= 9, y=7, z= 9}, max_pos = {x= 9, y=6, z= 9},
exptime=0.8, exptime = 1.1,
size=2, size = 2,
amount = 15,
falling_speed = 6,
acceleration={x=0, y=-0.05, z=0},
texture = "weather_raindrop.png" texture = "weather_raindrop.png"
} }
local function generate_effects(params) climate_api.register_weather(name, conditions, effects)
local avg_humidity = 40
local intensity = params.humidity / avg_humidity
local override = {}
override["climate_api:sound"] = {
gain = math.min(intensity, 1.2)
}
override["climate_api:particles"] = {
amount = 25 * math.min(intensity, 1.5),
falling_speed = 10 / math.min(intensity, 1.3)
}
return climate_api.utility.merge_tables(effects, override)
end
climate_api.register_weather(name, conditions, generate_effects)

View File

@ -3,7 +3,7 @@ local name = "regional_weather:snow"
local conditions = { local conditions = {
min_height = regional_weather.settings.min_height, min_height = regional_weather.settings.min_height,
max_height = regional_weather.settings.max_height, max_height = regional_weather.settings.max_height,
max_heat = 40, max_heat = 35,
min_humidity = 50, min_humidity = 50,
max_humidity = 65, max_humidity = 65,
daylight = 15 daylight = 15
@ -12,10 +12,13 @@ local conditions = {
local effects = {} local effects = {}
effects["climate_api:particles"] = { effects["climate_api:particles"] = {
min_pos = {x=-20, y= 3, z=-20}, min_pos = {x=-12, y=2, z=-12},
max_pos = {x= 20, y=12, z= 20}, max_pos = {x= 12, y=8, z= 12},
exptime=8, amount = 4,
size=1, exptime = 7,
size = 1,
falling_speed = 0.85,
acceleration = {x=0, y=0.06, z=0},
textures = {} textures = {}
} }
@ -23,17 +26,4 @@ for i = 1,12,1 do
effects["climate_api:particles"].textures[i] = "weather_snowflake" .. i .. ".png" effects["climate_api:particles"].textures[i] = "weather_snowflake" .. i .. ".png"
end end
local function generate_effects(params) climate_api.register_weather(name, conditions, effects)
local avg_humidity = 40
local intensity = params.humidity / avg_humidity
local override = {}
override["climate_api:particles"] = {
amount = 50 * 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)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB