2016-04-01 20:02:19 -04:00
|
|
|
local world_path = minetest.get_worldpath()
|
|
|
|
|
|
|
|
areas.config = {}
|
|
|
|
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
local function setting(name, tp, default)
|
|
|
|
local full_name = "areas." .. name
|
2016-04-01 20:02:19 -04:00
|
|
|
local value
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
if tp == "bool" then
|
2017-06-17 19:34:42 -04:00
|
|
|
value = minetest.settings:get_bool(full_name)
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
default = value == nil and minetest.is_yes(default)
|
2016-04-01 20:02:19 -04:00
|
|
|
elseif tp == "string" then
|
2017-06-17 19:34:42 -04:00
|
|
|
value = minetest.settings:get(full_name)
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
elseif tp == "v3f" then
|
2016-04-01 20:02:19 -04:00
|
|
|
value = minetest.setting_get_pos(full_name)
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
default = value == nil and minetest.string_to_pos(default)
|
|
|
|
elseif tp == "float" or tp == "int" then
|
2017-06-17 19:34:42 -04:00
|
|
|
value = tonumber(minetest.settings:get(full_name))
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
local v, other = default:match("^(%S+) (.+)")
|
|
|
|
default = value == nil and tonumber(other and v or default)
|
2016-04-01 20:02:19 -04:00
|
|
|
else
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
error("Cannot parse setting type " .. tp)
|
2016-04-01 20:02:19 -04:00
|
|
|
end
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
|
2016-04-01 20:02:19 -04:00
|
|
|
if value == nil then
|
|
|
|
value = default
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
assert(default ~= nil, "Cannot parse default for " .. full_name)
|
2016-04-01 20:02:19 -04:00
|
|
|
end
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
--print("add", name, default, value)
|
2016-04-01 20:02:19 -04:00
|
|
|
areas.config[name] = value
|
|
|
|
end
|
|
|
|
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
local file = io.open(areas.modpath .. "/settingtypes.txt", "r")
|
|
|
|
for line in file:lines() do
|
|
|
|
local name, tp, value = line:match("^areas%.(%S+) %(.*%) (%S+) (.*)")
|
|
|
|
if value then
|
|
|
|
setting(name, tp, value)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
file:close()
|
|
|
|
|
2016-04-01 20:02:19 -04:00
|
|
|
--------------
|
|
|
|
-- Settings --
|
|
|
|
--------------
|
|
|
|
|
update castles, areas, areas_protector, bakedclay, signs_lib,
bees, blox, bobblocks, coloredwood, homedecor, technic,
currency, digilines, digistguff, facade, farming_redo,
framedglass, gloopblocks, ilights, led_marquee, maptools,
mesecons, moreblocks, moreores, mymillwork, plasticbox,
replacer, ropes, street_signs, solidcolor, stained_glass,
teleport_request, unified_inventory, unifieddyes, worldedit,
add basic_signs, notify_hud_provider
2019-09-11 13:58:21 -04:00
|
|
|
setting("filename", "string", world_path.."/areas.dat")
|
2016-04-01 20:02:19 -04:00
|
|
|
|