New arena property: matchID

This commit is contained in:
Zughy 2023-12-01 21:20:25 +01:00
parent 575d581e56
commit 7b4b4cb702
11 changed files with 15 additions and 2 deletions

View File

@ -440,6 +440,7 @@ If you want to use an arena_lib function inside the logic of the items of your s
It all starts with a table called `arena_lib.mods = {}`. This table allows `arena_lib` to be subdivided per mod and it has different parameters, one being `arena_lib.mods[yourmod].arenas`. Here is where every new arena created gets put.
An arena is a table having as a key an ID and as a value its parameters. They are:
* `name`: (string) the name of the arena, declared when creating it
* `matchID`: (int) a unique 9 digit identifier, generated every time a match loads and emptied (`nil`) when it ends.
* `author`: (string) the name of the one who built/designed the map. Default is `"???"`. It appears in the signs infobox (right-click an arena sign)
* `thumbnail`: (string) the name of the optional file representing the arena, extension included. Default is `""`, meaning no thumbnail is associated with the arena. It must be put inside the `arena_lib/Thumbnails` world folder. If present, it can be seen by right-clicking built-in arena signs.
* `entrance_type`: (string) the type of the entrance of the arena. By default it takes the `arena_lib.DEFAULT_ENTRANCE` settings (which is `"sign"` by default)

View File

@ -404,6 +404,7 @@ custom=Benutzerdefiniert
Team properties: @1=
Name: @1=
ID: @1=
Match ID: @1=
Author: @1=
Thumbnail: @1=
BGM: @1=

View File

@ -404,6 +404,7 @@ custom=personalizada
Team properties: @1=
Name: @1=
ID: @1=
Match ID: @1=
Author: @1=
Thumbnail: @1=
BGM: @1=

View File

@ -404,6 +404,7 @@ custom=
Team properties: @1=
Name: @1=
ID: @1=
Match ID: @1=
Author: @1=
Thumbnail: @1=
BGM: @1=

View File

@ -404,6 +404,7 @@ custom=personalizzato
Team properties: @1=Proprietà squadra: @1
Name: @1=Nome: @1
ID: @1=ID: @1
Match ID: @1=ID partita: @1
Author: @1=Autorə: @1
Thumbnail: @1=Miniatura: @1
BGM: @1=Musica di sottofondo: @1

View File

@ -404,6 +404,7 @@ custom=własny
Team properties: @1=Właściwości drużyny: @1
Name: @1=Nazwa: @1
ID: @1=ID: @1
Match ID: @1=
Author: @1=Autor: @1
Thumbnail: @1=Miniaturka: @1
BGM: @1=BGM: @1

View File

@ -404,6 +404,7 @@ custom=произвольное
Team properties: @1=
Name: @1=
ID: @1=
Match ID: @1=
Author: @1=
Thumbnail: @1=
BGM: @1=

View File

@ -404,6 +404,7 @@ custom=
Team properties: @1=
Name: @1=
ID: @1=
Match ID: @1=
Author: @1=
Thumbnail: @1=
BGM: @1=

View File

@ -63,6 +63,7 @@ local arena_optional_fields = {
weather = true,
lighting = true, -- light = override_day_night_ratio
bgm = true,
matchID = true,
initial_time = true,
current_time = true
}

View File

@ -27,6 +27,7 @@ function arena_lib.load_arena(mod, arena_ID)
arena.in_game = true
arena.in_loading = true
arena.matchID = math.random(100000000, 999999999)
arena_lib.entrances[arena.entrance_type].update(mod, arena)
local shuffled_spawners = table.copy(arena.spawn_points)
@ -405,6 +406,7 @@ function arena_lib.end_arena(mod_ref, mod, arena, winners, is_forced)
end
end
arena.matchID = nil
arena.in_loading = false -- nel caso venga forzata mentre sta caricando, sennò rimane a caricare all'infinito
arena.in_celebration = false
arena.in_game = false

View File

@ -326,11 +326,13 @@ function arena_lib.print_arena_info(sender, mod, arena_name)
minetest.colorize("#cfc6b8", "====================================") .. "\n" ..
minetest.colorize("#eea160", S("Name: @1", minetest.colorize("#cfc6b8", arena_name ))) .. "\n" ..
minetest.colorize("#eea160", S("ID: @1", minetest.colorize("#cfc6b8", arena_ID))) .. "\n" ..
minetest.colorize("#eea160", S("Match ID: @1", minetest.colorize("#cfc6b8", arena.matchID or "---"))) .. "\n\n" ..
minetest.colorize("#eea160", S("Author: @1", minetest.colorize("#cfc6b8", arena.author))) .. "\n" ..
minetest.colorize("#eea160", S("Thumbnail: @1", minetest.colorize("#cfc6b8", thumbnail))) .. "\n" ..
minetest.colorize("#eea160", S("BGM: @1", minetest.colorize("#cfc6b8", arena_bgm))) .. "\n" ..
minetest.colorize("#eea160", S("Teams: @1", minetest.colorize("#cfc6b8", teams))) .. "\n" ..
minetest.colorize("#eea160", S("BGM: @1", minetest.colorize("#cfc6b8", arena_bgm))) .. "\n\n" ..
minetest.colorize("#eea160", S("Teams: @1", minetest.colorize("#cfc6b8", teams))) .. "\n" ..
min_players_per_team ..
max_players_per_team ..
minetest.colorize("#eea160", S("Players required: @1", minetest.colorize("#cfc6b8", arena_min_players))) .. "\n" ..