mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Self buffs clear on tab swaps
This commit is contained in:
@ -904,7 +904,7 @@ pub fn handle_wallrun(data: &JoinData<'_>, update: &mut StateUpdate) -> bool {
|
|||||||
pub fn attempt_swap_equipped_weapons(
|
pub fn attempt_swap_equipped_weapons(
|
||||||
data: &JoinData<'_>,
|
data: &JoinData<'_>,
|
||||||
update: &mut StateUpdate,
|
update: &mut StateUpdate,
|
||||||
_output_events: &mut OutputEvents,
|
output_events: &mut OutputEvents,
|
||||||
) {
|
) {
|
||||||
if data
|
if data
|
||||||
.inventory
|
.inventory
|
||||||
@ -916,6 +916,7 @@ pub fn attempt_swap_equipped_weapons(
|
|||||||
.is_some()
|
.is_some()
|
||||||
{
|
{
|
||||||
update.swap_equipped_weapons = true;
|
update.swap_equipped_weapons = true;
|
||||||
|
loadout_change_hook(data, output_events, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1000,7 +1001,7 @@ pub fn handle_manipulate_loadout(
|
|||||||
update: &mut StateUpdate,
|
update: &mut StateUpdate,
|
||||||
inv_action: InventoryAction,
|
inv_action: InventoryAction,
|
||||||
) {
|
) {
|
||||||
loadout_change_hook(data, output_events);
|
loadout_change_hook(data, output_events, true);
|
||||||
match inv_action {
|
match inv_action {
|
||||||
InventoryAction::Use(slot @ Slot::Inventory(inv_slot)) => {
|
InventoryAction::Use(slot @ Slot::Inventory(inv_slot)) => {
|
||||||
// If inventory action is using a slot, and slot is in the inventory
|
// If inventory action is using a slot, and slot is in the inventory
|
||||||
@ -1632,12 +1633,14 @@ impl Default for ComboConsumption {
|
|||||||
fn default() -> Self { Self::All }
|
fn default() -> Self { Self::All }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn loadout_change_hook(data: &JoinData<'_>, output_events: &mut OutputEvents) {
|
fn loadout_change_hook(data: &JoinData<'_>, output_events: &mut OutputEvents, clear_combo: bool) {
|
||||||
// Reset combo to 0
|
if clear_combo {
|
||||||
output_events.emit_server(ServerEvent::ComboChange {
|
// Reset combo to 0
|
||||||
entity: data.entity,
|
output_events.emit_server(ServerEvent::ComboChange {
|
||||||
change: -data.combo.map_or(0, |c| c.counter() as i32),
|
entity: data.entity,
|
||||||
});
|
change: -data.combo.map_or(0, |c| c.counter() as i32),
|
||||||
|
});
|
||||||
|
}
|
||||||
// Clear any buffs from equipped weapons
|
// Clear any buffs from equipped weapons
|
||||||
output_events.emit_server(ServerEvent::Buff {
|
output_events.emit_server(ServerEvent::Buff {
|
||||||
entity: data.entity,
|
entity: data.entity,
|
||||||
|
Reference in New Issue
Block a user