Skip to content

Commit

Permalink
Builtin/falling: Add fallback vector in case of nil 'wallmounted to dir'
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
paramat committed Oct 3, 2016
1 parent 2516c51 commit 89dbc0a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion builtin/game/falling.lua
Expand Up @@ -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
Expand Down

0 comments on commit 89dbc0a

Please sign in to comment.