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
1c7beaedae
commit
5fe2b81ec8
@ -81,7 +81,7 @@ pub enum Debug {
|
|||||||
Boost,
|
Boost,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
#[derive(Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||||
pub enum Item {
|
pub enum Item {
|
||||||
Tool {
|
Tool {
|
||||||
kind: Tool,
|
kind: Tool,
|
||||||
|
@ -713,36 +713,30 @@ impl Server {
|
|||||||
_ => {}
|
_ => {}
|
||||||
},
|
},
|
||||||
ClientMsg::ActivateInventorySlot(x) => {
|
ClientMsg::ActivateInventorySlot(x) => {
|
||||||
let item_opt = state
|
let item = state
|
||||||
.ecs()
|
.ecs()
|
||||||
.write_storage::<comp::Inventory>()
|
.write_storage::<comp::Inventory>()
|
||||||
.get_mut(entity)
|
.get_mut(entity)
|
||||||
.and_then(|inv| inv.remove(x));
|
.and_then(|inv| inv.remove(x));
|
||||||
|
|
||||||
if let Some(item) = item_opt {
|
|
||||||
match item {
|
match item {
|
||||||
comp::Item::Tool { .. } | comp::Item::Debug(_) => {
|
Some(comp::Item::Tool { .. }) | Some(comp::Item::Debug(_)) => {
|
||||||
if let Some(stats) = state
|
if let Some(stats) =
|
||||||
.ecs()
|
state.ecs().write_storage::<comp::Stats>().get_mut(entity)
|
||||||
.write_storage::<comp::Stats>()
|
|
||||||
.get_mut(entity)
|
|
||||||
{
|
{
|
||||||
state
|
state
|
||||||
.ecs()
|
.ecs()
|
||||||
.write_storage::<comp::Inventory>()
|
.write_storage::<comp::Inventory>()
|
||||||
.get_mut(entity)
|
.get_mut(entity)
|
||||||
.map(|inv| {
|
.map(|inv| inv.insert(x, stats.equipment.main.take()));
|
||||||
inv.insert(x, stats.equipment.main.take())
|
|
||||||
});
|
|
||||||
|
|
||||||
stats.equipment.main = Some(item);
|
stats.equipment.main = item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
state.write_component(entity, comp::InventoryUpdate);
|
state.write_component(entity, comp::InventoryUpdate);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ClientMsg::SwapInventorySlots(a, b) => {
|
ClientMsg::SwapInventorySlots(a, b) => {
|
||||||
state
|
state
|
||||||
.ecs()
|
.ecs()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user