diff options
author | fairiestoy <johannesvk@web.de> | 2013-08-21 05:23:47 +0200 |
---|---|---|
committer | fairiestoy <johannesvk@web.de> | 2013-08-21 05:23:47 +0200 |
commit | 065543f3321218af9f9df7749608876110bf5ab8 (patch) | |
tree | 770f8cf2c10c9f1392fb8ee3d8619d5730080800 | |
parent | 0ead0b1e5a1c8ed9aa5d516c53a48e9683b70921 (diff) |
Added TNT workaround
Added a quick workaround to avoid TNT set near claimed areas to destroy
partial buildings or landscapes with the TNT exploit. Since overwriting
the registered node functions seem not to work as expected, used the
landrush own routines for this 'fix'
-rw-r--r-- | init.lua | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -252,6 +252,32 @@ function minetest.item_place(itemstack, placer, pointed_thing) owner = landrush.get_owner(pointed_thing.above) player = placer:get_player_name() if landrush.can_interact(player, pointed_thing.above) or itemstack:get_name() == "" then + -- add a workaround for TNT, since overwriting the registered node seems not to work + if itemstack:get_name() == "tnt:tnt" or itemstack:get_name() == "tnt:tnt_burning" then + local pos = pointed_thing.above + local temp_pos = pos + temp_pos.x = pos.x + 2 + if player ~= landrush.get_owner( temp_pos ) then + minetest.chat_send_player( player, "Do not place TNT near claimed areas..." ) + return itemstack + end + temp_pos.x = pos.x - 2 + if player ~= landrush.get_owner( temp_pos ) then + minetest.chat_send_player( player, "Do not place TNT near claimed areas..." ) + return itemstack + end + temp_pos.z = pos.z + 2 + if player ~= landrush.get_owner( temp_pos ) then + minetest.chat_send_player( player, "Do not place TNT near claimed areas..." ) + return itemstack + end + temp_pos.z = pos.z - 2 + if player ~= landrush.get_owner( temp_pos ) then + minetest.chat_send_player( player, "Do not place TNT near claimed areas..." ) + return itemstack + end + end + -- end of the workaround return landrush.default_place(itemstack, placer, pointed_thing) else if ( owner ~= nil ) then |