Replace resolve dependency with attribute in components (#1995)

* Replace resolve dependency with attribute in components

* Add changes that went missing in translation
This commit is contained in:
DrSmugleaf
2020-09-02 01:30:03 +02:00
committed by GitHub
parent 4044602187
commit de9dfefd61
23 changed files with 85 additions and 66 deletions

View File

@@ -4,10 +4,7 @@ using System.Threading.Tasks;
using Content.Server.GameObjects.Components.Body;
using Content.Server.GameObjects.Components.GUI;
using Content.Server.GameObjects.Components.Interactable;
using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Components.Interactable;
using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.GameObjects.Components.Storage;
using Content.Shared.GameObjects.EntitySystems;
using Content.Shared.GameObjects.Verbs;
@@ -35,6 +32,8 @@ namespace Content.Server.GameObjects.Components.Items.Storage
[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.
@@ -301,14 +300,13 @@ namespace Content.Server.GameObjects.Components.Items.Storage
case RelayMovementEntityMessage msg:
if (msg.Entity.HasComponent<HandsComponent>())
{
var timing = IoCManager.Resolve<IGameTiming>();
if (timing.CurTime <
if (_gameTiming.CurTime <
_lastInternalOpenAttempt + InternalOpenAttemptDelay)
{
break;
}
_lastInternalOpenAttempt = timing.CurTime;
_lastInternalOpenAttempt = _gameTiming.CurTime;
TryOpenStorage(msg.Entity);
}
break;