forked from minetest-mods/areas
Needs to be defined earlier.
This commit is contained in:
16
pos.lua
16
pos.lua
@ -11,6 +11,14 @@ areas.set_pos = {}
|
||||
areas.pos1 = {}
|
||||
areas.pos2 = {}
|
||||
|
||||
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)
|
||||
}
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("select_area", {
|
||||
params = "<ID>",
|
||||
description = "Select a area by id.",
|
||||
@ -129,14 +137,6 @@ function areas:getPos(playerName)
|
||||
return areas:sortPos(pos1, pos2)
|
||||
end
|
||||
|
||||
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)
|
||||
}
|
||||
end
|
||||
|
||||
function areas:setPos1(playerName, pos)
|
||||
areas.pos1[playerName] = posLimit(pos)
|
||||
areas.markPos1(playerName)
|
||||
|
Reference in New Issue
Block a user