Fix melee windup persisting in some circumstances (#11625)
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
using Content.Shared.ActionBlocker;
|
using Content.Shared.ActionBlocker;
|
||||||
using Content.Shared.CombatMode;
|
using Content.Shared.CombatMode;
|
||||||
|
using Content.Shared.Hands;
|
||||||
using Content.Shared.Hands.Components;
|
using Content.Shared.Hands.Components;
|
||||||
|
using Content.Shared.Interaction.Events;
|
||||||
|
using Content.Shared.Inventory.Events;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Content.Shared.Weapons.Melee.Events;
|
using Content.Shared.Weapons.Melee.Events;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
@@ -34,6 +37,7 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
|||||||
|
|
||||||
SubscribeLocalEvent<MeleeWeaponComponent, ComponentGetState>(OnGetState);
|
SubscribeLocalEvent<MeleeWeaponComponent, ComponentGetState>(OnGetState);
|
||||||
SubscribeLocalEvent<MeleeWeaponComponent, ComponentHandleState>(OnHandleState);
|
SubscribeLocalEvent<MeleeWeaponComponent, ComponentHandleState>(OnHandleState);
|
||||||
|
SubscribeLocalEvent<MeleeWeaponComponent, HandDeselectedEvent>(OnMeleeDropped);
|
||||||
|
|
||||||
SubscribeAllEvent<LightAttackEvent>(OnLightAttack);
|
SubscribeAllEvent<LightAttackEvent>(OnLightAttack);
|
||||||
SubscribeAllEvent<StartHeavyAttackEvent>(OnStartHeavyAttack);
|
SubscribeAllEvent<StartHeavyAttackEvent>(OnStartHeavyAttack);
|
||||||
@@ -43,6 +47,15 @@ public abstract class SharedMeleeWeaponSystem : EntitySystem
|
|||||||
SubscribeAllEvent<StopAttackEvent>(OnStopAttack);
|
SubscribeAllEvent<StopAttackEvent>(OnStopAttack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnMeleeDropped(EntityUid uid, MeleeWeaponComponent component, HandDeselectedEvent args)
|
||||||
|
{
|
||||||
|
if (component.WindUpStart == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
component.WindUpStart = null;
|
||||||
|
Dirty(component);
|
||||||
|
}
|
||||||
|
|
||||||
private void OnStopAttack(StopAttackEvent msg, EntitySessionEventArgs args)
|
private void OnStopAttack(StopAttackEvent msg, EntitySessionEventArgs args)
|
||||||
{
|
{
|
||||||
var user = args.SenderSession.AttachedEntity;
|
var user = args.SenderSession.AttachedEntity;
|
||||||
|
|||||||
Reference in New Issue
Block a user