diff --git a/mods/ctf_alloc/depends.txt b/mods/ctf_alloc/depends.txt new file mode 100644 index 0000000..56021d4 --- /dev/null +++ b/mods/ctf_alloc/depends.txt @@ -0,0 +1,2 @@ +ctf +lib_chatcmdbuilder diff --git a/mods/ctf_alloc/init.lua b/mods/ctf_alloc/init.lua new file mode 100644 index 0000000..8f6b057 --- /dev/null +++ b/mods/ctf_alloc/init.lua @@ -0,0 +1,30 @@ +local storage = minetest.get_mod_storage() +local data = minetest.parse_json(storage:get_string("locktoteam")) or {} + +local ctf_autoalloc = ctf.autoalloc +function ctf.autoalloc(name, alloc_mode) + if data[name] then + return data[name] + end + + return ctf_autoalloc(name, alloc_mode) +end + +ChatCmdBuilder.new("ctf_lockpt", function(cmd) + cmd:sub(":name :team", function(name, pname, team) + if team == "!" then + data[pname] = nil + storage:set_string("locktoteam", minetest.write_json(data)) + return true, "Unlocked " .. pname + else + data[pname] = team + storage:set_string("locktoteam", minetest.write_json(data)) + return true, "Locked " .. pname .. " to " .. team + end + end) +end, { + description = "Lock a player to a team", + privs = { + ctf_admin = true, + } +}) diff --git a/mods/ctf_pvp_engine b/mods/ctf_pvp_engine index 730f090..9a10f60 160000 --- a/mods/ctf_pvp_engine +++ b/mods/ctf_pvp_engine @@ -1 +1 @@ -Subproject commit 730f0906de0f572e763dabeb7e4b7514e9e6bb41 +Subproject commit 9a10f60e974ab2f20d1a7843fc2f04ac60ec645d