From 0286cdcd0b1a1e8b8b4c7d925cc62f1024f60bc5 Mon Sep 17 00:00:00 2001 From: Yamagi Burmeister Date: Mon, 23 Sep 2019 17:32:43 +0200 Subject: [PATCH] Fix floater melee / zap damage getting applied if enemy is out of range. Found by @BjossiAlfreds, closes #454. --- src/game/monster/float/float.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/game/monster/float/float.c b/src/game/monster/float/float.c index 1cb651a7..7c0bfb39 100644 --- a/src/game/monster/float/float.c +++ b/src/game/monster/float/float.c @@ -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