From 04416e52ab3a277336a61d2bc2bf3607ca72cf4d Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 11 Mar 2018 07:51:29 +0000 Subject: [PATCH] Fix for laser trap not killing some enemies. --- src/entities/traps/laserTrap.c | 51 +++++++++++++++++----------------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/src/entities/traps/laserTrap.c b/src/entities/traps/laserTrap.c index 0cc4c6b..c19c975 100644 --- a/src/entities/traps/laserTrap.c +++ b/src/entities/traps/laserTrap.c @@ -123,24 +123,32 @@ static void touch(Entity *other) { other->dx = rrnd(-12, 12); other->dy = rrnd(-8, 0); + } - if (t->offTime != 0) - { - swapSelf(other); - other->applyDamage((int) (other->healthMax / 4)); - swapSelf(other); - } - else - { - /* instant kill */ - swapSelf(other); - other->applyDamage((int) other->health); - swapSelf(other); - } - - playBattleSound(SND_FLESH_HIT, other->uniqueId % MAX_SND_CHANNELS, other->x, other->y); - - playBattleSound(SND_ELECTRIC_HIT, self->uniqueId % MAX_SND_CHANNELS, self->x, self->y); + if (t->offTime != 0) + { + swapSelf(other); + other->applyDamage((int) (other->healthMax / 4)); + swapSelf(other); + } + else + { + /* instant kill */ + swapSelf(other); + other->applyDamage((int) other->health); + swapSelf(other); + } + + playBattleSound(SND_FLESH_HIT, other->uniqueId % MAX_SND_CHANNELS, other->x, other->y); + playBattleSound(SND_ELECTRIC_HIT, self->uniqueId % MAX_SND_CHANNELS, self->x, self->y); + + if (other->flags & EF_EXPLODES) + { + addSparkParticles(t->x, t->y); + } + else + { + addSmallFleshChunk(t->x, t->y); } if (other == (Entity*)world.bob && world.bob->stunTimer == 0) @@ -148,15 +156,6 @@ static void touch(Entity *other) stunBob(); } } - - if (other->flags & EF_EXPLODES) - { - addSparkParticles(t->x, t->y); - } - else - { - addSmallFleshChunk(t->x, t->y); - } } }