Skip to content

Commit

Permalink
Merge pull request #316 from lethal-guitar/fix-bomber-plane
Browse files Browse the repository at this point in the history
Fix bomber plane
  • Loading branch information
lethal-guitar committed Jan 8, 2019
2 parents d07eeb0 + 55c676d commit c315978
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
16 changes: 14 additions & 2 deletions src/game_logic/ai/bomber_plane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "base/match.hpp"
#include "engine/base_components.hpp"
#include "engine/collision_checker.hpp"
#include "engine/entity_tools.hpp"
#include "engine/life_time_components.hpp"
#include "engine/movement.hpp"
Expand Down Expand Up @@ -160,6 +161,19 @@ void BigBomb::update(
mStartedFalling = true;
entity.component<Sprite>()->mShow = true;
}

// Normally, the bomb's explosion is triggered in the onCollision callback,
// but if the bomb spawns in a location where it's already touching the
// ground (this happens in L3, for example), it would get stuck without
// exploding if we didn't do this check here.
const auto& position = *entity.component<WorldPosition>();
const auto& bbox = *entity.component<BoundingBox>();
if (d.mpCollisionChecker->isOnSolidGround(position, bbox)) {
triggerEffects(entity, *d.mpEntityManager);
d.mpEvents->emit(rigel::events::ScreenFlash{loader::INGAME_PALETTE[15]});
d.mpServiceProvider->playSound(data::SoundId::BigExplosion);
entity.destroy();
}
}


Expand All @@ -174,8 +188,6 @@ void BigBomb::onKilled(
engine::reassign<components::DestructionEffects>(
entity, BIG_BOMB_DETONATE_IN_AIR_EFFECT_SPEC);
triggerEffects(entity, *d.mpEntityManager);

entity.destroy();
}


Expand Down
1 change: 0 additions & 1 deletion src/game_logic/entity_configuration.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,6 @@ void EntityFactory::configureEntity(

case 63: // Big bomb
entity.assign<Shootable>(Health{1}, GivenScore{200});
entity.component<Shootable>()->mDestroyWhenKilled = false;
entity.assign<PlayerDamaging>(1);
entity.assign<AnimationSequence>(BOMB_DROPPING_ANIMATION);
entity.assign<DestructionEffects>(
Expand Down

0 comments on commit c315978

Please sign in to comment.