2014-11-17 21:16:59 -05:00
|
|
|
local world_path = minetest.get_worldpath()
|
2013-09-02 19:16:14 -04:00
|
|
|
|
2014-11-17 21:16:59 -05:00
|
|
|
areas.config = {}
|
|
|
|
|
2019-09-08 21:22:35 +02:00
|
|
|
local function setting(tp, name, default)
|
2020-03-16 02:23:54 +01:00
|
|
|
local full_name = "areas." .. name
|
2014-11-17 21:16:59 -05:00
|
|
|
local value
|
2019-09-08 21:22:35 +02:00
|
|
|
if tp == "boolean" then
|
2017-05-13 01:59:30 -07:00
|
|
|
value = minetest.settings:get_bool(full_name)
|
2014-11-17 21:16:59 -05:00
|
|
|
elseif tp == "string" then
|
2017-05-13 01:59:30 -07:00
|
|
|
value = minetest.settings:get(full_name)
|
2019-09-08 21:22:35 +02:00
|
|
|
elseif tp == "position" then
|
2014-11-17 21:16:59 -05:00
|
|
|
value = minetest.setting_get_pos(full_name)
|
2019-09-08 21:22:35 +02:00
|
|
|
elseif tp == "number" then
|
2017-05-13 01:59:30 -07:00
|
|
|
value = tonumber(minetest.settings:get(full_name))
|
2014-11-17 21:16:59 -05:00
|
|
|
else
|
2020-03-16 02:23:54 +01:00
|
|
|
error("Cannot parse setting type " .. tp)
|
2014-11-17 21:16:59 -05:00
|
|
|
end
|
2020-03-16 02:23:54 +01:00
|
|
|
|
2013-09-02 19:16:14 -04:00
|
|
|
if value == nil then
|
|
|
|
value = default
|
|
|
|
end
|
2014-11-17 21:16:59 -05:00
|
|
|
areas.config[name] = value
|
2013-09-02 19:16:14 -04:00
|
|
|
end
|
|
|
|
|
2014-11-17 21:16:59 -05:00
|
|
|
--------------
|
|
|
|
-- Settings --
|
|
|
|
--------------
|
2013-09-02 19:16:14 -04:00
|
|
|
|
2019-09-08 21:22:35 +02:00
|
|
|
setting("string", "filename", world_path.."/areas.dat")
|
|
|
|
|
|
|
|
-- Allow players with a privilege create their own areas
|
|
|
|
-- within the maximum size and number.
|
|
|
|
setting("boolean", "self_protection", true)
|
|
|
|
setting("string", "self_protection_privilege", "interact")
|
2020-02-27 22:17:52 +01:00
|
|
|
setting("position", "self_protection_max_size", {x = 64, y = 128, z = 64})
|
2020-12-12 16:51:27 +01:00
|
|
|
setting("number", "self_protection_max_areas", 8)
|
2019-09-08 21:22:35 +02:00
|
|
|
-- For players with the areas_high_limit privilege.
|
|
|
|
setting("position", "self_protection_max_size_high", {x = 512, y = 512, z = 512})
|
|
|
|
setting("number", "self_protection_max_areas_high", 32)
|