diff options
Diffstat (limited to 'src/game/base/spacemine.cc')
-rw-r--r-- | src/game/base/spacemine.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/game/base/spacemine.cc b/src/game/base/spacemine.cc index 133f4e0..2a45630 100644 --- a/src/game/base/spacemine.cc +++ b/src/game/base/spacemine.cc @@ -4,9 +4,11 @@ the terms and conditions of the GNU General Public License version 2 */ +#include "math/functions.h" +#include "core/entityprojectile.h" +#include "core/gameserver.h" #include "base/spacemine.h" #include "base/game.h" -#include "math/functions.h" namespace game { @@ -95,6 +97,20 @@ void SpaceMine::collision(core::Entity *other) entity->body()->applyTorqueImpulse(math::to_btVector3(explosion_torque * force * 0.1f)); entity->hit(this); + + } else if (other->type() == core::Entity::Projectile) { + + // hit by projectile + core::EntityProjectile *projectile = static_cast<core::EntityProjectile *>(other); + core::Player *assassin = 0; + + if (projectile->owner_id()) { + assassin = core::server()->find_player(projectile->owner_id()); + } + // send hit sound to assassin + if (assassin) { + assassin->sound("game/target_hit"); + } } spacemine_detonated_timestamp = core::game()->time(); |