1
0
mirror of https://github.com/minetest/minetest_game.git synced 2025-06-30 13:50:23 +02:00

Add API to weather mod

Co-authored-by: Till Affeldt <t.affeldt@tu-braunschweig.de>
This commit is contained in:
sfan5
2024-04-10 18:24:00 +02:00
parent 31133a371e
commit d1ba7c3db3
3 changed files with 75 additions and 45 deletions

View File

@ -1169,3 +1169,21 @@ the log.
* after logging the action, the original callback (if any) is called
* `def` See [Node definition]
* `name` Description of the node in the log message
Weather API
-----------
The weather mod will constantly adjust weather effects seen by the player
(that is: cloud parameters and shadow intensity).
These can be influenced using this API.
#### `weather.get = function(player)`
* Returns the current weather effects seen by the player.
It returns a table with two keys:
* `clouds`: A table (or `nil`) with cloud data following the same format as used for `player:set_clouds()`.
* `lighting`: A table (or `nil`) with lighting data following the same format as used for `player:set_lighting()`.
* `player`: ObjectRef of the relevant player
* You can override this function to change the weather effects by simply returning different values.
Setting `clouds` or `lighting` in the result table to `nil` will *prevent* those from changing.