Allow more than two teams in a match at once (#724)
* Fix bugs with more than two teams * Fix team allocation * Fix bugz * Fix crash * Fix crash with crash fix
This commit is contained in:
parent
0ef16edb23
commit
fbf0126599
14 changed files with 87 additions and 30 deletions
|
@ -52,12 +52,6 @@ function ctf_classes.register_on_changed(func)
|
|||
table.insert(registered_on_changed, func)
|
||||
end
|
||||
|
||||
function ctf_classes.set_skin(player, color, class)
|
||||
player:set_properties({
|
||||
textures = {"ctf_classes_skin_" .. class.name .. "_" .. (color or "blue") .. ".png"}
|
||||
})
|
||||
end
|
||||
|
||||
function ctf_classes.get(player)
|
||||
if type(player) == "string" then
|
||||
player = minetest.get_player_by_name(player)
|
||||
|
|
|
@ -48,9 +48,17 @@ minetest.register_chatcommand("class", {
|
|||
end
|
||||
})
|
||||
|
||||
ctf_colors.set_skin = function(player, color)
|
||||
ctf_classes.set_skin(player, color, ctf_classes.get(player))
|
||||
local old_set_skin = ctf_colors.set_skin
|
||||
ctf_colors.set_skin = function(player, color, ...)
|
||||
if color == "blue" or color == "red" then
|
||||
player:set_properties({
|
||||
textures = {"ctf_classes_skin_" .. ctf_classes.get(player).name .. "_" .. (color or "blue") .. ".png"}
|
||||
})
|
||||
elseif color then
|
||||
old_set_skin(player, color, ...)
|
||||
end
|
||||
end
|
||||
ctf_classes.set_skin = ctf_colors.set_skin
|
||||
|
||||
ctf_classes.register_on_changed(function(player, old, new)
|
||||
if not old then
|
||||
|
|
|
@ -11,6 +11,9 @@ local function regen_update()
|
|||
local pname = player:get_player_name()
|
||||
local class = get(player)
|
||||
local tname = ctf.player(pname).team
|
||||
|
||||
if medic_by_team[tname] == nil then return end
|
||||
|
||||
tnames[pname] = tname
|
||||
if class.properties.nearby_hpregen then
|
||||
if tname then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue