Replace IEntityManager resolves in systems for cached EntityManager
This commit is contained in:
@@ -105,7 +105,7 @@ namespace Content.Server.Light.EntitySystems
|
||||
|
||||
// try get first inserted bulb of the same type as targeted light fixtutre
|
||||
var bulb = replacer.InsertedBulbs.ContainedEntities.FirstOrDefault(
|
||||
(e) => IoCManager.Resolve<IEntityManager>().GetComponentOrNull<LightBulbComponent>(e)?.Type == fixture.BulbType);
|
||||
(e) => EntityManager.GetComponentOrNull<LightBulbComponent>(e)?.Type == fixture.BulbType);
|
||||
|
||||
// found bulb in inserted storage
|
||||
if (bulb != null)
|
||||
@@ -123,7 +123,7 @@ namespace Content.Server.Light.EntitySystems
|
||||
// found right bulb, let's spawn it
|
||||
if (bulbEnt != null)
|
||||
{
|
||||
bulb = EntityManager.SpawnEntity(bulbEnt.PrototypeName, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(replacer.Owner).Coordinates);
|
||||
bulb = EntityManager.SpawnEntity(bulbEnt.PrototypeName, EntityManager.GetComponent<TransformComponent>(replacer.Owner).Coordinates);
|
||||
bulbEnt.Amount--;
|
||||
}
|
||||
// not found any light bulbs
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Content.Server.Light.EntitySystems
|
||||
if (match.CurrentState != SmokableState.Lit)
|
||||
continue;
|
||||
|
||||
_atmosphereSystem.HotspotExpose(IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(match.Owner).Coordinates, 400, 50, true);
|
||||
_atmosphereSystem.HotspotExpose(EntityManager.GetComponent<TransformComponent>(match.Owner).Coordinates, 400, 50, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Content.Server.Light.EntitySystems
|
||||
component.PointLightComponent.Enabled = component.CurrentState == SmokableState.Lit;
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner, out ItemComponent? item))
|
||||
if (EntityManager.TryGetComponent(component.Owner, out ItemComponent? item))
|
||||
{
|
||||
switch (component.CurrentState)
|
||||
{
|
||||
@@ -97,7 +97,7 @@ namespace Content.Server.Light.EntitySystems
|
||||
}
|
||||
}
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(component.Owner, out AppearanceComponent? appearance))
|
||||
if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(SmokingVisuals.Smoking, component.CurrentState);
|
||||
}
|
||||
|
||||
@@ -37,13 +37,13 @@ namespace Content.Server.Light.EntitySystems
|
||||
|
||||
public void ToggleLight(UnpoweredFlashlightComponent flashlight)
|
||||
{
|
||||
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(flashlight.Owner, out PointLightComponent? light))
|
||||
if (!EntityManager.TryGetComponent(flashlight.Owner, out PointLightComponent? light))
|
||||
return;
|
||||
|
||||
flashlight.LightOn = !flashlight.LightOn;
|
||||
light.Enabled = flashlight.LightOn;
|
||||
|
||||
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(flashlight.Owner, out AppearanceComponent? appearance))
|
||||
if (EntityManager.TryGetComponent(flashlight.Owner, out AppearanceComponent? appearance))
|
||||
appearance.SetData(UnpoweredFlashlightVisuals.LightOn, flashlight.LightOn);
|
||||
|
||||
SoundSystem.Play(Filter.Pvs(light.Owner), flashlight.ToggleSound.GetSound(), flashlight.Owner);
|
||||
|
||||
Reference in New Issue
Block a user