From a1aee9a68f198441725b7c8076e282d6be97780f Mon Sep 17 00:00:00 2001 From: Zefram Date: Thu, 7 Aug 2014 13:46:21 +0200 Subject: [PATCH] Fix door hardness detection for open/close sounds --- mods/doors/init.lua | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/mods/doors/init.lua b/mods/doors/init.lua index 69416538..808f5f7d 100644 --- a/mods/doors/init.lua +++ b/mods/doors/init.lua @@ -16,17 +16,6 @@ doors = {} -- only_placer_can_open: if true only the player who placed the door can -- open it -local function is_right(pos) - local r1 = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z}) - local r2 = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1}) - if string.find(r1.name, "door_") or string.find(r2.name, "door_") then - if string.find(r1.name, "_1") or string.find(r2.name, "_1") then - return true - else - return false - end - end -end function doors.register_door(name, def) def.groups.not_in_creative_inventory = 1 @@ -104,6 +93,8 @@ function doors.register_door(name, def) else minetest.set_node(pt, {name=name.."_b_2", param2=p2}) minetest.set_node(pt2, {name=name.."_t_2", param2=p2}) + minetest.get_meta(pt):set_int("right", 1) + minetest.get_meta(pt2):set_int("right", 1) end if def.only_placer_can_open then @@ -153,7 +144,7 @@ function doors.register_door(name, def) snd_2 = def.sound_close_door end - if is_right(pos) then + if minetest.get_meta(pos):get_int("right") ~= 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}) -- 2.25.1