From c09e8c0e1ca8c2741d06fa36103df715b51ea7cb Mon Sep 17 00:00:00 2001 From: Sokomine Date: Tue, 16 May 2017 03:18:08 +0200 Subject: [PATCH] use settings instead of dofile; increased max area size by factor 4 --- config.lua | 19 +++++++++++++++---- markers_settings.txt | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 markers_settings.txt diff --git a/config.lua b/config.lua index f29e46e..99f655d 100644 --- a/config.lua +++ b/config.lua @@ -12,7 +12,7 @@ markers.EXPIRE_AFTER = 60*60*24; 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 +markers.MAX_SIZE = 4096; -- 64m * 64m= 4096 m^2 -- show only areas withhin this range when showing the list of ALL areas -- (else it does get too crowded on multiplayer servers) @@ -30,7 +30,18 @@ end -- for most cases, the default values ought to work --markers.AREA_RANGE = 100000; -if( io.open(minetest.get_worldpath().."/markers_settings.txt","r")) then - io.close() - dofile(minetest.get_worldpath().."/markers_settings.txt") +local settings = Settings( minetest.get_worldpath().."/markers_settings.txt"); +if( settings ) then + if( settings:get( "markers_MAX_MARKERS" )) then + 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 diff --git a/markers_settings.txt b/markers_settings.txt new file mode 100644 index 0000000..a292111 --- /dev/null +++ b/markers_settings.txt @@ -0,0 +1,19 @@ +# 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