Skip to content

Commit

Permalink
fix bug preventing player death
Browse files Browse the repository at this point in the history
  • Loading branch information
thombruce committed Nov 18, 2023
1 parent 14a15ef commit ef02de4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/ships/ship.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ pub(crate) fn ship_death_handling(
};

for event in death_events.read() {
if event.entity == player {
commands.entity(event.entity).despawn();
continue;
}

let Ok(adversaries) = adversaries.get(event.entity) else {
return;
};
Expand All @@ -111,9 +116,7 @@ pub(crate) fn ship_death_handling(

// If the destroyed ship is not the player, award XP to the player equal to
// 10x the damage the player has dealt to the ship.
if event.entity != player {
score.0 += 10 * player_dealt_damage; // TODO: Make proportionate to player-dealt damage relative to MaxHealth
}
score.0 += 10 * player_dealt_damage; // TODO: Make proportionate to player-dealt damage relative to MaxHealth

commands.entity(event.entity).despawn();
}
Expand Down

0 comments on commit ef02de4

Please sign in to comment.