mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Changed how lantern swap is caught
This commit is contained in:
parent
973b392e38
commit
04b0277e33
@ -427,14 +427,16 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
|
||||
comp::InventoryManip::Swap(a, b) => {
|
||||
let ecs = state.ecs();
|
||||
|
||||
if let (Slot::Inventory(inv_slot), Slot::Equip(slot::EquipSlot::Lantern))
|
||||
| (Slot::Equip(slot::EquipSlot::Lantern), Slot::Inventory(inv_slot)) = (a, b)
|
||||
{
|
||||
if let Some(comp::item::ItemKind::Lantern(lantern)) =
|
||||
inventory.get(inv_slot).map(|item| item.kind())
|
||||
{
|
||||
swap_lantern(&mut ecs.write_storage(), entity, lantern);
|
||||
}
|
||||
if let Some(comp::item::ItemKind::Lantern(lantern)) = match (a, b) {
|
||||
// Only current possible lantern swap is between Slot::Inventory and Slot::Equip
|
||||
// add more cases if needed
|
||||
(Slot::Equip(slot::EquipSlot::Lantern), Slot::Inventory(slot))
|
||||
| (Slot::Inventory(slot), Slot::Equip(slot::EquipSlot::Lantern)) => {
|
||||
inventory.get(slot).map(|item| item.kind())
|
||||
},
|
||||
_ => None,
|
||||
} {
|
||||
swap_lantern(&mut ecs.write_storage(), entity, lantern);
|
||||
}
|
||||
|
||||
if let Some(pos) = ecs.read_storage::<comp::Pos>().get(entity) {
|
||||
|
Loading…
Reference in New Issue
Block a user