forked from nalc/areas
Needs to be defined earlier.
This commit is contained in:
parent
024424ee8b
commit
6e2b9a0a51
|
@ -3,13 +3,17 @@ allow_defined_top = true
|
|||
|
||||
read_globals = {
|
||||
"DIR_DELIM",
|
||||
"minetest", "core",
|
||||
"core",
|
||||
"dump",
|
||||
"vector", "nodeupdate",
|
||||
"VoxelManip", "VoxelArea",
|
||||
"PseudoRandom", "ItemStack",
|
||||
"AreaStore",
|
||||
"intllib",
|
||||
"default",
|
||||
table = { fields = { "copy", "getn" } }
|
||||
}
|
||||
|
||||
globals = {
|
||||
"minetest"
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ minetest.register_chatcommand("set_owner", {
|
|||
|
||||
local id = areas:add(ownerName, areaName, pos1, pos2, nil)
|
||||
areas:save()
|
||||
|
||||
|
||||
minetest.chat_send_player(ownerName,
|
||||
"You have been granted control over area #"..
|
||||
id..". Type /list_areas to show your areas.")
|
||||
|
@ -383,10 +383,10 @@ minetest.register_chatcommand("area_info", {
|
|||
table.insert(lines, ("%s spanning up to %dx%dx%d.")
|
||||
:format(str, size.x, size.y, size.z))
|
||||
end
|
||||
local function priv_limit_info(priv, max_count, max_size)
|
||||
local function priv_limit_info(lpriv, lmax_count, lmax_size)
|
||||
size_info(("Players with the %q privilege"..
|
||||
" can protect up to %d areas"):format(
|
||||
priv, max_count), max_size)
|
||||
lpriv, lmax_count), lmax_size)
|
||||
end
|
||||
if self_prot then
|
||||
if privs.areas then
|
||||
|
|
|
@ -10,7 +10,7 @@ minetest.register_chatcommand("legacy_load_areas", {
|
|||
minetest.chat_send_player(name, "Converting areas...")
|
||||
local version = tonumber(param)
|
||||
if version == 0 then
|
||||
err = areas:node_ownership_load()
|
||||
local err = areas:node_ownership_load()
|
||||
if err then
|
||||
minetest.chat_send_player(name, "Error loading legacy file: "..err)
|
||||
return
|
||||
|
@ -48,6 +48,7 @@ minetest.register_chatcommand("legacy_load_areas", {
|
|||
|
||||
function areas:node_ownership_load()
|
||||
local filename = minetest.get_worldpath().."/owners.tbl"
|
||||
local tables, err
|
||||
tables, err = loadfile(filename)
|
||||
if err then
|
||||
return err
|
||||
|
|
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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user