]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix vehicle alarms to only play to the driver (yay for no more random alarms)
authorMario <mario@smbclan.net>
Sat, 26 Mar 2016 13:37:31 +0000 (23:37 +1000)
committerMario <mario@smbclan.net>
Sat, 26 Mar 2016 13:37:31 +0000 (23:37 +1000)
qcsrc/common/vehicles/vehicle/raptor.qc

index f1f29c55cd4dc94cb7b0e87e3f1a30ced4fdc217..8b2f9e01b89a7160ade80bf7d2a90f5ac992d5c4 100644 (file)
@@ -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;
        }