X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fweapons%2Fweapon%2Fshotgun.qc;h=e2f4b640aa1b818f3a6b7640c9cf7be2d61c93b2;hp=1eee25a05cc1d0992a587d6304856f327f7f6f26;hb=8298414706b35c6726479437b0775aed4ac9b55d;hpb=a98dd9ddfc5de8bbd5937e7937bb9a43b1d67501 diff --git a/qcsrc/common/weapons/weapon/shotgun.qc b/qcsrc/common/weapons/weapon/shotgun.qc index 1eee25a05..e2f4b640a 100644 --- a/qcsrc/common/weapons/weapon/shotgun.qc +++ b/qcsrc/common/weapons/weapon/shotgun.qc @@ -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);