2014-11-18 03:16:59 +01:00
|
|
|
local world_path = minetest.get_worldpath()
|
2013-09-03 01:16:14 +02:00
|
|
|
|
2014-11-18 03:16:59 +01:00
|
|
|
areas.config = {}
|
|
|
|
|
|
|
|
local function setting(tp, name, default)
|
|
|
|
local full_name = "areas."..name
|
|
|
|
local value
|
|
|
|
if tp == "boolean" then
|
2017-10-02 04:14:16 +02:00
|
|
|
value = minetest.settings:get_bool(full_name)
|
2014-11-18 03:16:59 +01:00
|
|
|
elseif tp == "string" then
|
2017-10-02 04:14:16 +02:00
|
|
|
value = minetest.settings:get(full_name)
|
2014-11-18 03:16:59 +01:00
|
|
|
elseif tp == "position" then
|
|
|
|
value = minetest.setting_get_pos(full_name)
|
|
|
|
elseif tp == "number" then
|
2017-10-02 04:14:16 +02:00
|
|
|
value = tonumber(minetest.settings:get(full_name))
|
2014-11-18 03:16:59 +01:00
|
|
|
else
|
|
|
|
error("Invalid setting type!")
|
|
|
|
end
|
2013-09-03 01:16:14 +02:00
|
|
|
if value == nil then
|
|
|
|
value = default
|
|
|
|
end
|
2014-11-18 03:16:59 +01:00
|
|
|
areas.config[name] = value
|
2013-09-03 01:16:14 +02:00
|
|
|
end
|
|
|
|
|
2014-11-18 03:16:59 +01:00
|
|
|
--------------
|
|
|
|
-- Settings --
|
|
|
|
--------------
|
2013-09-03 01:16:14 +02:00
|
|
|
|
2014-11-18 03:16:59 +01:00
|
|
|
setting("string", "filename", world_path.."/areas.dat")
|
2013-09-03 01:16:14 +02:00
|
|
|
|
2014-11-18 03:16:59 +01:00
|
|
|
-- Allow players with a privilege create their own areas
|
|
|
|
-- within the maximum size and number.
|
|
|
|
setting("boolean", "self_protection", false)
|
|
|
|
setting("string", "self_protection_privilege", "interact")
|
|
|
|
setting("position", "self_protection_max_size", {x=64, y=128, z=64})
|
|
|
|
setting("number", "self_protection_max_areas", 4)
|
|
|
|
-- 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)
|
2013-09-03 01:16:14 +02:00
|
|
|
|
2014-11-18 03:16:59 +01:00
|
|
|
-- legacy_table (owner_defs) compatibility. Untested and has known issues.
|
|
|
|
setting("boolean", "legacy_table", false)
|
2013-09-03 01:16:14 +02:00
|
|
|
|