Merge branch 'unvariant/lantern_bug' into 'master'

Fixes #1406 - Lantern light does not change when dragging it from inventory

Closes #1406

See merge request veloren/veloren!3107
This commit is contained in:
Justin Shipsey 2022-01-25 02:59:29 +00:00
commit 54d5a06a0d
2 changed files with 13 additions and 0 deletions

View File

@ -89,6 +89,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Bodies of water no longer contain black chunks on the voxel minimap.
- Agents can flee once again, and more appropriately
- Items in hotbar no longer change when sorting inventory
- Lantern color changes when swapping lanterns
## [0.11.0] - 2021-09-11

View File

@ -437,6 +437,18 @@ pub fn handle_inventory(server: &mut Server, entity: EcsEntity, manip: comp::Inv
comp::InventoryManip::Swap(a, b) => {
let ecs = state.ecs();
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) {
let mut merged_stacks = false;