Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Prevent crash if some mod inadvertently allowed doors to rotate
  • Loading branch information
sofar authored and paramat committed Dec 6, 2018
1 parent 1fa8180 commit 667e130
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mods/doors/init.lua
Expand Up @@ -162,6 +162,14 @@ function _doors.door_toggle(pos, node, clicker)
end

local dir = node.param2

-- It's possible param2 is messed up, so, validate before using
-- the input data. This indicates something may have rotated
-- the door, even though that is not supported.
if not transform[state + 1] or not transform[state + 1][dir + 1] then
return false
end

if state % 2 == 0 then
minetest.sound_play(def.door.sounds[1],
{pos = pos, gain = 0.3, max_hear_distance = 10})
Expand Down

0 comments on commit 667e130

Please sign in to comment.