1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-12-25 02:00:37 +01:00

if door is double, only 1 door play a sound (open|close)

remove debug comment
This commit is contained in:
crabman77 2016-01-09 21:00:40 +01:00
parent ce9c1d19d6
commit 43bfae145b

View File

@ -28,19 +28,19 @@ function doors3.get_pos(pos, dir, p1, b)
else else
if p1 == 1 then if p1 == 1 then
if dir == 1 then if dir == 1 then
pos2.x=pos2.x+1--ok pos2.x=pos2.x+1
elseif dir == 2 then elseif dir == 2 then
pos2.z=pos2.z-1 pos2.z=pos2.z-1
elseif dir == 3 then elseif dir == 3 then
pos2.x=pos2.x-1 pos2.x=pos2.x-1
else else
pos2.z=pos2.z+1--ok pos2.z=pos2.z+1
end end
else else
if dir == 1 then if dir == 1 then
pos2.z=pos2.z+1 pos2.z=pos2.z+1
elseif dir == 2 then elseif dir == 2 then
pos2.x=pos2.x+1--ok pos2.x=pos2.x+1
elseif dir == 3 then elseif dir == 3 then
pos2.z=pos2.z-1 pos2.z=pos2.z-1
else else
@ -246,11 +246,6 @@ function doors3.register_door(name, def)
snd_2 = def.sound_close_door snd_2 = def.sound_close_door
end end
local b = minetest.get_meta(pos):get_int("right") local b = minetest.get_meta(pos):get_int("right")
if b ~= 0 then
minetest.sound_play(snd_1, {pos = pos, gain = 0.3, max_hear_distance = 10})
else
minetest.sound_play(snd_2, {pos = pos, gain = 0.3, max_hear_distance = 10})
end
local pos2 = doors3.get_pos(pos, oldparam2, params[1], b) local pos2 = doors3.get_pos(pos, oldparam2, params[1], b)
local node = minetest.get_node_or_nil(pos2) local node = minetest.get_node_or_nil(pos2)
@ -261,6 +256,13 @@ function doors3.register_door(name, def)
end end
end end
end end
--if double doors, only 2eme play sound
if b ~= 0 then
minetest.sound_play(snd_1, {pos = pos, gain = 0.3, max_hear_distance = 10})
else
minetest.sound_play(snd_2, {pos = pos, gain = 0.3, max_hear_distance = 10})
end
end end