You can no longer disarm wielded weapons (#7983)

Co-authored-by: Kara <lunarautomaton6@gmail.com>
This commit is contained in:
Ripmorld
2022-05-08 15:54:13 +08:00
committed by GitHub
parent da1e3c3dd8
commit a76e7eca99
3 changed files with 34 additions and 3 deletions

View File

@@ -12,7 +12,8 @@ using Content.Shared.Popups;
using Content.Shared.Verbs;
using Robust.Shared.Audio;
using Robust.Shared.Player;
using System.Linq;
using Content.Server.Actions.Events;
namespace Content.Server.Wieldable
{
@@ -32,10 +33,17 @@ namespace Content.Server.Wieldable
SubscribeLocalEvent<WieldableComponent, GotUnequippedHandEvent>(OnItemLeaveHand);
SubscribeLocalEvent<WieldableComponent, VirtualItemDeletedEvent>(OnVirtualItemDeleted);
SubscribeLocalEvent<WieldableComponent, GetVerbsEvent<InteractionVerb>>(AddToggleWieldVerb);
SubscribeLocalEvent<WieldableComponent, DisarmAttemptEvent>(OnDisarmAttemptEvent);
SubscribeLocalEvent<IncreaseDamageOnWieldComponent, MeleeHitEvent>(OnMeleeHit);
}
private void OnDisarmAttemptEvent(EntityUid uid, WieldableComponent component, DisarmAttemptEvent args)
{
if (component.Wielded)
args.Cancel();
}
private void AddToggleWieldVerb(EntityUid uid, WieldableComponent component, GetVerbsEvent<InteractionVerb> args)
{
if (args.Hands == null || !args.CanAccess || !args.CanInteract)