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:
@@ -3,6 +3,7 @@ using Content.Server.Electrocution;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Stack;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Tools;
|
||||
using Content.Shared.Tools.Components;
|
||||
@@ -26,7 +27,7 @@ public sealed partial class CableSystem : EntitySystem
|
||||
InitializeCablePlacer();
|
||||
|
||||
SubscribeLocalEvent<CableComponent, InteractUsingEvent>(OnInteractUsing);
|
||||
SubscribeLocalEvent<CableComponent, CuttingFinishedEvent>(OnCableCut);
|
||||
SubscribeLocalEvent<CableComponent, CableCuttingFinishedEvent>(OnCableCut);
|
||||
// Shouldn't need re-anchoring.
|
||||
SubscribeLocalEvent<CableComponent, AnchorStateChangedEvent>(OnAnchorChanged);
|
||||
}
|
||||
@@ -36,12 +37,14 @@ public sealed partial class CableSystem : EntitySystem
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
var toolEvData = new ToolEventData(new CuttingFinishedEvent(args.User), targetEntity: uid);
|
||||
args.Handled = _toolSystem.UseTool(args.Used, args.User, uid, cable.CuttingDelay, new[] { cable.CuttingQuality }, toolEvData);
|
||||
args.Handled = _toolSystem.UseTool(args.Used, args.User, uid, cable.CuttingDelay, cable.CuttingQuality, new CableCuttingFinishedEvent());
|
||||
}
|
||||
|
||||
private void OnCableCut(EntityUid uid, CableComponent cable, CuttingFinishedEvent args)
|
||||
private void OnCableCut(EntityUid uid, CableComponent cable, DoAfterEvent args)
|
||||
{
|
||||
if (args.Cancelled)
|
||||
return;
|
||||
|
||||
if (_electrocutionSystem.TryDoElectrifiedAct(uid, args.User))
|
||||
return;
|
||||
|
||||
@@ -67,13 +70,3 @@ public sealed partial class CableSystem : EntitySystem
|
||||
QueueDel(uid);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class CuttingFinishedEvent : EntityEventArgs
|
||||
{
|
||||
public EntityUid User;
|
||||
|
||||
public CuttingFinishedEvent(EntityUid user)
|
||||
{
|
||||
User = user;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user