@@ -16,17 +16,6 @@ doors = {}
16
16
-- only_placer_can_open: if true only the player who placed the door can
17
17
-- open it
18
18
19
- local function is_right (pos )
20
- local r1 = minetest .get_node ({x = pos .x - 1 , y = pos .y , z = pos .z })
21
- local r2 = minetest .get_node ({x = pos .x , y = pos .y , z = pos .z - 1 })
22
- if string.find (r1 .name , " door_" ) or string.find (r2 .name , " door_" ) then
23
- if string.find (r1 .name , " _1" ) or string.find (r2 .name , " _1" ) then
24
- return true
25
- else
26
- return false
27
- end
28
- end
29
- end
30
19
31
20
function doors .register_door (name , def )
32
21
def .groups .not_in_creative_inventory = 1
@@ -104,6 +93,8 @@ function doors.register_door(name, def)
104
93
else
105
94
minetest .set_node (pt , {name = name .. " _b_2" , param2 = p2 })
106
95
minetest .set_node (pt2 , {name = name .. " _t_2" , param2 = p2 })
96
+ minetest .get_meta (pt ):set_int (" right" , 1 )
97
+ minetest .get_meta (pt2 ):set_int (" right" , 1 )
107
98
end
108
99
109
100
if def .only_placer_can_open then
@@ -153,7 +144,7 @@ function doors.register_door(name, def)
153
144
snd_2 = def .sound_close_door
154
145
end
155
146
156
- if is_right (pos ) then
147
+ if minetest . get_meta (pos ): get_int ( " right " ) ~= 0 then
157
148
minetest .sound_play (snd_1 , {pos = pos , gain = 0.3 , max_hear_distance = 10 })
158
149
else
159
150
minetest .sound_play (snd_2 , {pos = pos , gain = 0.3 , max_hear_distance = 10 })
0 commit comments