]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/weapon/shotgun.qc
Don't perform antilag takeback on every single bullet in the Shotgun attack
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / weapon / shotgun.qc
index 22c9288415f7636b6df39cd67277afc5c4d91022..18e75fad26e54aba8eed9cf6269ff6a5ecd9a29a 100644 (file)
@@ -16,8 +16,17 @@ void W_Shotgun_Attack(Weapon thiswep, entity actor, .entity weaponentity, float
        W_DecreaseAmmo(thiswep, actor, ammocount, weaponentity);
 
        W_SetupShot(actor, weaponentity, true, 5, SND_SHOTGUN_FIRE, ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), damage * bullets, thiswep.m_id);
+
+       // TRICK: do the antilag outside the regular fireBullet function, so it isn't performed unnecessarily on every single bullet!
+       float lag = antilag_getlag(actor);
+       if(lag && bullets > 0)
+               antilag_takeback_all(actor, lag);
+
        for(int sc = 0;sc < bullets;sc = sc + 1)
-               fireBullet(actor, weaponentity, w_shotorg, w_shotdir, spread, solidpenetration, damage, force, thiswep.m_id, bullet_trail_effect);
+               fireBullet_antilag(actor, weaponentity, w_shotorg, w_shotdir, spread, solidpenetration, damage, force, thiswep.m_id, bullet_trail_effect, false);
+       
+       if(lag && bullets > 0)
+               antilag_restore_all(actor);
 
        Send_Effect(EFFECT_SHOTGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, ammocount);