1
0
mirror of https://github.com/Sokomine/markers.git synced 2025-06-30 06:10:36 +02:00

Compare commits

1 Commits

Author SHA1 Message Date
3a36c425da Version MFF. 2018-09-08 00:36:44 +02:00
13 changed files with 63 additions and 99 deletions

0
README.md Normal file → Executable file
View File

2
areas.lua Normal file → Executable file
View File

@ -478,7 +478,7 @@ end
markers.form_input_handler_areas = function( player, formname, fields) markers.form_input_handler_areas = function( player, formname, fields)
local pname = player:get_player_name(); local pname = player:get_player_name();
local ppos = player:get_pos() local ppos = player:getpos()
if( formname ~= "markers:info" if( formname ~= "markers:info"
or not( player ) or not( player )

View File

@ -12,7 +12,7 @@ markers.EXPIRE_AFTER = 60*60*24;
markers.MAX_HEIGHT = 100; markers.MAX_HEIGHT = 100;
-- only areas up to this size (in square meters) can be protected -- only areas up to this size (in square meters) can be protected
markers.MAX_SIZE = 4096; -- 64m * 64m= 4096 m^2 markers.MAX_SIZE = 1024; -- 32m * 32m = 1024 m^2
-- show only areas withhin this range when showing the list of ALL areas -- show only areas withhin this range when showing the list of ALL areas
-- (else it does get too crowded on multiplayer servers) -- (else it does get too crowded on multiplayer servers)
@ -30,18 +30,7 @@ end
-- for most cases, the default values ought to work -- for most cases, the default values ought to work
--markers.AREA_RANGE = 100000; --markers.AREA_RANGE = 100000;
local settings = Settings( minetest.get_worldpath().."/markers_settings.txt"); if( io.open(minetest.get_worldpath().."/markers_settings.txt","r")) then
if( settings ) then io.close()
if( settings:get( "markers_MAX_MARKERS" )) then dofile(minetest.get_worldpath().."/markers_settings.txt")
markers.MAX_MARKERS = tonumber(settings:get( "markers_MAX_MARKERS"));
end
if( settings:get( "markers_EXPIRE_AFTER" )) then
markers.EXPIRE_AFTER = tonumber(settings:get( "markers_EXPIRE_AFTER"));
end
if( settings:get( "markers_MAX_HEIGHT" )) then
markers.MAX_HEIGHT = tonumber(settings:get( "markers_MAX_HEIGHT"));
end
if( settings:get( "markers_MAX_SIZE" )) then
markers.MAX_SIZE = tonumber(settings:get( "markers_MAX_SIZE"));
end
end end

1
depends.txt Normal file → Executable file
View File

@ -1,2 +1 @@
areas areas
default

10
init.lua Normal file → Executable file
View File

@ -128,7 +128,7 @@ markers.marker_placed = function( pos, placer, itemstack )
end end
-- make sure the list does not grow too large -- make sure the list does not grow too large
if( n > markers.MAX_MARKERS ) then if( n > markers.MAX_MARKERS and minetest.get_player_privs(name)["megabuilder"] ~= true) then
table.remove( markers.positions[ name ], 1 ); table.remove( markers.positions[ name ], 1 );
end end
end end
@ -284,7 +284,7 @@ markers.get_marker_formspec = function(player, pos, error_msg)
* (math.abs( coords[1].z - coords[2].z )+1); * (math.abs( coords[1].z - coords[2].z )+1);
-- check if area is too large -- check if area is too large
if( markers.MAX_SIZE < size ) then if( markers.MAX_SIZE < size and minetest.get_player_privs(name)["megabuilder"] ~= true) then
return formspec_info.."Error: You can only protect\nareas of up to "..tostring( markers.MAX_SIZE ).."m^2.\n".. return formspec_info.."Error: You can only protect\nareas of up to "..tostring( markers.MAX_SIZE ).."m^2.\n"..
"Your marked area is "..tostring( size ).." m^2 large.]"; "Your marked area is "..tostring( size ).." m^2 large.]";
end end
@ -374,19 +374,19 @@ markers.marker_on_receive_fields = function(pos, formname, fields, sender)
local add_depth = tonumber( fields['add_depth'] ); local add_depth = tonumber( fields['add_depth'] );
local error_msg = ''; local error_msg = '';
if( not( add_height ) or add_height < 0 or add_height > markers.MAX_HEIGHT ) then if( not( add_height ) or add_height < 0 or (add_height > markers.MAX_HEIGHT and minetest.get_player_privs(name)["megabuilder"] ~= true)) then
minetest.chat_send_player( name, 'Please enter a number between 0 and '..tostring( markers.MAX_HEIGHT ).. minetest.chat_send_player( name, 'Please enter a number between 0 and '..tostring( markers.MAX_HEIGHT )..
' in the field where the height of your area is requested. Your area will stretch that many blocks '.. ' in the field where the height of your area is requested. Your area will stretch that many blocks '..
'up into the sky from the position of this marker onward.'); 'up into the sky from the position of this marker onward.');
error_msg = 'The height value\nhas to be larger than 0\nand smaller than '..tostring( markers.MAX_HEIGHT ); error_msg = 'The height value\nhas to be larger than 0\nand smaller than '..tostring( markers.MAX_HEIGHT );
elseif( not( add_depth ) or add_depth < 0 or add_depth > markers.MAX_HEIGHT ) then elseif( not( add_depth ) or add_depth < 0 or (add_depth > markers.MAX_HEIGHT and minetest.get_player_privs(name)["megabuilder"] ~= true)) then
minetest.chat_send_player( name, 'Please enter a number between 0 and '..tostring( markers.MAX_HEIGHT ).. minetest.chat_send_player( name, 'Please enter a number between 0 and '..tostring( markers.MAX_HEIGHT )..
' in the field where the depth of your area is requested. Your area will stretch that many blocks '.. ' in the field where the depth of your area is requested. Your area will stretch that many blocks '..
'into the ground from the position of this marker onward.'); 'into the ground from the position of this marker onward.');
error_msg = 'The depth value\nhas to be larger than 0\nand smaller than '..tostring( markers.MAX_HEIGHT ); error_msg = 'The depth value\nhas to be larger than 0\nand smaller than '..tostring( markers.MAX_HEIGHT );
elseif( add_height + add_depth > markers.MAX_HEIGHT ) then elseif( add_height + add_depth > markers.MAX_HEIGHT ) and minetest.get_player_privs(name)["megabuilder"] ~= true then
minetest.chat_send_player( name, 'Sorry, your area exceeds the height limit. Height and depth added have to '.. minetest.chat_send_player( name, 'Sorry, your area exceeds the height limit. Height and depth added have to '..
'be smaller than '..tostring( markers.MAX_HEIGHT )..'.'); 'be smaller than '..tostring( markers.MAX_HEIGHT )..'.');
error_msg = 'height + depth has to\nbe smaller than '..tostring( markers.MAX_HEIGHT )..'.' error_msg = 'height + depth has to\nbe smaller than '..tostring( markers.MAX_HEIGHT )..'.'

8
land_title_register.lua Normal file → Executable file
View File

@ -9,18 +9,16 @@ minetest.register_tool( "markers:land_title_register",
wield_scale = {x=1,y=1,z=1}, wield_scale = {x=1,y=1,z=1},
stack_max = 1, -- there is no need to have more than one stack_max = 1, -- there is no need to have more than one
liquids_pointable = true, -- ground with only water on can be owned as well liquids_pointable = true, -- ground with only water on can be owned as well
--[[
-- the tool_capabilities are completely irrelevant here - no need to dig -- the tool_capabilities are completely irrelevant here - no need to dig
tool_capabilities = { tool_capabilities = {
full_punch_interval = 1.0, full_punch_interval = 1.0,
max_drop_level=0, max_drop_level=0,
groupcaps={ groupcaps={
fleshy={times={[2]=0.80, [3]=0.40}, maxwear=0.05, maxlevel=1}, fleshy={times={[2]=0.80, [3]=0.40}, uses = 1/0.05, maxlevel=1},
snappy={times={[2]=0.80, [3]=0.40}, maxwear=0.05, maxlevel=1}, snappy={times={[2]=0.80, [3]=0.40}, uses = 1/0.05, maxlevel=1},
choppy={times={[3]=0.90}, maxwear=0.05, maxlevel=0} choppy={times={[3]=0.90}, uses = 1/0.05, maxlevel=0}
} }
}, },
--]]
node_placement_prediction = nil, node_placement_prediction = nil,
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)

0
marker_stone.lua Normal file → Executable file
View File

View File

@ -1,19 +0,0 @@
# copy this to your worldpath if you want to override these values
# store the positions of that many markers for each player (until server restart)
# default: 50
markers_MAX_MARKERS = 50
# the protection against digging of the marker by other players expires after this time
# default: 60*60*24 (1 day)
markers_EXPIRE_AFTER = 86400
# self-protected areas can not get higher than this
# default: 100
markers_MAX_HEIGHT = 100
# only areas up to this size (in square meters) can be protected
# default: 4096
markers_MAX_SIZE = 4096

View File

@ -1,3 +0,0 @@
name = markers
description = markers for the Minetest mod "areas"
depends = areas

BIN
textures/compass_side_top.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 684 B

After

Width:  |  Height:  |  Size: 471 B

BIN
textures/markers_mark.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 377 B

After

Width:  |  Height:  |  Size: 281 B

BIN
textures/markers_stone.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 793 B

After

Width:  |  Height:  |  Size: 686 B

BIN
textures/markers_stone_side.png Normal file → Executable file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 832 B

After

Width:  |  Height:  |  Size: 743 B