From 4eee899c5de1be57ae4ae60ccff7b8c85706a057 Mon Sep 17 00:00:00 2001 From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Sun, 4 Jun 2023 05:00:18 +0200 Subject: [PATCH] try initial bot weapon selection only at join/reset instead of repeatedly in think, prevents spammed weapon switching attempts if the bot has no weapons --- qcsrc/server/client.qc | 5 +++++ qcsrc/server/command/vote.qc | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index c03766284..e55fc78ee 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2298,6 +2298,11 @@ void ObserverOrSpectatorThink(entity this) CS(this).autojoin_checked = true; TRANSMUTE(Player, this); PutClientInServer(this); + + .entity weaponentity = weaponentities[0]; + if(this.(weaponentity).m_weapon == WEP_Null) + W_NextWeapon(this, 0, weaponentity); + return; } diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index 02cb8e1ce..118b852a6 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -25,6 +25,7 @@ #include #include #include +#include #include // ============================================= @@ -416,6 +417,13 @@ void reset_map(bool is_fake_round_start) it.avelocity = '0 0 0'; CS(it).movement = '0 0 0'; PutClientInServer(it); + + if(IS_BOT_CLIENT(it)) + { + .entity weaponentity = weaponentities[0]; + if(it.(weaponentity).m_weapon == WEP_Null) + W_NextWeapon(it, 0, weaponentity); + } }); } } -- 2.39.2