Bunch more resolves removed.

This commit is contained in:
Vera Aguilera Puerto
2021-12-08 17:17:12 +01:00
parent ba736f70df
commit 684cb76173
38 changed files with 267 additions and 208 deletions

View File

@@ -15,6 +15,7 @@ namespace Content.Server.Ghost.Components
public class GhostRadioComponent : Component, IRadio
{
[Dependency] private readonly IServerNetManager _netManager = default!;
[Dependency] private readonly IEntityManager _entMan = default!;
public override string Name => "GhostRadio";
@@ -25,7 +26,7 @@ namespace Content.Server.Ghost.Components
public void Receive(string message, int channel, EntityUid speaker)
{
if (!IoCManager.Resolve<IEntityManager>().TryGetComponent(Owner, out ActorComponent? actor))
if (!_entMan.TryGetComponent(Owner, out ActorComponent? actor))
return;
var playerChannel = actor.PlayerSession.ConnectedClient;
@@ -35,7 +36,7 @@ namespace Content.Server.Ghost.Components
msg.Channel = ChatChannel.Radio;
msg.Message = message;
//Square brackets are added here to avoid issues with escaping
msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", Name: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(speaker).EntityName));
msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", Name: _entMan.GetComponent<MetaDataComponent>(speaker).EntityName));
_netManager.ServerSendMessage(msg, playerChannel);
}

View File

@@ -16,6 +16,8 @@ namespace Content.Server.Ghost.Roles.Components
[RegisterComponent, ComponentReference(typeof(GhostRoleComponent))]
public class GhostRoleMobSpawnerComponent : GhostRoleComponent
{
[Dependency] private readonly IEntityManager _entMan = default!;
public override string Name => "GhostRoleMobSpawner";
[ViewVariables(VVAccess.ReadWrite)] [DataField("deleteOnSpawn")]
@@ -40,10 +42,10 @@ namespace Content.Server.Ghost.Roles.Components
if (string.IsNullOrEmpty(Prototype))
throw new NullReferenceException("Prototype string cannot be null or empty!");
var mob = IoCManager.Resolve<IEntityManager>().SpawnEntity(Prototype, IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(Owner).Coordinates);
var mob = _entMan.SpawnEntity(Prototype, _entMan.GetComponent<TransformComponent>(Owner).Coordinates);
if (MakeSentient)
MakeSentientCommand.MakeSentient(mob, IoCManager.Resolve<IEntityManager>());
MakeSentientCommand.MakeSentient(mob, _entMan);
mob.EnsureComponent<MindComponent>();
@@ -56,7 +58,7 @@ namespace Content.Server.Ghost.Roles.Components
Taken = true;
if (_deleteOnSpawn)
IoCManager.Resolve<IEntityManager>().DeleteEntity(Owner);
_entMan.DeleteEntity(Owner);
return true;
}