Do not process NPC collissions if player isn't alive

This commit is contained in:
Alula 2020-12-06 16:48:43 +01:00
parent 20be51bb72
commit 035b2c2848
No known key found for this signature in database
GPG Key ID: 3E00485503A1D8BA
1 changed files with 4 additions and 0 deletions

View File

@ -318,6 +318,10 @@ impl Player {
}
pub fn tick_npc_collisions(&mut self, id: TargetPlayer, state: &mut SharedGameState, npc_map: &mut NPCMap, inventory: &mut Inventory) {
if !self.cond.alive() {
return;
}
for npc_cell in npc_map.npcs.values() {
let mut npc = npc_cell.borrow_mut();
if !npc.cond.alive() { continue; }