From: Mario Date: Mon, 27 Jul 2020 08:26:40 +0000 (+1000) Subject: Offset thrown weapon positions while dual wielding to ensure they don't land overlapping X-Git-Tag: xonotic-v0.8.5~826 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=14b59af2805e480ceaca156ce7f0b16dcadc6ed7;hp=8218efcc8f3b41ae9b9dd3f1ec954176c1a269b0;ds=sidebyside Offset thrown weapon positions while dual wielding to ensure they don't land overlapping --- diff --git a/qcsrc/server/impulse.qc b/qcsrc/server/impulse.qc index 090b239cc..ee26d65a7 100644 --- a/qcsrc/server/impulse.qc +++ b/qcsrc/server/impulse.qc @@ -322,13 +322,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! } }