aboutsummaryrefslogtreecommitdiff
path: root/games/devtest
diff options
context:
space:
mode:
authorx2048 <codeforsmile@gmail.com>2022-03-26 16:58:26 +0100
committerGitHub <noreply@github.com>2022-03-26 16:58:26 +0100
commit0f25fa7af655b98fa401176a523f269c843d1943 (patch)
tree1fa8762f53941d6c1250c0c3a7dc6b8557995a40 /games/devtest
parent8d55702d139db739f8bf43eaa600f41446b29a16 (diff)
downloadminetest-0f25fa7af655b98fa401176a523f269c843d1943.tar.gz
minetest-0f25fa7af655b98fa401176a523f269c843d1943.tar.bz2
minetest-0f25fa7af655b98fa401176a523f269c843d1943.zip
Add API to control shadow intensity from the game/mod (#11944)
* Also Disable shadows when sun/moon is hidden. Fixes #11972.
Diffstat (limited to 'games/devtest')
-rw-r--r--games/devtest/mods/experimental/init.lua1
-rw-r--r--games/devtest/mods/experimental/lighting.lua8
2 files changed, 9 insertions, 0 deletions
diff --git a/games/devtest/mods/experimental/init.lua b/games/devtest/mods/experimental/init.lua
index b292f792e..70091179c 100644
--- a/games/devtest/mods/experimental/init.lua
+++ b/games/devtest/mods/experimental/init.lua
@@ -7,6 +7,7 @@ experimental = {}
dofile(minetest.get_modpath("experimental").."/detached.lua")
dofile(minetest.get_modpath("experimental").."/items.lua")
dofile(minetest.get_modpath("experimental").."/commands.lua")
+dofile(minetest.get_modpath("experimental").."/lighting.lua")
function experimental.print_to_everything(msg)
minetest.log("action", msg)
diff --git a/games/devtest/mods/experimental/lighting.lua b/games/devtest/mods/experimental/lighting.lua
new file mode 100644
index 000000000..2b350550f
--- /dev/null
+++ b/games/devtest/mods/experimental/lighting.lua
@@ -0,0 +1,8 @@
+core.register_chatcommand("set_lighting", {
+ params = "shadow_intensity",
+ description = "Set lighting parameters.",
+ func = function(player_name, param)
+ local shadow_intensity = tonumber(param)
+ minetest.get_player_by_name(player_name):set_lighting({shadows = { intensity = shadow_intensity} })
+ end
+}) \ No newline at end of file