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

@@ -25,6 +25,8 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
[RegisterComponent]
public sealed class RevolverBarrelComponent : ServerRangedBarrelComponent
{
[Dependency] private readonly IRobustRandom _random = default!;
public override string Name => "RevolverBarrel";
public override uint? NetID => ContentNetIDs.REVOLVER_BARREL;
@@ -176,7 +178,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Barrels
/// </summary>
public void Spin()
{
var random = IoCManager.Resolve<IRobustRandom>().Next(_ammoSlots.Length - 1);
var random = _random.Next(_ammoSlots.Length - 1);
_currentSlot = random;
if (_soundSpin != null)
{