]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
try initial bot weapon selection only at join/reset instead of repeatedly in think...
authorJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Sun, 4 Jun 2023 03:00:18 +0000 (05:00 +0200)
committerJuhu <5894800-Juhu_@users.noreply.gitlab.com>
Tue, 6 Jun 2023 18:31:20 +0000 (20:31 +0200)
qcsrc/server/client.qc
qcsrc/server/command/vote.qc

index 645017726ceaf64ba91098590344455302e55ddf..8783c0bac31b4ffc02556ccf0ed4f62194a38c36 100644 (file)
@@ -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;
        }
 
index 12e130c9e80ddf25aa17ba4da4583762ddcb95bd..b5f70143db2b9236f2b8c5704056afcee8beac56 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>
 
 // =============================================
@@ -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);
+                               }
                        });
                }
        }