fakequeries: fixed hooking problems on certain providers

linkage: added support for fake steam ids for bots controlled via yb_enable_fake_steamids)

note that fake steam ids just used for give ability server owners to run statistics modules with tracking by steam ids ant not nicknames.
This commit is contained in:
jeefo 2024-01-19 18:29:20 +03:00
commit 1dc1043f7d
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
5 changed files with 42 additions and 1 deletions

View file

@ -10,6 +10,7 @@
ConVar cv_display_welcome_text ("display_welcome_text", "1", "Enables or disables showing welcome message to host entity on game start.");
ConVar cv_enable_query_hook ("enable_query_hook", "0", "Enables or disables fake server queries response, that shows bots as real players in server browser.");
ConVar cv_breakable_health_limit ("breakable_health_limit", "500.0", "Specifies the maximum health of breakable object, that bot will consider to destroy.", true, 1.0f, 3000.0);
ConVar cv_enable_fake_steamids ("enable_fake_steamids", "0", "Allows or disallows bots to return fake steam id.");
BotSupport::BotSupport () {
m_needToSendWelcome = false;
@ -530,6 +531,16 @@ String BotSupport::getCurrentDateTime () {
return String (timebuf);
}
StringRef BotSupport::getFakeSteamId (edict_t *ent) {
if (!cv_enable_fake_steamids.bool_ () || !isPlayer (ent)) {
return "BOT";
}
auto botNameHash = StringRef::fnv1a32 (ent->v.netname.chars ());
// just fake steam id a d return it with get player authid function
return strings.format ("STEAM_0:1:%d", cr::abs (static_cast <int32_t> (botNameHash) & 0xffff00));
}
StringRef BotSupport::weaponIdToAlias (int32_t id) {
StringRef none = "none";