aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorparamat <mat.gregory@virginmedia.com>2016-10-02 22:04:47 +0100
committerparamat <mat.gregory@virginmedia.com>2016-10-03 01:56:08 +0100
commit89dbc0a25d4e38d706f0fd3d604d4ac5ce57d240 (patch)
treee32d14d3bfd8e1327079f1628002547aa35af136 /builtin
parent2516c516bc018e2ff58c7d07c5f2ee8fd5f67167 (diff)
downloadminetest-89dbc0a25d4e38d706f0fd3d604d4ac5ce57d240.tar.gz
minetest-89dbc0a25d4e38d706f0fd3d604d4ac5ce57d240.tar.bz2
minetest-89dbc0a25d4e38d706f0fd3d604d4ac5ce57d240.zip
Builtin/falling: Add fallback vector in case of nil 'wallmounted to dir'
The fallback vector is in case 'wallmounted to dir' is nil due to voxelmanip placing a wallmounted node without resetting a pre-existing param2 value that is out-of-range for wallmounted. The fallback vector corresponds to param2 = 0.
Diffstat (limited to 'builtin')
-rw-r--r--builtin/game/falling.lua6
1 files changed, 5 insertions, 1 deletions
diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua
index fa7ff24bc..4b16a0586 100644
--- a/builtin/game/falling.lua
+++ b/builtin/game/falling.lua
@@ -130,7 +130,11 @@ function check_attached_node(p, n)
local def = core.registered_nodes[n.name]
local d = {x = 0, y = 0, z = 0}
if def.paramtype2 == "wallmounted" then
- d = core.wallmounted_to_dir(n.param2)
+ -- The fallback vector here is in case 'wallmounted to dir' is nil due
+ -- to voxelmanip placing a wallmounted node without resetting a
+ -- pre-existing param2 value that is out-of-range for wallmounted.
+ -- The fallback vector corresponds to param2 = 0.
+ d = core.wallmounted_to_dir(n.param2) or {x = 0, y = 1, z = 0}
else
d.y = -1
end