@@ -15,6 +15,17 @@ doors = {}
15
15
-- selection_box_top
16
16
-- only_placer_can_open: if true only the player who placed the door can
17
17
-- open it
18
+ local function is_right (pos )
19
+ local r1 = minetest .get_node ({x = pos .x - 1 , y = pos .y , z = pos .z })
20
+ local r2 = minetest .get_node ({x = pos .x , y = pos .y , z = pos .z - 1 })
21
+ if string.find (r1 .name , " door_" ) or string.find (r2 .name , " door_" ) then
22
+ if string.find (r1 .name , " _1" ) or string.find (r2 .name , " _1" ) then
23
+ return true
24
+ else
25
+ return false
26
+ end
27
+ end
28
+ end
18
29
19
30
function doors :register_door (name , def )
20
31
def .groups .not_in_creative_inventory = 1
@@ -59,6 +70,19 @@ function doors:register_door(name, def)
59
70
meta = minetest .get_meta (pos ):to_table ()
60
71
minetest .set_node (pos , {name = replace , param2 = p2 })
61
72
minetest .get_meta (pos ):from_table (meta )
73
+
74
+ local snd_1 = " _close"
75
+ local snd_2 = " _open"
76
+ if params [1 ] == 3 then
77
+ snd_1 = " _open"
78
+ snd_2 = " _close"
79
+ end
80
+
81
+ if is_right (pos ) then
82
+ minetest .sound_play (" door" .. snd_1 , {pos = pos , gain = 0.3 , max_hear_distance = 10 })
83
+ else
84
+ minetest .sound_play (" door" .. snd_2 , {pos = pos , gain = 0.3 , max_hear_distance = 10 })
85
+ end
62
86
end
63
87
64
88
local function on_mesecons_signal_open (pos , node )
0 commit comments