diff options
author | TenPlus1 <kinsellaja@yahoo.com> | 2018-04-10 09:25:29 +0100 |
---|---|---|
committer | TenPlus1 <kinsellaja@yahoo.com> | 2018-04-10 09:25:29 +0100 |
commit | ad60e1e117ce1d069b6798d2c502f1d050a64bb3 (patch) | |
tree | d7aaacdcf88d76fe47b40976711932fd9eac1443 | |
parent | 1a2bc350c516e1f73e99b23076c9ca8974f014a3 (diff) |
add protection check for hoe bomb
-rw-r--r-- | hoebomb.lua | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/hoebomb.lua b/hoebomb.lua index 2c9d927..05e939b 100644 --- a/hoebomb.lua +++ b/hoebomb.lua @@ -12,7 +12,13 @@ end -- hoe bomb function -local function hoe_area(pos) +local function hoe_area(pos, player) + + -- check for protection + if minetest.is_protected(pos, player:get_player_name()) then + minetest.record_protection_violation(pos, player:get_player_name()) + return + end local r = 5 -- radius @@ -74,7 +80,7 @@ minetest.register_entity("farming:hoebomb_entity", { -- round up coords to fix glitching through doors self.lastpos = vector.round(self.lastpos) - hoe_area(self.lastpos) + hoe_area(self.lastpos, self.player) end self.object:remove() @@ -128,7 +134,7 @@ minetest.register_craftitem("farming:hoe_bomb", { on_use = function(itemstack, user, pointed_thing) if pointed_thing.type == "node" then - hoe_area(pointed_thing.above) + hoe_area(pointed_thing.above, user) else throw_potion(itemstack, user) |