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-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0ea4b302329b495b3b3a21f5c994081482643c9c;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 645017726..8783c0bac 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2287,6 +2287,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 12e130c9e..b5f70143d 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -25,6 +25,7 @@ #include #include #include +#include #include // ============================================= @@ -411,6 +412,13 @@ void reset_map(bool dorespawn, 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); + } }); } }