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

@@ -26,6 +26,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
[Dependency] private readonly IPhysicsManager _physicsManager = default!;
[Dependency] private readonly IGameTiming _gameTiming = default!;
public override string Name => "MeleeWeapon";
private TimeSpan _lastAttackTime;
@@ -85,7 +86,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
void IAttack.Attack(AttackEventArgs eventArgs)
{
var curTime = IoCManager.Resolve<IGameTiming>().CurTime;
var curTime = _gameTiming.CurTime;
var span = curTime - _lastAttackTime;
if(span.TotalSeconds < _cooldownTime) {
return;
@@ -127,7 +128,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Melee
sys.SendAnimation(Arc, angle, eventArgs.User, hitEntities);
}
_lastAttackTime = IoCManager.Resolve<IGameTiming>().CurTime;
_lastAttackTime = _gameTiming.CurTime;
if (Owner.TryGetComponent(out ItemCooldownComponent cooldown))
{