This commit is contained in:
Rane
2022-02-10 17:15:06 -05:00
committed by GitHub
parent 65faa85620
commit 81c7a03c97
22 changed files with 502 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Linq;
using Content.Server.Act;
using Content.Server.Actions.Events;
using Content.Server.Administration.Logs;
using Content.Server.Interaction;
using Content.Server.Popups;
@@ -44,11 +45,16 @@ namespace Content.Server.Actions.Actions
[ViewVariables]
[DataField("disarmSuccessSound")]
private SoundSpecifier DisarmSuccessSound { get; } = new SoundPathSpecifier("/Audio/Effects/thudswoosh.ogg");
public void DoTargetEntityAction(TargetEntityActionEventArgs args)
{
var entMan = IoCManager.Resolve<IEntityManager>();
var disarmedActs = entMan.GetComponents<IDisarmedAct>(args.Target).ToArray();
var attemptEvent = new DisarmAttemptEvent(args.Target, args.Performer);
entMan.EventBus.RaiseLocalEvent(args.Target, attemptEvent);
if (attemptEvent.Cancelled)
return;
if (!args.Performer.InRangeUnobstructed(args.Target)) return;

View File

@@ -0,0 +1,15 @@
using Robust.Shared.GameObjects;
namespace Content.Server.Actions.Events
{
public class DisarmAttemptEvent : CancellableEntityEventArgs
{
public readonly EntityUid TargetUid;
public readonly EntityUid DisarmerUid;
public DisarmAttemptEvent(EntityUid targetUid, EntityUid disarmerUid)
{
TargetUid = targetUid;
DisarmerUid = disarmerUid;
}
}
}