Skip to content

Commit

Permalink
Dispenser: Don't drop badguy when player is dying
Browse files Browse the repository at this point in the history
Fixes #2541
  • Loading branch information
tobbi committed Aug 20, 2023
1 parent 45bad76 commit c090048
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/badguy/dispenser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,16 @@ Dispenser::active_update(float dt_sec)
}
if (m_dispense_timer.check())
{
// Auto always shoots in Tux's direction.
if (m_autotarget)
auto player = get_nearest_player();
if (player)
{
auto player = get_nearest_player();
if (player)
if(player->is_dying() || player->is_dead())
{
return;
}

// Auto always shoots in Tux's direction.
if (m_autotarget)
{
Direction target_dir = (player->get_pos().x > get_pos().x) ? Direction::RIGHT : Direction::LEFT;
if (m_dir != target_dir)
Expand All @@ -155,6 +160,7 @@ Dispenser::active_update(float dt_sec)
}
}
}

launch_object();
}
}
Expand Down

0 comments on commit c090048

Please sign in to comment.