mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed inventory full message when pressing the pickup item key in quick succession (#651)
This commit is contained in:
@ -11,7 +11,7 @@ use common::{
|
|||||||
};
|
};
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use specs::{join::Join, world::WorldExt, Builder, Entity as EcsEntity, WriteStorage};
|
use specs::{join::Join, world::WorldExt, Builder, Entity as EcsEntity, WriteStorage};
|
||||||
use tracing::{debug, error, warn};
|
use tracing::{debug, error};
|
||||||
use vek::Vec3;
|
use vek::Vec3;
|
||||||
|
|
||||||
pub fn swap_lantern(
|
pub fn swap_lantern(
|
||||||
@ -36,7 +36,7 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
|
|||||||
|
|
||||||
match manip {
|
match manip {
|
||||||
comp::InventoryManip::Pickup(uid) => {
|
comp::InventoryManip::Pickup(uid) => {
|
||||||
let mut picked_up_item: Option<comp::Item> = None;
|
let picked_up_item: Option<comp::Item>;
|
||||||
let item_entity = if let (Some((item, item_entity)), Some(inv)) = (
|
let item_entity = if let (Some((item, item_entity)), Some(inv)) = (
|
||||||
state
|
state
|
||||||
.ecs()
|
.ecs()
|
||||||
@ -68,8 +68,11 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
|
|||||||
Some(_) => None, // Inventory was full
|
Some(_) => None, // Inventory was full
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
warn!("Failed to get entity/component for item Uid: {}", uid);
|
// Item entity/component could not be found - most likely because the player
|
||||||
None
|
// attempted to pick up the same item very quickly before its deletion of the
|
||||||
|
// world from the first pickup attempt was processed.
|
||||||
|
debug!("Failed to get entity/component for item Uid: {}", uid);
|
||||||
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
let event = if let Some(item_entity) = item_entity {
|
let event = if let Some(item_entity) = item_entity {
|
||||||
|
Reference in New Issue
Block a user