From 4f29df7e22d4f8b97f1a58d6a2805c058a1ef074 Mon Sep 17 00:00:00 2001 From: Zughy <4279489-marco_a@users.noreply.gitlab.com> Date: Thu, 13 Jan 2022 00:19:28 +0100 Subject: [PATCH] Don't allow players attached to something to join queues and ongoing games --- locale/arena_lib.it.tr | 2 ++ locale/template.txt | 2 ++ src/signs.lua | 21 ++++++++++++++++----- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/locale/arena_lib.it.tr b/locale/arena_lib.it.tr index c93da0c..36c854b 100755 --- a/locale/arena_lib.it.tr +++ b/locale/arena_lib.it.tr @@ -140,9 +140,11 @@ Arena sign=Cartello dell'arena [!] Uh-oh, it looks like this sign has been misplaced: well, fixed, hit it again!==[!]Oh oh, sembra che questo cartello sia fuori posto: beh, sistemato, colpiscilo di nuovo! [!] 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! +[!] Can't enter a game if some of your party members are attached to something! (e.g. boats, horses etc.)=[!] Non puoi entrare in partita se alcuni membri del gruppo sono attaccati a qualcosa! (es. navi, cavalli ecc.) [!] There is not 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! +[!] You must detach yourself from the entity you're attached to before entering!=[!] Devi prima staccarti dall'entità alla quale sei agganciato/a se vuoi entrare! [!] The arena is not enabled!=[!] L'arena non è attiva! [!] The arena is already full!=[!] L'arena è già piena! [!] The arena is loading, try again in a few seconds!=[!] L'arena è in caricamento, riprova tra qualche secondo! diff --git a/locale/template.txt b/locale/template.txt index 02e1150..17d8e2d 100755 --- a/locale/template.txt +++ b/locale/template.txt @@ -140,9 +140,11 @@ Arena sign= [!] Uh-oh, it looks like this sign has been misplaced: well, fixed, hit it again!= [!] 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!= +[!] Can't enter a game if some of your party members are attached to something! (e.g. boats, horses etc.)= [!] There is not enough space for the whole party!= [!] There is no team with enough space for the whole party!= [!] Only the party leader can leave the queue!= +[!] You must detach yourself from the entity you're attached to before entering!= [!] The arena is not enabled!= [!] The arena is already full!= [!] The arena is loading, try again in a few seconds!= diff --git a/src/signs.lua b/src/signs.lua index 9d7d096..b8e19d4 100755 --- a/src/signs.lua +++ b/src/signs.lua @@ -65,7 +65,7 @@ signs_lib.register_sign("arena_lib:sign", { minetest.chat_send_player(p_name, minetest.colorize("#e6482e", S("[!] You must leave the editor first!"))) return end - -- se il cartello è stato spostato (tipo con WorldEdit), lo ripristino (e se c'è una partita in corso, la interrompo) + -- se il cartello è stato spostato tipo con WorldEdit, lo aggiorno alla nuova posizione (e se c'è una partita in corso, la interrompo) if minetest.serialize(sign_arena.sign) ~= minetest.serialize(pos) then local arena_name = sign_arena.name arena_lib.force_arena_ending(mod, sign_arena, "ARENA_LIB") @@ -86,11 +86,17 @@ signs_lib.register_sign("arena_lib:sign", { local party_members = parties.get_party_members(p_name) + -- per tutti i membri... 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 + -- se uno è in partita + 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 + + -- se uno è attaccato a qualcosa + if minetest.get_player_by_name(pl_name):get_attach() then + minetest.chat_send_player(p_name, minetest.colorize("#e6482e", S("[!] Can't enter a game if some of your party members are attached to something! (e.g. boats, horses etc.)"))) + return end end --se non c'è spazio (no team) @@ -115,6 +121,11 @@ signs_lib.register_sign("arena_lib:sign", { end end + -- se si è attaccati a qualcosa + if puncher:get_attach() then + minetest.chat_send_player(p_name, minetest.colorize("#e6482e", S("[!] You must detach yourself from the entity you're attached to before entering!"))) + return end + -- se non è abilitata if not sign_arena.enabled then minetest.chat_send_player(p_name, minetest.colorize("#e6482e", S("[!] The arena is not enabled!")))