From ce106e18811c9216ba9813d22b5f50a4f0977d07 Mon Sep 17 00:00:00 2001 From: Marco <4279489-marco_a@users.noreply.gitlab.com> Date: Fri, 29 May 2020 23:22:47 +0200 Subject: [PATCH] Translations updated | less redundancy and better editor structure --- _edit_tools/editor_icons.lua | 20 ++++---- _edit_tools/editor_main.lua | 64 ++++++++++++++----------- _edit_tools/tools_sign.lua | 6 +-- _edit_tools/tools_spawner.lua | 6 +-- api.lua | 89 ++++++++++------------------------- locale/arena_lib.it.tr | 89 ++++++++++++++++++++++------------- locale/template.txt | 84 +++++++++++++++++++++------------ player_manager.lua | 16 +++++-- signs.lua | 7 ++- utils.lua | 28 +++++++++++ 10 files changed, 237 insertions(+), 172 deletions(-) create mode 100644 utils.lua diff --git a/_edit_tools/editor_icons.lua b/_edit_tools/editor_icons.lua index 8e11610..8bc4f55 100644 --- a/_edit_tools/editor_icons.lua +++ b/_edit_tools/editor_icons.lua @@ -1,6 +1,10 @@ +local S = minetest.get_translator("arena_lib") + + + minetest.register_tool("arena_lib:editor_spawners", { - description = "Spawner", + description = S("Spawners"), inventory_image = "arenalib_editor_spawners.png", groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = "2"}, on_place = function() end, @@ -8,9 +12,9 @@ minetest.register_tool("arena_lib:editor_spawners", { on_use = function(itemstack, user) - arena_lib.HUD_send_msg("hotbar", user:get_player_name(), "Spawner | ID sel.: 1 (Click dx su slot #2 per cambiare)") - user:get_meta():set_int("arena_lib_editor.spawner_ID", 1) + + arena_lib.HUD_send_msg("hotbar", user:get_player_name(), S("Spawners | sel. ID: @1 (right click slot #2 to change)", 1)) minetest.after(0, function() arena_lib.give_spawners_tools(user) @@ -23,7 +27,7 @@ minetest.register_tool("arena_lib:editor_spawners", { minetest.register_tool("arena_lib:editor_signs", { - description = "Cartelli", + description = S("Signs"), inventory_image = "arenalib_editor_signs.png", groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = "2"}, on_place = function() end, @@ -31,7 +35,7 @@ minetest.register_tool("arena_lib:editor_signs", { on_use = function(itemstack, user) - arena_lib.HUD_send_msg("hotbar", user:get_player_name(), "Un cartello per arena") + arena_lib.HUD_send_msg("hotbar", user:get_player_name(), S("One sign per arena")) minetest.after(0, function() arena_lib.give_signs_tools(user) @@ -44,7 +48,7 @@ minetest.register_tool("arena_lib:editor_signs", { minetest.register_tool("arena_lib:editor_info", { - description = "Info", + description = S("Info"), inventory_image = "arenalib_editor_info.png", groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = "2"}, on_place = function() end, @@ -64,7 +68,7 @@ minetest.register_tool("arena_lib:editor_info", { minetest.register_tool("arena_lib:editor_return", { - description = "Torna indietro", + description = S("Go back"), inventory_image = "arenalib_editor_return.png", groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = "2"}, on_place = function() end, @@ -82,7 +86,7 @@ minetest.register_tool("arena_lib:editor_return", { minetest.register_tool("arena_lib:editor_quit", { - description = "Esci dall'editor", + description = S("Leave the editor"), inventory_image = "arenalib_editor_quit.png", groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = "2"}, on_place = function() end, diff --git a/_edit_tools/editor_main.lua b/_edit_tools/editor_main.lua index 72cf923..1bfe4d8 100644 --- a/_edit_tools/editor_main.lua +++ b/_edit_tools/editor_main.lua @@ -1,5 +1,6 @@ local S = minetest.get_translator("arena_lib") -local in_edit_mode = {} -- arenas names +local arenas_in_edit_mode = {} -- KEY: arena name; INDEX: name of the player inside the editor +local players_in_edit_mode = {} -- KEY: player name; INDEX: (placeholder, not relevant) local editor_tools = { "", "arena_lib:editor_spawners", @@ -17,20 +18,7 @@ function arena_lib.enter_editor(sender, mod, arena_name) local id, arena = arena_lib.get_arena_by_name(mod, arena_name) - -- controllo se esiste l'arena - if arena == nil then - minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] This arena doesn't exist!"))) - return end - - -- se è abilitata, annullo - if arena.enabled then - minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] You must disable the arena first!"))) - return end - - -- se sta già venendo modificata da qualcuno, annullo - if in_edit_mode[arena_name] ~= nil then - minetest.chat_send_player(sender, minetest.colorize("#e6482e", "[!] L'arena sta già venendo modificata da qualcun altro! (" .. in_edit_mode[arena_name] .. ")")) - return end + if not ARENA_LIB_EDIT_PRECHECKS_PASSED(sender, arena) then return end local player = minetest.get_player_by_name(sender) @@ -42,7 +30,8 @@ function arena_lib.enter_editor(sender, mod, arena_name) arena_lib.show_main_editor(player) -- metto l'arena in edit mode - in_edit_mode[arena_name] = sender + arenas_in_edit_mode[arena_name] = sender + players_in_edit_mode[sender] = true end @@ -54,7 +43,8 @@ function arena_lib.quit_editor(player) if arena_name == "" then return end - in_edit_mode[arena_name] = nil + arenas_in_edit_mode[arena_name] = nil + players_in_edit_mode[player:get_player_name()] = nil player:get_meta():set_string("arena_lib_editor.mod", "") player:get_meta():set_string("arena_lib_editor.arena", "") @@ -70,24 +60,42 @@ end + + +---------------------------------------------- +--------------------UTILS--------------------- +---------------------------------------------- + function arena_lib.show_main_editor(player) local arena_name = player:get_meta():get_string("arena_lib_editor.arena") player:get_inventory():set_list("main", editor_tools) - arena_lib.HUD_send_msg("hotbar", player:get_player_name(), "Arena_lib editor | Stai modificando: " .. arena_name) + arena_lib.HUD_send_msg("hotbar", player:get_player_name(), S("Arena_lib editor | Now editing: @1", arena_name)) end -function arena_lib.is_arena_in_edit_mode(arena_name, player_exception) - - if player_exception then - if in_edit_mode[arena_name] == player_exception then return false end - end - - if in_edit_mode[arena_name] ~= nil then return true - else return false - end - +function arena_lib.is_arena_in_edit_mode(arena_name) + if arenas_in_edit_mode[arena_name] ~= nil then return true + else return false end +end + + + +function arena_lib.is_player_in_edit_mode(p_name) + if players_in_edit_mode[p_name] ~= nil then return true + else return false end +end + + + + + +---------------------------------------------- +-----------------GETTERS---------------------- +---------------------------------------------- + +function arena_lib.get_player_in_edit_mode(arena_name) + return arenas_in_edit_mode[arena_name] end diff --git a/_edit_tools/tools_sign.lua b/_edit_tools/tools_sign.lua index 3094642..ed9bd13 100644 --- a/_edit_tools/tools_sign.lua +++ b/_edit_tools/tools_sign.lua @@ -2,10 +2,10 @@ local S = minetest.get_translator("arena_lib") local spawners_tools = { "arena_lib:sign_add", "arena_lib:sign_remove", + "", "default:sign_wall", "default:sign_wall_steel", "", - "", "arena_lib:editor_return", "arena_lib:editor_quit", } @@ -14,7 +14,7 @@ local spawners_tools = { minetest.register_tool("arena_lib:sign_add", { - description = S("Left click on a sign to create the access to the arena"), + description = S("Add sign"), inventory_image = "arenalib_tool_sign_add.png", groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = "2"}, on_place = function() end, @@ -41,7 +41,7 @@ minetest.register_tool("arena_lib:sign_add", { minetest.register_tool("arena_lib:sign_remove", { - description = S("Left click on a sign to remove the access to the arena"), + description = S("Remove sign"), inventory_image = "arenalib_tool_sign_remove.png", groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = "2"}, on_place = function() end, diff --git a/_edit_tools/tools_spawner.lua b/_edit_tools/tools_spawner.lua index b59b1a1..5777397 100644 --- a/_edit_tools/tools_spawner.lua +++ b/_edit_tools/tools_spawner.lua @@ -72,7 +72,7 @@ minetest.register_tool("arena_lib:spawner_remove", { end placer:get_meta():set_int("arena_lib_editor.spawner_ID", spawner_ID) - arena_lib.HUD_send_msg("hotbar", placer:get_player_name(), "Spawner | ID sel.: " .. spawner_ID .. " (Click dx su slot #2 per cambiare)") + arena_lib.HUD_send_msg("hotbar", placer:get_player_name(), S("Spawners | sel. ID: @1 (right click slot #2 to change)", spawner_ID)) end }) @@ -81,7 +81,7 @@ minetest.register_tool("arena_lib:spawner_remove", { minetest.register_tool("arena_lib:spawner_deleteall", { - description = "Cancella tutto", + description = S("Delete all spawners"), inventory_image = "arenalib_tool_spawner_deleteall.png", groups = {not_in_creative_inventory = 1, oddly_breakable_by_hand = "2"}, on_place = function() end, @@ -94,7 +94,7 @@ minetest.register_tool("arena_lib:spawner_deleteall", { local p_name = user:get_player_name() arena_lib.set_spawner(p_name, mod, arena_name, "deleteall") - minetest.chat_send_player(user:get_player_name(), "Tutti gli spawn point sono stati rimossi") + minetest.chat_send_player(user:get_player_name(), S("All the spawn points has been removed")) end }) diff --git a/api.lua b/api.lua index d706c4c..3513bee 100644 --- a/api.lua +++ b/api.lua @@ -225,24 +225,17 @@ function arena_lib.remove_arena(sender, mod, arena_name) local id, arena = arena_lib.get_arena_by_name(mod, arena_name) - if not arena then - minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] There is no arena named @1!", arena_name))) - return end - - if arena.in_game then - minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] There is an ongoing match inside the arena @1: impossible to remove!", arena_name))) - return end + if not ARENA_LIB_EDIT_PRECHECKS_PASSED(sender, arena) then return end --TODO: -chiedere conferma -- rimozione cartello coi rispettivi metadati if arena.sign ~= nil then - minetest.set_node(arena.sign, {name = "air"}) end + minetest.set_node(arena.sign, {name = "air"}) + end local mod_ref = arena_lib.mods[mod] - arena_lib.send_message_players_in_arena(arena, mod_ref.prefix ..S("The arena you were queueing for has been removed... :(")) - -- rimozione arena e aggiornamento storage mod_ref.arenas[id] = nil update_storage(true, mod, id, arena) @@ -259,20 +252,7 @@ function arena_lib.set_spawner(sender, mod, arena_name, param, ID) local id, arena = arena_lib.get_arena_by_name(mod, arena_name) - -- se non esiste l'arena, annullo - if arena == nil then - minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] This arena doesn't exist!"))) - return end - - -- se non è disabilitata, annullo - if arena.enabled then - minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] You must disable the arena first!"))) - return end - - -- se è in modalità edit, annullo - if arena_lib.is_arena_in_edit_mode(arena_name, sender) then - minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] Someone is already editing this arena!"))) - return end + if not ARENA_LIB_EDIT_PRECHECKS_PASSED(sender, arena) then return end local pos = vector.floor(minetest.get_player_by_name(sender):get_pos()) -- tolgo i decimali per immagazzinare un int local pos_Y_up = {x = pos.x, y = pos.y+1, z = pos.z} -- alzo Y di uno sennò tippa nel blocco @@ -321,7 +301,8 @@ function arena_lib.set_spawner(sender, mod, arena_name, param, ID) -- se c'è già uno spawner in quel punto, annullo for id, spawn in pairs(arena.spawn_points) do - if minetest.serialize(pos_Y_up) == minetest.serialize(spawn) then minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] There's already a spawn in this point!"))) + if minetest.serialize(pos_Y_up) == minetest.serialize(spawn) then + minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] There's already a spawn in this point!"))) return end end @@ -346,20 +327,7 @@ function arena_lib.set_sign(sender, pos, remove, mod, arena_name) if mod then arena_ID, arena = arena_lib.get_arena_by_name(mod, arena_name) - -- se non esiste, annullo - if not arena then - minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] This arena doesn't exist!"))) - return end - - -- se l'arena è abilitata annullo - if arena.enabled then - minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] You must disable the arena first!"))) - return end - - -- se è in modalità edit, annullo - if arena_lib.is_arena_in_edit_mode(arena_name, sender) then - minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] Someone is already editing this arena!"))) - return end + if not ARENA_LIB_EDIT_PRECHECKS_PASSED(sender, arena) then return end local player = minetest.get_player_by_name(sender) local p_pos = player:get_pos() @@ -392,6 +360,8 @@ function arena_lib.set_sign(sender, pos, remove, mod, arena_name) arena_ID, arena = arena_lib.get_arena_by_name(mod, player:get_meta():get_string("arena_lib_editor.arena")) end + local mod_ref = arena_lib.mods[mod] + -- se c'è già un cartello assegnato if next(arena.sign) ~= nil then -- dal linea di comando non fa distinzione (nil), sennò sto usando lo strumento per rimuovere da editor (remove == true) @@ -399,17 +369,17 @@ function arena_lib.set_sign(sender, pos, remove, mod, arena_name) if minetest.serialize(pos) == minetest.serialize(arena.sign) then minetest.set_node(pos, {name = "air"}) arena.sign = {} - minetest.chat_send_player(sender, S("Sign of arena @1 successfully removed", arena.name)) + minetest.chat_send_player(sender, mod_ref.prefix .. S("Sign of arena @1 successfully removed", arena.name)) update_storage(false, mod, arena_ID, arena) else - minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] This sign doesn't belong to the arena @1!", arena.name))) + minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] This sign doesn't belong to @1!", arena.name))) end elseif remove == false then - minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] C'è già un cartello per quest'arena!"))) + minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] There is already a sign for this arena!"))) end return elseif remove == true then - minetest.chat_send_player(sender, minetest.colorize("#e6482e", "[!] Non c'è nessun cartello da rimuovere assegnato a quest'arena!")) + minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] There is no sign to remove assigned to @1!", arena.name))) return end @@ -424,36 +394,32 @@ function arena_lib.set_sign(sender, pos, remove, mod, arena_name) minetest.get_meta(pos):set_string("mod", mod) minetest.get_meta(pos):set_int("arenaID", arena_ID) + minetest.chat_send_player(sender, mod_ref.prefix .. S("Sign of arena @1 successfully set", arena.name)) + end function arena_lib.enable_arena(sender, mod, arena_name) - local mod_ref = arena_lib.mods[mod] local arena_ID, arena = arena_lib.get_arena_by_name(mod, arena_name) - -- controllo se esiste l'arena - if not arena then - minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] There is no arena named @1!", arena_name))) - return end + if not ARENA_LIB_EDIT_PRECHECKS_PASSED(sender, arena) then return end - -- se è già abilitata, annullo - if arena.enabled then - minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] The arena is already enabled"))) - return end - - -- check requisiti: spawner e cartello + -- check requisiti: spawner if arena_lib.get_arena_spawners_count(arena) < arena.max_players then - minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] Insufficient spawners, the arena has been disabled!"))) + minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] Insufficient spawners, the arena can't be enabled!"))) arena.enabled = false return end + -- cartello if not arena.sign.x then - minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] Sign not set, the arena has been disabled!"))) + minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] Sign not set, the arena can't be enabled!"))) arena.enabled = false return end + local mod_ref = arena_lib.mods[mod] + -- abilito arena.enabled = true arena_lib.update_sign(arena.sign, arena) @@ -469,14 +435,11 @@ function arena_lib.disable_arena(sender, mod, arena_name) local mod_ref = arena_lib.mods[mod] local arena_ID, arena = arena_lib.get_arena_by_name(mod, arena_name) - -- controllo se esiste l'arena - if not arena then - minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] There is no arena named @1!", arena_name))) - return end + if not ARENA_LIB_EDIT_PRECHECKS_PASSED(sender, arena, true) then return end -- se è già disabilitata, annullo if not arena.enabled then - minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] The arena is already disabled"))) + minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] The arena is already disabled!"))) return end -- se una partita è in corso, annullo @@ -490,7 +453,7 @@ function arena_lib.disable_arena(sender, mod, arena_name) players_in_queue[pl_name] = nil arena.players[pl_name] = nil arena.in_queue = false - minetest.chat_send_player(pl_name, minetest.colorize("#e6482e", S("[!] The arena you were queueing for has been disabled!"))) + minetest.chat_send_player(pl_name, minetest.colorize("#e6482e", S("[!] The arena you were queueing for has been disabled... :()"))) end @@ -853,7 +816,7 @@ function arena_lib.remove_player_from_arena(p_name, reason) mod_ref.on_kick(arena, p_name) end elseif reason == 3 then - arena_lib.send_message_players_in_arena(arena, minetest.colorize("#d69298", "<<< " .. S("@1 has quit the arena", p_name))) + arena_lib.send_message_players_in_arena(arena, minetest.colorize("#d69298", "<<< " .. S("@1 has quit the match", p_name))) if mod_ref.on_quit then mod_ref.on_quit(arena, p_name) end diff --git a/locale/arena_lib.it.tr b/locale/arena_lib.it.tr index b2c1143..fab7e05 100644 --- a/locale/arena_lib.it.tr +++ b/locale/arena_lib.it.tr @@ -6,33 +6,32 @@ # api.lua [!] An arena with that name exists already!=[!] Esiste già un'arena con quel nome! Arena @1 succesfully created=Arena @1 creata con successo -[!] There is no arena named @1!=[!] Non c'è nessun'arena chiamata @1! -[!] There is an ongoing match inside the arena @1: impossible to remove!=[!] Una partita è in corso nell'arena @1: impossibile rimuoverla! -The arena you were queueing for has been removed... :(=L'arena per la quale eri in coda è stata rimossa... :( Arena @1 successfully removed=Arena @1 rimossa con successo -[!] This arena doesn't exist!=[!] Quest'arena non esiste! -[!] Spawn points can't exceed the maximum number of players!=[!] Gli spawn point non possono superare i giocatori massimi! [!] No spawner with that ID to overwrite!=[!] Nessuno spawner con quell'ID da sovrascrivere! -[!] You can't set the spawn point in the air!=[!] Non puoi impostare spawn point nell'aria! -[!] There's already one spawn at this point!=[!] C'è già uno spawn in questo punto! -Spawn point #@1 successfully overwritten=Spawn point #@1 sovrascritto con successo -Spawn point #@1 successfully set=Spawn point #@1 impostato con successo -[!] You must disable the arena first!=[!] Devi prima disabilitare l'arena! +Spawn point #@1 successfully overwritten=Punto di spawn #@1 sovrascritto con successo +[!] No spawner with that ID to delete!=[!] Nessuno spawner con quell'ID da cancellare! +Spawn point #@1 successfully deleted=Punto di spawn #@1 cancellato con successo +[!] Unknown parameter!=[!] Parametro non riconosciuto! +[!] Spawn points can't exceed the maximum number of players!=[!] I punti di spawn non possono superare i giocatori massimi! +[!] There's already a spawn in this point!=[!] C'è già uno spawn in questo punto! +Spawn point #@1 successfully set=Punto di spawn #@1 impostato con successo +[!] That's not a sign!=[!] Questo non è un cartello! Sign of arena @1 successfully removed=Cartello dell'arena @1 rimosso con successo +[!] This sign doesn't belong to @1!=[!] Questo cartello non appartiene a @1! [!] There is already a sign for this arena!=[!] Esiste già un cartello per quest'arena! -[!] The arena is already enabled=[!] L'arena è già abilitata -[!] Insufficient spawners, the arena has been disabled!=[!] Spawner insufficienti, arena disabilitata! -[!] Sign not set, the arena has been disabled!=[!] Cartello non impostato, arena disabilitata! +[!] There is no sign to remove assigned to @1!=[!] Non c'è nessun cartello da rimuovere assegnato a @1! +Sign of arena @1 successfully set=Cartello dell'arena @1 impostato con successo +[!] Insufficient spawners, the arena can't be enabled!=[!] Spawner insufficienti, l'arena non può essere abilitata! +[!] Sign not set, the arena can't be enabled!=[!] Cartello non impostato, l'arena non può essere abilitata! Arena @1 successfully enabled=Arena @1 abilitata con successo [!] The arena is already disabled=[!] L'arena è già disabilitata [!] You can't disable an arena during an ongoing game!=[!] Non puoi disabilitare un'arena mentre una partita è in corso! -[!] The arena you were queueing for has been disabled!=[!] L'arena per la quale eri in coda è stata disabilitata! +[!] The arena you were queueing for has been disabled... :(=[!] L'arena per la quale eri in coda è stata disabilitata... :( Arena @1 successfully disabled=Arena @1 disabilitata con successo @1 wins the game=@1 ha vinto la partita @1 has been eliminated=@1 è stato eliminato @1 has been kicked=@1 è stato cacciato -@1 has quit the arena=@1 ha abbandonato l'arena -# TODO: quit option | @1 has left the game=@1 ha abbandonato la partita +@1 has quit the match=@1 ha abbandonato la partita Waiting for more players...=In attesa di più giocatori... The queue has been cancelled due to not enough players=La coda è stata annullata per troppi pochi giocatori You're the last player standing: you win!=Sei l'ultimo giocatore rimasto in partita: hai vinto! @@ -41,13 +40,6 @@ You win the game due to not enough players=Hai vinto la partita per troppi pochi # debug_utilities.lua name: =nome: Total arenas: =Arene totali: -Name: =Nome: -Enabled: =Abilitata: -Sign: =Cartello: -Players required: =Giocatori minimi: -Players supported: =Giocatori massimi: -Players inside: =Giocatori dentro: -Status: =Stato: in queue=in coda loading=in caricamento in game=in partita @@ -55,7 +47,14 @@ celebrating=in celebrazione waiting=in attesa Timer: =Timer: current: =corrente: -Spawn points: =Spawn points: +Name: =Nome: +Enabled: =Abilitata: +Players required: =Giocatori minimi: +Players supported: =Giocatori massimi: +Players inside: =Giocatori dentro: +Status: =Stato: +Sign: =Cartello: +Spawn points: =Punti di spawn: Properties: =Proprietà: Temp properties: =Proprietà temporanee: [!] No ongoing game! =[!] Nessuna partita in corso! @@ -65,24 +64,50 @@ Player: =Giocatore: # items.lua You're immune!=Sei immune! -Left click on a sign to create/remove the access to the arena=Tasto sinistro su un cartello per creare/rimuovere l'accesso all'arena -[!] That's not a sign!=[!] Questo non è un cartello! + # signs.lua [!] The arena is not enabled!=[!] L'arena non è attiva! -Get ready!=Preparati! -The queue has been cancelled due to not enough players=La coda è stata annullata per troppi pochi giocatori [!] 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! [!] This minigame doesn't allow to join while in progress!=[!] Questo minigioco non permette di entrare a partita iniziata! -@1 has joined the game=@1 si è aggiunto alla partita -You've entered the arena @1=Sei entrato nell'arena @1 -The game begins in @1 seconds!=La partita inizierà tra @1 secondi! +Waiting for more players...=In attesa di più giocatori... +The queue has been cancelled due to not enough players=La coda è stata annullata per troppi pochi giocatori @1 seconds for the match to start=@1 secondi all'inizio -Left click on a sign to set the arena=Click sinistro su un cartello per impostare l'arena +The game begins in @1 seconds!=La partita inizierà tra @1 secondi! +Get ready!=Preparati! # signs_lib gives troubles atm #WIP=LAVORI@\nIN CORSO #Terminating=Concludendo #Ongoing=In partita #Loading=In caricamento #Waiting=In attesa + +# utils.lua +[!] This arena doesn't exist!=[!] Quest'arena non esiste! +[!] You must disable the arena first!=[!] Devi prima disabilitare l'arena! +[!] There must be no one inside the editor of the arena to perform this command! (now inside: @1)=[!] Non deve esserci nessuno nell'editor dell'arena per poter eseguire questo comando! (attualmente dentro: @1) + +# editor_main.lua +Arena_lib editor | Now editing: @1=Arena_lib editor | Stai modificando: @1 + +# editor_icons.lua +Spawners=Spawner +Spawners | sel. ID: @1 (right click slot #2 to change)=Spawner | ID sel.: @1 (tasto dx su slot #2 per cambiare) +Signs=Cartelli +One sign per arena=Un cartello per arena +Info=Info +Go back=Torna indietro +Leave the editor=Esci dall'editor + + +# tools_spawner.lua +Add spawner=Aggiungi spawner +Remove spawner=Rimuovi spawner +Delete all spawners=Cancella tutti gli spawner +All the spawn points has been removed=Tutti i punti di spawn sono stati rimossi + +# tools_sign.lua +Add sign=Aggiungi cartello +Remove sign=Rimuovi cartello + diff --git a/locale/template.txt b/locale/template.txt index 917f05e..9c24199 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -6,33 +6,32 @@ # api.lua [!] An arena with that name exists already!= Arena @1 succesfully created= -[!] There is no arena named @1!= -[!] There is an ongoing match inside the arena @1: impossible to remove!= -The arena you were queueing for has been removed... :(= Arena @1 successfully removed= -[!] This arena doesn't exist!= -[!] Spawn points can't exceed the maximum number of players!= [!] No spawner with that ID to overwrite!= -[!] You can't set the spawn point in the air!= -[!] There's already one spawn at this point!= Spawn point #@1 successfully overwritten= +[!] No spawner with that ID to delete!= +Spawn point #@1 successfully deleted= +[!] Unknown parameter!= +[!] Spawn points can't exceed the maximum number of players!= +[!] There's already a spawn in this point!= Spawn point #@1 successfully set= -[!] You must disable the arena first!= +[!] That's not a sign!= Sign of arena @1 successfully removed= +[!] This sign doesn't belong to @1!= [!] There is already a sign for this arena!= -[!] The arena is already enabled= -[!] Insufficient spawners, the arena has been disabled!= -[!] Sign not set, the arena has been disabled!= +[!] There is no sign to remove assigned to @1!= +Sign of arena @1 successfully set= +[!] Insufficient spawners, the arena can't be enabled!= +[!] Sign not set, the arena can't be enabled!= Arena @1 successfully enabled= -[!] The arena is already disabled= +[!] The arena is already disabled!= [!] You can't disable an arena during an ongoing game!= -[!] The arena you were queueing for has been disabled!= +[!] The arena you were queueing for has been disabled... :(= Arena @1 successfully disabled= @1 wins the game= @1 has been eliminated= @1 has been kicked= -@1 has quit the arena= -@1 has left the game= +@1 has quit the match= Waiting for more players...= The queue has been cancelled due to not enough players= You're the last player standing: you win!= @@ -41,13 +40,6 @@ You win the game due to not enough players= # debug_utilities.lua name: = Total arenas: = -Name: = -Enabled: = -Sign: = -Players required: = -Players supported: = -Players inside: = -Status: = in queue= loading= in game= @@ -55,6 +47,13 @@ celebrating= waiting= Timer: = current: = +Name: = +Players required: = +Players supported: = +Players inside: = +Enabled: = +Status: = +Sign: = Spawn points: = Properties: = Temp properties: = @@ -65,24 +64,49 @@ Player: = # items.lua You're immune!= -Left click on a sign to create/remove the access to the arena= -[!] That's not a sign!= # signs.lua [!] The arena is not enabled!= -Get ready!= -The queue has been cancelled due to not enough players= [!] The arena is already full!= [!] The arena is loading, try again in a few seconds!= [!] This minigame doesn't allow to join while in progress!= -@1 has joined the game= -You've entered the arena @1= -The game begins in @1 seconds!= +Waiting for more players...= +The queue has been cancelled due to not enough players= @1 seconds for the match to start= -Left click on a sign to set the arena= +The game begins in @1 seconds!= +Get ready!= # signs_lib gives troubles atm #WIP= #Terminating= #Ongoing= #Loading= #Waiting= + +# utils.lua +[!] This arena doesn't exist!= +[!] You must disable the arena first!= +[!] There must be no one inside the editor of the arena to perform this command! (now inside: @1)= + +# editor_main.lua +Arena_lib editor | Now editing: @1= + +# editor_icons.lua +Spawners= +Spawners | sel. ID: @1 (right click slot #2 to change)= +Signs= +One sign per arena= +Info= +Go back= +Leave the editor= + + +# tools_spawner.lua +Add spawner= +Remove spawner= +Delete all spawners= +All the spawn points has been removed= + +# tools_sign.lua +Add sign= +Remove sign= + diff --git a/player_manager.lua b/player_manager.lua index 8741af9..7099b94 100644 --- a/player_manager.lua +++ b/player_manager.lua @@ -2,10 +2,18 @@ minetest.register_on_joinplayer(function(player) arena_lib.HUD_add(player) - -- nel caso fosse crashato il server con qualcuno nell'editor - if player:get_meta():get_string("arena_lib_editor.arena") ~= "" then - player:get_meta():set_string("arena_lib_editor.mod", "") - player:get_meta():set_string("arena_lib_editor.arena", "") + -- nel caso qualcuno si fosse disconnesso da dentro all'editor o fosse crashato il server con qualcuno nell'editor + if player:get_inventory():contains_item("main", "arena_lib:editor_quit") then + + local p_meta = player:get_meta() + + p_meta:set_string("arena_lib_editor.mod", "") + p_meta:set_string("arena_lib_editor.arena", "") + p_meta:set_string("arena_lib_editor.spawner_ID", "") + + if minetest.get_modpath("hub_manager") then return end -- se c'è hub_manager, ci pensa quest'ultimo allo svuotamento dell'inventario + + player:get_inventory():set_list("main", {}) end end) diff --git a/signs.lua b/signs.lua index ee4a2dd..f4f9aab 100644 --- a/signs.lua +++ b/signs.lua @@ -21,7 +21,12 @@ minetest.override_item("default:sign_wall", { local sign_arena = mod_ref.arenas[arenaID] local p_name = puncher:get_player_name() - if not sign_arena then return end -- nel caso qualche cartello dovesse buggarsi, si può rompere e non fa crashare + if not sign_arena then return end -- nel caso qualche cartello dovesse buggarsi, si può rompere senza far crashare + + -- se si è nell'editor + if arena_lib.is_player_in_edit_mode(p_name) then + minetest.chat_send_player(p_name, minetest.colorize("#e6482e", S("[!] You must leave the editor first!"))) + return end -- se non è abilitata if not sign_arena.enabled then diff --git a/utils.lua b/utils.lua new file mode 100644 index 0000000..bb68472 --- /dev/null +++ b/utils.lua @@ -0,0 +1,28 @@ +local S = minetest.get_translator("arena_lib") + + + +function ARENA_LIB_EDIT_PRECHECKS_PASSED(sender, arena, skip_enabled) + + -- se non esiste l'arena, annullo + if arena == nil then + minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] This arena doesn't exist!"))) + return end + + -- se non è disabilitata, annullo + if arena.enabled and not skip_enabled then + minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] You must disable the arena first!"))) + return end + + -- se è in modalità edit, annullo + if arena_lib.is_arena_in_edit_mode(arena.name) then + + local p_name_inside = arena_lib.get_player_in_edit_mode(arena.name) + + if sender ~= p_name_inside then + minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] There must be no one inside the editor of the arena to perform this command! (now inside: @1)", p_name_inside))) + return end + end + + return true +end