forked from mtcontrib/markers
split config values into new config.lua; added markers.AREA_RANGE in order to restrict the amount of areas shown on big servers
This commit is contained in:
parent
22b833d93d
commit
01234ecd2b
20
areas.lua
20
areas.lua
|
@ -92,24 +92,38 @@ markers.get_area_list_formspec = function(ppos, player, mode, pos, mode_data, se
|
||||||
|
|
||||||
-- show only areas that do not have parents
|
-- show only areas that do not have parents
|
||||||
elseif( mode=='main_areas' ) then
|
elseif( mode=='main_areas' ) then
|
||||||
title = 'All main areas:';
|
title = 'All main areas withhin '..tostring( markers.AREA_RANGE )..' m:';
|
||||||
tlabel = '*all main areas*';
|
tlabel = '*all main areas*';
|
||||||
for id, area in pairs(areas.areas) do
|
for id, area in pairs(areas.areas) do
|
||||||
|
|
||||||
if( not( area.parent )) then
|
if( not( area.parent )
|
||||||
|
-- ppos is always available
|
||||||
|
and( (area.pos1.x >= ppos.x-markers.AREA_RANGE and area.pos1.x <= ppos.x+markers.AREA_RANGE )
|
||||||
|
or(area.pos2.x >= ppos.x-markers.AREA_RANGE and area.pos2.x <= ppos.x+markers.AREA_RANGE ))
|
||||||
|
and( (area.pos1.y >= ppos.y-markers.AREA_RANGE and area.pos1.y <= ppos.y+markers.AREA_RANGE )
|
||||||
|
or(area.pos2.y >= ppos.y-markers.AREA_RANGE and area.pos2.y <= ppos.y+markers.AREA_RANGE ))
|
||||||
|
and( (area.pos1.z >= ppos.z-markers.AREA_RANGE and area.pos1.z <= ppos.z+markers.AREA_RANGE )
|
||||||
|
or(area.pos2.z >= ppos.z-markers.AREA_RANGE and area.pos2.z <= ppos.z+markers.AREA_RANGE ))) then
|
||||||
table.insert( id_list, id );
|
table.insert( id_list, id );
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
elseif( mode=='all' ) then
|
elseif( mode=='all' ) then
|
||||||
title = 'All areas:';
|
title = 'All areas withhin '..tostring( markers.AREA_RANGE )..' m:';
|
||||||
tlabel = '*all areas*';
|
tlabel = '*all areas*';
|
||||||
|
|
||||||
for id, area in pairs(areas.areas) do
|
for id, area in pairs(areas.areas) do
|
||||||
|
if( ( (area.pos1.x >= ppos.x-markers.AREA_RANGE and area.pos1.x <= ppos.x+markers.AREA_RANGE )
|
||||||
|
or(area.pos2.x >= ppos.x-markers.AREA_RANGE and area.pos2.x <= ppos.x+markers.AREA_RANGE ))
|
||||||
|
and( (area.pos1.y >= ppos.y-markers.AREA_RANGE and area.pos1.y <= ppos.y+markers.AREA_RANGE )
|
||||||
|
or(area.pos2.y >= ppos.y-markers.AREA_RANGE and area.pos2.y <= ppos.y+markers.AREA_RANGE ))
|
||||||
|
and( (area.pos1.z >= ppos.z-markers.AREA_RANGE and area.pos1.z <= ppos.z+markers.AREA_RANGE )
|
||||||
|
or(area.pos2.z >= ppos.z-markers.AREA_RANGE and area.pos2.z <= ppos.z+markers.AREA_RANGE ))) then
|
||||||
table.insert( id_list, id );
|
table.insert( id_list, id );
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Sort the list of areas so the nearest comes first
|
-- Sort the list of areas so the nearest comes first
|
||||||
local nearsorter = function(a, b)
|
local nearsorter = function(a, b)
|
||||||
|
|
21
config.lua
Normal file
21
config.lua
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
|
||||||
|
-- stores up to 4 marker positions for each player
|
||||||
|
markers.positions = {}
|
||||||
|
|
||||||
|
-- store the positions of that many markers for each player (until server restart)
|
||||||
|
markers.MAX_MARKERS = 50;
|
||||||
|
|
||||||
|
-- the protection against digging of the marker by other players expires after this time
|
||||||
|
markers.EXPIRE_AFTER = 60*60*24;
|
||||||
|
|
||||||
|
-- self-protected areas can not get higher than 100 blocks
|
||||||
|
markers.MAX_HEIGHT = 100;
|
||||||
|
|
||||||
|
-- only areas up to this size (in square meters) can be protected
|
||||||
|
markers.MAX_SIZE = 1024; -- 32m * 32m = 1024 m^2
|
||||||
|
|
||||||
|
-- show only areas withhin this range when showing the list of ALL areas
|
||||||
|
-- (else it does get too crowded on multiplayer servers)
|
||||||
|
-- set to something >60000 in order to view all areas; set to a smaller
|
||||||
|
-- value (i.e. 500) on multiplayer servers with many protected areas
|
||||||
|
markers.AREA_RANGE = 100000;
|
19
init.lua
19
init.lua
|
@ -5,26 +5,9 @@
|
||||||
|
|
||||||
markers = {}
|
markers = {}
|
||||||
|
|
||||||
-- stores up to 4 marker positions for each player
|
dofile(minetest.get_modpath("markers").."/config.lua");
|
||||||
markers.positions = {}
|
|
||||||
|
|
||||||
-- store the positions of that many markers for each player (until server restart)
|
|
||||||
markers.MAX_MARKERS = 50;
|
|
||||||
|
|
||||||
-- the protection against digging of the marker by other players expires after this time
|
|
||||||
markers.EXPIRE_AFTER = 60*60*24;
|
|
||||||
|
|
||||||
-- self-protected areas can not get higher than 100 blocks
|
|
||||||
markers.MAX_HEIGHT = 100;
|
|
||||||
|
|
||||||
-- only areas up to this size (in square meters) can be protected
|
|
||||||
markers.MAX_SIZE = 1024; -- 32m * 32m = 1024 m^2
|
|
||||||
|
|
||||||
|
|
||||||
dofile(minetest.get_modpath("markers").."/areas.lua");
|
dofile(minetest.get_modpath("markers").."/areas.lua");
|
||||||
|
|
||||||
dofile(minetest.get_modpath("markers").."/marker_stone.lua");
|
dofile(minetest.get_modpath("markers").."/marker_stone.lua");
|
||||||
|
|
||||||
dofile(minetest.get_modpath("markers").."/land_title_register.lua");
|
dofile(minetest.get_modpath("markers").."/land_title_register.lua");
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user