58db9e7dd0
* Move hud_score mod to 'other' modpack * hud_score: Reuse element when adding a new element with the same name |
||
---|---|---|
.. | ||
init.lua | ||
mod.conf | ||
README.md |
hud_score
hud_score
provides an API to display HUD score elements which can be used to
display kill scores, bounty scores, etc.
Methods
hud_score.new(name, score_def)
: Adds a new HUD score element to playername
.name
[string]: Player namescore_def
[table]: HUD score element definition. See below.
HUD score element definition
HUD score element definition table, passed to hud_score.new
.
Example definition:
{
name = "ctf_stats:kill_score", -- Can be any arbitrary string
color = "0x00FF00", -- Should be compatible with Minetest's HUD def
value = 50, -- The actual number to be displayed
-- Field `time` is automatically added by `hud_score.new`
-- to keep track of element expiry
}
players
table
This is a table of tables, indexed by player names. This table holds the HUD
data of all online players. Each sub-table is a list of HUD score elements,
which are added by hud_score.new
.
local players = {
["name"] = {
[1] = <hud_score_element>,
[2] = <hud_score_element>,
[3] = <hud_score_element>
...
},
["name2"] = {
...
},
...
}