summaryrefslogtreecommitdiff
path: root/doors.lua
diff options
context:
space:
mode:
Diffstat (limited to 'doors.lua')
-rw-r--r--doors.lua28
1 files changed, 28 insertions, 0 deletions
diff --git a/doors.lua b/doors.lua
new file mode 100644
index 0000000..6804797
--- /dev/null
+++ b/doors.lua
@@ -0,0 +1,28 @@
+if minetest.get_modpath("doors") then
+ function landrush.protect_against_door(door)
+ local definition = minetest.registered_items[door]
+ local on_place = definition.on_place
+ function definition.on_place(itemstack, placer, pointed_thing)
+ local bottom = pointed_thing.above
+ local top = {x=pointed_thing.above.x, y=pointed_thing.above.y+1, z=pointed_thing.above.z}
+ local name = placer:get_player_name()
+ if landrush.can_interact(name, top) and landrush.can_interact(name, bottom) then
+ return on_place(itemstack, placer, pointed_thing)
+ else
+ topowner = landrush.get_owner(top)
+ bottomowner = landrush.get_owner(bottom)
+ if topowner and bottomowner and topowner ~= bottomowner then
+ minetest.chat_send_player(name, "Area owned by "..topowner.." and "..bottomowner)
+ elseif topowner then
+ minetest.chat_send_player(name, "Area owned by "..topowner)
+ else
+ minetest.chat_send_player(name, "Area owned by "..bottomowner)
+ end
+ end
+ end
+ end
+
+ landrush.protect_against_door("doors:door_wood")
+ landrush.protect_against_door("doors:door_steel")
+end
+