From 150855111dd3042049a22d1c3a3d98f51afb336b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 2 Dec 2012 16:58:22 +0000 Subject: Have mines always explode on collision. --- src/game/base/spacemine.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/base/spacemine.cc b/src/game/base/spacemine.cc index 32d4798..865deb0 100644 --- a/src/game/base/spacemine.cc +++ b/src/game/base/spacemine.cc @@ -92,11 +92,11 @@ void SpaceMine::collision(core::Entity *other) const float force = math::max(entity->mass(), entity->radius() * 100.0f); entity->body()->applyCentralImpulse(math::to_btVector3(explosion_direction * force )); - entity->body()->applyTorqueImpulse(math::to_btVector3(explosion_torque * force * 0.1f)); - - spacemine_detonated_timestamp = core::game()->time(); + entity->body()->applyTorqueImpulse(math::to_btVector3(explosion_torque * force * 0.1f)); } + spacemine_detonated_timestamp = core::game()->time(); + set_state(core::Entity::Destroyed); // this method is a bullet callback, we can not reset() here } @@ -111,7 +111,7 @@ void SpaceMine::frame(const unsigned long elapsed) reset(); } - if (core::game()->time() - spacemine_detonated_timestamp > 5) { + if (spacemine_detonated_timestamp + 5.0f < core::game()->time()) { die(); } } -- cgit v1.2.3