forked from mtcontrib/farming
add protection check for hoe bomb
This commit is contained in:
parent
1a2bc350c5
commit
ad60e1e117
12
hoebomb.lua
12
hoebomb.lua
@ -12,7 +12,13 @@ end
|
|||||||
|
|
||||||
|
|
||||||
-- hoe bomb function
|
-- 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
|
local r = 5 -- radius
|
||||||
|
|
||||||
@ -74,7 +80,7 @@ minetest.register_entity("farming:hoebomb_entity", {
|
|||||||
-- round up coords to fix glitching through doors
|
-- round up coords to fix glitching through doors
|
||||||
self.lastpos = vector.round(self.lastpos)
|
self.lastpos = vector.round(self.lastpos)
|
||||||
|
|
||||||
hoe_area(self.lastpos)
|
hoe_area(self.lastpos, self.player)
|
||||||
end
|
end
|
||||||
|
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
@ -128,7 +134,7 @@ minetest.register_craftitem("farming:hoe_bomb", {
|
|||||||
on_use = function(itemstack, user, pointed_thing)
|
on_use = function(itemstack, user, pointed_thing)
|
||||||
|
|
||||||
if pointed_thing.type == "node" then
|
if pointed_thing.type == "node" then
|
||||||
hoe_area(pointed_thing.above)
|
hoe_area(pointed_thing.above, user)
|
||||||
else
|
else
|
||||||
throw_potion(itemstack, user)
|
throw_potion(itemstack, user)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user