]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/impulse.qc
Some more cleanup of defs.qh, use a flag to indicate crouch state instead of a separa...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / impulse.qc
index 090b239cc8c839ddddc8034d9f44ada102eac031..f066615f326b270e81b4e98b8161aeb4312c689a 100644 (file)
@@ -4,6 +4,7 @@
 #include "weapons/throwing.qh"
 #include "command/common.qh"
 #include "cheats.qh"
+#include "client.qh"
 #include "clientkill.qh"
 #include "weapons/selection.qh"
 #include "weapons/tracing.qh"
@@ -322,13 +323,19 @@ IMPULSE(weapon_drop)
 {
        if (this.vehicle) return;
        if (IS_DEAD(this)) return;
+       bool is_dualwielding = W_DualWielding(this);
        for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
        {
                .entity weaponentity = weaponentities[slot];
-               W_ThrowWeapon(this, weaponentity, W_CalculateProjectileVelocity(this, this.velocity, v_forward * 750, false), '0 0 0', true);
-
-               if(autocvar_g_weaponswitch_debug != 1)
-                       break;
+               vector md = this.(weaponentity).movedir;
+               vector vecs = ((md.x > 0) ? md : '0 0 0');
+               vector dv = v_right * -vecs.y;
+               if(!is_dualwielding)
+                       dv = '0 0 0'; // don't override!
+               W_ThrowWeapon(this, weaponentity, W_CalculateProjectileVelocity(this, this.velocity, v_forward * 750, false), dv, true);
+
+               if(autocvar_g_weaponswitch_debug == 2)
+                       break; // in this mode, the off-hand weapon is selected based on the primary weapon, don't drop it twice!
        }
 }