From 7e97b9e49527b1f94429b786c5f71b45bfaa4454 Mon Sep 17 00:00:00 2001 From: Enrico Marconi Date: Fri, 2 Jul 2021 14:01:20 +0200 Subject: [PATCH 1/2] Check if entity is alive before applying a buff --- server/src/events/entity_manipulation.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/server/src/events/entity_manipulation.rs b/server/src/events/entity_manipulation.rs index 47b28d7e39..eabde86f76 100644 --- a/server/src/events/entity_manipulation.rs +++ b/server/src/events/entity_manipulation.rs @@ -959,6 +959,7 @@ pub fn handle_buff(server: &mut Server, entity: EcsEntity, buff_change: buff::Bu if !bodies .get(entity) .map_or(false, |body| body.immune_to(new_buff.kind)) + && ecs.is_alive(entity) { buffs.insert(new_buff); } From 8106ac492a10a1c9d81d7286bc3d8f2be07e06d0 Mon Sep 17 00:00:00 2001 From: Enrico Marconi Date: Fri, 2 Jul 2021 17:58:08 +0200 Subject: [PATCH 2/2] Actually check if entity is alive --- server/src/events/entity_manipulation.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/server/src/events/entity_manipulation.rs b/server/src/events/entity_manipulation.rs index eabde86f76..a2e414a463 100644 --- a/server/src/events/entity_manipulation.rs +++ b/server/src/events/entity_manipulation.rs @@ -959,7 +959,10 @@ pub fn handle_buff(server: &mut Server, entity: EcsEntity, buff_change: buff::Bu if !bodies .get(entity) .map_or(false, |body| body.immune_to(new_buff.kind)) - && ecs.is_alive(entity) + && ecs + .read_component::() + .get(entity) + .map_or(true, |h| !h.is_dead) { buffs.insert(new_buff); }