Show player/server count in server list

This commit is contained in:
Federico Cecchetto
2022-06-26 23:25:04 +02:00
parent b12a763367
commit 1b6442fc9e
3 changed files with 37 additions and 0 deletions

View File

@ -9,4 +9,7 @@ namespace server_list
void handle_info_response(const game::netadr_s& address, const utils::info_string& info);
bool sl_key_event(int key, int down);
int get_player_count();
int get_server_count();
}

View File

@ -17,6 +17,7 @@
#include "fastfiles.hpp"
#include "scripting.hpp"
#include "updater.hpp"
#include "server_list.hpp"
#include "game/ui_scripting/execution.hpp"
#include "game/scripting/execution.hpp"
@ -342,6 +343,12 @@ namespace ui_scripting
::game::Dvar_SetFromStringByNameFromSource("virtualLobbyPresentable", "1", ::game::DvarSetSource::DVAR_SOURCE_INTERNAL);
};
auto server_list_table = table();
lua["serverlist"] = server_list_table;
server_list_table["getplayercount"] = server_list::get_player_count;
server_list_table["getservercount"] = server_list::get_server_count;
auto updater_table = table();
lua["updater"] = updater_table;