mirror of
https://github.com/minetest-mods/areas.git
synced 2024-12-25 02:00:40 +01:00
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:
parent
cfd4bb2423
commit
6218e5884d
8
pos.lua
8
pos.lua
@ -11,11 +11,13 @@ areas.set_pos = {}
|
|||||||
areas.pos1 = {}
|
areas.pos1 = {}
|
||||||
areas.pos2 = {}
|
areas.pos2 = {}
|
||||||
|
|
||||||
|
local LIMIT = 30992 -- this is due to MAPBLOCK_SIZE=16!
|
||||||
|
|
||||||
local function posLimit(pos)
|
local function posLimit(pos)
|
||||||
return {
|
return {
|
||||||
x = math.max(math.min(pos.x, 31000), -31000),
|
x = math.max(math.min(pos.x, LIMIT), -LIMIT),
|
||||||
y = math.max(math.min(pos.y, 31000), -31000),
|
y = math.max(math.min(pos.y, LIMIT), -LIMIT),
|
||||||
z = math.max(math.min(pos.z, 31000), -31000)
|
z = math.max(math.min(pos.z, LIMIT), -LIMIT)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user