Merge branch 'bbenton91/fix-item-pickup-when-dead' into 'master'

Fix for issue #809. Added is_dead check to item pickup

See merge request veloren/veloren!1453
This commit is contained in:
Samuel Keiffer 2020-10-25 22:27:30 +00:00
commit 35ff4b7b84

View File

@ -66,6 +66,15 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
return;
};
// Grab the stats from the player and check if the player is dead.
let stats = state.ecs().read_storage::<comp::Stats>();
if let Some(entity_stats) = stats.get(entity) {
if entity_stats.is_dead {
debug!("Failed to pick up item as the player is dead");
return; // If dead, don't continue
}
}
// Attempt to add the item to the player's inventory
match inv.push(item) {
None => Some(item_entity),