From a5eef1c5de77fa7770877802e66c3e1c53f9a0da Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Wed, 24 Apr 2019 18:59:36 -0400 Subject: 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. --- areas/pos.lua | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'areas/pos.lua') 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 = "", 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) -- cgit v1.2.3