From: Juhu <5894800-Juhu_@users.noreply.gitlab.com> Date: Sun, 4 Jun 2023 03:00:18 +0000 (+0200) Subject: try initial bot weapon selection only at join/reset instead of repeatedly in think... X-Git-Tag: xonotic-v0.8.6~27^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4eee899c5de1be57ae4ae60ccff7b8c85706a057;p=xonotic%2Fxonotic-data.pk3dir.git 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 --- 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); + } }); } }