54 lines
1.3 KiB
Lua
Raw Normal View History

2019-04-17 16:23:34 -04:00
-- Init
local storage = minetest.get_mod_storage()
local mp = minetest.get_modpath(minetest.get_current_modname())
kingdoms = {}
kingdoms.storage = storage
-- Load helpers
dofile(mp .. "/helpers.lua")
-- Define privs
kingdoms.kingdom_privs = {
2019-04-18 20:48:07 -04:00
recruiter = true, -- Accept / kick members
2019-04-17 16:23:34 -04:00
make_base = true, -- Place flag
interact = true, -- Interact with team areas
diplomat = true, -- Make / end wars
2019-04-18 20:48:07 -04:00
rank_master = true, -- Make / remove ranks
2019-04-17 16:23:34 -04:00
}
-- Define default ranks
kingdoms.default_ranks = {
king = kingdoms.helpers.copy_table(kingdoms.kingdom_privs),
2019-04-18 20:48:07 -04:00
lord = {make_base = true, interact = true, recruiter = true},
2019-04-17 16:23:34 -04:00
soldier = {make_base = true, interact = true}
}
-- Load players
local pStr = storage:get_string("members")
if pStr == "" then
kingdoms.members = {}
else
kingdoms.members = minetest.deserialize(pStr)
end
-- Load kingdoms
local kStr = storage:get_string("kingdoms")
if kStr == "" then
kingdoms.kingdoms = {}
else
kingdoms.kingdoms = minetest.deserialize(kStr)
end
2019-04-18 20:48:07 -04:00
-- Load pending join requests
local pendingStr = storage:get_string("pending_requests")
if pendingStr == "" then
kingdoms.pending = {}
else
kingdoms.pending = minetest.deserialize(pendingStr)
end
-- Load external files
dofile(mp .. "/kingdoms.lua")
2019-04-17 16:23:34 -04:00
dofile(mp .. "/chat.lua")