Ajoute certaines modifications venant de MFF + ajustement HUD

* Aires openfarming
* Privilège megabuilder
* HUD légèrement modifié pour laisser de la place à celui de factions
This commit is contained in:
2019-12-28 02:43:12 +01:00
parent aca830fd22
commit feae9967dc
4 changed files with 77 additions and 24 deletions

View File

@ -1,3 +1,5 @@
-- Mega_builder privilege
minetest.register_privilege("megabuilder", "Can protect an infinite amount of areas.")
function areas:player_exists(name)
return minetest.get_auth_handler().get_auth(name) ~= nil
@ -216,39 +218,41 @@ function areas:canPlayerAddArea(pos1, pos2, name)
.." the necessary privilege."
end
local max_size = privs.areas_high_limit and
-- MFF: megabuilders skip checks on size and number of areas
if not privs.megabuilder then
local max_size = privs.areas_high_limit and
self.config.self_protection_max_size_high or
self.config.self_protection_max_size
if
if
(pos2.x - pos1.x) > max_size.x or
(pos2.y - pos1.y) > max_size.y or
(pos2.z - pos1.z) > max_size.z then
return false, "Area is too big."
end
-- Check number of areas the user has and make sure it not above the max
local count = 0
for _, area in pairs(self.areas) do
if area.owner == name then
count = count + 1
(pos2.z - pos1.z) > max_size.z then
return false, "Area is too big."
end
end
local max_areas = privs.areas_high_limit and
-- Check number of areas the user has and make sure it not above the max
local count = 0
for _, area in pairs(self.areas) do
if area.owner == name then
count = count + 1
end
end
local max_areas = privs.areas_high_limit and
self.config.self_protection_max_areas_high or
self.config.self_protection_max_areas
if count >= max_areas then
return false, "You have reached the maximum amount of"
if count >= max_areas then
return false, "You have reached the maximum amount of"
.." areas that you are allowed to protect."
end
end
-- Check intersecting areas
local can, id = self:canInteractInArea(pos1, pos2, name)
if not can then
local area = self.areas[id]
return false, ("The area intersects with %s [%u] (%s).")
-- Check intersecting areas
local can, id = self:canInteractInArea(pos1, pos2, name)
if not can then
local area = self.areas[id]
return false, ("The area intersects with %s [%u] (%s).")
:format(area.name, id, area.owner)
end
end
return true
end