More DoAfter Changes (#14609)

* DoAfters

* Compact Clone()

* Fix mice and cuffables

* Try generalize attempt events

* moves climbabledoafter event to shared, fixes issue with climbable target

* Fix merge (cuffing)

* Make all events netserializable

* handful of doafter events moved

* moves the rest of the events to their respective shared folders

* Changes all mentions of server doafter to shared

* stop stripping cancellation

* fix merge errors

* draw paused doafters

* handle unpausing

* missing netserializable ref

* removes break on stun reference

* removes cuffing state reference

* Fix tools

* Fix door prying.

* Fix construction

* Fix dumping

* Fix wielding assert

* fix rev

* Fix test

* more test fixes

---------

Co-authored-by: keronshb <keronshb@live.com>
This commit is contained in:
Leon Friedrich
2023-04-03 13:13:48 +12:00
committed by GitHub
parent 9e66fac805
commit 19277a2276
170 changed files with 3042 additions and 2954 deletions

View File

@@ -1,11 +1,10 @@
using Content.Shared.Examine;
using Content.Shared.Interaction;
using Content.Shared.Inventory;
using Content.Server.DoAfter;
using Content.Server.Popups;
using Content.Shared.DoAfter;
using Content.Shared.Forensics;
using Content.Shared.IdentityManagement;
using Robust.Shared.Serialization;
namespace Content.Server.Forensics
{
@@ -14,7 +13,7 @@ namespace Content.Server.Forensics
/// </summary>
public sealed class ForensicPadSystem : EntitySystem
{
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
[Dependency] private readonly InventorySystem _inventory = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
@@ -23,7 +22,7 @@ namespace Content.Server.Forensics
base.Initialize();
SubscribeLocalEvent<ForensicPadComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<ForensicPadComponent, AfterInteractEvent>(OnAfterInteract);
SubscribeLocalEvent<ForensicPadComponent, DoAfterEvent<ForensicPadData>>(OnDoAfter);
SubscribeLocalEvent<ForensicPadComponent, ForensicPadDoAfterEvent>(OnDoAfter);
}
private void OnExamined(EntityUid uid, ForensicPadComponent component, ExaminedEvent args)
@@ -79,25 +78,21 @@ namespace Content.Server.Forensics
private void StartScan(EntityUid used, EntityUid user, EntityUid target, ForensicPadComponent pad, string sample)
{
var padData = new ForensicPadData(sample);
var ev = new ForensicPadDoAfterEvent(sample);
var doAfterEventArgs = new DoAfterEventArgs(user, pad.ScanDelay, target: target, used: used)
var doAfterEventArgs = new DoAfterArgs(user, pad.ScanDelay, ev, used, target: target, used: used)
{
BreakOnTargetMove = true,
BreakOnUserMove = true,
BreakOnStun = true,
NeedHand = true,
RaiseOnUser = false
NeedHand = true
};
_doAfterSystem.DoAfter(doAfterEventArgs, padData);
_doAfterSystem.TryStartDoAfter(doAfterEventArgs);
}
private void OnDoAfter(EntityUid uid, ForensicPadComponent component, DoAfterEvent<ForensicPadData> args)
private void OnDoAfter(EntityUid uid, ForensicPadComponent padComponent, ForensicPadDoAfterEvent args)
{
if (args.Handled
|| args.Cancelled
|| !EntityManager.TryGetComponent(args.Args.Used, out ForensicPadComponent? padComponent))
if (args.Handled || args.Cancelled)
{
return;
}
@@ -110,20 +105,10 @@ namespace Content.Server.Forensics
MetaData(uid).EntityName = Loc.GetString("forensic-pad-gloves-name", ("entity", args.Args.Target));
}
padComponent.Sample = args.AdditionalData.Sample;
padComponent.Sample = args.Sample;
padComponent.Used = true;
args.Handled = true;
}
private sealed class ForensicPadData
{
public string Sample;
public ForensicPadData(string sample)
{
Sample = sample;
}
}
}
}