]> de.git.xonotic.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>
Mon, 5 Jun 2023 19:48:12 +0000 (21:48 +0200)
qcsrc/server/client.qc
qcsrc/server/command/vote.qc

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);
+                       }
                });
        }
 }