Parties: party leaders can't join an arena if some party members are still in an ongoing game

This commit is contained in:
Zughy 2020-11-25 20:21:54 +01:00
parent 37aac9032f
commit 70368e8460
4 changed files with 12 additions and 19 deletions

View File

@ -39,11 +39,6 @@ parties.register_on_pre_party_join(function(party_leader, p_name)
if not arena then return true end
-- se l'invitato è l'unico rimasto in partita ed è in celebrazione
if arena.players_amount == 1 and arena.in_celebration then
minetest.chat_send_player(p_name, minetest.colorize("#e6482e", S("[!] You can't perform this action if you're the only one left!")))
return false end
-- se l'invitato è in coda, lo rimuovo
if arena_lib.is_player_in_queue(p_name) then
arena_lib.remove_from_queue(p_name)
@ -51,14 +46,3 @@ parties.register_on_pre_party_join(function(party_leader, p_name)
return true
end)
parties.register_on_party_join(function(party_leader, p_name)
--se è in arena, lo rimuovo
if arena_lib.is_player_in_arena(p_name) then
arena_lib.remove_player_from_arena(p_name, 3)
end
end)

View File

@ -122,6 +122,7 @@ You're immune!=Sei immune!
Arena sign=Cartello dell'arena
[!] You must leave the editor first!=[!] Devi prima uscire dall'editor!
[!] Only the party leader can enter the queue!=[!] Solo il capo gruppo può entrare nella coda!
[!] You must wait for all your party members to finish their ongoing games before entering a new one!=[!] Devi aspettare che i membri della tua squadra terminino le loro partite in corso prima di iniziarne una nuova!
[!] There is no enough space for the whole party!=[!] Non c'è abbastanza spazio per tutto il gruppo!
[!] There is no team with enough space for the whole party!=[!] Non c'è un team con abbastanza spazio per tutto il gruppo!
[!] Only the party leader can leave the queue!=[!] Solo il capo gruppo può abbandonare la coda!

View File

@ -122,6 +122,7 @@ You're immune!=
Arena sign=
[!] You must leave the editor first!=
[!] Only the party leader can enter the queue!=
[!] You must wait for all your party members to finish their ongoing games before entering a new one!=
[!] There is no enough space for the whole party!=
[!] There is no team with enough space for the whole party!=
[!] The arena is not enabled!=

View File

@ -56,11 +56,18 @@ signs_lib.register_sign("arena_lib:sign", {
minetest.chat_send_player(p_name, minetest.colorize("#e6482e", S("[!] Only the party leader can enter the queue!")))
return end
local party_members_amount = #parties.get_party_members(p_name)
local party_members = parties.get_party_members(p_name)
for _, pl_name in pairs(party_members) do
if arena_lib.is_player_in_arena(pl_name) then
minetest.chat_send_player(p_name, minetest.colorize("#e6482e", S("[!] You must wait for all your party members to finish their ongoing games before entering a new one!")))
return
end
end
--se non c'è spazio (no team)
if not sign_arena.teams_enabled then
if party_members_amount > sign_arena.max_players - sign_arena.players_amount then
if #party_members > sign_arena.max_players - sign_arena.players_amount then
minetest.chat_send_player(p_name, minetest.colorize("#e6482e", S("[!] There is no enough space for the whole party!")))
return end
-- se non c'è spazio (team)
@ -68,7 +75,7 @@ signs_lib.register_sign("arena_lib:sign", {
local free_space = false
for _, amount in pairs(sign_arena.players_amount_per_team) do
if party_members_amount <= sign_arena.max_players - amount then
if #party_members <= sign_arena.max_players - amount then
free_space = true
break
end