mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-11-16 15:30:30 +01:00
Merge branch 'areas'
fix issue areas in areas https://github.com/MinetestForFun/server-minetestforfun/issues/398
This commit is contained in:
commit
abb1e093e0
|
@ -134,6 +134,33 @@ function areas:canInteractInArea(pos1, pos2, name, allow_open)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function areas:canMakeArea(pos1, pos2, name) --MFF crabman(25/02/2016) fix areas in areas
|
||||||
|
if name and minetest.check_player_privs(name, self.adminPrivs) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
areas:sortPos(pos1, pos2)
|
||||||
|
|
||||||
|
local id_areas_intersect = {}
|
||||||
|
local areas = self:getAreasForArea(pos1, pos2)
|
||||||
|
|
||||||
|
if not areas then return true end
|
||||||
|
|
||||||
|
for id, area in pairs(areas) do
|
||||||
|
if area.owner == name and self:isSubarea(pos1, pos2, id) then
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
if not area.open and not self:isAreaOwner(id, name) then
|
||||||
|
table.insert(id_areas_intersect, id)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if #id_areas_intersect > 0 then
|
||||||
|
return false, id_areas_intersect[1]
|
||||||
|
end
|
||||||
|
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--MFF DEBUT crabman(17/09/2015 ) respawn player in special area(event) if a spawn is set.
|
--MFF DEBUT crabman(17/09/2015 ) respawn player in special area(event) if a spawn is set.
|
||||||
--1 party (2 party in beds mod)
|
--1 party (2 party in beds mod)
|
||||||
|
|
|
@ -184,7 +184,7 @@ function areas:canPlayerAddArea(pos1, pos2, name)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check intersecting areas
|
-- Check intersecting areas
|
||||||
local can, id = self:canInteractInArea(pos1, pos2, name)
|
local can, id = self:canMakeArea(pos1, pos2, name) --MFF crabman(25/02/2016) fix areas in areas
|
||||||
if not can then
|
if not can then
|
||||||
local area = self.areas[id]
|
local area = self.areas[id]
|
||||||
return false, ("The area intersects with %s [%u] (%s).")
|
return false, ("The area intersects with %s [%u] (%s).")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user