From d873f27070c373bf1156f21bccce5d214ed39c83 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Mon, 23 Mar 2026 04:17:25 -0700 Subject: [PATCH] feat: add GetNetStats (latency) and AcceptBattlefieldPort (BG queue) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GetNetStats() returns bandwidthIn, bandwidthOut, latencyHome, latencyWorld — with real latency from getLatencyMs(). Used by latency display addons and the default UI's network indicator. AcceptBattlefieldPort(index, accept) accepts or declines a battleground queue invitation. Backed by existing acceptBattlefield and declineBattlefield methods. --- src/addons/lua_engine.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/addons/lua_engine.cpp b/src/addons/lua_engine.cpp index 6d60c119..2e555903 100644 --- a/src/addons/lua_engine.cpp +++ b/src/addons/lua_engine.cpp @@ -5182,6 +5182,25 @@ void LuaEngine::registerCoreAPI() { if (gh) gh->requestPvpLog(); return 0; }}, + // --- Network & BG Queue --- + {"GetNetStats", [](lua_State* L) -> int { + auto* gh = getGameHandler(L); + uint32_t ms = gh ? gh->getLatencyMs() : 0; + lua_pushnumber(L, 0); // bandwidthIn + lua_pushnumber(L, 0); // bandwidthOut + lua_pushnumber(L, ms); // latencyHome + lua_pushnumber(L, ms); // latencyWorld + return 4; + }}, + {"AcceptBattlefieldPort", [](lua_State* L) -> int { + auto* gh = getGameHandler(L); + int accept = lua_toboolean(L, 2); + if (gh) { + if (accept) gh->acceptBattlefield(); + else gh->declineBattlefield(); + } + return 0; + }}, // --- Taxi/Flight Paths --- {"NumTaxiNodes", [](lua_State* L) -> int { auto* gh = getGameHandler(L);