From 5eb9527481d4edff62ade0a9685db12d3f86afce Mon Sep 17 00:00:00 2001 From: Zughy <4279489-marco_a@users.noreply.gitlab.com> Date: Sat, 11 Jun 2022 15:14:14 +0200 Subject: [PATCH] `name` and `icon` attributes when registering a minigame --- DOCS.md | 4 +++- src/api/core.lua | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/DOCS.md b/DOCS.md index ba523aa..daa7804 100644 --- a/DOCS.md +++ b/DOCS.md @@ -50,7 +50,9 @@ arena_lib.register_minigame("yourmod", {parameter1, parameter2 etc}) ``` `"yourmod"` is how arena_lib will store your mod inside its storage, and it's also what it needs in order to understand you're referring to that specific minigame (that's why almost every `arena_lib` function contains `"mod"` as a parameter). You'll need it when calling for commands and callbacks. **Use the same name you used in mod.conf or some features won't be available**. The second field, on the contrary, is a table of optional parameters: they define the very features of your minigame. They are: -* `prefix`: (string) what's going to appear in most of the lines printed by your mod. Default is `[Arena_lib] ` +* `name`: (string) the name of your minigame. If not specified, it takes the name used to register the minigame +* `prefix`: (string) what's going to appear in most of the lines printed by your mod. Default is `[] `, where `` is the name of your minigame +* `icon`: (string) optional icon to represent your minigame. Currently unused by default, it comes in handy for external mods * `teams`: (table) contains team names. If not declared, your minigame won't have teams and the table will be equal to `{-1}`. You can add as many teams as you like, as the number of spawners (and players) will be multiplied by the number of teams (so `max_players = 4` * 3 teams = `max_players = 12`) * `teams_color_overlay`: (table) [color strings](https://drafts.csswg.org/css-color/#named-colors). It applies a color overlay onto the players' skin according to their team, to better distinguish them. It requires `teams`. Default is `nil` * `is_team_chat_default`: (bool) whether players messages in a game should be sent to their teammates only. It requires `teams`, default is false diff --git a/src/api/core.lua b/src/api/core.lua index 42cec22..a77c078 100755 --- a/src/api/core.lua +++ b/src/api/core.lua @@ -91,7 +91,9 @@ function arena_lib.register_minigame(mod, def) load_settings(mod) --default parameters - mod_ref.prefix = "[Arena_lib] " + mod_ref.name = def.name or mod + mod_ref.prefix = "[" .. mod_ref.name .. "] " + mod_ref.icon = def.icon mod_ref.teams = {-1} mod_ref.teams_color_overlay = nil mod_ref.is_team_chat_default = false