Adaption for CTF
This commit is contained in:
parent
8241217e4a
commit
ccafa95bd0
3 changed files with 3 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
||||||
# playerlist
|
# playerlist for ctf
|
||||||
Show a list of all online players (similar to minecrafts tab-list) when a player is pressing the playerlist key (by default: sneak).
|
Show a list of all online players (similar to minecrafts tab-list) when a player is pressing the playerlist key (by default: sneak).
|
||||||
Provides an API that can be used to hide or nick players, sort them and display them with different colors. (E.g. Display admins at the top of the list and make their name red). There is also a ping bar for every player (<= 20ms -> 4, <= 40ms -> 3, <= 60ms -> 2, > 60ms -> 1).
|
Provides an API that can be used to hide or nick players, sort them and display them with different colors. (E.g. Display admins at the top of the list and make their name red). There is also a ping bar for every player (<= 20ms -> 4, <= 40ms -> 3, <= 60ms -> 2, > 60ms -> 1).
|
||||||
|
|
||||||
|
|
1
init.lua
1
init.lua
|
@ -27,6 +27,7 @@ controls.register_on_press(function(user, key)
|
||||||
for i, player, color, text in playerlist.iterator() do
|
for i, player, color, text in playerlist.iterator() do
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
local ping = math.max(1, math.ceil(4 - (minetest.get_player_information(name).avg_rtt or 0) * 50))
|
local ping = math.max(1, math.ceil(4 - (minetest.get_player_information(name).avg_rtt or 0) * 50))
|
||||||
|
local color = color or ctf_colors.get_color(ctf.player(name)).hex
|
||||||
table.insert(huds, user:hud_add({
|
table.insert(huds, user:hud_add({
|
||||||
hud_elem_type = "text",
|
hud_elem_type = "text",
|
||||||
position = {x = 0.5, y = 0},
|
position = {x = 0.5, y = 0},
|
||||||
|
|
2
mod.conf
2
mod.conf
|
@ -1,3 +1,3 @@
|
||||||
name = playerlist
|
name = playerlist
|
||||||
description = The playerlist feature (extracted from the elidragon mod)
|
description = The playerlist feature (extracted from the elidragon mod)
|
||||||
depends = controls
|
depends = controls, ctf, ctf_colors
|
||||||
|
|
Loading…
Reference in a new issue