From: Mario Date: Sat, 26 Mar 2016 13:37:31 +0000 (+1000) Subject: Fix vehicle alarms to only play to the driver (yay for no more random alarms) X-Git-Tag: xonotic-v0.8.2~1009 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a17b4d185569dbd2a8a80663c6d029f8793b3f13;p=xonotic%2Fxonotic-data.pk3dir.git Fix vehicle alarms to only play to the driver (yay for no more random alarms) --- diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index f1f29c55c..8b2f9e01b 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -440,21 +440,24 @@ bool raptor_frame(entity this) if(vehic.bomb1.cnt < time) { - entity _missile = findchainentity(enemy, vehic); - float _incomming = 0; - while(_missile) + bool incoming = false; + FOREACH_ENTITY_ENT(enemy, vehic, { - if(_missile.flags & FL_PROJECTILE) - if(MISSILE_IS_TRACKING(_missile)) - if(vdist(vehic.origin - _missile.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range)) - ++_incomming; + if(it.flags & FL_PROJECTILE) + if(MISSILE_IS_TRACKING(it)) + if(vdist(vehic.origin - it.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range)) + { + incoming = true; + break; + } + }); - _missile = _missile.chain; + if(incoming) + { + msg_entity = this; + soundto(MSG_ONE, vehic, CH_PAIN_SINGLE, SND(VEH_MISSILE_ALARM), VOL_BASE, ATTEN_NONE); } - if(_incomming) - sound(vehic, CH_PAIN_SINGLE, SND_VEH_MISSILE_ALARM, VOL_BASE, ATTEN_NONE); - vehic.bomb1.cnt = time + 1; }