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

@@ -2,14 +2,12 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Content.Server.Hands.Components;
using Content.Server.Tools.Components;
using Content.Shared.ActionBlocker;
using Content.Shared.Acts;
using Content.Shared.Body.Components;
using Content.Shared.Interaction;
using Content.Shared.Item;
using Content.Shared.Movement;
using Content.Shared.Notification.Managers;
using Content.Shared.Physics;
using Content.Shared.Placeable;
@@ -27,7 +25,6 @@ using Robust.Shared.Maths;
using Robust.Shared.Physics;
using Robust.Shared.Player;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Timing;
using Robust.Shared.ViewVariables;
namespace Content.Server.Storage.Components
@@ -37,14 +34,12 @@ namespace Content.Server.Storage.Components
[ComponentReference(typeof(IStorageComponent))]
public class EntityStorageComponent : Component, IActivate, IStorageComponent, IInteractUsing, IDestroyAct, IActionBlocker, IExAct
{
[Dependency] private readonly IGameTiming _gameTiming = default!;
public override string Name => "EntityStorage";
private const float MaxSize = 1.0f; // maximum width or height of an entity allowed inside the storage.
private static readonly TimeSpan InternalOpenAttemptDelay = TimeSpan.FromSeconds(0.5);
private TimeSpan _lastInternalOpenAttempt;
public static readonly TimeSpan InternalOpenAttemptDelay = TimeSpan.FromSeconds(0.5);
public TimeSpan LastInternalOpenAttempt;
private const int OpenMask = (int) (
CollisionGroup.MobImpassable |
@@ -227,7 +222,7 @@ namespace Content.Server.Storage.Components
ModifyComponents();
SoundSystem.Play(Filter.Pvs(Owner), _closeSound.GetSound(), Owner);
_lastInternalOpenAttempt = default;
LastInternalOpenAttempt = default;
}
protected virtual void OpenStorage()
@@ -313,29 +308,6 @@ namespace Content.Server.Storage.Components
}
}
/// <inheritdoc />
public override void HandleMessage(ComponentMessage message, IComponent? component)
{
base.HandleMessage(message, component);
switch (message)
{
case RelayMovementEntityMessage msg:
if (msg.Entity.HasComponent<HandsComponent>())
{
if (_gameTiming.CurTime <
_lastInternalOpenAttempt + InternalOpenAttemptDelay)
{
break;
}
_lastInternalOpenAttempt = _gameTiming.CurTime;
TryOpenStorage(msg.Entity);
}
break;
}
}
public virtual bool TryOpenStorage(IEntity user)
{
if (!CanOpen(user)) return false;