From a17b4d185569dbd2a8a80663c6d029f8793b3f13 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 26 Mar 2016 23:37:31 +1000 Subject: [PATCH] Fix vehicle alarms to only play to the driver (yay for no more random alarms) --- qcsrc/common/vehicles/vehicle/raptor.qc | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) 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; } -- 2.39.2