Doors: Prevent placement in protected areas.
authorAuke Kok <sofar@foo-projects.org>
Mon, 29 Feb 2016 16:35:36 +0000 (08:35 -0800)
committersfan5 <sfan5@live.de>
Mon, 29 Feb 2016 19:29:47 +0000 (20:29 +0100)
https://forum.minetest.net/viewtopic.php?f=42&t=1523&start=500#p208773

Currently, doors can be placed inside others' protected areas. We
need to check protection for both bottom and top halves.

mods/doors/init.lua

index 67cb296b12812c693e42a1edf715df02aa30bde1..72196e680a64fe585151ce484f2c9aceb5c38191 100644 (file)
@@ -235,6 +235,11 @@ function doors.register(name, def)
                                return itemstack
                        end
 
+                       local pn = placer:get_player_name()
+                       if minetest.is_protected(pos, pn) or minetest.is_protected(above, pn) then
+                               return itemstack
+                       end
+
                        local dir = minetest.dir_to_facedir(placer:get_look_dir())
 
                        local ref = {