summaryrefslogtreecommitdiff
path: root/areas
diff options
context:
space:
mode:
authorVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2019-04-24 18:59:36 -0400
committerVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2019-04-24 18:59:36 -0400
commita5eef1c5de77fa7770877802e66c3e1c53f9a0da (patch)
tree0f36e64a58e5f5bb7d95be6ae692f58f2ebfe483 /areas
parentdda854cf06f90a04a03844e19c4d4ad220e38fe4 (diff)
downloaddreambuilder_modpack-a5eef1c5de77fa7770877802e66c3e1c53f9a0da.tar
dreambuilder_modpack-a5eef1c5de77fa7770877802e66c3e1c53f9a0da.tar.gz
dreambuilder_modpack-a5eef1c5de77fa7770877802e66c3e1c53f9a0da.tar.bz2
dreambuilder_modpack-a5eef1c5de77fa7770877802e66c3e1c53f9a0da.tar.xz
dreambuilder_modpack-a5eef1c5de77fa7770877802e66c3e1c53f9a0da.zip
update castles, areas, homedecor, plantlife,
gloopblocks, hotbar, inspector, maptools, mesecons, moreblocks, moreores, technic, teleport_request, and worldedit switched to caverealms_lite (with minor fixes by me) switched to CWz's fork of player_textures The homedecor update brings in the big split, and will require you to re-enable all modpack components in order to avoid loss of content.
Diffstat (limited to 'areas')
-rw-r--r--areas/.luacheckrc6
-rw-r--r--areas/chatcommands.lua6
-rw-r--r--areas/legacy.lua3
-rw-r--r--areas/pos.lua26
4 files changed, 24 insertions, 17 deletions
diff --git a/areas/.luacheckrc b/areas/.luacheckrc
index 15eed66..c0ea991 100644
--- a/areas/.luacheckrc
+++ b/areas/.luacheckrc
@@ -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"
+}
diff --git a/areas/chatcommands.lua b/areas/chatcommands.lua
index 6079e93..ddff850 100644
--- a/areas/chatcommands.lua
+++ b/areas/chatcommands.lua
@@ -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
diff --git a/areas/legacy.lua b/areas/legacy.lua
index 83b3d27..876b88d 100644
--- a/areas/legacy.lua
+++ b/areas/legacy.lua
@@ -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
diff --git a/areas/pos.lua b/areas/pos.lua
index f969aaa..36a6b78 100644
--- a/areas/pos.lua
+++ b/areas/pos.lua
@@ -11,6 +11,16 @@ 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, LIMIT), -LIMIT),
+ y = math.max(math.min(pos.y, LIMIT), -LIMIT),
+ z = math.max(math.min(pos.z, LIMIT), -LIMIT)
+ }
+end
+
minetest.register_chatcommand("select_area", {
params = "<ID>",
description = "Select a area by id.",
@@ -35,7 +45,7 @@ minetest.register_chatcommand("area_pos1", {
.." location or the one specified",
privs = {},
func = function(name, param)
- local pos = nil
+ local pos
local found, _, x, y, z = param:find(
"^(-?%d+)[, ](-?%d+)[, ](-?%d+)$")
if found then
@@ -50,7 +60,7 @@ minetest.register_chatcommand("area_pos1", {
else
return false, "Invalid usage, see /help area_pos1."
end
- pos = vector.round(pos)
+ pos = posLimit(vector.round(pos))
areas:setPos1(name, pos)
return true, "Area position 1 set to "
..minetest.pos_to_string(pos)
@@ -62,7 +72,7 @@ minetest.register_chatcommand("area_pos2", {
description = "Set area protection region position 2 to your"
.." location or the one specified",
func = function(name, param)
- local pos = nil
+ local pos
local found, _, x, y, z = param:find(
"^(-?%d+)[, ](-?%d+)[, ](-?%d+)$")
if found then
@@ -77,7 +87,7 @@ minetest.register_chatcommand("area_pos2", {
else
return false, "Invalid usage, see /help area_pos2."
end
- pos = vector.round(pos)
+ pos = posLimit(vector.round(pos))
areas:setPos2(name, pos)
return true, "Area position 2 set to "
..minetest.pos_to_string(pos)
@@ -129,14 +139,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)