]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'Juhu/bot_weapcomplain' into 'master'
authorterencehill <piuntn@gmail.com>
Tue, 6 Jun 2023 17:46:04 +0000 (17:46 +0000)
committerterencehill <piuntn@gmail.com>
Tue, 6 Jun 2023 17:46:04 +0000 (17:46 +0000)
Fix bots selecting invalid weapons

See merge request xonotic/xonotic-data.pk3dir!1186

qcsrc/server/bot/default/bot.qc
qcsrc/server/client.qc
qcsrc/server/command/vote.qc
qcsrc/server/weapons/selection.qc

index 2a663a10dc7e02b377704e7540ab6e730e32d526..07587befa8794a13bdeb6d0240828f611ce6f8ef 100644 (file)
@@ -73,12 +73,6 @@ void bot_think(entity this)
 
        if (!IS_PLAYER(this) || (autocvar_g_campaign && !campaign_bots_may_start))
        {
-               if (IS_PLAYER(this))
-               {
-                       .entity weaponentity = weaponentities[0];
-                       if(this.(weaponentity).m_weapon == WEP_Null)
-                               W_NextWeapon(this, 0, weaponentity);
-               }
                CS(this).movement = '0 0 0';
                this.bot_nextthink = time + 0.5;
                return;
@@ -124,9 +118,6 @@ void bot_think(entity this)
 
        if (time < game_starttime)
        {
-               .entity weaponentity = weaponentities[0];
-               if(this.(weaponentity).m_weapon == WEP_Null)
-                       W_NextWeapon(this, 0, weaponentity);
                // block the bot during the countdown to game start
                CS(this).movement = '0 0 0';
                return;
index c037662846bb66e28b2649e221282ec018f3ee5d..e55fc78eefce53b1856e1dbfeeb01bf1281343f9 100644 (file)
@@ -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;
        }
 
index 02cb8e1cec9c730f967833becf5b93b14ea8308d..118b852a632c0476b14a9efd2974b9e21eeffcc3 100644 (file)
@@ -25,6 +25,7 @@
 #include <server/scores.qh>
 #include <server/teamplay.qh>
 #include <server/weapons/accuracy.qh>
+#include <server/weapons/selection.qh>
 #include <server/world.qh>
 
 // =============================================
@@ -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);
+                       }
                });
        }
 }
index 0368f7f5f9cb9a51c2157793c8724e98713e510e..d2bb32c6fc27f925343f35617941c5b7f50a4e57 100644 (file)
@@ -102,6 +102,7 @@ bool client_hasweapon(entity this, Weapon wpn, .entity weaponentity, float andam
                return true;
        }
        if (complain)
+       if(IS_REAL_CLIENT(this))
        {
                // DRESK - 3/16/07
                // Report Proper Weapon Status / Modified Weapon Ownership Message