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,11 +1,10 @@
|
||||
using System.Threading;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Server.Storage.Components;
|
||||
using Content.Shared.Storage.Components;
|
||||
using Content.Shared.Verbs;
|
||||
using Content.Server.Disposal.Unit.Components;
|
||||
using Content.Server.Disposal.Unit.EntitySystems;
|
||||
using Content.Server.DoAfter;
|
||||
using Content.Server.Xenoarchaeology.XenoArtifacts.Triggers.Systems;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Placeable;
|
||||
using Content.Shared.Storage;
|
||||
@@ -17,7 +16,7 @@ namespace Content.Server.Storage.EntitySystems
|
||||
{
|
||||
public sealed class DumpableSystem : EntitySystem
|
||||
{
|
||||
[Dependency] private readonly DoAfterSystem _doAfterSystem = default!;
|
||||
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
|
||||
[Dependency] private readonly DisposalUnitSystem _disposalUnitSystem = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||
@@ -28,16 +27,19 @@ namespace Content.Server.Storage.EntitySystems
|
||||
SubscribeLocalEvent<DumpableComponent, AfterInteractEvent>(OnAfterInteract, after: new[]{ typeof(StorageSystem) });
|
||||
SubscribeLocalEvent<DumpableComponent, GetVerbsEvent<AlternativeVerb>>(AddDumpVerb);
|
||||
SubscribeLocalEvent<DumpableComponent, GetVerbsEvent<UtilityVerb>>(AddUtilityVerbs);
|
||||
SubscribeLocalEvent<DumpableComponent, DoAfterEvent>(OnDoAfter);
|
||||
SubscribeLocalEvent<DumpableComponent, DumpableDoAfterEvent>(OnDoAfter);
|
||||
}
|
||||
|
||||
private void OnAfterInteract(EntityUid uid, DumpableComponent component, AfterInteractEvent args)
|
||||
{
|
||||
if (!args.CanReach)
|
||||
if (!args.CanReach || args.Handled)
|
||||
return;
|
||||
|
||||
if (HasComp<DisposalUnitComponent>(args.Target) || HasComp<PlaceableSurfaceComponent>(args.Target))
|
||||
StartDoAfter(uid, args.Target.Value, args.User, component);
|
||||
if (!HasComp<DisposalUnitComponent>(args.Target) && !HasComp<PlaceableSurfaceComponent>(args.Target))
|
||||
return;
|
||||
|
||||
StartDoAfter(uid, args.Target.Value, args.User, component);
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
private void AddDumpVerb(EntityUid uid, DumpableComponent dumpable, GetVerbsEvent<AlternativeVerb> args)
|
||||
@@ -52,7 +54,7 @@ namespace Content.Server.Storage.EntitySystems
|
||||
{
|
||||
Act = () =>
|
||||
{
|
||||
StartDoAfter(uid, null, args.User, dumpable);//Had multiplier of 0.6f
|
||||
StartDoAfter(uid, args.Target, args.User, dumpable);//Had multiplier of 0.6f
|
||||
},
|
||||
Text = Loc.GetString("dump-verb-name"),
|
||||
Icon = new SpriteSpecifier.Texture(new ResourcePath("/Textures/Interface/VerbIcons/drop.svg.192dpi.png")),
|
||||
@@ -104,12 +106,10 @@ namespace Content.Server.Storage.EntitySystems
|
||||
|
||||
float delay = storage.StoredEntities.Count * (float) dumpable.DelayPerItem.TotalSeconds * dumpable.Multiplier;
|
||||
|
||||
_doAfterSystem.DoAfter(new DoAfterEventArgs(userUid, delay, target: targetUid, used: storageUid)
|
||||
_doAfterSystem.TryStartDoAfter(new DoAfterArgs(userUid, delay, new DumpableDoAfterEvent(), storageUid, target: targetUid, used: storageUid)
|
||||
{
|
||||
RaiseOnTarget = false,
|
||||
BreakOnTargetMove = true,
|
||||
BreakOnUserMove = true,
|
||||
BreakOnStun = true,
|
||||
NeedHand = true
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user