mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-11-16 23:40:31 +01:00
Fixed area size for megabuilders
This commit is contained in:
parent
cc7e126c7a
commit
94a11a598e
|
@ -117,36 +117,39 @@ function areas:canPlayerAddArea(pos1, pos2, name)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check self protection privilege, if it is enabled,
|
-- Check self protection privilege, if it is enabled,
|
||||||
-- and if the area is too big.
|
|
||||||
if not self.config.self_protection or
|
if not self.config.self_protection or
|
||||||
not privs[areas.config.self_protection_privilege] then
|
not privs[areas.config.self_protection_privilege] then
|
||||||
return false, "Self protection is disabled or you do not have"
|
return false, "Self protection is disabled or you do not have"
|
||||||
.." the necessary privilege."
|
.." the necessary privilege."
|
||||||
end
|
end
|
||||||
|
|
||||||
local max_size = privs.areas_high_limit and
|
-- MFF: megabuilders skip checks on size and number of areas.
|
||||||
self.config.self_protection_max_size_high or
|
if not privs["megabuilder"] then
|
||||||
self.config.self_protection_max_size
|
-- Check size
|
||||||
if
|
local max_size = privs.areas_high_limit and
|
||||||
(pos2.x - pos1.x) > max_size.x or
|
self.config.self_protection_max_size_high or
|
||||||
(pos2.y - pos1.y) > max_size.y or
|
self.config.self_protection_max_size
|
||||||
(pos2.z - pos1.z) > max_size.z then
|
if
|
||||||
return false, "Area is too big."
|
(pos2.x - pos1.x) > max_size.x or
|
||||||
end
|
(pos2.y - pos1.y) > max_size.y or
|
||||||
|
(pos2.z - pos1.z) > max_size.z then
|
||||||
-- Check number of areas the user has and make sure it not above the max
|
return false, "Area is too big."
|
||||||
local count = 0
|
end
|
||||||
for _, area in pairs(self.areas) do
|
|
||||||
if area.owner == name then
|
-- Check number of areas the user has and make sure it not above the max
|
||||||
count = count + 1
|
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"
|
||||||
|
.." areas that you are allowed to protect."
|
||||||
end
|
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 and minetest.get_player_privs(name)["megabuilder"] ~= true then
|
|
||||||
return false, "You have reached the maximum amount of"
|
|
||||||
.." areas that you are allowed to protect."
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check intersecting areas
|
-- Check intersecting areas
|
||||||
|
|
Loading…
Reference in New Issue
Block a user