mirror of
https://github.com/minetest-mods/areas.git
synced 2024-08-21 10:44:05 +02:00
Don't allow areas to cross outside mapgen world limits.
Limit any area to within [-31000,31000].
This commit is contained in:
parent
a303abe51b
commit
630bdefd98
8
pos.lua
8
pos.lua
@ -129,13 +129,17 @@ function areas:getPos(playerName)
|
|||||||
return areas:sortPos(pos1, pos2)
|
return areas:sortPos(pos1, pos2)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function posLimit(pos)
|
||||||
|
return math.max(math.min(p, 31000), -31000)
|
||||||
|
end
|
||||||
|
|
||||||
function areas:setPos1(playerName, pos)
|
function areas:setPos1(playerName, pos)
|
||||||
areas.pos1[playerName] = pos
|
areas.pos1[playerName] = posLimit(pos)
|
||||||
areas.markPos1(playerName)
|
areas.markPos1(playerName)
|
||||||
end
|
end
|
||||||
|
|
||||||
function areas:setPos2(playerName, pos)
|
function areas:setPos2(playerName, pos)
|
||||||
areas.pos2[playerName] = pos
|
areas.pos2[playerName] = posLimit(pos)
|
||||||
areas.markPos2(playerName)
|
areas.markPos2(playerName)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user