Add ability to lock a player to a certain color
This commit is contained in:
parent
45ef43d964
commit
1fd07dfa23
3 changed files with 33 additions and 1 deletions
2
mods/ctf_alloc/depends.txt
Normal file
2
mods/ctf_alloc/depends.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
ctf
|
||||
lib_chatcmdbuilder
|
30
mods/ctf_alloc/init.lua
Normal file
30
mods/ctf_alloc/init.lua
Normal file
|
@ -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,
|
||||
}
|
||||
})
|
|
@ -1 +1 @@
|
|||
Subproject commit 730f0906de0f572e763dabeb7e4b7514e9e6bb41
|
||||
Subproject commit 9a10f60e974ab2f20d1a7843fc2f04ac60ec645d
|
Loading…
Reference in a new issue