mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
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:
commit
35ff4b7b84
@ -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),
|
||||
|
Loading…
Reference in New Issue
Block a user