fir crash in flip door routine if param2 is nil

This commit is contained in:
Vanessa Ezekowitz 2014-01-19 09:00:17 -05:00
parent c123501dce
commit fabb714008
1 changed files with 4 additions and 3 deletions

View File

@ -493,13 +493,14 @@ function homedecor.flip_door(pos, node, player, name, side, isClosed)
local rside = nil local rside = nil
local nfdir = nil local nfdir = nil
local ofdir = node.param2 or 0
if side == "left" then if side == "left" then
rside = "right" rside = "right"
nfdir=node.param2 - 1 nfdir=ofdir - 1
if nfdir < 0 then nfdir = 3 end if nfdir < 0 then nfdir = 3 end
else else
rside = "left" rside = "left"
nfdir=node.param2 + 1 nfdir=ofdir + 1
if nfdir > 3 then nfdir = 0 end if nfdir > 3 then nfdir = 0 end
end end
local sound; local sound;
@ -527,7 +528,7 @@ function homedecor.flip_gate(pos, node, player, gate, oc)
gain = 2, gain = 2,
}) })
local fdir = node.param2 local fdir = node.param2 or 0
-- since right facing gates use "open" nodes for closed, we need an -- since right facing gates use "open" nodes for closed, we need an
-- isClosed flag to tell if it's "really" closed. -- isClosed flag to tell if it's "really" closed.