From 0b8d3f99a5424113178329e56c2ebe4b38fd2b46 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 12 Feb 2020 19:49:48 +0100 Subject: 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. --- builtin/game/misc.lua | 16 ---------------- 1 file changed, 16 deletions(-) (limited to 'builtin/game/misc.lua') 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 -- cgit v1.2.3