Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Changing hands unwields item (space-wizards#28161)
Browse files Browse the repository at this point in the history
Unhand me, fiend
  • Loading branch information
Errant-4 authored and dvir001 committed Jun 1, 2024
1 parent 4e50f97 commit 55da5d7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Content.Shared/Wieldable/WieldableSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public override void Initialize()
SubscribeLocalEvent<WieldableComponent, GotUnequippedHandEvent>(OnItemLeaveHand);
SubscribeLocalEvent<WieldableComponent, VirtualItemDeletedEvent>(OnVirtualItemDeleted);
SubscribeLocalEvent<WieldableComponent, GetVerbsEvent<InteractionVerb>>(AddToggleWieldVerb);
SubscribeLocalEvent<WieldableComponent, HandDeselectedEvent>(OnDeselectWieldable);

SubscribeLocalEvent<MeleeRequiresWieldComponent, AttemptMeleeEvent>(OnMeleeAttempt);
SubscribeLocalEvent<GunRequiresWieldComponent, ShotAttemptedEvent>(OnShootAttempt);
Expand Down Expand Up @@ -89,6 +90,14 @@ private void OnGunWielded(EntityUid uid, GunWieldBonusComponent component, ref I
_gun.RefreshModifiers(uid);
}

private void OnDeselectWieldable(EntityUid uid, WieldableComponent component, HandDeselectedEvent args)
{
if (!component.Wielded)
return;

TryUnwield(uid, component, args.User);
}

private void OnGunRefreshModifiers(Entity<GunWieldBonusComponent> bonus, ref GunRefreshModifiersEvent args)
{
if (TryComp(bonus, out WieldableComponent? wield) &&
Expand Down

0 comments on commit 55da5d7

Please sign in to comment.