This commit is contained in:
root 2021-10-03 14:58:25 +02:00
parent 329d48d26d
commit aee6b25cdd
2 changed files with 48 additions and 43 deletions

View file

@ -61,6 +61,7 @@ Change log:
- 3.1 - Ability to hide protection blocks using /protector_hide and /protector_show , italian local added (thanks Hamlet)
- 3.2 - Defaults to Minetest translation if found, otherwise intllib fallback if loaded, locale files updated for both. Added 'protector_msg' setting for player text.
- 3.3 - Added support for playerfactions new api (thanks louisroyer), added limiter to protection radius of 22.
- 3.4 - Player flip and hurt functions moved to minetest.register_protection_violation function (thanks hlqkj)
Lucky Blocks: 10

View file

@ -356,17 +356,10 @@ protector.can_dig = function(r, pos, digger, onlyowner, infolevel)
end
local old_is_protected = minetest.is_protected
-- add protector hurt and flip to protection violation function
minetest.register_on_protection_violation(function(pos, name)
-- check for protected area, return true if protected and digger isn't on list
function minetest.is_protected(pos, digger)
digger = digger or "" -- nil check
-- is area protected against digger?
if not protector.can_dig(protector_radius, pos, digger, false, 1) then
local player = minetest.get_player_by_name(digger)
local player = minetest.get_player_by_name(name)
if player and player:is_player() then
@ -407,7 +400,18 @@ function minetest.is_protected(pos, digger)
end
end
end
end)
local old_is_protected = minetest.is_protected
-- check for protected area, return true if protected and digger isn't on list
function minetest.is_protected(pos, digger)
digger = digger or "" -- nil check
-- is area protected against digger?
if not protector.can_dig(protector_radius, pos, digger, false, 1) then
return true
end