Remove IDestroyAct, IBreakAct (#7876)

This commit is contained in:
Alex Evgrashin
2022-05-03 01:43:25 +03:00
committed by GitHub
parent 5d23100af3
commit 50ae467c76
21 changed files with 135 additions and 151 deletions

View File

@@ -1,5 +1,4 @@
using System.Linq;
using Content.Shared.Acts;
using Content.Shared.Alert;
using Content.Shared.Buckle.Components;
using Content.Shared.DragDrop;
@@ -11,7 +10,7 @@ namespace Content.Server.Buckle.Components
{
[RegisterComponent]
[ComponentReference(typeof(SharedStrapComponent))]
public sealed class StrapComponent : SharedStrapComponent, ISerializationHooks, IDestroyAct
public sealed class StrapComponent : SharedStrapComponent, ISerializationHooks
{
[Dependency] private readonly IEntityManager _entityManager = default!;
@@ -183,12 +182,7 @@ namespace Content.Server.Buckle.Components
RemoveAll();
}
void IDestroyAct.OnDestroy(DestructionEventArgs eventArgs)
{
RemoveAll();
}
private void RemoveAll()
public void RemoveAll()
{
var entManager = IoCManager.Resolve<IEntityManager>();

View File

@@ -1,5 +1,6 @@
using Content.Server.Buckle.Components;
using Content.Server.Interaction;
using Content.Shared.Destructible;
using Content.Shared.Interaction;
using Content.Shared.Storage;
using Content.Shared.Verbs;
@@ -22,6 +23,7 @@ namespace Content.Server.Buckle.Systems
SubscribeLocalEvent<StrapComponent, GetVerbsEvent<InteractionVerb>>(AddStrapVerbs);
SubscribeLocalEvent<StrapComponent, ContainerGettingInsertedAttemptEvent>(OnInsertAttempt);
SubscribeLocalEvent<StrapComponent, InteractHandEvent>(OnInteractHand);
SubscribeLocalEvent<StrapComponent, DestructionEventArgs>(OnDestroy);
}
private void OnInsertAttempt(EntityUid uid, StrapComponent component, ContainerGettingInsertedAttemptEvent args)
@@ -118,5 +120,10 @@ namespace Content.Server.Buckle.Systems
args.Verbs.Add(verb);
}
}
private void OnDestroy(EntityUid uid, StrapComponent component, DestructionEventArgs args)
{
component.RemoveAll();
}
}
}