fix(node): make node system responsive
This commit is contained in:
parent
8425354ab1
commit
208b68f218
@ -184,8 +184,6 @@ namespace Components
|
|||||||
|
|
||||||
if (!Dedicated::IsEnabled())
|
if (!Dedicated::IsEnabled())
|
||||||
{
|
{
|
||||||
if (ServerList::UseMasterServer) return; // don't run node frame if master server is active
|
|
||||||
|
|
||||||
if (Game::CL_GetLocalClientConnectionState(0) != Game::CA_DISCONNECTED)
|
if (Game::CL_GetLocalClientConnectionState(0) != Game::CA_DISCONNECTED)
|
||||||
{
|
{
|
||||||
WasIngame = true;
|
WasIngame = true;
|
||||||
@ -266,7 +264,7 @@ namespace Components
|
|||||||
|
|
||||||
if (list.isnode() && (!list.port() || list.port() == address.getPort()))
|
if (list.isnode() && (!list.port() || list.port() == address.getPort()))
|
||||||
{
|
{
|
||||||
if (!Dedicated::IsEnabled() && ServerList::IsOnlineList() && !ServerList::UseMasterServer && list.protocol() == PROTOCOL)
|
if (!Dedicated::IsEnabled() && ServerList::IsOnlineList() && list.protocol() == PROTOCOL)
|
||||||
{
|
{
|
||||||
#ifdef NODE_SYSTEM_DEBUG
|
#ifdef NODE_SYSTEM_DEBUG
|
||||||
Logger::Debug("Inserting {} into the serverlist", address.getString());
|
Logger::Debug("Inserting {} into the serverlist", address.getString());
|
||||||
|
@ -29,8 +29,6 @@ namespace Components
|
|||||||
Dvar::Var ServerList::NETServerQueryLimit;
|
Dvar::Var ServerList::NETServerQueryLimit;
|
||||||
Dvar::Var ServerList::NETServerFrames;
|
Dvar::Var ServerList::NETServerFrames;
|
||||||
|
|
||||||
bool ServerList::UseMasterServer = true;
|
|
||||||
|
|
||||||
std::vector<ServerList::ServerInfo>* ServerList::GetList()
|
std::vector<ServerList::ServerInfo>* ServerList::GetList()
|
||||||
{
|
{
|
||||||
if (IsOnlineList())
|
if (IsOnlineList())
|
||||||
@ -293,6 +291,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
Discovery::Perform();
|
Discovery::Perform();
|
||||||
}
|
}
|
||||||
|
#ifdef IW4_USE_MASTER_SERVER
|
||||||
else if (IsOnlineList())
|
else if (IsOnlineList())
|
||||||
{
|
{
|
||||||
const auto masterPort = (*Game::com_masterPort)->current.integer;
|
const auto masterPort = (*Game::com_masterPort)->current.integer;
|
||||||
@ -319,6 +318,7 @@ namespace Components
|
|||||||
Logger::Print("Sending server list request to master\n");
|
Logger::Print("Sending server list request to master\n");
|
||||||
Network::SendCommand(RefreshContainer.host, "getservers", std::format("IW4 {} full empty", PROTOCOL));
|
Network::SendCommand(RefreshContainer.host, "getservers", std::format("IW4 {} full empty", PROTOCOL));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
else if (IsFavouriteList())
|
else if (IsFavouriteList())
|
||||||
{
|
{
|
||||||
LoadFavourties();
|
LoadFavourties();
|
||||||
@ -730,10 +730,6 @@ namespace Components
|
|||||||
{
|
{
|
||||||
RefreshContainer.awatingList = false;
|
RefreshContainer.awatingList = false;
|
||||||
|
|
||||||
Logger::Print("We haven't received a response from the master within {} seconds!\n", (Game::Sys_Milliseconds() - RefreshContainer.awaitTime) / 1000);
|
|
||||||
Toast::Show("net_disconnect", "^2Notice", "Master server could not be reached. Switching to decentralized network", 3000);
|
|
||||||
|
|
||||||
UseMasterServer = false;
|
|
||||||
Node::Synchronize();
|
Node::Synchronize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -892,7 +888,7 @@ namespace Components
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Set default masterServerName + port and save it
|
// Set default masterServerName + port and save it
|
||||||
Utils::Hook::Set<const char*>(0x60AD92, "master.xlabs.dev");
|
Utils::Hook::Set<const char*>(0x60AD92, "server.alterware.dev");
|
||||||
Utils::Hook::Set<std::uint8_t>(0x60AD90, Game::DVAR_NONE); // masterServerName
|
Utils::Hook::Set<std::uint8_t>(0x60AD90, Game::DVAR_NONE); // masterServerName
|
||||||
Utils::Hook::Set<std::uint8_t>(0x60ADC6, Game::DVAR_NONE); // masterPort
|
Utils::Hook::Set<std::uint8_t>(0x60ADC6, Game::DVAR_NONE); // masterPort
|
||||||
|
|
||||||
|
@ -52,7 +52,6 @@ namespace Components
|
|||||||
static void UpdateVisibleInfo();
|
static void UpdateVisibleInfo();
|
||||||
|
|
||||||
static bool GetMasterServer(const char* ip, int port, Game::netadr_t& address);
|
static bool GetMasterServer(const char* ip, int port, Game::netadr_t& address);
|
||||||
static bool UseMasterServer;
|
|
||||||
|
|
||||||
static Dvar::Var UIServerSelected;
|
static Dvar::Var UIServerSelected;
|
||||||
static Dvar::Var UIServerSelectedMap;
|
static Dvar::Var UIServerSelectedMap;
|
||||||
|
Loading…
Reference in New Issue
Block a user