Remove IRelayMoveInput (#4663)

* Remove IRelayMoveInput

This interface gets called every time a movement key is pressed so it gets called a lot.

* Remove RelayMovementEntityMessage

Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
metalgearsloth
2021-09-20 19:06:48 +10:00
committed by GitHub
parent fcc1217e5d
commit 578ed16b8f
16 changed files with 179 additions and 174 deletions

View File

@@ -1,16 +1,22 @@
using System.Collections.Generic;
using Content.Server.Hands.Components;
using Content.Server.Interaction;
using Content.Server.Storage.Components;
using Content.Shared.Movement;
using JetBrains.Annotations;
using Robust.Server.Player;
using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Timing;
namespace Content.Server.Storage.EntitySystems
{
[UsedImplicitly]
internal sealed class StorageSystem : EntitySystem
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
private readonly List<IPlayerSession> _sessionCache = new();
/// <inheritdoc />
@@ -20,6 +26,22 @@ namespace Content.Server.Storage.EntitySystems
SubscribeLocalEvent<EntRemovedFromContainerMessage>(HandleEntityRemovedFromContainer);
SubscribeLocalEvent<EntInsertedIntoContainerMessage>(HandleEntityInsertedIntoContainer);
SubscribeLocalEvent<EntityStorageComponent, RelayMovementEntityEvent>(OnRelayMovement);
}
private void OnRelayMovement(EntityUid uid, EntityStorageComponent component, RelayMovementEntityEvent args)
{
if (ComponentManager.HasComponent<HandsComponent>(uid))
{
if (_gameTiming.CurTime <
component.LastInternalOpenAttempt + EntityStorageComponent.InternalOpenAttemptDelay)
{
return;
}
component.LastInternalOpenAttempt = _gameTiming.CurTime;
component.TryOpenStorage(args.Entity);
}
}
/// <inheritdoc />