Merge branch 'bbenton91/client-item-pickup-check' into 'master'

Added client-side is_dead check to inventory pickup

See merge request veloren/veloren!1456
This commit is contained in:
Samuel Keiffer 2020-10-27 13:39:29 +00:00
commit fab3802587

View File

@ -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::<comp::Stats>()
.get(self.entity)
.map_or(false, |s| s.is_dead)
{
return;
}
self.send_msg(ClientGeneral::ControlEvent(ControlEvent::InventoryManip(
InventoryManip::Pickup(uid),
)));