feat: add GetNetStats (latency) and AcceptBattlefieldPort (BG queue)
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run

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.
This commit is contained in:
Kelsi 2026-03-23 04:17:25 -07:00
parent a53342e23f
commit d873f27070

View file

@ -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);