]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/monster/shambler.qc
Optimize some more find loops
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monster / shambler.qc
index 7a11b139e446ca1847e261ce06fa0d19feaf5f81..b94332c30143e697fedba7401f460a8135db04da 100644 (file)
@@ -80,8 +80,6 @@ void M_Shambler_Attack_Swing(entity this)
 
 void M_Shambler_Attack_Lightning_Explode(entity this)
 {
-       entity head;
-
        sound(this, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_NORM);
        Send_Effect(EFFECT_ELECTRO_IMPACT, this.origin, '0 0 0', 1);
 
@@ -95,11 +93,11 @@ void M_Shambler_Attack_Lightning_Explode(entity this)
 
        RadiusDamage (this, this.realowner, (autocvar_g_monster_shambler_attack_lightning_damage), (autocvar_g_monster_shambler_attack_lightning_damage), (autocvar_g_monster_shambler_attack_lightning_radius), NULL, NULL, (autocvar_g_monster_shambler_attack_lightning_force), this.projectiledeathtype, other);
 
-       for(head = findradius(this.origin, (autocvar_g_monster_shambler_attack_lightning_radius_zap)); head; head = head.chain) if(head != this.realowner) if(head.takedamage)
+       FOREACH_ENTITY_RADIUS(this.origin, autocvar_g_monster_shambler_attack_lightning_radius_zap, it != this.realowner && it.takedamage,
        {
-               te_csqc_lightningarc(this.origin, head.origin);
-               Damage(head, this, this.realowner, (autocvar_g_monster_shambler_attack_lightning_damage_zap) * MONSTER_SKILLMOD(this), DEATH_MONSTER_SHAMBLER_ZAP.m_id, head.origin, '0 0 0');
-       }
+               te_csqc_lightningarc(this.origin, it.origin);
+               Damage(it, this, this.realowner, (autocvar_g_monster_shambler_attack_lightning_damage_zap) * MONSTER_SKILLMOD(this), DEATH_MONSTER_SHAMBLER_ZAP.m_id, it.origin, '0 0 0');
+       });
 
        setthink(this, SUB_Remove);
        this.nextthink = time + 0.2;