From 57d09be6b91600a0b128cd9abd797d4b24c08062 Mon Sep 17 00:00:00 2001 From: Brad Date: Mon, 26 Oct 2020 23:23:29 -0400 Subject: [PATCH] Added client-side is_dead check to inventory pickup --- client/src/lib.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/client/src/lib.rs b/client/src/lib.rs index 01c24a81c5..9824086919 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -584,7 +584,20 @@ impl Client { } pub fn pick_up(&mut self, entity: EcsEntity) { + // Get the stats component from the entity + if let Some(uid) = self.state.read_component_copied(entity) { + // If we're dead, exit before sending the message + if self + .state + .ecs() + .read_storage::() + .get(self.entity) + .map_or(false, |s| s.is_dead) + { + return; + } + self.send_msg(ClientGeneral::ControlEvent(ControlEvent::InventoryManip( InventoryManip::Pickup(uid), )));