Remove IInteractHand (#7601)
* Plantholder * Strap * Finish him * Mirror review stuff
This commit is contained in:
@@ -1,24 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Shared.Acts;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Buckle.Components;
|
||||
using Content.Shared.DragDrop;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Sound;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
|
||||
namespace Content.Server.Buckle.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(SharedStrapComponent))]
|
||||
public sealed class StrapComponent : SharedStrapComponent, IInteractHand, ISerializationHooks, IDestroyAct
|
||||
public sealed class StrapComponent : SharedStrapComponent, ISerializationHooks, IDestroyAct
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
|
||||
@@ -216,18 +209,6 @@ namespace Content.Server.Buckle.Components
|
||||
return new StrapComponentState(Position);
|
||||
}
|
||||
|
||||
bool IInteractHand.InteractHand(InteractHandEventArgs eventArgs)
|
||||
{
|
||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
if (!entManager.TryGetComponent<BuckleComponent>(eventArgs.User, out var buckle))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return buckle.ToggleBuckle(eventArgs.User, Owner);
|
||||
}
|
||||
|
||||
public override bool DragDropOn(DragDropEvent eventArgs)
|
||||
{
|
||||
var entManager = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
using Content.Server.Buckle.Components;
|
||||
using Content.Server.Interaction;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.MobState.Components;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Storage;
|
||||
using Content.Shared.Verbs;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
|
||||
namespace Content.Server.Buckle.Systems
|
||||
{
|
||||
@@ -24,6 +21,7 @@ namespace Content.Server.Buckle.Systems
|
||||
|
||||
SubscribeLocalEvent<StrapComponent, GetVerbsEvent<InteractionVerb>>(AddStrapVerbs);
|
||||
SubscribeLocalEvent<StrapComponent, ContainerGettingInsertedAttemptEvent>(OnInsertAttempt);
|
||||
SubscribeLocalEvent<StrapComponent, InteractHandEvent>(OnInteractHand);
|
||||
}
|
||||
|
||||
private void OnInsertAttempt(EntityUid uid, StrapComponent component, ContainerGettingInsertedAttemptEvent args)
|
||||
@@ -33,6 +31,14 @@ namespace Content.Server.Buckle.Systems
|
||||
args.Cancel();
|
||||
}
|
||||
|
||||
private void OnInteractHand(EntityUid uid, StrapComponent component, InteractHandEvent args)
|
||||
{
|
||||
if (!TryComp<BuckleComponent>(args.User, out var buckle))
|
||||
return;
|
||||
|
||||
buckle.ToggleBuckle(args.User, uid);
|
||||
}
|
||||
|
||||
// TODO ECS BUCKLE/STRAP These 'Strap' verbs are an incestuous mess of buckle component and strap component
|
||||
// functions. Whenever these are fully ECSed, maybe do it in a way that allows for these verbs to be handled in
|
||||
// a sensible manner in a single system?
|
||||
|
||||
Reference in New Issue
Block a user