]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/weapons/selection.qc
Move more REPLICATE calls to \common and from qh files to qc files (it fixes compilat...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / weapons / selection.qc
index ca331bb3c49af73091d4b0020f535d95e2bdc68b..0368f7f5f9cb9a51c2157793c8724e98713e510e 100644 (file)
@@ -346,3 +346,13 @@ void W_LastWeapon(entity this, .entity weaponentity)
        else
                W_SwitchToOtherWeapon(this, weaponentity);
 }
+
+// fix switchweapon (needed when spectating is disabled, as PutClientInServer comes too early)
+REPLICATE_APPLYCHANGE("cl_weaponpriority",
+       for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
+       {
+               .entity weaponentity = weaponentities[slot];
+               if (this.(weaponentity) && (this.(weaponentity).m_weapon != WEP_Null || slot == 0))
+                       this.(weaponentity).m_switchweapon = w_getbestweapon(this, weaponentity);
+       }
+);