Important fixes for zonebuilder & filter servers on protocol
This commit is contained in:
parent
197fe51a64
commit
0d222e30cf
@ -397,6 +397,11 @@ namespace Components
|
|||||||
|
|
||||||
Node::Node()
|
Node::Node()
|
||||||
{
|
{
|
||||||
|
if (ZoneBuilder::IsEnabled())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
net_natFix = Game::Dvar_RegisterBool("net_natFix", false, 0, "Fix node registration for certain firewalls/routers");
|
net_natFix = Game::Dvar_RegisterBool("net_natFix", false, 0, "Fix node registration for certain firewalls/routers");
|
||||||
|
|
||||||
Scheduler::Loop([]
|
Scheduler::Loop([]
|
||||||
@ -406,14 +411,15 @@ namespace Components
|
|||||||
|
|
||||||
Scheduler::Loop(RunFrame, Scheduler::Pipeline::MAIN);
|
Scheduler::Loop(RunFrame, Scheduler::Pipeline::MAIN);
|
||||||
|
|
||||||
|
Scheduler::OnGameInitialized([]
|
||||||
|
{
|
||||||
|
|
||||||
Session::Handle("nodeListResponse", HandleResponse);
|
Session::Handle("nodeListResponse", HandleResponse);
|
||||||
Session::Handle("nodeListRequest", [](const Network::Address& address, [[maybe_unused]] const std::string& data)
|
Session::Handle("nodeListRequest", [](const Network::Address& address, [[maybe_unused]] const std::string& data)
|
||||||
{
|
{
|
||||||
SendList(address);
|
SendList(address);
|
||||||
});
|
});
|
||||||
|
|
||||||
Scheduler::OnGameInitialized([]
|
|
||||||
{
|
|
||||||
Migrate();
|
Migrate();
|
||||||
LoadNodePreset();
|
LoadNodePreset();
|
||||||
LoadNodes();
|
LoadNodes();
|
||||||
|
@ -322,6 +322,19 @@ namespace Components
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!entry.HasMember("ip") || !entry["protocol"].IsInt())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto protocol = entry["protocol"].GetInt();
|
||||||
|
|
||||||
|
if (protocol != PROTOCOL)
|
||||||
|
{
|
||||||
|
// We can't connect to it anyway
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Using VA because it's faster
|
// Using VA because it's faster
|
||||||
Network::Address server(Utils::String::VA("%s:%u", entry["ip"].GetString(), entry["port"].GetInt()));
|
Network::Address server(Utils::String::VA("%s:%u", entry["ip"].GetString(), entry["port"].GetInt()));
|
||||||
server.setType(Game::NA_IP); // Just making sure...
|
server.setType(Game::NA_IP); // Just making sure...
|
||||||
@ -371,7 +384,7 @@ namespace Components
|
|||||||
|
|
||||||
Toast::Show("cardicon_headshot", "Server Browser", "Fetching servers...", 3000);
|
Toast::Show("cardicon_headshot", "Server Browser", "Fetching servers...", 3000);
|
||||||
|
|
||||||
const auto* url = "http://iw4x.plutools.pw/v1/servers/iw4x";
|
const auto url = std::format("http://iw4x.plutools.pw/v1/servers/iw4x?protocol={}", PROTOCOL);
|
||||||
const auto reply = Utils::WebIO("IW4x", url).setTimeout(5000)->get();
|
const auto reply = Utils::WebIO("IW4x", url).setTimeout(5000)->get();
|
||||||
if (reply.empty())
|
if (reply.empty())
|
||||||
{
|
{
|
||||||
|
@ -23,6 +23,7 @@ namespace Components
|
|||||||
int ping;
|
int ping;
|
||||||
int matchType;
|
int matchType;
|
||||||
int securityLevel;
|
int securityLevel;
|
||||||
|
int protocol;
|
||||||
bool hardcore;
|
bool hardcore;
|
||||||
bool svRunning;
|
bool svRunning;
|
||||||
bool aimassist;
|
bool aimassist;
|
||||||
|
Loading…
Reference in New Issue
Block a user