fix: zero out bots pings prior bot disconnection
fix: do not hook pfnCmdStart if game doesn't support fake pings
This commit is contained in:
parent
c298e607ae
commit
a4233dfaf8
4 changed files with 46 additions and 15 deletions
|
|
@ -498,7 +498,7 @@ void BotSupport::syncCalculatePings () {
|
|||
}
|
||||
|
||||
void BotSupport::emitPings (edict_t *to) {
|
||||
MessageWriter msg;
|
||||
static MessageWriter msg;
|
||||
|
||||
auto isThirdpartyBot = [] (edict_t *ent) {
|
||||
return !bots[ent] && (ent->v.flags & FL_FAKECLIENT);
|
||||
|
|
@ -509,6 +509,11 @@ void BotSupport::emitPings (edict_t *to) {
|
|||
continue;
|
||||
}
|
||||
|
||||
// do not send to dormants
|
||||
if (client.ent->v.flags & FL_DORMANT) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// no ping, no fun
|
||||
if (!client.ping) {
|
||||
client.ping = getPingBitmask (client.ent, rg.get (5, 10), rg.get (15, 40));
|
||||
|
|
@ -518,7 +523,25 @@ void BotSupport::emitPings (edict_t *to) {
|
|||
.writeLong (client.ping)
|
||||
.end ();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void BotSupport::resetPings (edict_t *to) {
|
||||
static MessageWriter msg;
|
||||
|
||||
// no reset if game isn't support them
|
||||
if (!game.is (GameFlags::HasFakePings)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto &client : m_clients) {
|
||||
if (!(client.flags & ClientFlags::Used) || isFakeClient (client.ent)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
msg.start (MSG_ONE_UNRELIABLE, SVC_PINGS, nullptr, client.ent)
|
||||
.writeLong (getPingBitmask (to, 0, 0))
|
||||
.end ();
|
||||
}
|
||||
}
|
||||
|
||||
bool BotSupport::isModel (const edict_t *ent, StringRef model) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue