diff options
author | sfan5 <sfan5@live.de> | 2020-02-12 19:49:48 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2020-02-23 22:24:12 +0100 |
commit | 0b8d3f99a5424113178329e56c2ebe4b38fd2b46 (patch) | |
tree | 0533bd86aef3bbf1e871ef1558ff9de0109e7f08 /builtin | |
parent | c657fb343f120b7462f7ca580852636ad98b8ae0 (diff) | |
download | minetest-0b8d3f99a5424113178329e56c2ebe4b38fd2b46.tar.gz minetest-0b8d3f99a5424113178329e56c2ebe4b38fd2b46.tar.bz2 minetest-0b8d3f99a5424113178329e56c2ebe4b38fd2b46.zip |
Move core.get_connected_players() implementation to C++
Keeping the ObjectRefs around in a table isn't ideal and this allows
removing the somewhat nonsensical is_player_connected() added in 86ef7147.
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/game/misc.lua | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/builtin/game/misc.lua b/builtin/game/misc.lua index 02c36ccb1..0ed11ada0 100644 --- a/builtin/game/misc.lua +++ b/builtin/game/misc.lua @@ -40,9 +40,6 @@ function core.check_player_privs(name, ...) end -local player_list = {} - - function core.send_join_message(player_name) if not core.is_singleplayer() then core.chat_send_all("*** " .. player_name .. " joined the game.") @@ -61,7 +58,6 @@ end core.register_on_joinplayer(function(player) local player_name = player:get_player_name() - player_list[player_name] = player if not core.is_singleplayer() then local status = core.get_server_status(player_name, true) if status and status ~= "" then @@ -74,22 +70,10 @@ end) core.register_on_leaveplayer(function(player, timed_out) local player_name = player:get_player_name() - player_list[player_name] = nil core.send_leave_message(player_name, timed_out) end) -function core.get_connected_players() - local temp_table = {} - for index, value in pairs(player_list) do - if value:is_player_connected() then - temp_table[#temp_table + 1] = value - end - end - return temp_table -end - - function core.is_player(player) -- a table being a player is also supported because it quacks sufficiently -- like a player if it has the is_player function |