Bunch more resolves removed.
This commit is contained in:
@@ -21,6 +21,8 @@ namespace Content.Server.Light.Components
|
||||
public class EmergencyLightComponent : SharedEmergencyLightComponent, IExamine
|
||||
#pragma warning restore 618
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
[ViewVariables]
|
||||
private EmergencyLightState State
|
||||
{
|
||||
@@ -31,7 +33,7 @@ namespace Content.Server.Light.Components
|
||||
return;
|
||||
|
||||
_state = value;
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.RaiseEvent(EventSource.Local, new EmergencyLightMessage(this, _state));
|
||||
_entMan.EventBus.RaiseEvent(EventSource.Local, new EmergencyLightMessage(this, _state));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +62,7 @@ namespace Content.Server.Light.Components
|
||||
/// </summary>
|
||||
public void UpdateState()
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver))
|
||||
if (!_entMan.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -80,7 +82,7 @@ namespace Content.Server.Light.Components
|
||||
|
||||
public void OnUpdate(float frameTime)
|
||||
{
|
||||
if ((!IoCManager.Resolve<IEntityManager>().EntityExists(Owner) || !IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out BatteryComponent? battery) || IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityPaused))
|
||||
if ((!_entMan.EntityExists(Owner) || !_entMan.TryGetComponent(Owner, out BatteryComponent? battery) || _entMan.GetComponent<MetaDataComponent>(Owner).EntityPaused))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -98,7 +100,7 @@ namespace Content.Server.Light.Components
|
||||
battery.CurrentCharge += _chargingWattage * frameTime * _chargingEfficiency;
|
||||
if (battery.IsFullyCharged)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver))
|
||||
if (_entMan.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver))
|
||||
{
|
||||
receiver.Load = 1;
|
||||
}
|
||||
@@ -110,23 +112,23 @@ namespace Content.Server.Light.Components
|
||||
|
||||
private void TurnOff()
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PointLightComponent? light))
|
||||
if (_entMan.TryGetComponent(Owner, out PointLightComponent? light))
|
||||
{
|
||||
light.Enabled = false;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
appearance.SetData(EmergencyLightVisuals.On, false);
|
||||
}
|
||||
|
||||
private void TurnOn()
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PointLightComponent? light))
|
||||
if (_entMan.TryGetComponent(Owner, out PointLightComponent? light))
|
||||
{
|
||||
light.Enabled = true;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
|
||||
appearance.SetData(EmergencyLightVisuals.On, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ namespace Content.Server.Light.Components
|
||||
[RegisterComponent]
|
||||
public class ExpendableLightComponent : SharedExpendableLightComponent, IUse
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
/// <summary>
|
||||
/// Status of light, whether or not it is emitting light.
|
||||
/// </summary>
|
||||
@@ -36,14 +38,14 @@ namespace Content.Server.Light.Components
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemComponent?>(Owner, out var item))
|
||||
if (_entMan.TryGetComponent<ItemComponent?>(Owner, out var item))
|
||||
{
|
||||
item.EquippedPrefix = "unlit";
|
||||
}
|
||||
|
||||
CurrentState = ExpendableLightState.BrandNew;
|
||||
Owner.EnsureComponent<PointLightComponent>();
|
||||
IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out _appearance);
|
||||
_entMan.TryGetComponent(Owner, out _appearance);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -53,7 +55,7 @@ namespace Content.Server.Light.Components
|
||||
{
|
||||
if (!Activated && CurrentState == ExpendableLightState.BrandNew)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemComponent?>(Owner, out var item))
|
||||
if (_entMan.TryGetComponent<ItemComponent?>(Owner, out var item))
|
||||
{
|
||||
item.EquippedPrefix = "lit";
|
||||
}
|
||||
@@ -92,7 +94,7 @@ namespace Content.Server.Light.Components
|
||||
|
||||
private void UpdateSpriteAndSounds(bool on)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SpriteComponent? sprite))
|
||||
if (_entMan.TryGetComponent(Owner, out SpriteComponent? sprite))
|
||||
{
|
||||
switch (CurrentState)
|
||||
{
|
||||
@@ -126,7 +128,7 @@ namespace Content.Server.Light.Components
|
||||
}
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ClothingComponent? clothing))
|
||||
if (_entMan.TryGetComponent(Owner, out ClothingComponent? clothing))
|
||||
{
|
||||
clothing.ClothingEquippedPrefix = on ? "Activated" : string.Empty;
|
||||
}
|
||||
@@ -155,13 +157,13 @@ namespace Content.Server.Light.Components
|
||||
case ExpendableLightState.Fading:
|
||||
|
||||
CurrentState = ExpendableLightState.Dead;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName = SpentName;
|
||||
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityDescription = SpentDesc;
|
||||
_entMan.GetComponent<MetaDataComponent>(Owner).EntityName = SpentName;
|
||||
_entMan.GetComponent<MetaDataComponent>(Owner).EntityDescription = SpentDesc;
|
||||
|
||||
UpdateSpriteAndSounds(Activated);
|
||||
UpdateVisualizer();
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent<ItemComponent?>(Owner, out var item))
|
||||
if (_entMan.TryGetComponent<ItemComponent?>(Owner, out var item))
|
||||
{
|
||||
item.EquippedPrefix = "unlit";
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@ namespace Content.Server.Light.Components
|
||||
internal sealed class HandheldLightComponent : SharedHandheldLightComponent, IUse, IExamine, IInteractUsing
|
||||
#pragma warning restore 618
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entMan = default!;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("wattage")] public float Wattage { get; set; } = 3f;
|
||||
[ViewVariables] private PowerCellSlotComponent _cellSlot = default!;
|
||||
private PowerCellComponent? Cell => _cellSlot.Cell;
|
||||
@@ -70,7 +72,7 @@ namespace Content.Server.Light.Components
|
||||
protected override void OnRemove()
|
||||
{
|
||||
base.OnRemove();
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this));
|
||||
_entMan.EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this));
|
||||
}
|
||||
|
||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
@@ -118,7 +120,7 @@ namespace Content.Server.Light.Components
|
||||
SetState(false);
|
||||
Activated = false;
|
||||
UpdateLightAction();
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this));
|
||||
_entMan.EventBus.QueueEvent(EventSource.Local, new DeactivateHandheldLightMessage(this));
|
||||
|
||||
if (makeNoise)
|
||||
{
|
||||
@@ -157,7 +159,7 @@ namespace Content.Server.Light.Components
|
||||
Activated = true;
|
||||
UpdateLightAction();
|
||||
SetState(true);
|
||||
IoCManager.Resolve<IEntityManager>().EventBus.QueueEvent(EventSource.Local, new ActivateHandheldLightMessage(this));
|
||||
_entMan.EventBus.QueueEvent(EventSource.Local, new ActivateHandheldLightMessage(this));
|
||||
|
||||
SoundSystem.Play(Filter.Pvs(Owner), TurnOnSound.GetSound(), Owner);
|
||||
return true;
|
||||
@@ -165,22 +167,22 @@ namespace Content.Server.Light.Components
|
||||
|
||||
private void SetState(bool on)
|
||||
{
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out SpriteComponent? sprite))
|
||||
if (_entMan.TryGetComponent(Owner, out SpriteComponent? sprite))
|
||||
{
|
||||
sprite.LayerSetVisible(1, on);
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out PointLightComponent? light))
|
||||
if (_entMan.TryGetComponent(Owner, out PointLightComponent? light))
|
||||
{
|
||||
light.Enabled = on;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ClothingComponent? clothing))
|
||||
if (_entMan.TryGetComponent(Owner, out ClothingComponent? clothing))
|
||||
{
|
||||
clothing.ClothingEquippedPrefix = Loc.GetString(on ? "on" : "off");
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ItemComponent? item))
|
||||
if (_entMan.TryGetComponent(Owner, out ItemComponent? item))
|
||||
{
|
||||
item.EquippedPrefix = Loc.GetString(on ? "on" : "off");
|
||||
}
|
||||
@@ -199,7 +201,7 @@ namespace Content.Server.Light.Components
|
||||
return;
|
||||
}
|
||||
|
||||
var appearanceComponent = IoCManager.Resolve<IEntityManager>().GetComponent<AppearanceComponent>(Owner);
|
||||
var appearanceComponent = _entMan.GetComponent<AppearanceComponent>(Owner);
|
||||
|
||||
if (Cell.MaxCharge - Cell.CurrentCharge < Cell.MaxCharge * 0.70)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user