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")
|
|
|
|
|
2019-04-21 10:40:33 -04:00
|
|
|
-- Config
|
|
|
|
kingdoms.marker_radius = 100
|
|
|
|
kingdoms.marker_capture_time = 60 -- Seconds
|
|
|
|
kingdoms.marker_capture_range = 5
|
|
|
|
|
|
|
|
-- Generated based on config
|
|
|
|
kingdoms.marker_radius_sq = kingdoms.marker_radius ^ 2
|
|
|
|
|
2019-04-17 16:23:34 -04:00
|
|
|
-- 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-21 13:01:49 -04:00
|
|
|
admin = true, -- Change team settings
|
2019-04-17 16:23:34 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
-- Define default ranks
|
|
|
|
kingdoms.default_ranks = {
|
|
|
|
king = kingdoms.helpers.copy_table(kingdoms.kingdom_privs),
|
2019-04-21 13:01:49 -04:00
|
|
|
high_lord = {make_base = true, interact = true, recruiter = true, admin = true, diplomat = true},
|
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}
|
|
|
|
}
|
|
|
|
|
2019-04-21 10:40:33 -04:00
|
|
|
-- Define colors
|
|
|
|
kingdoms.colors = {
|
|
|
|
White = "#FFFFFF",
|
|
|
|
Black = "#000000",
|
|
|
|
Red = "#800000",
|
|
|
|
Yellow = "#FFFF00",
|
|
|
|
Green = "#008000",
|
|
|
|
Blue = "#000080",
|
|
|
|
Purple = "#800080",
|
|
|
|
Orange = "#FF8C00",
|
|
|
|
Brown = "#8B4513"
|
|
|
|
}
|
|
|
|
|
2019-04-17 16:23:34 -04:00
|
|
|
-- 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
|
|
|
|
|
2019-04-21 10:40:33 -04:00
|
|
|
-- Load markers
|
|
|
|
local mStr = storage:get_string("markers")
|
|
|
|
if mStr == "" then
|
|
|
|
kingdoms.markers = {}
|
|
|
|
else
|
|
|
|
kingdoms.markers = minetest.deserialize(mStr)
|
|
|
|
end
|
|
|
|
|
2019-04-18 20:48:07 -04:00
|
|
|
-- Load external files
|
|
|
|
dofile(mp .. "/kingdoms.lua")
|
2019-04-21 10:40:33 -04:00
|
|
|
dofile(mp .. "/markers.lua")
|
2019-04-17 16:23:34 -04:00
|
|
|
dofile(mp .. "/chat.lua")
|