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:
@@ -32,6 +32,10 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged
|
||||
[RegisterComponent]
|
||||
public sealed class ServerRangedWeaponComponent : SharedRangedWeaponComponent, IHandSelected
|
||||
{
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
private TimeSpan _lastFireTime;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
@@ -102,7 +106,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged
|
||||
if (msg.TargetGrid != GridId.Invalid)
|
||||
{
|
||||
// grid pos
|
||||
if (!IoCManager.Resolve<IMapManager>().TryGetGrid(msg.TargetGrid, out var grid))
|
||||
if (!_mapManager.TryGetGrid(msg.TargetGrid, out var grid))
|
||||
{
|
||||
// Client sent us a message with an invalid grid.
|
||||
break;
|
||||
@@ -147,7 +151,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged
|
||||
return;
|
||||
}
|
||||
|
||||
var curTime = IoCManager.Resolve<IGameTiming>().CurTime;
|
||||
var curTime = _gameTiming.CurTime;
|
||||
var span = curTime - _lastFireTime;
|
||||
if (span.TotalSeconds < 1 / _barrel.FireRate)
|
||||
{
|
||||
@@ -158,7 +162,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged
|
||||
|
||||
if (ClumsyCheck &&
|
||||
user.HasComponent<ClumsyComponent>() &&
|
||||
IoCManager.Resolve<IRobustRandom>().Prob(ClumsyExplodeChance))
|
||||
_random.Prob(ClumsyExplodeChance))
|
||||
{
|
||||
var soundSystem = EntitySystem.Get<AudioSystem>();
|
||||
soundSystem.PlayAtCoords("/Audio/Items/bikehorn.ogg",
|
||||
|
||||
Reference in New Issue
Block a user