97 lines
2.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")
2019-04-21 10:40:33 -04:00
-- Config
kingdoms.marker_radius = 100
2019-04-21 18:33:42 -04:00
kingdoms.marker_capture_time = 10 -- Seconds
2019-04-21 10:40:33 -04:00
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-21 14:46:27 -04:00
-- Load news
local nStr = storage:get_string("news")
if nStr == "" then
kingdoms.news = {uid = 1, news = {}}
2019-04-21 14:46:27 -04:00
else
kingdoms.news = minetest.deserialize(nStr)
end
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
2019-04-21 14:46:27 -04:00
dofile(mp .. "/news.lua")
2019-04-18 20:48:07 -04:00
dofile(mp .. "/kingdoms.lua")
dofile(mp .. "/gui.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")
2019-04-24 23:07:49 -04:00
dofile(mp .. "/doors.lua")