2
0
mirror of https://github.com/rehlds/rehlds.git synced 2024-12-28 07:35:47 +03:00

Implemented optional CVar sv_tags for sets a string defining the "gametags" for this server to allows users/scripts to filter in the matchmaking/server-browser interfaces based on the value

This commit is contained in:
s1lentq 2024-01-18 21:38:33 +07:00
parent f29d6c5769
commit 76cbd2c140
6 changed files with 35 additions and 0 deletions

View File

@ -55,6 +55,7 @@ This means that plugins that do binary code analysis (Orpheu for example) probab
<li>sv_rehlds_local_gametime <1|0> // A feature of local gametime which decrease "lags" if you run same map for a long time. Default: 0
<li>sv_use_entity_file // Use custom entity file for a map. Path to an entity file will be "maps/[map name].ent". 0 - use original entities. 1 - use .ent files from maps directory. 2 - use .ent files from maps directory and create new .ent file if not exist.
<li>sv_usercmd_custom_random_seed // When enabled server will populate an additional random seed independent of the client. Default: 0
<li>sv_tags <comma-delimited string list of tags> // Sets a string defining the "gametags" for this server, this is optional, but if it is set it allows users/scripts to filter in the matchmaking/server-browser interfaces based on the value. Default: ""
</ul>
</details>

View File

@ -366,6 +366,7 @@ extern cvar_t sv_visiblemaxplayers;
extern cvar_t sv_downloadurl;
extern cvar_t sv_allow_dlfile;
extern cvar_t sv_version;
extern cvar_t sv_tags;
#ifdef REHLDS_FIXES
extern cvar_t sv_echo_unknown_cmd;
extern cvar_t sv_auto_precache_sounds_in_models;

View File

@ -193,6 +193,8 @@ cvar_t sv_version = { "sv_version", "", FCVAR_SERVER, 0.0f, NULL };
cvar_t sv_version = {"sv_version", "", 0, 0.0f, NULL};
#endif
cvar_t sv_tags = { "sv_tags", "", 0, 0.0f, NULL };
cvar_t sv_rcon_minfailures = { "sv_rcon_minfailures", "5", 0, 0.0f, NULL };
cvar_t sv_rcon_maxfailures = { "sv_rcon_maxfailures", "10", 0, 0.0f, NULL };
cvar_t sv_rcon_minfailuretime = { "sv_rcon_minfailuretime", "30", 0, 0.0f, NULL };
@ -8258,6 +8260,7 @@ void SV_Init(void)
Cvar_RegisterVariable(&sv_version);
Cvar_RegisterVariable(&sv_allow_dlfile);
#ifdef REHLDS_FIXES
Cvar_RegisterVariable(&sv_tags);
Cvar_RegisterVariable(&sv_force_ent_intersection);
Cvar_RegisterVariable(&sv_echo_unknown_cmd);
Cvar_RegisterVariable(&sv_auto_precache_sounds_in_models);

View File

@ -232,6 +232,10 @@ CSteam3Server::CSteam3Server() :
m_CallbackLogonFailure(this, &CSteam3Server::OnLogonFailure),
m_SteamIDGS(1, 0, k_EUniverseInvalid, k_EAccountTypeInvalid)
{
#ifdef REHLDS_FIXES
m_GameTagsData[0] = '\0';
#endif
m_bHasActivePlayers = false;
m_bWantToBeSecure = false;
m_bLanOnly = false;
@ -499,6 +503,21 @@ void CSteam3Server::RunFrame()
}
}
void CSteam3Server::UpdateGameTags()
{
#ifdef REHLDS_FIXES
if (!sv_tags.string[0])
return;
if (m_GameTagsData[0] && !Q_stricmp(m_GameTagsData, sv_tags.string))
return;
Q_strlcpy(m_GameTagsData, sv_tags.string);
Q_strlwr(m_GameTagsData);
CRehldsPlatformHolder::get()->SteamGameServer()->SetGameTags(m_GameTagsData);
#endif
}
void CSteam3Server::SendUpdatedServerDetails()
{
int botCount = 0;
@ -521,6 +540,8 @@ void CSteam3Server::SendUpdatedServerDetails()
CRehldsPlatformHolder::get()->SteamGameServer()->SetBotPlayerCount(botCount);
CRehldsPlatformHolder::get()->SteamGameServer()->SetServerName(Cvar_VariableString("hostname"));
CRehldsPlatformHolder::get()->SteamGameServer()->SetMapName(g_psv.name);
UpdateGameTags();
}
void CSteam3Client::Shutdown()

View File

@ -54,6 +54,8 @@ protected:
bool InitModule();
};
#define MAX_STEAM_TAGS_LENGTH 128 // Steam doesn't send tags string more than 128 bytes
class CSteam3Server: public CSteam3
{
public:
@ -71,6 +73,10 @@ protected:
bool m_bLanOnly;
CSteamID m_SteamIDGS;
#ifdef REHLDS_FIXES
char m_GameTagsData[MAX_STEAM_TAGS_LENGTH];
#endif
public:
NOBODY void SetServerType();
@ -96,6 +102,7 @@ public:
void NotifyOfLevelChange(bool bForce);
void RunFrame();
void SendUpdatedServerDetails();
void UpdateGameTags();
};
class CSteam3Client: public CSteam3

View File

@ -15,5 +15,7 @@ void check_size() {
void checkSizesStatic() {
CHECK_TYPE_SIZE(client_t, 0x5018, 0x4EF4);
CHECK_TYPE_SIZE(userfilter_t, 0x20, 0x18);
#ifndef REHLDS_FIXES
CHECK_TYPE_SIZE(CSteam3Server, 0x90, 0xA8);
#endif
}