Enable/disable arena functions now take the arena name as a parameter (before it was the ID)

This commit is contained in:
Marco 2020-05-27 16:47:37 +02:00
parent cff3b69b11
commit 8a9702b351
4 changed files with 19 additions and 14 deletions

View File

@ -68,13 +68,13 @@ ChatCmdBuilder.new("NAMEOFYOURCOMMAND", function(cmd)
#### 1.2.3 Enabling an arena
When a sign has been set, it won't work. This because an arena must be enabled manually via
`arena_lib.enable_arena(sender, mod, arena_ID)`
`arena_lib.enable_arena(sender, mod, arena_name)`
If all the conditions are met, you'll receive a confirmation. If not, you'll receive a reason and the arena will remain disabled. Conditions are:
* all spawn points set
* sign placed
Arenas can be disabled too, via
`arena_lib.disable_arena(sender, mod, arena_ID)`
`arena_lib.disable_arena(sender, mod, arena_name)`
In order to do that, no game must be taking place in that specific arena.
### 1.3 Arena phases

21
api.lua
View File

@ -339,14 +339,19 @@ end
function arena_lib.enable_arena(sender, mod, arena_ID)
function arena_lib.enable_arena(sender, mod, arena_name)
local mod_ref = arena_lib.mods[mod]
local arena = mod_ref.arenas[arena_ID]
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 associated with this ID!")))
minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] There is no arena named @1!", arena_name)))
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
@ -364,20 +369,20 @@ function arena_lib.enable_arena(sender, mod, arena_ID)
arena.enabled = true
arena_lib.update_sign(arena.sign, arena)
update_storage(false, mod, arena_ID, arena)
minetest.chat_send_player(sender, mod_ref.prefix .. S("Arena successfully enabled"))
minetest.chat_send_player(sender, mod_ref.prefix .. S("Arena @1 successfully enabled", arena_name))
end
function arena_lib.disable_arena(sender, mod, arena_ID)
function arena_lib.disable_arena(sender, mod, arena_name)
local mod_ref = arena_lib.mods[mod]
local arena = mod_ref.arenas[arena_ID]
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 associated with this ID!")))
minetest.chat_send_player(sender, minetest.colorize("#e6482e", S("[!] There is no arena named @1!", arena_name)))
return end
-- se è già disabilitata, annullo
@ -406,7 +411,7 @@ function arena_lib.disable_arena(sender, mod, arena_ID)
arena.enabled = false
arena_lib.update_sign(arena.sign, arena)
update_storage(false, mod, arena_ID, arena)
minetest.chat_send_player(sender, mod_ref.prefix .. S("Arena @1 successfully disabled", arena.name))
minetest.chat_send_player(sender, mod_ref.prefix .. S("Arena @1 successfully disabled", arena_name))
end

View File

@ -20,10 +20,10 @@ Spawn point #@1 successfully set=Spawn point #@1 impostato con successo
[!] You must disable the arena first!=[!] Devi prima disabilitare l'arena!
Sign of arena @1 successfully removed=Cartello dell'arena @1 rimosso con successo
[!] There is already a sign for this arena!=[!] Esiste già un cartello per quest'arena!
[!] There is no arena associated with this ID!=[!] Non esiste nessun'arena associata a questo ID!
[!] 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!
Arena successfully enabled=Arena abilitata con successo
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!

View File

@ -20,10 +20,10 @@ Spawn point #@1 successfully set=
[!] You must disable the arena first!=
Sign of arena @1 successfully removed=
[!] There is already a sign for this arena!=
[!] There is no arena associated with this ID!=
[!] The arena is already enabled=
[!] Insufficient spawners, the arena has been disabled!=
[!] Sign not set, the arena has been disabled!=
Arena successfully enabled=
Arena @1 successfully enabled=
[!] The arena is already disabled=
[!] You can't disable an arena during an ongoing game!=
[!] The arena you were queueing for has been disabled!=