Below is an explanation of the Lua function I intend to add, and a description of what effects I'd like the weather system to contain. I'd like users to let me know what they think of each feature, and developers to do the same and also specify if and how the idea is acceptable. I don't wish to work for nothing and create code that won't make it in Minetest, so please voice your opinion. I also added a pool so I can easily see how popular the idea is.
- Code: Select all
# random usage example
player.set_weather({
sky_color = {r = 64, g = 96, b = 128},
particle_speed = 0.1,
particle_texture = "raindrops.png",
particle_sound = "raining.ogg",
humidity = 0.5,
wind_strength = 0.25,
wind_direction = 90,
wind_sound = "woosh.ogg",
}, 10)
- sky_color: This color replaces the color of the sky and fog, based on the value of the "humidity" parameter. When "humidity" is 0, the sky is the default color... when 0.5, the sky is halfway between the default color and this... when 1, the sky uses this color.
NOTE: I'm aware that there's already is a set_sky function. The reason I'm proposing an additional sky coloring parameter here is for weather effects to not interfere with the original sky settings. set_sky was intended as a permanent effect which defines the environment, and not to be used dynamically for weather... while it would also not respect the "humidity" parameter used for gradual appliance / transition. The sky modification here will be applied on top of set_sky and the colors chosen in it... so if you used set_sky to make the sky pink, blue weather sky will transition through purple.
- particle_speed: How fast particles fall. A large value should be used for rain and a small one for snow. Particle count itself depends on the "humidity" parameter; When humidity is 0, there are no weather particles... and when 1, the maximum amount of particles is used. I intend to code a special client-side particle spawner, which circles around each player while preventing particles from reaching indoor areas too.
- particle_texture: The texture used by precipitation. Rain drops, snow flakes, etc.
- particle_sound: The sound played by particle spawners or particles as they fall.
NOTE: I'm aware that a weather mod could separately use minetest.play_sound here. But I'd prefer to add a separate precipitation sound, so each active particle spawner can play it... making sure you hear rain coming from outdoor if you're sitting in a house for instance. Doing the sound manually would be difficult and laggy.
- humidity: The parameter which decides the intensity of all weather effects described above: Sky color replacement by the "sky_color" parameter, and particle density for the "particle_*" parameters. However, this also aims to modify other visual effects not defined within set_weather explicitly, such as:
* Clouds density: 0 means no clouds, 0.5 makes the cloud pattern halfway full, 1 fills the cloud pattern. I'm not sure how to modify the builtin clouds to work this way, and might need some help here.
* Fog strength: 0 means fog distance represents draw distance, 1 brings fog as close as possible. Simulates humidity making everything foggy.
- wind_strength: A special feature I wish to add is wind. Currently I plan to give wind the following effects:
* Clouds: They should move in the direction of "wind_direction" at the speed specified by "wind_strength".
* Precipitation: Rain / snow particle direction shall be influenced by wind the same way.
* Waving: When shaders and wavering leafs / liquids are enabled, "wind_direction" and "wind_speed" should change the effect. When there's no wind, liquids and leaves should not deform at all. When wind is at maximum intensity, fluids and leafs should swing very quickly and violently. RBA (RealBadAngel) might need to look into this one.
* Wind audio: An ambient sound should be heard when there is wind... representing the sound you hear in real life when wind blows into your ears or a microphone. "wind_strength" should obviously determine the volume... but if possible, "wind_direction" should also influence the stereo balance so you hear the wind from where it's blowing.
- wind_direction: Direction wind blows from in degrees (0 to 360), explained above.
- wind_sound: The ambient wind sound, described above.
- 2nd parameter (located outside the brackets): This value represents the transition rate. If 100, it takes 100 seconds for sky color / particle density / wind / etc. to transition from one value to the other. This will allow the server to send a weather package only once, and have the weather get good / bad gradually.