summaryrefslogtreecommitdiff
path: root/doors.lua
diff options
context:
space:
mode:
authorBrandon Bohannon <brandon@bremaweb.com>2013-02-16 00:07:16 -0600
committerBrandon Bohannon <brandon@bremaweb.com>2013-02-16 00:07:16 -0600
commite83f5144665edafd80b5f99435cf12f66e37432d (patch)
tree1ff7d9dd7537d99980f4c57cbfe1a22900efea14 /doors.lua
parent6537ff75ae31a13b5f9160127c484911477c0e6b (diff)
initial commit
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
+