Even more resolve removals.
This commit is contained in:
@@ -29,6 +29,7 @@ namespace Content.Server.VendingMachines
|
||||
[ComponentReference(typeof(IActivate))]
|
||||
public class VendingMachineComponent : SharedVendingMachineComponent, IActivate, IBreakAct, IWires
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
@@ -38,7 +39,7 @@ namespace Content.Server.VendingMachines
|
||||
private string _packPrototypeId = string.Empty;
|
||||
private string _spriteName = "";
|
||||
|
||||
private bool Powered => !IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered;
|
||||
private bool Powered => !_entMan.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered;
|
||||
private bool _broken;
|
||||
|
||||
[DataField("soundVend")]
|
||||
@@ -54,14 +55,14 @@ namespace Content.Server.VendingMachines
|
||||
|
||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
if(!IoCManager.Resolve<IEntityManager>().TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
if(!_entMan.TryGetComponent(eventArgs.User, out ActorComponent? actor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!Powered)
|
||||
return;
|
||||
|
||||
var wires = IoCManager.Resolve<IEntityManager>().GetComponent<WiresComponent>(Owner);
|
||||
var wires = _entMan.GetComponent<WiresComponent>(Owner);
|
||||
if (wires.IsPanelOpen)
|
||||
{
|
||||
wires.OpenInterface(actor.PlayerSession);
|
||||
@@ -79,12 +80,12 @@ namespace Content.Server.VendingMachines
|
||||
return;
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName = packPrototype.Name;
|
||||
_entMan.GetComponent<MetaDataComponent>(Owner).EntityName = packPrototype.Name;
|
||||
_animationDuration = TimeSpan.FromSeconds(packPrototype.AnimationDuration);
|
||||
_spriteName = packPrototype.SpriteName;
|
||||
if (!string.IsNullOrEmpty(_spriteName))
|
||||
{
|
||||
var spriteComponent = IoCManager.Resolve<IEntityManager>().GetComponent<SpriteComponent>(Owner);
|
||||
var spriteComponent = _entMan.GetComponent<SpriteComponent>(Owner);
|
||||
const string vendingMachineRSIPath = "Structures/Machines/VendingMachines/{0}.rsi";
|
||||
spriteComponent.BaseRSIPath = string.Format(vendingMachineRSIPath, _spriteName);
|
||||
}
|
||||
@@ -106,7 +107,7 @@ namespace Content.Server.VendingMachines
|
||||
UserInterface.OnReceiveMessage += UserInterfaceOnOnReceiveMessage;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver))
|
||||
if (_entMan.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver))
|
||||
{
|
||||
TrySetVisualState(receiver.Powered ? VendingMachineVisualState.Normal : VendingMachineVisualState.Off);
|
||||
}
|
||||
@@ -182,7 +183,7 @@ namespace Content.Server.VendingMachines
|
||||
{
|
||||
_ejecting = false;
|
||||
TrySetVisualState(VendingMachineVisualState.Normal);
|
||||
IoCManager.Resolve<IEntityManager>().SpawnEntity(id, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
_entMan.SpawnEntity(id, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
|
||||
});
|
||||
|
||||
SoundSystem.Play(Filter.Pvs(Owner), _soundVend.GetSound(), Owner, AudioParams.Default.WithVolume(-2f));
|
||||
@@ -190,7 +191,7 @@ namespace Content.Server.VendingMachines
|
||||
|
||||
private void TryEject(string id, EntityUid? sender)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<AccessReader?>(Owner, out var accessReader))
|
||||
if (_entMan.TryGetComponent<AccessReader?>(Owner, out var accessReader))
|
||||
{
|
||||
var accessSystem = EntitySystem.Get<AccessReaderSystem>();
|
||||
if (sender == null || !accessSystem.IsAllowed(accessReader, sender.Value))
|
||||
@@ -232,7 +233,7 @@ namespace Content.Server.VendingMachines
|
||||
finalState = VendingMachineVisualState.Off;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(VendingMachineVisuals.VisualState, finalState);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user