Fix floater melee / zap damage getting applied if enemy is out of range.

Found by @BjossiAlfreds, closes #454.
This commit is contained in:
Yamagi Burmeister 2019-09-23 17:32:43 +02:00
parent a942ca4bba
commit 0286cdcd0b

View file

@ -665,9 +665,13 @@ floater_zap(edict_t *self)
gi.WriteByte(1); /* sparks */
gi.multicast(origin, MULTICAST_PVS);
T_Damage(self->enemy, self, self, dir, self->enemy->s.origin,
vec3_origin, 5 + randk() % 6, -10, DAMAGE_ENERGY,
MOD_UNKNOWN);
if (range(self, self->enemy) && infront(self, self->enemy) &&
visible(self, self->enemy))
{
T_Damage(self->enemy, self, self, dir, self->enemy->s.origin,
vec3_origin, 5 + randk() % 6, -10, DAMAGE_ENERGY,
MOD_UNKNOWN);
}
}
void