Fixed that equipping weapons by using them from hotbar would bypass equipping animation.

This commit is contained in:
Sam 2022-10-22 20:03:29 -04:00
parent 1782408676
commit a44c36432e
3 changed files with 28 additions and 29 deletions

View File

@ -302,10 +302,9 @@ impl Ability {
abilities
.auxiliary(index, context)
.map(|(_, ability)| ability.id.as_str())
.or_else(|| contextual_id(
abilities.abilities.get(index),
EquipSlot::ActiveMainhand,
))
.or_else(|| {
contextual_id(abilities.abilities.get(index), EquipSlot::ActiveMainhand)
})
})
},
Ability::OffWeaponAux(index) => {
@ -313,10 +312,9 @@ impl Ability {
abilities
.auxiliary(index, context)
.map(|(_, ability)| ability.id.as_str())
.or_else(|| contextual_id(
abilities.abilities.get(index),
EquipSlot::ActiveOffhand,
))
.or_else(|| {
contextual_id(abilities.abilities.get(index), EquipSlot::ActiveOffhand)
})
})
},
Ability::Empty => None,

View File

@ -317,16 +317,18 @@ impl CharacterBehavior for Data {
let mut update = StateUpdate::from(data);
if let CharacterState::ComboMelee2(c) = data.character {
if c.stage_section.is_none() {
match inv_action {
let reset_to_idle = match inv_action {
InventoryAction::Drop(slot)
| InventoryAction::Swap(slot, _)
| InventoryAction::Swap(_, Slot::Equip(slot)) if matches!(slot, EquipSlot::ActiveMainhand | EquipSlot::ActiveOffhand) => {
update.character = CharacterState::Idle(idle::Data {
is_sneaking: data.character.is_stealthy(),
footwear: None,
});
},
_ => (),
| InventoryAction::Swap(_, Slot::Equip(slot)) if matches!(slot, EquipSlot::ActiveMainhand | EquipSlot::ActiveOffhand) => true,
InventoryAction::Use(_) => true,
_ => false,
};
if reset_to_idle {
update.character = CharacterState::Idle(idle::Data {
is_sneaking: data.character.is_stealthy(),
footwear: None,
});
}
handle_manipulate_loadout(data, output_events, &mut update, inv_action);
}

View File

@ -49,19 +49,18 @@ impl CharacterBehavior for Data {
inv_action: InventoryAction,
) -> StateUpdate {
let mut update = StateUpdate::from(data);
match inv_action {
InventoryAction::Drop(EquipSlot::ActiveMainhand | EquipSlot::ActiveOffhand)
| InventoryAction::Swap(EquipSlot::ActiveMainhand | EquipSlot::ActiveOffhand, _)
| InventoryAction::Swap(
_,
Slot::Equip(EquipSlot::ActiveMainhand | EquipSlot::ActiveOffhand),
) => {
update.character = CharacterState::Idle(idle::Data {
is_sneaking: self.is_sneaking,
footwear: None,
});
},
_ => (),
let reset_to_idle = match inv_action {
InventoryAction::Drop(slot)
| InventoryAction::Swap(slot, _)
| InventoryAction::Swap(_, Slot::Equip(slot)) if matches!(slot, EquipSlot::ActiveMainhand | EquipSlot::ActiveOffhand) => true,
InventoryAction::Use(_) => true,
_ => false,
};
if reset_to_idle {
update.character = CharacterState::Idle(idle::Data {
is_sneaking: data.character.is_stealthy(),
footwear: None,
});
}
handle_manipulate_loadout(data, output_events, &mut update, inv_action);
update