aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorHybridDog <3192173+HybridDog@users.noreply.github.com>2020-10-06 20:49:46 +0200
committerGitHub <noreply@github.com>2020-10-06 20:49:46 +0200
commit2f4037752b023f87ca1f8859a8dce4f833353967 (patch)
tree5c52b01857c8c46d709d43d1bbc194a3805acded /doc
parente80fc22dd996e5b0efd8c4f67700c0920e323e46 (diff)
downloadminetest-2f4037752b023f87ca1f8859a8dce4f833353967.tar.gz
minetest-2f4037752b023f87ca1f8859a8dce4f833353967.tar.bz2
minetest-2f4037752b023f87ca1f8859a8dce4f833353967.zip
Add minetest.get_artificial_light and minetest.get_natural_light (#5680)
Add more detailed light detection functions, a function to get the artificial light (torches) and a function to get the sunlight as seen by the player (you can specify timeofday). Co-authored-by: rubenwardy <rw@rubenwardy.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/lua_api.txt16
1 files changed, 16 insertions, 0 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 9e9af20da..c4eb56374 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -4824,6 +4824,22 @@ Environment access
* `pos`: The position where to measure the light.
* `timeofday`: `nil` for current time, `0` for night, `0.5` for day
* Returns a number between `0` and `15` or `nil`
+ * `nil` is returned e.g. when the map isn't loaded at `pos`
+* `minetest.get_natural_light(pos[, timeofday])`
+ * Figures out the sunlight (or moonlight) value at pos at the given time of
+ day.
+ * `pos`: The position of the node
+ * `timeofday`: `nil` for current time, `0` for night, `0.5` for day
+ * Returns a number between `0` and `15` or `nil`
+ * This function tests 203 nodes in the worst case, which happens very
+ unlikely
+* `minetest.get_artificial_light(param1)`
+ * Calculates the artificial light (light from e.g. torches) value from the
+ `param1` value.
+ * `param1`: The param1 value of a `paramtype = "light"` node.
+ * Returns a number between `0` and `15`
+ * Currently it's the same as `math.floor(param1 / 16)`, except that it
+ ensures compatibility.
* `minetest.place_node(pos, node)`
* Place node with the same effects that a player would cause
* `minetest.dig_node(pos)`