mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Avoid right-ward shift
This commit is contained in:
parent
7e66fe792d
commit
082ccd7c46
@ -81,7 +81,7 @@ pub enum Debug {
|
||||
Boost,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub enum Item {
|
||||
Tool {
|
||||
kind: Tool,
|
||||
|
@ -713,36 +713,30 @@ impl Server {
|
||||
_ => {}
|
||||
},
|
||||
ClientMsg::ActivateInventorySlot(x) => {
|
||||
let item_opt = state
|
||||
let item = state
|
||||
.ecs()
|
||||
.write_storage::<comp::Inventory>()
|
||||
.get_mut(entity)
|
||||
.and_then(|inv| inv.remove(x));
|
||||
|
||||
if let Some(item) = item_opt {
|
||||
match item {
|
||||
comp::Item::Tool { .. } | comp::Item::Debug(_) => {
|
||||
if let Some(stats) = state
|
||||
.ecs()
|
||||
.write_storage::<comp::Stats>()
|
||||
.get_mut(entity)
|
||||
Some(comp::Item::Tool { .. }) | Some(comp::Item::Debug(_)) => {
|
||||
if let Some(stats) =
|
||||
state.ecs().write_storage::<comp::Stats>().get_mut(entity)
|
||||
{
|
||||
state
|
||||
.ecs()
|
||||
.write_storage::<comp::Inventory>()
|
||||
.get_mut(entity)
|
||||
.map(|inv| {
|
||||
inv.insert(x, stats.equipment.main.take())
|
||||
});
|
||||
.map(|inv| inv.insert(x, stats.equipment.main.take()));
|
||||
|
||||
stats.equipment.main = Some(item);
|
||||
stats.equipment.main = item;
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
state.write_component(entity, comp::InventoryUpdate);
|
||||
}
|
||||
}
|
||||
ClientMsg::SwapInventorySlots(a, b) => {
|
||||
state
|
||||
.ecs()
|
||||
|
Loading…
Reference in New Issue
Block a user