Replace IEntityManager resolves in systems for cached EntityManager

This commit is contained in:
Vera Aguilera Puerto
2021-12-08 13:00:43 +01:00
parent 2699540526
commit c8b65be747
98 changed files with 338 additions and 338 deletions

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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);