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:
@@ -1,5 +1,4 @@
|
||||
using Content.Server.DoAfter;
|
||||
using Content.Server.Mech.Components;
|
||||
using Content.Server.Mech.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Interaction;
|
||||
@@ -13,14 +12,14 @@ namespace Content.Server.Mech.Systems;
|
||||
public sealed class MechEquipmentSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly MechSystem _mech = default!;
|
||||
[Dependency] private readonly DoAfterSystem _doAfter = default!;
|
||||
[Dependency] private readonly SharedDoAfterSystem _doAfter = default!;
|
||||
[Dependency] private readonly PopupSystem _popup = default!;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Initialize()
|
||||
{
|
||||
SubscribeLocalEvent<MechEquipmentComponent, AfterInteractEvent>(OnUsed);
|
||||
SubscribeLocalEvent<MechEquipmentComponent, DoAfterEvent<InsertEquipmentEvent>>(OnInsertEquipment);
|
||||
SubscribeLocalEvent<MechEquipmentComponent, InsertEquipmentEvent>(OnInsertEquipment);
|
||||
}
|
||||
|
||||
private void OnUsed(EntityUid uid, MechEquipmentComponent component, AfterInteractEvent args)
|
||||
@@ -46,18 +45,16 @@ public sealed class MechEquipmentSystem : EntitySystem
|
||||
|
||||
_popup.PopupEntity(Loc.GetString("mech-equipment-begin-install", ("item", uid)), mech);
|
||||
|
||||
var insertEquipment = new InsertEquipmentEvent();
|
||||
var doAfterEventArgs = new DoAfterEventArgs(args.User, component.InstallDuration, target: mech, used: uid)
|
||||
var doAfterEventArgs = new DoAfterArgs(args.User, component.InstallDuration, new InsertEquipmentEvent(), uid, target: mech, used: uid)
|
||||
{
|
||||
BreakOnStun = true,
|
||||
BreakOnTargetMove = true,
|
||||
BreakOnUserMove = true
|
||||
};
|
||||
|
||||
_doAfter.DoAfter(doAfterEventArgs, insertEquipment);
|
||||
_doAfter.TryStartDoAfter(doAfterEventArgs);
|
||||
}
|
||||
|
||||
private void OnInsertEquipment(EntityUid uid, MechEquipmentComponent component, DoAfterEvent<InsertEquipmentEvent> args)
|
||||
private void OnInsertEquipment(EntityUid uid, MechEquipmentComponent component, InsertEquipmentEvent args)
|
||||
{
|
||||
if (args.Handled || args.Cancelled || args.Args.Target == null)
|
||||
return;
|
||||
@@ -67,9 +64,4 @@ public sealed class MechEquipmentSystem : EntitySystem
|
||||
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
private sealed class InsertEquipmentEvent : EntityEventArgs
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user