Limit areas to -30992,30992 due to MABLOCK_SIZE=16

Internally, when allocating an AreaStore, the limits are required
to be within the last full block, and so, you cannot create one "on"
the edge, as it will trigger an exception. When limited to the last
full mapblock, it all works fine.
This commit is contained in:
Auke Kok 2019-04-03 11:10:59 -07:00
parent cfd4bb2423
commit 6218e5884d
1 changed files with 5 additions and 3 deletions

View File

@ -11,11 +11,13 @@ areas.set_pos = {}
areas.pos1 = {}
areas.pos2 = {}
local LIMIT = 30992 -- this is due to MAPBLOCK_SIZE=16!
local function posLimit(pos)
return {
x = math.max(math.min(pos.x, 31000), -31000),
y = math.max(math.min(pos.y, 31000), -31000),
z = math.max(math.min(pos.z, 31000), -31000)
x = math.max(math.min(pos.x, LIMIT), -LIMIT),
y = math.max(math.min(pos.y, LIMIT), -LIMIT),
z = math.max(math.min(pos.z, LIMIT), -LIMIT)
}
end