mirror of
https://github.com/EliasFleckenstein03/playerlist.git
synced 2024-08-20 13:04:06 +02:00
Fix crash and invalid setting default
This commit is contained in:
parent
e8d50c038b
commit
8241217e4a
7
init.lua
7
init.lua
@ -2,10 +2,7 @@ playerlist = {
|
|||||||
huds = {}
|
huds = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
local playerlist_key = minetest.settings:get("playerlist_key")
|
local playerlist_key = minetest.settings:get("playerlist_key") or "sneak"
|
||||||
if playerlist_key == "" then
|
|
||||||
playerlist_key = "sneak"
|
|
||||||
end
|
|
||||||
|
|
||||||
function playerlist.iterator()
|
function playerlist.iterator()
|
||||||
return ipairs(minetest.get_connected_players())
|
return ipairs(minetest.get_connected_players())
|
||||||
@ -29,7 +26,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 * 50))
|
local ping = math.max(1, math.ceil(4 - (minetest.get_player_information(name).avg_rtt or 0) * 50))
|
||||||
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},
|
||||||
|
Loading…
Reference in New Issue
Block a user