Remove many resolves on Content.Server

This commit is contained in:
Vera Aguilera Puerto
2021-12-08 17:04:21 +01:00
parent 420039f278
commit ba736f70df
72 changed files with 407 additions and 302 deletions

View File

@@ -10,6 +10,8 @@ namespace Content.Server.Atmos.Components
[RegisterComponent]
public sealed class AtmosPlaqueComponent : Component, IMapInit
{
[Dependency] private readonly IEntityManager _entMan = default!;
public override string Name => "AtmosPlaque";
[DataField("plaqueType")]
@@ -55,6 +57,8 @@ namespace Content.Server.Atmos.Components
return;
}
var metaData = _entMan.GetComponent<MetaDataComponent>(Owner);
var val = _type switch
{
PlaqueType.Zumos =>
@@ -68,7 +72,8 @@ namespace Content.Server.Atmos.Components
PlaqueType.Unset => "Uhm",
_ => "Uhm",
};
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityDescription = val;
metaData.EntityDescription = val;
var val1 = _type switch
{
@@ -83,9 +88,10 @@ namespace Content.Server.Atmos.Components
PlaqueType.Unset => "Uhm",
_ => "Uhm",
};
IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner).EntityName = val1;
if (IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out AppearanceComponent? appearance))
metaData.EntityName = val1;
if (_entMan.TryGetComponent(Owner, out AppearanceComponent? appearance))
{
var state = _type == PlaqueType.Zumos ? "zumosplaque" : "atmosplaque";